diff --git a/jero-boot/db/蔚来标准sql/dev_third_record.sql b/jero-boot/db/蔚来标准sql/dev_third_record.sql index e5eaf7717..a02c7e021 100644 --- a/jero-boot/db/蔚来标准sql/dev_third_record.sql +++ b/jero-boot/db/蔚来标准sql/dev_third_record.sql @@ -1208,4 +1208,96 @@ MODIFY COLUMN `work_progress_en` text CHARACTER SET utf8mb4 COLLATE utf8mb4_gene --参数收集清单 添加英文 UPDATE `laws_weilai`.`onl_cgform_field` SET `db_field_en_name` = 'Control Component' WHERE `id` = '84fec4a260dc646dc570cbf7cb581dab'; UPDATE `laws_weilai`.`onl_cgform_field` SET `db_field_en_name` = 'Component Value' WHERE `id` = '5d468613746f413a53fa0b485089839b'; -UPDATE `laws_weilai`.`onl_cgform_field` SET `db_field_en_name` = 'Validate Component' WHERE `id` = '608274a6a6dfed0e183093d9ea357436'; \ No newline at end of file +UPDATE `laws_weilai`.`onl_cgform_field` SET `db_field_en_name` = 'Validate Component' WHERE `id` = '608274a6a6dfed0e183093d9ea357436'; + +--平台件项目库数据标识 +ALTER TABLE `laws_weilai`.`project_library_base` +ADD COLUMN `platform` varchar(255) NULL COMMENT '平台件项目库数据(platform=YES)' AFTER `brand`; + +--平台件合规认证计划 +CREATE TABLE `laws_weilai`.`platform_task_planning` ( + `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(0) NULL DEFAULT NULL COMMENT '创建日期', + `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新日期', + `sys_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门', + `node_name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '节点名称', + `node_time` datetime(0) NULL DEFAULT NULL COMMENT '节点时间', + `project_id` varchar(36) 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 ROW_FORMAT = Dynamic; + + +--车型项目库法规清单关联平台件表2023-09-19 +CREATE TABLE `laws_inventory_platform` ( + `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(0) NULL DEFAULT NULL COMMENT '创建日期', + `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新日期', + `sys_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门', + `laws_inventory_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '车型项目库法规清单id', + `platform_laws_inventory_id` varchar(36) 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 ROW_FORMAT = Dynamic; + +--车修改字段长度2023-09-28 +ALTER TABLE `project_certification_directory` +MODIFY COLUMN `directory_name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '目录名称' AFTER `project_library_id`, +MODIFY COLUMN `lot` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '批次' AFTER `directory_name`, +MODIFY COLUMN `detection_report_location` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检测报告位置' AFTER `experiment_file`, +MODIFY COLUMN `explain_info` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '说明' AFTER `detection_report_location`; + +--添加平台件项目库字段2023-10-09 +ALTER TABLE `project_library_base` +ADD COLUMN `power` varchar(255) NULL COMMENT '功率' AFTER `platform`, +ADD COLUMN `producer` varchar(255) NULL COMMENT '生产商' AFTER `power`, +ADD COLUMN `duty_depart` varchar(255) NULL COMMENT '责任部门' AFTER `producer`, +ADD COLUMN `regulation_owner_id` varchar(255) NULL COMMENT '法规工程师' AFTER `duty_depart`, +ADD COLUMN `engineering_interface_person` varchar(255) NULL COMMENT '工程接口人' AFTER `regulation_owner_id`, +ADD COLUMN `brand_label` varchar(255) NULL COMMENT '名牌标签' AFTER `engineering_interface_person`, +ADD COLUMN `product_model` varchar(255) NULL COMMENT '产品型号' AFTER `brand_label`, +ADD COLUMN `cell_enterprise` varchar(255) NULL COMMENT '电芯生产企业' AFTER `product_model`, +ADD COLUMN `assembly_enterprise` varchar(255) NULL COMMENT '总成生产企业' AFTER `cell_enterprise`, +ADD COLUMN `part_number_cn` varchar(255) NULL COMMENT '零件号(国内)' AFTER `assembly_enterprise`, +ADD COLUMN `part_number_en` varchar(255) NULL COMMENT '零件号(国外)' AFTER `part_number_cn`, +ADD COLUMN `filing_code` varchar(255) NULL COMMENT '24位备案码' AFTER `part_number_en`, +ADD COLUMN `supplier_code` varchar(255) NULL COMMENT '供应商代码' AFTER `filing_code`, +ADD COLUMN `product_type_code` varchar(255) NULL COMMENT '产品类型代码' AFTER `supplier_code`, +ADD COLUMN `battery_type_code` varchar(255) NULL COMMENT '电池类型代码' AFTER `product_type_code`, +ADD COLUMN `specification_code` varchar(255) NULL COMMENT '规格代码' AFTER `battery_type_code`, +ADD COLUMN `traceability_code` varchar(255) NULL COMMENT '追溯代码' AFTER `specification_code`, +ADD COLUMN `ymd_number` varchar(255) NULL COMMENT '生产也月日序列号' AFTER `traceability_code`, +ADD COLUMN `size` varchar(255) NULL COMMENT '尺寸' AFTER `ymd_number`, +ADD COLUMN `rated_capacity` varchar(255) NULL COMMENT '额定容量' AFTER `size`, +ADD COLUMN `nominal_voltage` varchar(255) NULL COMMENT '标称电压' AFTER `rated_capacity`, +ADD COLUMN `rated_mass` varchar(255) NULL COMMENT '额定质量' AFTER `nominal_voltage`, +ADD COLUMN `module_number` varchar(255) NULL COMMENT '包含模块个数' AFTER `rated_mass`, +ADD COLUMN `connection_type` varchar(255) NULL COMMENT '模块串并联方式' AFTER `module_number`, +ADD COLUMN `module_specification_code` varchar(255) NULL COMMENT '所用模块或单体规格代码' AFTER `connection_type`, +ADD COLUMN `cooling_method` varchar(255) NULL COMMENT '冷却方式' AFTER `module_specification_code`, +ADD COLUMN `filing_completion_time` datetime(0) NULL COMMENT '备案完成时间' AFTER `cooling_method`, +ADD COLUMN `remark` varchar(1000) NULL COMMENT '备注' AFTER `filing_completion_time`; + +--平台件合规认证计划添加标识字段2023-10-09 +ALTER TABLE `platform_task_planning` +ADD COLUMN `flag` varchar(255) NULL COMMENT '位置标识(用来区分上下两部分数据,up->上,down->下)' AFTER `project_id` + +--平台件合规认证计划初始化数据 2023-10-10 +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('08ecf06f4f947836d0e95285fd8afb96', NULL, NULL, NULL, NULL, NULL, 'KO', NULL, NULL, 'up'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('09e577fa7afa3a8cb26b9c8f29eaf8d9', NULL, NULL, NULL, NULL, NULL, 'RF', NULL, NULL, 'up'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('17323a3d13e747e493c41e2e09bedc92', NULL, NULL, NULL, NULL, NULL, 'ADF', NULL, NULL, 'up'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('1d8e6f4286e402ab55845fac79576683', NULL, NULL, NULL, NULL, NULL, 'BDF', NULL, NULL, 'up'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('3f6174140af490d111a9b087580e29fc', NULL, NULL, NULL, NULL, NULL, 'BDR', NULL, NULL, 'up'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('50dcbff0377f68f2e01f89b3677f7cef', NULL, NULL, NULL, NULL, NULL, 'CDF', NULL, NULL, 'up'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('5b22bcbc6ac90933f96faa1371fe16dc', NULL, NULL, NULL, NULL, NULL, 'ESO', NULL, NULL, 'up'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('7e98edcee56a14394e0fd9448132f2e0', NULL, NULL, NULL, NULL, NULL, 'SOP', NULL, NULL, 'up'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('85fa6eb0b58d93d4cc76b8fb1d5248ca', NULL, NULL, NULL, NULL, NULL, '法规清单(KO+2~4w)', NULL, NULL, 'down'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('97aaf07d156b6a4278e0ac3627566c8b', NULL, NULL, NULL, NULL, NULL, '责任确认(RF)', NULL, NULL, 'down'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('a533416284ab81c7f6ee95b5e9e06d38', NULL, NULL, NULL, NULL, NULL, '设计核查(BDF)', NULL, NULL, 'down'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('cd7d6332a42dd3855f0117ffb188f5b1', NULL, NULL, NULL, NULL, NULL, '强检报告(CDF前)', NULL, NULL, 'down'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('e611b793756bf9caeb4a1c09526ceb76', NULL, NULL, NULL, NULL, NULL, 'E-mark(CDF前)', NULL, NULL, 'down'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('e76e63a251aa6d64cac96125315805e1', NULL, NULL, NULL, NULL, NULL, 'CAMDS提交(CDF前)', NULL, NULL, 'down'); +INSERT INTO `platform_task_planning`(`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `node_name`, `node_time`, `project_id`, `flag`) VALUES ('ee85c1b1964586e512ef0b2b401b16b5', NULL, NULL, NULL, NULL, NULL, '验证检查(ESO)', NULL, NULL, 'down'); + diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/constant/enums/YesOrNoEnum.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/constant/enums/YesOrNoEnum.java index 62b5bc535..2b56f4dd2 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/constant/enums/YesOrNoEnum.java +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/constant/enums/YesOrNoEnum.java @@ -6,15 +6,17 @@ package com.jero.common.constant.enums; * @auth zhn */ public enum YesOrNoEnum { - NO("否","0"), - YES("是","1"); + NO("否","NO","0"), + YES("是","YES","1"); String name; + String nameEn; String value; - private YesOrNoEnum(String name, String value) { + private YesOrNoEnum(String name,String nameEn, String value) { this.name = name; + this.nameEn = nameEn; this.value = value; } @@ -33,4 +35,12 @@ public enum YesOrNoEnum { public void setValue(String value) { this.value = value; } + + public String getNameEn() { + return nameEn; + } + + public void setNameEn(String nameEn) { + this.nameEn = nameEn; + } } diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/system/util/JwtUtil.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/system/util/JwtUtil.java index 54db7a793..1da048c0e 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/system/util/JwtUtil.java +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/system/util/JwtUtil.java @@ -28,7 +28,7 @@ import com.jero.common.util.oConvertUtils; public class JwtUtil { // Token过期时间30分钟(用户登录过期时间是此时间的两倍,以token在reids缓存时间为准) - public static final long EXPIRE_TIME = 240 * 60 * 1000; + public static final long EXPIRE_TIME = 7 * 24 * 60 * 60 * 1000L; /** * 校验token是否正确 diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysPermissionController.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysPermissionController.java index 84956933d..e1aa6a133 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysPermissionController.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysPermissionController.java @@ -688,6 +688,11 @@ public class SysPermissionController { existTaskFlag = sysPermissionService.judgeToDo(); meta.put("existTask",existTaskFlag); } + //OTA任务 + if(StringUtils.equals(permission.getId(), SysPermissionEnum.OTA_TASKS.getId())){ + + } + json.put("meta", meta); } diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysUserController.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysUserController.java index 69b474d20..75aff3c83 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysUserController.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysUserController.java @@ -118,6 +118,44 @@ public class SysUserController { @Autowired private IProjectUserDutyTerritoryService projectUserDutyTerritoryService; + /** + * 搜索用户列表数据 + */ + @ApiOperation(value = "搜索用户列表数据") + @RequestMapping(value = "/searchUser", method = RequestMethod.GET) + public Result> searchUser(SysUser user, HttpServletRequest req) { + Result> result = new Result>(); + List resList = new ArrayList<>(); + String username = user.getUsername(); + SysUser userSearch = null; + if(StringUtils.isNotEmpty(username)){ + userSearch = sysUserService.getUserByName(username); + } + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + if(StringUtils.isNotEmpty(username)){ + queryWrapper1.like("username",username); + queryWrapper1.orderByAsc("username"); + } + Page page = new Page<>(1, 20); + IPage pageList = sysUserService.page(page, queryWrapper1); + List userList = pageList.getRecords(); + if(null != userSearch){ + SysUser finalUserSearch = userSearch; + boolean hasUser = userList.stream() + .filter(u -> u.getId().equals(finalUserSearch.getId())) + .findFirst() + .isPresent(); + if(!hasUser){ + resList.add(userSearch); + } + } + resList.addAll(userList); + result.setSuccess(true); + result.setResult(resList); + log.info(userList.toString()); + return result; + } + /** * 获取用户列表数据 * diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/enums/SysPermissionEnum.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/enums/SysPermissionEnum.java index 951afcc20..8af3f1388 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/enums/SysPermissionEnum.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/enums/SysPermissionEnum.java @@ -9,6 +9,7 @@ public enum SysPermissionEnum { PROJECT_REGULATION_TASKS("项目法规任务","1580735287309119489",""), REGULATORY_ASSESSMENT_TASKS("法规评估任务","1580735611793059842",""), + OTA_TASKS("OTA任务","1702513806814900226",""), PROJECT_PARAMETER_TASKS("项目参数任务","1580735965892980738",""); private String name; diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/xml/TodoCenterMapper.xml b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/xml/TodoCenterMapper.xml index 75a7e43c2..1a2deaf32 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/xml/TodoCenterMapper.xml +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/xml/TodoCenterMapper.xml @@ -23,11 +23,12 @@ SELECT pm.id FROM params_manifest pm JOIN ( SELECT id FROM - ( SELECT id,substring_index( substring_index( a.certification_engineer, ',', b.help_topic_id + 1 ), ',',- 1 ) user_id + ( SELECT id,substring_index( substring_index( a.certification_engineer, ',', b.help_topic_id + 1 ), ',',- 1 ) user_id, + a.platform FROM project_library_base a JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.certification_engineer ) - length( REPLACE ( a.certification_engineer, ',', '' ) ) + 1 )) temp - WHERE user_id = #{userId}) a ON pm.project_id = a.id + WHERE user_id = #{userId} and platform is null) a ON pm.project_id = a.id where pm.state = #{state} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/entity/AuthDummyInventoryInfoEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/entity/AuthDummyInventoryInfoEO.java index f627832be..43f046ec2 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/entity/AuthDummyInventoryInfoEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/entity/AuthDummyInventoryInfoEO.java @@ -161,4 +161,9 @@ public class AuthDummyInventoryInfoEO implements Serializable { /**认证类型*/ @ApiModelProperty(value = "认证类型") private String attestationType; + + /**备注*/ + @ApiModelProperty(value = "备注") + @Excel(name = "备注", width = 50) + private String remark; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/service/impl/AuthDummyInventoryInfoEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/service/impl/AuthDummyInventoryInfoEOServiceImpl.java index 6ddfe2164..091cf57c6 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/service/impl/AuthDummyInventoryInfoEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/authDummy/service/impl/AuthDummyInventoryInfoEOServiceImpl.java @@ -961,9 +961,9 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl 1){ @@ -1623,8 +1623,10 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl collect = bussDocumentLibraryEOList.stream() - .filter(e -> e.getSerialNumber().equals(authDummyInventoryInfoEO.getSerialNumber())).collect(Collectors.toList()); - authDummyInventoryInfoEO.setBussDocumentLibraryId(collect.get(0).getId()); + .filter(e -> e.getSerialNumber().trim().equals(authDummyInventoryInfoEO.getSerialNumber().trim())).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(collect)){ + authDummyInventoryInfoEO.setBussDocumentLibraryId(collect.get(0).getId()); + } } } // //2. 验证标准号在法规清单中是否添加过 @@ -1705,6 +1707,7 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl list = Arrays.asList(title.split(",")); int index = 0; if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){ - index = list.indexOf("交付物模板") + 1; + index = list.indexOf("备注") + 1; }else{ - index = list.indexOf("Deliverable Template") + 1; + index = list.indexOf("Remark") + 1; } //创建临时文件夹 diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectExportController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectExportController.java new file mode 100644 index 000000000..48cc1e0bc --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectExportController.java @@ -0,0 +1,177 @@ +package com.jero.modules.cert.collect.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.cert.collect.entity.ParamsCollectExport; +import com.jero.modules.cert.collect.enums.ExportStateEnum; +import com.jero.modules.cert.collect.service.IParamsCollectExportService; +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: 2023-09-26 + * @Version: V1.0 + */ +@Api(tags="参数收集导出列表") +@RestController +@RequestMapping("/params/paramsCollectExport") +@Slf4j +public class ParamsCollectExportController extends JeroController { + @Autowired + private IParamsCollectExportService paramsCollectExportService; + + /** + * 分页列表查询 + * + * @param paramsCollectExport + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "参数收集导出列表-分页列表查询") + @ApiOperation(value="参数收集导出列表-分页列表查询", notes="参数收集导出列表-分页列表查询") + @GetMapping(value = "/page") + public Result queryPageList(ParamsCollectExport paramsCollectExport, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + @RequestParam(name = "cut") String cut, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(paramsCollectExport, req.getParameterMap()); + queryWrapper.orderByDesc("create_time"); + Page page = new Page(pageNo, pageSize); + IPage pageList = paramsCollectExportService.page(page, queryWrapper); + List resList = pageList.getRecords(); + for (ParamsCollectExport pce : resList) { + pce.setStateText(ExportStateEnum.getNameByVal(pce.getState(),cut)); + } + return Result.OK(pageList); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "参数收集导出列表-列表查询") + @ApiOperation(value="参数收集导出列表-列表查询", notes="参数收集导出列表-列表查询") + @GetMapping(value = "/list") + public Result> queryList() { + List list = paramsCollectExportService.queryList(); + return Result.OK(list); + } + + /** + * 添加 + * + * @param paramsCollectExport + * @return + */ + @AutoLog(value = "参数收集导出列表-添加") + @ApiOperation(value="参数收集导出列表-添加", notes="参数收集导出列表-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody ParamsCollectExport paramsCollectExport) { + paramsCollectExportService.add(paramsCollectExport); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param paramsCollectExport + * @return + */ + @AutoLog(value = "参数收集导出列表-编辑") + @ApiOperation(value="参数收集导出列表-编辑", notes="参数收集导出列表-编辑") + @PutMapping(value = "/edit") + public Result edit(@Validated @RequestBody ParamsCollectExport paramsCollectExport) { + paramsCollectExportService.editById(paramsCollectExport); + 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) { + paramsCollectExportService.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.paramsCollectExportService.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) { + ParamsCollectExport paramsCollectExport = paramsCollectExportService.queryById(id); + if(paramsCollectExport==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(paramsCollectExport); + } + + /** + * 导出excel + * + * @param request + * @param paramsCollectExport + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ParamsCollectExport paramsCollectExport) { + return super.exportXls(request, paramsCollectExport, ParamsCollectExport.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, ParamsCollectExport.class); + } + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectExport.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectExport.java new file mode 100644 index 000000000..c7d0126ab --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectExport.java @@ -0,0 +1,88 @@ +package com.jero.modules.cert.collect.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +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: 2023-09-26 + * @Version: V1.0 + */ +@Data +@TableName("params_collect_export") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="params_collect_export对象", description="参数收集导出列表") +public class ParamsCollectExport implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + + /**创建人*/ + @ApiModelProperty(value = "创建人") + private 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 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 String sysOrgCode; + + /**文件名称*/ + @Excel(name = "文件名称", width = 15) + @ApiModelProperty(value = "文件名称") + private String fileName; + + /**导出状态*/ + @Excel(name = "导出状态", width = 15) + @ApiModelProperty(value = "导出状态") + private String state; + + @TableField(exist = false) + private String stateText; + + /**文件关联ID*/ + @Excel(name = "文件关联ID", width = 15) + @ApiModelProperty(value = "文件关联ID") + private String fileId; + + /**参数清单id*/ + @Excel(name = "参数清单id", width = 15) + @ApiModelProperty(value = "参数清单id") + private String paramsManifestId; + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/enums/ExportStateEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/enums/ExportStateEnum.java new file mode 100644 index 000000000..b0ac95358 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/enums/ExportStateEnum.java @@ -0,0 +1,63 @@ +package com.jero.modules.cert.collect.enums; + +import com.jero.common.constant.enums.CutEnum; + +/** + * @Author: liyawei + * @Description: 参数收集清单-配置数据单个类型 + * @Date: Created in 11:33 2022/5/7 + */ +public enum ExportStateEnum { + EXPORTING("导出中", "Exporting", "0"), + SUCCESSFULLY("导出成功", "Export Successfully", "1"), + FAILURE("导出失败", "Export Failure", "2"); + + String nameCn; + String nameEn; + String value; + + ExportStateEnum(String nameCn, String nameEn, String value) { + this.nameCn = nameCn; + this.nameEn = nameEn; + this.value = value; + } + + public String getNameCn() { + return nameCn; + } + + public void setNameCn(String nameCn) { + this.nameCn = nameCn; + } + + public String getNameEn() { + return nameEn; + } + + public void setNameEn(String nameEn) { + this.nameEn = nameEn; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public static String getNameByVal(String val, String cut) { + ExportStateEnum res = EXPORTING; + for (ExportStateEnum es : ExportStateEnum.values()) { + if (es.getValue().equals(val)) { + res = es; + break; + } + } + if (CutEnum.CN.getValue().equals(cut)) { + return res.getNameCn(); + } else { + return res.getNameEn(); + } + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/ParamsCollectExportMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/ParamsCollectExportMapper.java new file mode 100644 index 000000000..db1f18b93 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/ParamsCollectExportMapper.java @@ -0,0 +1,17 @@ +package com.jero.modules.cert.collect.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import com.jero.modules.cert.collect.entity.ParamsCollectExport; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 参数收集导出列表 + * @Author: jero-boot + * @Date: 2023-09-26 + * @Version: V1.0 + */ +public interface ParamsCollectExportMapper extends BaseMapper { + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectExportMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectExportMapper.xml new file mode 100644 index 000000000..e6b6f60d0 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsCollectExportMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectExportService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectExportService.java new file mode 100644 index 000000000..cdb92ff4e --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectExportService.java @@ -0,0 +1,61 @@ +package com.jero.modules.cert.collect.service; + +import com.jero.modules.cert.collect.entity.ParamsCollectExport; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * @Description: 参数收集导出列表 + * @Author: jero-boot + * @Date: 2023-09-26 + * @Version: V1.0 + */ +public interface IParamsCollectExportService extends IService { + + /** + * 保存 + * + * @param paramsCollectExport + * @return + */ + void add(ParamsCollectExport paramsCollectExport); + + /** + * 更新 + * + * @param paramsCollectExport + * @return + */ + void editById(ParamsCollectExport paramsCollectExport); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + ParamsCollectExport queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectExportServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectExportServiceImpl.java new file mode 100644 index 000000000..a7bef6f57 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectExportServiceImpl.java @@ -0,0 +1,89 @@ +package com.jero.modules.cert.collect.service.impl; + +import com.jero.modules.cert.collect.entity.ParamsCollectExport; +import com.jero.modules.cert.collect.mapper.ParamsCollectExportMapper; +import com.jero.modules.cert.collect.service.IParamsCollectExportService; +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: 2023-09-26 + * @Version: V1.0 + */ +@Service +public class ParamsCollectExportServiceImpl extends ServiceImpl implements IParamsCollectExportService { + + /** + * 保存 + * + * @param paramsCollectExport + * @return + */ + @Override + public void add(ParamsCollectExport paramsCollectExport) { + Date now = new Date(); + paramsCollectExport.setCreateTime(now); + paramsCollectExport.setUpdateTime(now); + save(paramsCollectExport); + } + + /** + * 更新 + * + * @param paramsCollectExport + * @return + */ + @Override + public void editById(ParamsCollectExport paramsCollectExport) { + Date now = new Date(); + paramsCollectExport.setUpdateTime(now); + saveOrUpdate(paramsCollectExport); + } + + /** + * 通过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 ParamsCollectExport 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/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java index dc7be6228..fa85b61e3 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java @@ -183,6 +183,8 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl queryConditionVOList = JSONObject.parseArray(paramsCollectManifestVO.getQueryConditionVOListStr(), QueryConditionVO.class); @@ -826,7 +836,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl paramsConfigDataVOList = this.getConfigDataVOList(controlType, paramsConfigEO, paramsConfigDataEO, collectManifestEO); // 重新组合配置数据 - paramsConfigDataVO.put(paramsConfigDataEO.getId(), paramsConfigDataVOList); + paramsConfigDataVO.put(paramsConfigDataEO.getOrderNum() + "+" + paramsConfigDataEO.getId(), paramsConfigDataVOList); } }else{ ParamsConfigDataEO paramsConfigDataEO = this.getConfigDataEOByConfigIdAndCollectManifestId(paramsConfigId, paramsCollectManifestId, paramsConfigDataEOList); // 参数配置数据 @@ -1621,14 +1631,22 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl configDataMap : paramsConfigDataVOMap.entrySet()) { List> paramsConfigDataVOList = (List>) configDataMap.getValue(); - + int orderNum = 0; + //顺序号不存在ID中,查询的时候会拼接 + String paramsConfigDataId = configDataMap.getKey(); + int plusIndex = paramsConfigDataId.indexOf("+"); + if (plusIndex != -1) { + orderNum = Integer.parseInt(paramsConfigDataId.substring(0, plusIndex)); + paramsConfigDataId = paramsConfigDataId.substring(plusIndex + 1); + } if (CollectionUtil.isNotEmpty(paramsConfigDataVOList)) { ParamsConfigDataEO paramsConfigDataEO = new ParamsConfigDataEO(); if (CollectionUtils.isNotEmpty(oldConfigDataEOList)) { + String finalParamsConfigDataId = paramsConfigDataId; List oldConfigDataEOs = oldConfigDataEOList.stream().filter(configData -> { boolean flag = false; - if (StringUtils.equals(configDataMap.getKey(), configData.getId())) { + if (StringUtils.equals(finalParamsConfigDataId, configData.getId())) { flag = true; } return flag; @@ -1638,8 +1656,8 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl paramsConfigDataVO : paramsConfigDataVOList) { @@ -3588,6 +3613,20 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl queryWrapper = QueryGenerator.initQueryWrapper(paramsCollectManifestHistoryEO, req.getParameterMap()); + String allNumber = req.getParameter("allNumber"); + if(StringUtils.isNotBlank(allNumber)){ + queryWrapper.lambda().eq(ParamsCollectManifestHistoryEO::getNioNumber,allNumber); + } queryWrapper.lambda().notIn(ParamsCollectManifestHistoryEO::getControlType, ControlTypeEnum.Title.getValue()) .orderByAsc(ParamsCollectManifestHistoryEO::getNioNumber); @@ -173,7 +177,7 @@ public class ParamsCollectManifestHistoryEOServiceImpl extends ServiceImpl paramsConfigDataVOList = this.getConfigDataVOList(controlType, paramsConfigEO, paramsConfigDataEO, collectManifestEO); // 重新组合配置数据 - paramsConfigDataVO.put(paramsConfigDataEO.getId(), paramsConfigDataVOList); + paramsConfigDataVO.put(paramsConfigDataEO.getOrderNum()+"+"+paramsConfigDataEO.getId(), paramsConfigDataVOList); } }else{ ParamsConfigDataHistoryEO paramsConfigDataEO = this.getConfigDataEOByConfigIdAndCollectManifestId(paramsConfigId, paramsCollectManifestId, paramsConfigDataEOList); // 参数配置数据 diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java index 4b8742a10..75cf6800b 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java @@ -8,16 +8,32 @@ 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.jero.common.api.vo.Result; import com.jero.common.constant.enums.CutEnum; import com.jero.common.exception.JeroBootException; import com.jero.common.system.vo.DictModel; -import com.jero.modules.cert.collect.entity.*; +import com.jero.modules.cert.collect.entity.ParamsCollectManifestEO; +import com.jero.modules.cert.collect.entity.ParamsCollectManifestHistoryEO; +import com.jero.modules.cert.collect.entity.ParamsConfigDataEO; +import com.jero.modules.cert.collect.entity.ParamsConfigDataHistoryEO; +import com.jero.modules.cert.collect.entity.ParamsConfigEO; +import com.jero.modules.cert.collect.entity.ParamsConfigHistoryEO; +import com.jero.modules.cert.collect.entity.ParamsManifestEO; +import com.jero.modules.cert.collect.entity.ParamsManifestHistoryEO; import com.jero.modules.cert.collect.enums.CollectManifestChangeFlagEnum; import com.jero.modules.cert.collect.enums.CollectManifestStateEnum; import com.jero.modules.cert.collect.enums.ManifestStateEnum; -import com.jero.modules.cert.collect.mapper.*; -import com.jero.modules.cert.collect.service.*; +import com.jero.modules.cert.collect.mapper.ParamsCollectManifestEOMapper; +import com.jero.modules.cert.collect.mapper.ParamsCollectManifestHistoryEOMapper; +import com.jero.modules.cert.collect.mapper.ParamsConfigEOMapper; +import com.jero.modules.cert.collect.mapper.ParamsManifestEOMapper; +import com.jero.modules.cert.collect.mapper.ParamsManifestHistoryEOMapper; +import com.jero.modules.cert.collect.service.IParamsCollectManifestEOService; +import com.jero.modules.cert.collect.service.IParamsConfigDataEOService; +import com.jero.modules.cert.collect.service.IParamsConfigDataHistoryEOService; +import com.jero.modules.cert.collect.service.IParamsConfigEOService; +import com.jero.modules.cert.collect.service.IParamsConfigHistoryEOService; +import com.jero.modules.cert.collect.service.IParamsManifestEOService; +import com.jero.modules.cert.collect.service.IParamsManifestHistoryEOService; import com.jero.modules.cert.collect.vo.ParamsManifestHistoryVO; import com.jero.modules.cert.collect.vo.ParamsManifestVO; import com.jero.modules.cert.report.entity.ParamsReportEO; @@ -29,7 +45,6 @@ import com.jero.modules.cert.template.enums.ControlTypeEnum; import com.jero.modules.cert.template.service.IParamsInfoPublishEOService; import com.jero.modules.cert.template.service.IParamsTemplateEOService; import com.jero.modules.enums.DictCodeEnum; -import com.jero.modules.project.entity.ProjectCertificationInventoryEO; import com.jero.modules.project.entity.ProjectRelatedPersonnel; import com.jero.modules.project.service.IProjectLibraryBaseService; import com.jero.modules.project.service.IProjectRelatedPersonnelService; @@ -50,7 +65,16 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.text.NumberFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.UUID; import java.util.stream.Collectors; /** @@ -619,6 +643,7 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl (CollectManifestStateEnum.WAIT_COLLECT.getValue().equals(e.get("state")) - || CollectManifestStateEnum.SDT_BACK.getValue().equals(e.get("state")) - || CollectManifestStateEnum.CHANGE.getValue().equals(e.get("state"))) && dictItem.getItemValue().equals(e.get("duty_territory"))) + || CollectManifestStateEnum.SDT_BACK.getValue().equals(e.get("state"))) + && dictItem.getItemValue().equals(e.get("duty_territory"))) .count(); // 未开始的参数项 数量 collectingNumber += listAll.stream().filter(e -> (CollectManifestStateEnum.WAIT_SDT.getValue().equals(e.get("state")) || CollectManifestStateEnum.WAIT_FILL.getValue().equals(e.get("state")) || CollectManifestStateEnum.DRE_BACK.getValue().equals(e.get("state")) - || CollectManifestStateEnum.CERT_BACK.getValue().equals(e.get("state"))) && dictItem.getItemValue().equals(e.get("duty_territory"))) + || CollectManifestStateEnum.CERT_BACK.getValue().equals(e.get("state"))) + && dictItem.getItemValue().equals(e.get("duty_territory"))) .count(); // 收集中的参数项 数量 - submitNumber += listAll.stream().filter(e -> CollectManifestStateEnum.SUBMIT.getValue().equals(e.get("state")) && dictItem.getItemValue().equals(e.get("duty_territory"))) + submitNumber += listAll.stream().filter(e -> (CollectManifestStateEnum.SUBMIT.getValue().equals(e.get("state")) + || CollectManifestStateEnum.CHANGE.getValue().equals(e.get("state"))) + && dictItem.getItemValue().equals(e.get("duty_territory"))) .count(); // 已提交的参数项 数量 - syncReportNumber += listAll.stream().filter(e -> CollectManifestStateEnum.SYNC_REPORT.getValue().equals(e.get("state")) && dictItem.getItemValue().equals(e.get("duty_territory"))) + syncReportNumber += listAll.stream().filter(e -> CollectManifestStateEnum.SYNC_REPORT.getValue().equals(e.get("state")) + && dictItem.getItemValue().equals(e.get("duty_territory"))) .count(); // 已同步上报库的参数项 数量 } @@ -1465,4 +1496,5 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/mapper/xml/ParamsReportExportHistoryEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/mapper/xml/ParamsReportExportHistoryEOMapper.xml index 8451ceabe..75f07be76 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/mapper/xml/ParamsReportExportHistoryEOMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/mapper/xml/ParamsReportExportHistoryEOMapper.xml @@ -57,4 +57,4 @@ order by export_time desc - \ No newline at end of file + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/IParamsReportConfigDataEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/IParamsReportConfigDataEOService.java index 94b9c8c6c..ab3698f26 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/IParamsReportConfigDataEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/IParamsReportConfigDataEOService.java @@ -39,4 +39,7 @@ public interface IParamsReportConfigDataEOService extends IService paramsReportDetailIdList); + + + List queryListByCollectManifestIdList(List paramsCollectManifestIdList); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportConfigDataEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportConfigDataEOServiceImpl.java index 7168c6649..0f72783e3 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportConfigDataEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportConfigDataEOServiceImpl.java @@ -78,4 +78,19 @@ public class ParamsReportConfigDataEOServiceImpl extends ServiceImpl queryListByCollectManifestIdList(List paramsCollectManifestIdList) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(ParamsReportConfigDataEO::getParamsCollectManifestId, paramsCollectManifestIdList); + queryWrapper.orderByDesc(ParamsReportConfigDataEO::getOrderNum); + return this.list(queryWrapper); + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java index 4acc8c899..3e0003063 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java @@ -154,6 +154,9 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl collectManifestIdList = list.stream().map(ParamsReportDetailEO::getId).distinct().collect(Collectors.toList()); + List paramsReportConfigDataEOList = this.paramsReportConfigDataEOService.queryListByCollectManifestIdList(collectManifestIdList); + List> listMap = new ArrayList<>(); list.forEach(collectManifestEO -> { // 参数收集清单 @@ -225,7 +228,14 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl configMap = new HashMap<>(); String paramsConfigId = paramsConfigEO.getId(); - List paramsConfigDataEOList = this.paramsReportConfigDataEOService.queryListByConfigIdAndCollectManifestId(paramsConfigId, paramsCollectManifestId); // 参数配置数据 + List paramsConfigDataEOList = paramsReportConfigDataEOList.stream().filter(prcdEO -> { + boolean flag = false; + if (StringUtils.equals(prcdEO.getParamsConfigId(),paramsConfigId) && StringUtils.equals(prcdEO.getParamsCollectManifestId(),paramsCollectManifestId)) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); +// List paramsConfigDataEOList = this.paramsReportConfigDataEOService.queryListByConfigIdAndCollectManifestId(paramsConfigId, paramsCollectManifestId); // 参数配置数据 if(CollectionUtils.isNotEmpty(paramsConfigDataEOList)){ // 匿名比较器排序 Collections.sort(paramsConfigDataEOList, new Comparator() { @@ -239,7 +249,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl paramsConfigDataVOList = this.getConfigDataVOList(controlType, paramsConfigEO, paramsConfigDataEO, collectManifestEO); // 重新组合配置数据 - paramsConfigDataVO.put(paramsConfigDataEO.getId(),paramsConfigDataVOList); + paramsConfigDataVO.put(paramsConfigDataEO.getOrderNum()+"+"+paramsConfigDataEO.getId(),paramsConfigDataVOList); } } @@ -1866,14 +1876,18 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl paramsConfigDataVOMap = (Map) paramsReportConfigDataMap.get("paramsConfigData"); for (Map.Entry paramsConfigDataMap : paramsConfigDataVOMap.entrySet()) { + //顺序号不存在ID中,查询的时候会拼接 String configDataId = paramsConfigDataMap.getKey(); + List> configDataVOList = (List>) paramsConfigDataMap.getValue(); - - if (CollectionUtil.isNotEmpty(configDataVOList)) { - Integer orderNum = (Integer) configDataVOList.get(0).get("orderNum"); - + int orderNum = (Integer) configDataVOList.get(0).get("orderNum"); + int plusIndex = configDataId.indexOf("+"); + if (plusIndex != -1) { + configDataId = configDataId.substring(plusIndex + 1); + orderNum = Integer.parseInt(configDataId.substring(0, plusIndex)); + } ParamsReportConfigDataEO paramsReportConfigDataEO = new ParamsReportConfigDataEO(); paramsReportConfigDataEO.setOrderNum(orderNum); for (Map paramsConfigDataVO : configDataVOList) { @@ -2043,7 +2057,6 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl prcdEoList = this.paramsReportConfigDataEOService.list(prcdQueryWrap); if(CollectionUtils.isNotEmpty(prcdEoList)){ - List paramsConfigDataIdList = paramsConfigDataVOMap.entrySet().stream().map(e -> e.getKey()).distinct().collect(Collectors.toList()); + List paramsConfigDataIdList = paramsConfigDataVOMap.entrySet().stream().map(e -> e.getKey().split("\\+")[0]).distinct().collect(Collectors.toList()); List newAddPcdDataIdList = paramsConfigDataVOMap.entrySet().stream().map(e -> e.getKey()).filter(e -> { boolean flag = false; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java index 1ff4ec1e7..26505d519 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java @@ -5468,7 +5468,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl list = Arrays.asList(value.split(",")); + List ddList = dictItemList.stream().filter(e -> "duty_territory".equals(e.getDictCode()) && list.contains(e.getItemValue())).collect(Collectors.toList()); + List valueList = ddList.stream().map(SysDictItem::getStatNode).collect(Collectors.toList()); + dummyInventoryInfoEO.setDutyDepart(StringUtils.join(valueList,",")); } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/home/controller/HomePermissionController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/home/controller/HomePermissionController.java new file mode 100644 index 000000000..e3be48b61 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/home/controller/HomePermissionController.java @@ -0,0 +1,389 @@ +package com.jero.modules.home.controller; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.jero.common.api.vo.Result; +import com.jero.common.constant.CommonConstant; +import com.jero.common.constant.enums.CutEnum; +import com.jero.common.system.vo.LoginUser; +import com.jero.common.util.MD5Util; +import com.jero.common.util.oConvertUtils; +import com.jero.modules.ota.entity.OtaManageReceiveNsdp; +import com.jero.modules.ota.service.IOtaManageApplyEOService; +import com.jero.modules.system.entity.SysDepartPermission; +import com.jero.modules.system.entity.SysPermission; +import com.jero.modules.system.entity.SysPermissionDataRule; +import com.jero.modules.system.entity.SysRolePermission; +import com.jero.modules.system.enums.SysPermissionEnum; +import com.jero.modules.system.mapper.TodoCenterMapper; +import com.jero.modules.system.model.SysPermissionTree; +import com.jero.modules.system.model.TreeModel; +import com.jero.modules.system.service.ISysDepartPermissionService; +import com.jero.modules.system.service.ISysPermissionDataRuleService; +import com.jero.modules.system.service.ISysPermissionService; +import com.jero.modules.system.service.ISysRolePermissionService; +import com.jero.modules.system.util.PermissionDataUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 菜单权限表 为了做待办中心消息提醒放过来的 + *

+ * + * @Author scott + * @since 2018-12-21 + */ +@Slf4j +@RestController +@RequestMapping("/home/permission") +public class HomePermissionController { + + @Autowired + private ISysPermissionService sysPermissionService; + + @Autowired + private TodoCenterMapper todoCenterMapper; + + @Autowired + private IOtaManageApplyEOService otaManageApplyEOService; + + + + /** + * 查询用户拥有的菜单权限和按钮权限 + * + * @return + */ + @RequestMapping(value = "/getUserPermissionByToken", method = RequestMethod.GET) + public Result getUserPermissionByToken(String cut) { + Result result = new Result(); + try { + //直接获取当前用户不适用前端token + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (oConvertUtils.isEmpty(loginUser)) { + return Result.error("请登录系统!"); + } + List metaList = sysPermissionService.queryByUser(loginUser.getUsername()); + //添加首页路由 + //update-begin-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存 + if (!PermissionDataUtil.hasIndexPage(metaList)) { + SysPermission indexMenu = sysPermissionService.list(new LambdaQueryWrapper().eq(SysPermission::getName, "首页")).get(0); + metaList.add(0, indexMenu); + } + //update-end-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存 + JSONObject json = new JSONObject(); + JSONArray menujsonArray = new JSONArray(); + this.getPermissionJsonArray(menujsonArray, metaList, null, cut); + JSONArray authjsonArray = new JSONArray(); + this.getAuthJsonArray(authjsonArray, metaList); + //查询所有的权限 + LambdaQueryWrapper query = new LambdaQueryWrapper(); + query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0); + query.eq(SysPermission::getMenuType, CommonConstant.MENU_TYPE_2); + //query.eq(SysPermission::getStatus, "1"); + List allAuthList = sysPermissionService.list(query); + JSONArray allauthjsonArray = new JSONArray(); + this.getAllAuthJsonArray(allauthjsonArray, allAuthList); + //路由菜单 + json.put("menu", menujsonArray); + //按钮权限(用户拥有的权限集合) + json.put("auth", authjsonArray); + //全部权限配置集合(按钮权限,访问权限) + json.put("allAuth", allauthjsonArray); + result.setResult(json); + result.success("查询成功"); + } catch (Exception e) { + result.error500("查询失败:" + e.getMessage()); + log.error(e.getMessage(), e); + } + return result; + } + + /** + * 获取菜单JSON数组 + * + * @param jsonArray + * @param metaList + * @param parentJson + */ + private void getPermissionJsonArray(JSONArray jsonArray, List metaList, JSONObject parentJson, String cut) { + for (SysPermission permission : metaList) { + if (permission.getMenuType() == null) { + continue; + } + String tempPid = permission.getParentId(); + JSONObject json = getPermissionJsonObject(permission, cut); + if (json == null) { + continue; + } + if (parentJson == null && oConvertUtils.isEmpty(tempPid)) { + jsonArray.add(json); + if (!permission.isLeaf()) { + getPermissionJsonArray(jsonArray, metaList, json, cut); + } + } else if (parentJson != null && oConvertUtils.isNotEmpty(tempPid) && tempPid.equals(parentJson.getString("id"))) { + // 类型( 0:一级菜单 1:子菜单 2:按钮 ) + if (permission.getMenuType().equals(CommonConstant.MENU_TYPE_2)) { + JSONObject metaJson = parentJson.getJSONObject("meta"); + if (metaJson.containsKey("permissionList")) { + metaJson.getJSONArray("permissionList").add(json); + } else { + JSONArray permissionList = new JSONArray(); + permissionList.add(json); + metaJson.put("permissionList", permissionList); + } + // 类型( 0:一级菜单 1:子菜单 2:按钮 ) + } else if (permission.getMenuType().equals(CommonConstant.MENU_TYPE_1) || permission.getMenuType().equals(CommonConstant.MENU_TYPE_0)) { + if (parentJson.containsKey("children")) { + parentJson.getJSONArray("children").add(json); + } else { + JSONArray children = new JSONArray(); + children.add(json); + parentJson.put("children", children); + } + + if (!permission.isLeaf()) { + getPermissionJsonArray(jsonArray, metaList, json, cut); + } + } + } + + } + } + + + /** + * 获取权限JSON数组 + * + * @param jsonArray + * @param metaList + */ + private void getAuthJsonArray(JSONArray jsonArray, List metaList) { + for (SysPermission permission : metaList) { + if (permission.getMenuType() == null) { + continue; + } + JSONObject json = null; + if (permission.getMenuType().equals(CommonConstant.MENU_TYPE_2) && CommonConstant.STATUS_1.equals(permission.getStatus())) { + json = new JSONObject(); + json.put("action", permission.getPerms()); + json.put("type", permission.getPermsType()); + json.put("describe", permission.getName()); + jsonArray.add(json); + } + } + } + + + /** + * 获取权限JSON数组 + * + * @param jsonArray + * @param allList + */ + private void getAllAuthJsonArray(JSONArray jsonArray, List allList) { + JSONObject json = null; + for (SysPermission permission : allList) { + json = new JSONObject(); + json.put("action", permission.getPerms()); + json.put("status", permission.getStatus()); + //1显示2禁用 + json.put("type", permission.getPermsType()); + json.put("describe", permission.getName()); + jsonArray.add(json); + } + } + + + /** + * 根据菜单配置生成路由json + * + * @param permission + * @return + */ + private JSONObject getPermissionJsonObject(SysPermission permission, String cut) { + JSONObject json = new JSONObject(); + // 类型(0:一级菜单 1:子菜单 2:按钮) + if (permission.getMenuType().equals(CommonConstant.MENU_TYPE_2)) { + //json.put("action", permission.getPerms()); + //json.put("type", permission.getPermsType()); + //json.put("describe", permission.getName()); + return null; + } else if (permission.getMenuType().equals(CommonConstant.MENU_TYPE_0) || permission.getMenuType().equals(CommonConstant.MENU_TYPE_1)) { + json.put("id", permission.getId()); + if (permission.isRoute()) { + json.put("route", "1");// 表示生成路由 + } else { + json.put("route", "0");// 表示不生成路由 + } + + if (isWWWHttpUrl(permission.getUrl())) { + json.put("path", MD5Util.MD5Encode(permission.getUrl(), "utf-8")); + } else { + json.put("path", permission.getUrl()); + } + + // 重要规则:路由name (通过URL生成路由name,路由name供前端开发,页面跳转使用) + if (oConvertUtils.isNotEmpty(permission.getComponentName())) { + json.put("name", permission.getComponentName()); + } else { + json.put("name", urlToRouteName(permission.getUrl())); + } + + // 是否隐藏路由,默认都是显示的 + if (permission.isHidden()) { + json.put("hidden", true); + } + // 聚合路由 + if (permission.isAlwaysShow()) { + json.put("alwaysShow", true); + } + json.put("component", permission.getComponent()); + JSONObject meta = new JSONObject(); + // 由用户设置是否缓存页面 用布尔值 + if (permission.isKeepAlive()) { + meta.put("keepAlive", true); + } else { + meta.put("keepAlive", false); + } + + /*update_begin author:wuxianquan date:20190908 for:往菜单信息里添加外链菜单打开方式 */ + //外链菜单打开方式 + if (permission.isInternalOrExternal()) { + meta.put("internalOrExternal", true); + } else { + meta.put("internalOrExternal", false); + } + /* update_end author:wuxianquan date:20190908 for: 往菜单信息里添加外链菜单打开方式*/ + + if (CutEnum.EN.getValue().equals(cut)) { + meta.put("title", permission.getMenuEn()); + } else { + meta.put("title", permission.getName()); + } + + //update-begin--Author:scott Date:20201015 for:路由缓存问题,关闭了tab页时再打开就不刷新 #842 + String component = permission.getComponent(); + if (oConvertUtils.isNotEmpty(permission.getComponentName()) || oConvertUtils.isNotEmpty(component)) { + meta.put("componentName", oConvertUtils.getString(permission.getComponentName(), component.substring(component.lastIndexOf("/") + 1))); + } + //update-end--Author:scott Date:20201015 for:路由缓存问题,关闭了tab页时再打开就不刷新 #842 + + if (oConvertUtils.isEmpty(permission.getParentId())) { + // 一级菜单跳转地址 + json.put("redirect", permission.getRedirect()); + if (oConvertUtils.isNotEmpty(permission.getIcon())) { + meta.put("icon", permission.getIcon()); + } + } else { + if (oConvertUtils.isNotEmpty(permission.getIcon())) { + meta.put("icon", permission.getIcon()); + } + } + if (isWWWHttpUrl(permission.getUrl())) { + meta.put("url", permission.getUrl()); + } + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + Map params = new HashMap<>(); + params.put("currentUserId", currentUser.getId()); + + List flowTypeList = new ArrayList<>(); + //项目法规任务 + if (StringUtils.equals(permission.getId(), SysPermissionEnum.PROJECT_REGULATION_TASKS.getId())) { + flowTypeList.add("1"); + flowTypeList.add("2"); + flowTypeList.add("3"); + flowTypeList.add("4"); + flowTypeList.add("10"); + flowTypeList.add("21"); + params.put("flowTypeList", flowTypeList); + //存在待办任务标识,true为有 + boolean existTaskFlag = false; + int result = todoCenterMapper.todoCenterTaskCount(params); + if (result > 0) { + existTaskFlag = true; + } + //查询当前登录用户是否有项目法规任务 + meta.put("existTask", existTaskFlag); + } + //法规评估任务 + if (StringUtils.equals(permission.getId(), SysPermissionEnum.REGULATORY_ASSESSMENT_TASKS.getId())) { + flowTypeList.add("5"); + flowTypeList.add("6"); + params.put("flowTypeList", flowTypeList); + int result = todoCenterMapper.todoCenterTaskCount(params); + boolean existTaskFlag = false; + if (result > 0) { + existTaskFlag = true; + } + meta.put("existTask", existTaskFlag); + } + //项目参数任务 + if (StringUtils.equals(permission.getId(), SysPermissionEnum.PROJECT_PARAMETER_TASKS.getId())) { + boolean existTaskFlag = false; + existTaskFlag = sysPermissionService.judgeToDo(); + meta.put("existTask", existTaskFlag); + } + //OTA任务 + if (StringUtils.equals(permission.getId(), SysPermissionEnum.OTA_TASKS.getId())) { + boolean existTaskFlag = false; + List otaList = otaManageApplyEOService.getOtaTodoList(new OtaManageReceiveNsdp()); + if(!otaList.isEmpty()){ + existTaskFlag = true; + } + meta.put("existTask", existTaskFlag); + } + + json.put("meta", meta); + } + + return json; + } + + /** + * 判断是否外网URL 例如: http://localhost:8080/jero-boot/swagger-ui.html#/ 支持特殊格式: {{ + * window._CONFIG['domianURL'] }}/druid/ {{ JS代码片段 }},前台解析会自动执行JS代码片段 + * + * @return + */ + private boolean isWWWHttpUrl(String url) { + if (url != null && (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("{{"))) { + return true; + } + return false; + } + + /** + * 通过URL生成路由name(去掉URL前缀斜杠,替换内容中的斜杠‘/’为-) 举例: URL = /isystem/role RouteName = + * isystem-role + * + * @return + */ + private String urlToRouteName(String url) { + if (oConvertUtils.isNotEmpty(url)) { + if (url.startsWith("/")) { + url = url.substring(1); + } + url = url.replace("/", "-"); + + // 特殊标记 + url = url.replace(":", "@"); + return url; + } else { + return null; + } + } + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaManageApplyEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaManageApplyEOController.java index ff5d721a0..48402b047 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaManageApplyEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaManageApplyEOController.java @@ -8,6 +8,7 @@ import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.system.base.controller.JeroController; import com.jero.common.util.PageUtil; import com.jero.modules.ota.entity.OtaManageApplyEO; +import com.jero.modules.ota.entity.OtaManageReceiveNsdp; import com.jero.modules.ota.service.IOtaManageApplyEOService; import com.jero.modules.ota.vo.VersionVO; import com.jero.modules.project.entity.ProjectLibraryBase; @@ -344,5 +345,20 @@ public class OtaManageApplyEOController extends JeroController getOtaTodoList(OtaManageReceiveNsdp otaManageReceiveNsdp, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) { + + List list = otaManageApplyEOService.getOtaTodoList(otaManageReceiveNsdp); + Page pages = PageUtil.getPages(pageNo, pageSize, list); + return Result.OK(pages); + } + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageApplyEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageApplyEO.java index 5408c129a..31dae5e12 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageApplyEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageApplyEO.java @@ -211,6 +211,20 @@ public class OtaManageApplyEO implements Serializable { @ApiModelProperty(value = "导出文件名") private String exportName; + @TableField(exist = false) + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "软件版本创建时间") + private Date createdAt; + + @TableField(exist = false) + @ApiModelProperty(value = "发布类型") + private String releaseType; + + @TableField(exist = false) + @ApiModelProperty(value = "车型(匹配版本号后)") + private String vehicleMatch; + @TableField(exist = false) @ApiModelProperty(value = "中英文切换") private String cut; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManagePermission.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManagePermission.java index bdfd2c301..c0fa8d8ae 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManagePermission.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManagePermission.java @@ -71,4 +71,9 @@ public class OtaManagePermission implements Serializable { @ApiModelProperty(value = "对应applyID") private String applyId; + /**车型*/ + @Excel(name = "车型", width = 15) + @ApiModelProperty(value = "车型") + private String vehicle; + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceive.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceive.java index 87712f25e..8b8651b67 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceive.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceive.java @@ -116,6 +116,16 @@ public class OtaManageReceive implements Serializable { @ApiModelProperty(value = "发布时间") private String releaseDate; + /**车型(匹配版本号后)*/ + @Excel(name = "车型(匹配版本号后)", width = 15) + @ApiModelProperty(value = "车型(匹配版本号后)") + private String vehicleMatch; + + /**发布类型*/ + @Excel(name = "发布类型", width = 15) + @ApiModelProperty(value = "发布类型") + private String releaseType; + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceiveNsdp.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceiveNsdp.java index c4d1c3a8a..e1b1cb18d 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceiveNsdp.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/entity/OtaManageReceiveNsdp.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -71,6 +72,12 @@ public class OtaManageReceiveNsdp implements Serializable { @ApiModelProperty(value = "发布版本") private String releaseName; + + /**发布版本*/ + @Excel(name = "适用车型", width = 15) + @ApiModelProperty(value = "适用车型") + private String vehicle; + /**发布类型*/ @Excel(name = "发布类型", width = 15) @ApiModelProperty(value = "发布类型") @@ -93,4 +100,17 @@ public class OtaManageReceiveNsdp implements Serializable { @ApiModelProperty(value = "创建时间") private java.util.Date createdAt; + + @TableField(exist = false) + private String market; + + + @TableField(exist = false) + @ApiModelProperty(value = "表头排序字段") + private java.lang.String orderByField; + + @TableField(exist = false) + @ApiModelProperty(value = "排序") + private java.lang.String orderBy; + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/job/OtaDataUpdate.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/job/OtaDataUpdate.java index a8120b94c..0a9a6cfe4 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/job/OtaDataUpdate.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/job/OtaDataUpdate.java @@ -15,6 +15,9 @@ import org.springframework.stereotype.Service; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; @Service public class OtaDataUpdate implements Job { @@ -34,6 +37,11 @@ public class OtaDataUpdate implements Job { */ @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + //截取版本号中前面数字部分 + String regex = "BL\\d+\\.+\\d+\\.(\\d+)"; + Pattern pattern = Pattern.compile(regex); + + List omrSyncList = otaManageReceiveService.getReceiveSync(); List omrList = otaManageReceiveService.queryList(); @@ -66,6 +74,13 @@ public class OtaDataUpdate implements Job { } if (addFlag) { //同步数据中新增 + String plannedBpLaunchBatch = omrSync.getPlannedBpLaunchBatch(); + if (StringUtils.isNotEmpty(plannedBpLaunchBatch)) { + Matcher matcher = pattern.matcher(plannedBpLaunchBatch); + if (matcher.find()) { + omrSync.setPlannedBpLaunchBatch(matcher.group()); + } + } addList.add(omrSync); } } @@ -79,7 +94,6 @@ public class OtaDataUpdate implements Job { otaManageReceiveService.updateBatchById(updateList); } - List omrnSyncList = otaManageReceiveNsdpService.getOtaManageReceiveNsdpSync(); List omrnList = otaManageReceiveNsdpService.queryList(); @@ -103,9 +117,6 @@ public class OtaDataUpdate implements Job { } } - Map releaceDateMap = new HashMap<>(); - Date today = new Date(); - for (OtaManageReceiveNsdp omrnSync : omrnSyncList) { boolean addFlag = true; for (OtaManageReceiveNsdp omrn : omrnList) { @@ -115,22 +126,16 @@ public class OtaDataUpdate implements Job { } if (addFlag) { //同步数据中新增 - addNsdpList.add(omrnSync); - } - //找到最快来临的发布时间 - Date releaceDate = releaceDateMap.get(omrnSync.getReleaseName()); - try { - Date syncDate = sdf.parse(omrnSync.getReleaseDate()); - if (null == releaceDate) { - releaceDateMap.put(omrnSync.getReleaseName(), syncDate); - } else { - if (syncDate.after(today) && syncDate.before(releaceDate)) { - releaceDateMap.put(omrnSync.getReleaseName(), syncDate); + String releaseName = omrnSync.getReleaseName(); + if (StringUtils.isNotEmpty(releaseName)) { + Matcher matcher = pattern.matcher(releaseName); + if (matcher.find()) { + omrnSync.setReleaseName(matcher.group()); } } - } catch (ParseException e) { - e.printStackTrace(); + addNsdpList.add(omrnSync); } + } if (CollectionUtils.isNotEmpty(addNsdpList)) { @@ -143,27 +148,112 @@ public class OtaDataUpdate implements Job { otaManageReceiveNsdpService.updateBatchById(updateNsdpList); } + //记录发布时间 + Map releaceDateMap = new HashMap<>(); + //记录车型列表 + Map> omrnVehicleMap = new HashMap<>(); + + Map releaceTypeMap = new HashMap<>(); + + Date today = new Date(); + List omrnLastList = otaManageReceiveNsdpService.queryList(); + for (OtaManageReceiveNsdp omrn : omrnLastList) { + //找到最快来临的发布时间 + Date releaceDate = releaceDateMap.get(omrn.getReleaseName()); + try { + Date syncDate = sdf.parse(omrn.getReleaseDate()); + if (null == releaceDate) { + releaceDateMap.put(omrn.getReleaseName(), syncDate); + } else { + if (syncDate.after(today) && syncDate.before(releaceDate)) { + releaceDateMap.put(omrn.getReleaseName(), syncDate); + } + } + } catch (ParseException e) { + e.printStackTrace(); + } + //处理车型字符串 + Set vehicleSet = omrnVehicleMap.get(omrn.getReleaseName()); + if(null == vehicleSet){ + vehicleSet = new HashSet<>(); + } + String appliedVehicleProject = omrn.getVehicle(); + if(StringUtils.isNotEmpty(appliedVehicleProject)){ + for (String s : appliedVehicleProject.split(",")) { + String[] split = s.split(" "); + if (split.length == 3) { + String projectName = split[0]; + String market = split[2]; + vehicleSet.add(projectName + " " + market); + } + } + } + omrnVehicleMap.put(omrn.getReleaseName(),vehicleSet); + + releaceTypeMap.put(omrn.getReleaseName(),omrn.getReleaseType()); + } + + + //开始刷新 otaManageReceive中的车型和发布时间 List dateUpdateList = new ArrayList<>(); List omrListForDate = otaManageReceiveService.queryList(); for (OtaManageReceive omr : omrListForDate) { - if(releaceDateMap.containsKey(omr.getPlannedBpLaunchBatch())){ + //处理发布时间 + if (releaceDateMap.containsKey(omr.getPlannedBpLaunchBatch())) { omr.setReleaseDate(sdf.format(releaceDateMap.get(omr.getPlannedBpLaunchBatch()))); - dateUpdateList.add(omr); } + //处理车型 + String appliedVehicleProject = omr.getAppliedVehicleProject(); + Set vehicleSet = new HashSet<>(); + if(StringUtils.isNotEmpty(appliedVehicleProject)){ + Set omrnVehicleSet = omrnVehicleMap.get(omr.getPlannedBpLaunchBatch()); + if(CollectionUtils.isEmpty(omrnVehicleSet)){ + omrnVehicleSet = new HashSet<>(); + } + for (String s : appliedVehicleProject.split(",")) { + String[] split = s.split(" "); + if (split.length == 1 && "All".equals(split[0])) { + vehicleSet.addAll(omrnVehicleSet); + }else if (split.length == 2) { + if("All".equals(split[1])){ + for (String val : omrnVehicleSet) { + if(val.contains(split[0])){ + vehicleSet.add(val); + } + } + }else{ + for (String val : omrnVehicleSet) { + if(val.contains(s)){ + vehicleSet.add(val); + } + } + } + }else if (split.length == 3) { + for (String val : omrnVehicleSet) { + if(val.contains(split[0]+" "+split[2])){ + vehicleSet.add(val); + } + } + } + } + if(!vehicleSet.isEmpty()){ + omr.setVehicleMatch(vehicleSet.stream().collect(Collectors.joining(","))); + } + omr.setReleaseType(releaceTypeMap.get(omr.getPlannedBpLaunchBatch())); + } + dateUpdateList.add(omr); } if (CollectionUtils.isNotEmpty(dateUpdateList)) { otaManageReceiveService.updateBatchById(dateUpdateList); } + System.out.println("===============================OtaDataUpdate定时任务结束==============================="); } private boolean compareReceive(OtaManageReceiveNsdp omrn, OtaManageReceiveNsdp omrnSync) { if (!StringUtils.equals(omrn.getPlatformName(), omrnSync.getPlatformName())) { return false; } - if (!StringUtils.equals(omrn.getReleaseName(), omrnSync.getReleaseName())) { - return false; - } if (!StringUtils.equals(omrn.getReleaseType(), omrnSync.getReleaseType())) { return false; } @@ -173,13 +263,13 @@ public class OtaDataUpdate implements Job { if (!StringUtils.equals(omrn.getReleaseDate(), omrnSync.getReleaseDate())) { return false; } + if (!StringUtils.equals(omrn.getVehicle(), omrnSync.getVehicle())) { + return false; + } return true; } private boolean compareReceive(OtaManageReceive omr, OtaManageReceive omrSync) { - if (!StringUtils.equals(omr.getPlannedBpLaunchBatch(), omrSync.getPlannedBpLaunchBatch())) { - return false; - } if (!StringUtils.equals(omr.getSummary(), omrSync.getSummary())) { return false; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml index 2edd55c10..7c83b88f7 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/mapper/xml/OtaManageApplyEOMapper.xml @@ -72,7 +72,7 @@ omr.summary,omr.status, omr.homologation_impact,omr.homologation, omr.impact_cn_homo,omr.impact_eu_homo, - omr.master_domain,omr.applied_vehicle_project, + omr.master_domain,omr.applied_vehicle_project,omr.vehicle_match, oma.id,oma.project_version,oma.attestation_schedule,oma.match_status,oma.remark,oma.vehicle_type from ota_manage_receive omr left join ota_manage_apply oma on oma.vdr = omr.id @@ -92,9 +92,6 @@ and (omr.impact_cn_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%') and omr.impact_eu_homo LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.impactHomo}),'%')) - - and omr.applied_vehicle_project LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.appliedVehicleProject}),'%') - and omr.homologation_impact LIKE CONCAT(CONCAT('%',#{otaManageApplyEO.homologationImpact}),'%') @@ -153,6 +150,7 @@ oma.attestation_schedule, oma.project_version, pni.project_name car, + oma.vehicle_type, pyni.year_name FROM project_library_base plb diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageApplyEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageApplyEOService.java index 45220cbb6..c007e9b14 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageApplyEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageApplyEOService.java @@ -2,6 +2,7 @@ package com.jero.modules.ota.service; import com.baomidou.mybatisplus.extension.service.IService; import com.jero.modules.ota.entity.OtaManageApplyEO; +import com.jero.modules.ota.entity.OtaManageReceiveNsdp; import com.jero.modules.ota.vo.VersionVO; import com.jero.modules.project.entity.ProjectLibraryBase; import org.springframework.web.servlet.ModelAndView; @@ -134,4 +135,6 @@ public interface IOtaManageApplyEOService extends IService { ModelAndView allCarExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO); ModelAndView oneCarExportXls(HttpServletRequest request, OtaManageApplyEO otaManageApplyEO); + + List getOtaTodoList(OtaManageReceiveNsdp otaManageReceiveNsdp); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageReceiveNsdpService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageReceiveNsdpService.java index 1e4ffbc38..938e33eb9 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageReceiveNsdpService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageReceiveNsdpService.java @@ -61,4 +61,6 @@ public interface IOtaManageReceiveNsdpService extends IService getOtaManageReceiveNsdpSync(); + + List getListByReleaseName(String releaseName); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageReceiveService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageReceiveService.java index 765eb5aed..4e8be0be0 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageReceiveService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/IOtaManageReceiveService.java @@ -4,6 +4,7 @@ import com.jero.modules.ota.entity.OtaManageApplyEO; import com.jero.modules.ota.entity.OtaManageReceive; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; +import java.util.Map; /** * @Description: OTA管理 @@ -64,6 +65,8 @@ public interface IOtaManageReceiveService extends IService { List getReceiveByplanned(String plannedBpLaunchBatch); + List getReceiveByplannedList(List plannedBpLaunchBatchList); + List getReceiveSync(); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java index 3d5ba5b49..7fcc03374 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java @@ -11,18 +11,12 @@ import com.jero.common.util.oConvertUtils; import com.jero.modules.dummy.enums.OrderEnum; import com.jero.modules.feishu.enums.TemplateInfoEnum2; import com.jero.modules.feishu.service.IFeishuService; -import com.jero.modules.ota.entity.OtaManageApplyEO; -import com.jero.modules.ota.entity.OtaManageHistory; -import com.jero.modules.ota.entity.OtaManagePermission; -import com.jero.modules.ota.entity.OtaManageReceive; +import com.jero.modules.ota.entity.*; import com.jero.modules.ota.enums.OtaCarEnum; import com.jero.modules.ota.enums.OtaHomoImpactEnum; import com.jero.modules.ota.enums.OtaStatusEnum; import com.jero.modules.ota.mapper.OtaManageApplyEOMapper; -import com.jero.modules.ota.service.IOtaManageApplyEOService; -import com.jero.modules.ota.service.IOtaManageHistoryService; -import com.jero.modules.ota.service.IOtaManagePermissionService; -import com.jero.modules.ota.service.IOtaManageReceiveService; +import com.jero.modules.ota.service.*; import com.jero.modules.ota.vo.AllCarExportCnVO; import com.jero.modules.ota.vo.AllCarExportEnVO; import com.jero.modules.ota.vo.OneCarExportCnVO; @@ -63,6 +57,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.text.Collator; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -108,6 +103,8 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getNsdpList(OtaManageApplyEO otaManageApplyEO) { + Date today = new Date(); + List resList = new ArrayList<>(); + List dataList = otaManageReceiveNsdpService.queryList(); + Map> dataMap = dataList.stream().collect(Collectors.groupingBy(OtaManageReceiveNsdp::getReleaseName)); + + for (String rn : dataMap.keySet()) { + if(StringUtils.isNotEmpty(otaManageApplyEO.getPlannedBpLaunchBatch())&&!otaManageApplyEO.getPlannedBpLaunchBatch().equals(rn)){ + continue; + } + List valList = dataMap.get(rn); + if (CollectionUtils.isNotEmpty(valList)) { + Date releaseDate = null; + //市场 + Set marketSet = new HashSet<>(); + //车型 + Set vehicleSet = new HashSet<>(); + for (OtaManageReceiveNsdp omrn : valList) { + //找到最快来临的发布时间 + try { + if(StringUtils.isNotBlank(omrn.getReleaseDate())){ + Date syncDate = sdf.parse(omrn.getReleaseDate()); + if (null == releaseDate) { + releaseDate = syncDate; + } else { + if (syncDate.after(today) && syncDate.before(releaseDate)) { + releaseDate = syncDate; + } + } + } + } catch (ParseException e) { + e.printStackTrace(); + } + String appliedVehicleProject = omrn.getVehicle(); + if(StringUtils.isNotEmpty(appliedVehicleProject)){ + for (String s : appliedVehicleProject.split(",")) { + String[] split = s.split(" "); + if (split.length == 3) { + vehicleSet.add(split[0]+" "+split[2]); + marketSet.add(split[2]); + } + } + } + } + if(ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeStart()) && ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeEnd())){ + if(ObjectUtils.isEmpty(releaseDate) || otaManageApplyEO.getSoftwareIssueTimeStart().after(releaseDate) || otaManageApplyEO.getSoftwareIssueTimeEnd().before(releaseDate)){ + continue; + } + } + if (StringUtils.isNotEmpty(otaManageApplyEO.getAppliedVehicleProject()) && !vehicleSet.contains(otaManageApplyEO.getAppliedVehicleProject())) { + continue; + } + if (StringUtils.isNotEmpty(otaManageApplyEO.getMarket()) && !marketSet.contains(otaManageApplyEO.getMarket())) { + continue; + } + OtaManageReceiveNsdp omrn = valList.get(0); + if (StringUtils.isNotEmpty(otaManageApplyEO.getReleaseType()) && !otaManageApplyEO.getReleaseType().equals(omrn.getReleaseType())) { + continue; + } + OtaManageApplyEO oma = new OtaManageApplyEO(); + oma.setId(omrn.getId()); + oma.setPlannedBpLaunchBatch(omrn.getReleaseName()); + if (!marketSet.isEmpty()) { + oma.setMarket(StringUtils.join(marketSet, ",")); + } + if (!vehicleSet.isEmpty()) { + oma.setAppliedVehicleProject(StringUtils.join(vehicleSet, ",")); + } + if (ObjectUtils.isNotEmpty(releaseDate)) { + oma.setReleaseDate(sdf.format(releaseDate)); + } + oma.setCreatedAt(omrn.getCreatedAt()); + oma.setReleaseType(omrn.getReleaseType()); + resList.add(oma); + } + } + return resList; + } + + /** * OTA管理列表和全车型列表-分页列表查询 * @@ -208,7 +286,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getOtaPage(OtaManageApplyEO otaManageApplyEO) { LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); boolean otaManager = isOtaManager(); - List otaManageApplyEOList = this.getBaseMapper().getOtaList(otaManageApplyEO); + List otaManageApplyEOList = this.getNsdpList(otaManageApplyEO); List dataList = new ArrayList<>(); //去跟manager和studio权限 @@ -223,80 +301,80 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl result = new ArrayList<>(); +// List result = new ArrayList<>(); +// if (!dataList.isEmpty()) { +// List otaNameList = OtaCarEnum.getOtaNameList(); +// List plannedBpLaunchBatchList = dataList.stream() +// .filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch())) +// .map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList()); +// if (!plannedBpLaunchBatchList.isEmpty()) { +// for (String plannedBpLaunchBatch : plannedBpLaunchBatchList) { +// OtaManageApplyEO manageApplyEO = new OtaManageApplyEO(); +// manageApplyEO.setPlannedBpLaunchBatch(plannedBpLaunchBatch); +// manageApplyEO.setId(plannedBpLaunchBatch); +// +// List otaManageApplyEOS = dataList.stream() +// .filter(e -> plannedBpLaunchBatch.equals(e.getPlannedBpLaunchBatch())).collect(Collectors.toList()); +// if (!otaManageApplyEOS.isEmpty()) { +// //发布时间 +// manageApplyEO.setReleaseDate(otaManageApplyEOS.get(0).getReleaseDate()); +// +// List appliedVehicleProjectList = otaManageApplyEOS.stream() +// .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) +// .map(OtaManageApplyEO::getAppliedVehicleProject).collect(Collectors.toList()); +// List carList = new ArrayList<>(); +// for (String appliedVehicleProject : appliedVehicleProjectList) { +// carList.addAll(Arrays.asList(appliedVehicleProject.split(","))); +// } +// if (!carList.isEmpty()) { +// //适用车型 +// carList = carList.stream().distinct().collect(Collectors.toList()); +// manageApplyEO.setAppliedVehicleProject(StringUtils.join(carList, ",")); +// //市场 +// Set marketSet = new HashSet<>(); +// for (String appliedVehicleProject : carList) { +// if(otaNameList.contains(appliedVehicleProject)){ +// marketSet.add(appliedVehicleProject); +// }else{ +// for (String s : appliedVehicleProject.split(",")) { +// String[] split = s.split(" "); +// if (split.length == 2) { +// if (!otaNameList.contains(s)) { +// marketSet.add(split[1]); +// } +// } else if (split.length == 3) { +// if (!otaNameList.contains(s)) { +// marketSet.add(split[2]); +// } +// } +// } +// } +// } +// if (!marketSet.isEmpty()) { +// manageApplyEO.setMarket(StringUtils.join(marketSet, ",")); +// } +// } +// } +// result.add(manageApplyEO); +// } +// } +// } +// if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeStart())) { +// result = result.stream() +// .filter(e -> StringUtils.isNotBlank(e.getReleaseDate()) +// && (e.getReleaseNameDate().after(otaManageApplyEO.getSoftwareIssueTimeStart()) +// || e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeStart()))).collect(Collectors.toList()); +// } +// if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeEnd())) { +// result = result.stream().filter(e -> StringUtils.isNotBlank(e.getReleaseDate()) +// && (e.getReleaseNameDate().before(otaManageApplyEO.getSoftwareIssueTimeEnd()) +// || e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeEnd()))).collect(Collectors.toList()); +// } if (!dataList.isEmpty()) { - List otaNameList = OtaCarEnum.getOtaNameList(); - List plannedBpLaunchBatchList = dataList.stream() - .filter(e -> StringUtils.isNotBlank(e.getPlannedBpLaunchBatch())) - .map(OtaManageApplyEO::getPlannedBpLaunchBatch).distinct().collect(Collectors.toList()); - if (!plannedBpLaunchBatchList.isEmpty()) { - for (String plannedBpLaunchBatch : plannedBpLaunchBatchList) { - OtaManageApplyEO manageApplyEO = new OtaManageApplyEO(); - manageApplyEO.setPlannedBpLaunchBatch(plannedBpLaunchBatch); - manageApplyEO.setId(plannedBpLaunchBatch); - - List otaManageApplyEOS = dataList.stream() - .filter(e -> plannedBpLaunchBatch.equals(e.getPlannedBpLaunchBatch())).collect(Collectors.toList()); - if (!otaManageApplyEOS.isEmpty()) { - //发布时间 - manageApplyEO.setReleaseDate(otaManageApplyEOS.get(0).getReleaseDate()); - - List appliedVehicleProjectList = otaManageApplyEOS.stream() - .filter(e -> StringUtils.isNotBlank(e.getAppliedVehicleProject())) - .map(OtaManageApplyEO::getAppliedVehicleProject).collect(Collectors.toList()); - List carList = new ArrayList<>(); - for (String appliedVehicleProject : appliedVehicleProjectList) { - carList.addAll(Arrays.asList(appliedVehicleProject.split(","))); - } - if (!carList.isEmpty()) { - //适用车型 - carList = carList.stream().distinct().collect(Collectors.toList()); - manageApplyEO.setAppliedVehicleProject(StringUtils.join(carList, ",")); - //市场 - Set marketSet = new HashSet<>(); - for (String appliedVehicleProject : carList) { - if(otaNameList.contains(appliedVehicleProject)){ - marketSet.add(appliedVehicleProject); - }else{ - for (String s : appliedVehicleProject.split(",")) { - String[] split = s.split(" "); - if (split.length == 2) { - if (!otaNameList.contains(s)) { - marketSet.add(split[1]); - } - } else if (split.length == 3) { - if (!otaNameList.contains(s)) { - marketSet.add(split[2]); - } - } - } - } - } - if (!marketSet.isEmpty()) { - manageApplyEO.setMarket(StringUtils.join(marketSet, ",")); - } - } - } - result.add(manageApplyEO); - } - } - } - if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeStart())) { - result = result.stream() - .filter(e -> StringUtils.isNotBlank(e.getReleaseDate()) - && (e.getReleaseNameDate().after(otaManageApplyEO.getSoftwareIssueTimeStart()) - || e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeStart()))).collect(Collectors.toList()); - } - if (ObjectUtils.isNotEmpty(otaManageApplyEO.getSoftwareIssueTimeEnd())) { - result = result.stream().filter(e -> StringUtils.isNotBlank(e.getReleaseDate()) - && (e.getReleaseNameDate().before(otaManageApplyEO.getSoftwareIssueTimeEnd()) - || e.getReleaseNameDate().equals(otaManageApplyEO.getSoftwareIssueTimeEnd()))).collect(Collectors.toList()); - } - if (!result.isEmpty()) { //表头排序 - heartSort(otaManageApplyEO, result); + heartSort(otaManageApplyEO, dataList); } - return result; + return dataList; } /** @@ -414,7 +492,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl { String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseDate()) ? e1.getReleaseDate() : ""; @@ -669,6 +747,22 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl { + String e1ReleaseType = StringUtils.isNotBlank(e1.getReleaseType()) ? e1.getReleaseType() : ""; + String e2ReleaseType = StringUtils.isNotBlank(e2.getReleaseType()) ? e2.getReleaseType() : ""; + return comparator.compare(e1ReleaseType, e2ReleaseType); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { + Collections.sort(otaManageApplyEOList, (e1, e2) -> { + String e1ReleaseType = StringUtils.isNotBlank(e1.getReleaseType()) ? e1.getReleaseType() : ""; + String e2ReleaseType = StringUtils.isNotBlank(e2.getReleaseType()) ? e2.getReleaseType() : ""; + return comparator.compare(e2ReleaseType, e1ReleaseType); + }); + } + } //备注 if ("remark".equals(otaManageApplyEO.getOrderByField())) { if (OrderEnum.POSITIVE.getValue().equals(otaManageApplyEO.getOrderBy())) { @@ -685,6 +779,13 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl { + Date e1CreatedAt = ObjectUtils.isNotEmpty(e1.getCreatedAt()) ? e1.getCreatedAt() : new Date(0); + Date e2CreatedAt = ObjectUtils.isNotEmpty(e2.getCreatedAt()) ? e2.getCreatedAt() : new Date(0); + return e2CreatedAt.compareTo(e1CreatedAt); + }); + } } private boolean hasPermission(String plannedBpLaunchBatch){ @@ -734,27 +835,31 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl listTemp = Arrays.asList(split); - List conditionList = Arrays.asList(conditionSplit); - if (listTemp.containsAll(conditionList)) { - omaMap.put(manageApplyEO.getVdr(), manageApplyEO); - break; - } } +// String[] split = appliedVehicleProjectTemp.split(" "); +// if (split.length == 1) { +// omaMap.put(manageApplyEO.getVdr(), manageApplyEO); +// break; +// } else if (split.length == 2) { +// if (Arrays.equals(conditionSplit, split)) { +// omaMap.put(manageApplyEO.getVdr(), manageApplyEO); +// break; +// } +// } else if (split.length == 3) { +// List listTemp = Arrays.asList(split); +// List conditionList = Arrays.asList(conditionSplit); +// if (listTemp.containsAll(conditionList)) { +// omaMap.put(manageApplyEO.getVdr(), manageApplyEO); +// break; +// } +// } } } } @@ -882,7 +987,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getPullDownList() { - List otaManageApplyEOS = this.getBaseMapper().getOtaCarList(null); + List otaManageApplyEOS = this.getNsdpList(new OtaManageApplyEO()); Map result = new HashMap<>(); if (!otaManageApplyEOS.isEmpty()) { //软件版本 planned_bp_launch_batch_ @@ -922,11 +1027,48 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getCarList(String cut, String plannedBpLaunchBatch) { + List dataList = otaManageReceiveNsdpService.getListByReleaseName(plannedBpLaunchBatch); + //车型 + Set vehicleSet = new HashSet<>(); + for (OtaManageReceiveNsdp omrn : dataList) { + String appliedVehicleProject = omrn.getVehicle(); + if(StringUtils.isNotEmpty(appliedVehicleProject)){ + for (String s : appliedVehicleProject.split(",")) { + String[] split = s.split(" "); + if (split.length == 3) { + String projectName = split[0]; + String market = split[2]; + vehicleSet.add(projectName + " " + market); + } + } + } + } + List resList = new ArrayList<>(); + if (CutEnum.CN.getValue().equals(cut)) { + resList.add("全部"); + } else { + resList.add("All"); + } + resList.addAll(vehicleSet); + return resList; + } + + + /** + * 下拉数据-全部和分车型(不含年款) + * + * @return + */ + /*. + @Override public List getCarList(String cut, String plannedBpLaunchBatch) { Set set = new HashSet<>(); @@ -1003,6 +1145,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getStudioCarList(String plannedBpLaunchBatch) { Set set = new HashSet<>(); @@ -1166,61 +1309,92 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getVersionInfo(String vdr, String car, String cut) { - //认证进度数据字典 certification_progress - List regionDictList = sysDictItemServiceImpl.selectItemsByDictCode("certification_progress"); - - List regionList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); - - List versionVOList = this.getBaseMapper().getVersionInfo(vdr); List result = new LinkedList<>(); - if (!versionVOList.isEmpty()) { - List oneList = versionVOList.stream().filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList()); - List twoList = versionVOList.stream().filter(e -> StringUtils.isNotBlank(e.getParentId())).collect(Collectors.toList()); + OtaManageReceive omr = otaManageReceiveService.getById(vdr); + //获取到版本号,然后获取所有车型 + String plannedBpLaunchBatch = omr.getPlannedBpLaunchBatch(); + if (StringUtils.isNotEmpty(plannedBpLaunchBatch)) { + List dataList = otaManageReceiveNsdpService.getListByReleaseName(plannedBpLaunchBatch); + //车型 + Set vehicleSet = new HashSet<>(); + for (OtaManageReceiveNsdp omrn : dataList) { + String appliedVehicleProject = omrn.getVehicle(); + if (StringUtils.isNotEmpty(appliedVehicleProject)) { + for (String s : appliedVehicleProject.split(",")) { + String[] split = s.split(" "); + if (split.length == 3) { + vehicleSet.add(split[0] + " " + split[2]); + } + } + } + } - for (VersionVO versionVO : oneList) { - result.add(versionVO); - List collect = twoList.stream().filter(e -> versionVO.getProjectId().equals(e.getParentId())).collect(Collectors.toList()); - Collections.sort(collect, new Comparator() { - @Override - public int compare(VersionVO o1, VersionVO o2) { - return Integer.valueOf(o1.getVersionNumber()).compareTo(Integer.valueOf(o2.getVersionNumber())); + //认证进度数据字典 certification_progress + List regionDictList = sysDictItemServiceImpl.selectItemsByDictCode("certification_progress"); + + List regionList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); + + List versionVOList = this.getBaseMapper().getVersionInfo(vdr); + if (!versionVOList.isEmpty()) { +// List oneList = versionVOList.stream().filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList()); +// List twoList = versionVOList.stream().filter(e -> StringUtils.isNotBlank(e.getParentId())).collect(Collectors.toList()); +// +// for (VersionVO versionVO : oneList) { +// result.add(versionVO); +// List collect = twoList.stream().filter(e -> versionVO.getProjectId().equals(e.getParentId())).collect(Collectors.toList()); +// Collections.sort(collect, new Comparator() { +// @Override +// public int compare(VersionVO o1, VersionVO o2) { +// return Integer.valueOf(o1.getVersionNumber()).compareTo(Integer.valueOf(o2.getVersionNumber())); +// } +// }); +// result.addAll(collect); +// } + for (VersionVO versionVO : versionVOList) { + String market = versionVO.getMarket(); + List list = new LinkedList<>(); + for (String s : market.split(",")) { + List collect = regionList.stream().filter(e -> e.getValue().equals(s)).collect(Collectors.toList()); + if (!collect.isEmpty()) { + list.add(collect.get(0).getTextEn()); + } } - }); - result.addAll(collect); - } - for (VersionVO versionVO : result) { - String market = versionVO.getMarket(); - List list = new LinkedList<>(); - for (String s : market.split(",")) { - List collect = regionList.stream().filter(e -> e.getValue().equals(s)).collect(Collectors.toList()); - if (!collect.isEmpty()) { - list.add(collect.get(0).getTextEn()); + if (!list.isEmpty()) { + market = StringUtils.join(list, ","); } - } - if (!list.isEmpty()) { - market = StringUtils.join(list, ","); - } - if (StringUtils.isBlank(versionVO.getProjectVersion())) { - versionVO.setVersionName(versionVO.getCar() + "-" + market); - } else { - versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getYearName() + "-" + market + "-" + versionVO.getVersionNumber()); - } - //认证进度 - if (StringUtils.isNotBlank(versionVO.getAttestationSchedule())) { - List collect = regionDictList.stream() - .filter(e -> e.getItemValue().equals(versionVO.getAttestationSchedule())).collect(Collectors.toList()); - if (CutEnum.CN.getValue().equals(cut)) { - versionVO.setAttestationSchedule(collect.get(0).getItemText()); + if (StringUtils.isBlank(versionVO.getProjectVersion())) { + versionVO.setVersionName(versionVO.getCar() + "-" + market); } else { - versionVO.setAttestationSchedule(collect.get(0).getEnName()); + versionVO.setVersionName(versionVO.getCar() + "-" + versionVO.getYearName() + "-" + market + "-" + versionVO.getVersionNumber()); } + //认证进度 + if (StringUtils.isNotBlank(versionVO.getAttestationSchedule())) { + List collect = regionDictList.stream() + .filter(e -> e.getItemValue().equals(versionVO.getAttestationSchedule())).collect(Collectors.toList()); + if (CutEnum.CN.getValue().equals(cut)) { + versionVO.setAttestationSchedule(collect.get(0).getItemText()); + } else { + versionVO.setAttestationSchedule(collect.get(0).getEnName()); + } + } + result.add(versionVO); + } + } + for (String vehicleStr : vehicleSet) { + boolean flag = false; + for (VersionVO ver : result) { + if(ver.getVehicleType().equals(vehicleStr)){ + flag = true; + break; + } + } + if(!flag){ + VersionVO versionVO = new VersionVO(); + versionVO.setVersionName(vehicleStr); + versionVO.setVehicleType(vehicleStr); + result.add(versionVO); } } - } - if (result.isEmpty()) { - VersionVO versionVO = new VersionVO(); - versionVO.setVersionName(car); - result.add(versionVO); } return result; } @@ -1231,6 +1405,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl omrList = otaManageReceiveService.getReceiveByplanned(id); List appliedVehicleProjectList = omrList.stream() @@ -1278,62 +1453,91 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl plbList = projectLibraryBaseService.getList(plbSearch); - //存储符合条件的项目中Studio的用户ID - Set matchStudioSet = new HashSet(); - for (ProjectLibraryBase plb : plbList) { - boolean flag = false; - if (appMap.containsKey("All")) { - matchStudioSet.add(plb.getStudioEngineer()); - continue; - } - String targetMarket = plb.getTargetMarket(); - String projectName = plb.getProjectName().toUpperCase(Locale.ROOT); - String[] targetMarkets = targetMarket.split(","); - for (String tm : targetMarkets) { - if ((appMap.containsKey("CN") && tm.equals("China")) - || (appMap.containsKey("EU") && tm.equals("EU")) - || (appMap.containsKey("RHD") && tm.equals("UK"))) { - //三个ALL的市场类型 - matchStudioSet.add(plb.getStudioEngineer()); - continue; - } - if (appMap.containsKey(projectName)) { - Set appSet = appMap.get(projectName); - if (appSet.contains(tm)) { - matchStudioSet.add(plb.getStudioEngineer()); - continue; + + */ + + List dataList = otaManageReceiveNsdpService.getListByReleaseName(id); + //车型 + Set vehicleSet = new HashSet<>(); + for (OtaManageReceiveNsdp omrn : dataList) { + String appliedVehicleProject = omrn.getVehicle(); + if(StringUtils.isNotEmpty(appliedVehicleProject)){ + for (String s : appliedVehicleProject.split(",")) { + String[] split = s.split(" "); + if (split.length == 3) { + String projectName = split[0]; + String market = split[2]; + vehicleSet.add(projectName + " " + market); } } } } + + //查询所有NT2平台的项目 + ProjectLibraryBase plbSearch = new ProjectLibraryBase(); + plbSearch.setDigitalPlatform("NT2"); + List plbList = projectLibraryBaseService.getList(plbSearch); + //存储符合条件的项目中Studio的用户ID,value车型列表 + Map> matchStudioMap = new HashMap<>(); + for (ProjectLibraryBase plb : plbList) { + String projectName = plb.getProjectName(); + if(projectName.equals("FORCE")){ + projectName = "Force"; + } + boolean flag = false; + String targetMarket = plb.getTargetMarket(); + String[] targetMarkets = targetMarket.split(","); + for (String tm : targetMarkets) { + String tmStr = tm.trim(); + if (tm.equals("China")) { + tmStr = "CN"; + } else if (tm.equals("UK")) { + tmStr = "RHD"; + } + String vehicleStr = projectName + " " + tmStr; + if (vehicleSet.contains(vehicleStr)) { + Set vehset = null; + if (matchStudioMap.containsKey(plb.getStudioEngineer())) { + vehset = matchStudioMap.get(plb.getStudioEngineer()); + } else { + vehset = new HashSet<>(); + } + vehset.add(vehicleStr); + matchStudioMap.put(plb.getStudioEngineer(), vehset); + } + } + } + List ompAllList = otaManagePermissionService.list(); List ompList = new ArrayList<>(); - for (String studioId : matchStudioSet) { - OtaManagePermission omp = new OtaManagePermission(); - omp.setApplyId(id); - omp.setUserId(studioId); - ompList.add(omp); + for (String studioId : matchStudioMap.keySet()) { + List filterList = ompAllList.stream().filter(o->o.getApplyId().equals(id)&&o.getUserId().equals(studioId)).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(filterList)){ + OtaManagePermission omp = new OtaManagePermission(); + omp.setApplyId(id); + omp.setUserId(studioId); + omp.setVehicle(matchStudioMap.get(studioId).stream().collect(Collectors.joining(","))); + ompList.add(omp); + } + } + if(CollectionUtils.isNotEmpty(ompList)){ + otaManagePermissionService.saveBatch(ompList); } - otaManagePermissionService.saveBatch(ompList); //给studio发消息 LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); Map params = new HashMap<>(); - List userIdList = new ArrayList<>(matchStudioSet); + List userIdList = new ArrayList<>(matchStudioMap.keySet()); params.put("userIdList", userIdList); params.put("contentCn", "您好,请及时查看处理此项任务,谢谢!-请在PC端查看"); params.put("contentEn", "Hello! Please check and address the task in a timely manner. Thank you!-Check on the PC"); params.put("plannedBpLaunchBatch", id); params.put("viewBtnUrlCnPhone", backUrlPhone); String url = backUrl; - if (omrList.size() > 0) { - url = backUrl + "/components/detil?plannedBpLaunchBatch=" + id + "&releaseDate=" + omrList.get(0).getReleaseDate(); + if (dataList.size() > 0) { + url = backUrl + "/components/detil?plannedBpLaunchBatch=" + id + "&releaseDate=" + dataList.get(0).getReleaseDate(); } params.put("viewBtnUrlCn", url); params.put("viewBtnUrlEn", url); - params.put("appliedVehicleProject", appMap.keySet().stream().collect(Collectors.joining(","))); + params.put("appliedVehicleProject", vehicleSet.stream().collect(Collectors.joining(","))); params.put("Initiator", " " + currentUser.getUsername()); params.put("initiatorStrCn", "发起人"); params.put("initiatorStrEn", "Initiator"); @@ -1832,7 +2036,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl> getStatisticalStatus(String projectId, String plannedBpLaunchBatch, String cut, List plbEoList) { List> result = new ArrayList<>(); List projectLibraryBaseList = new ArrayList<>(); - if (!plbEoList.isEmpty()) { + if (ObjectUtils.isNotEmpty(plbEoList)) { projectLibraryBaseList = plbEoList.stream().filter(e -> e.getId().equals(projectId)).collect(Collectors.toList()); } List receiveList = this.getBaseMapper().getListByProjectId(projectId, plannedBpLaunchBatch); @@ -1954,7 +2158,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl pageList = getOtaPage(otaManageApplyEO); + List pageList = getNsdpList(otaManageApplyEO); List exportList = null; // 过滤选中数据 @@ -2081,4 +2285,143 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl getListByVdrList(List vdrList) { + if(CollectionUtils.isEmpty(vdrList)){ + return new ArrayList<>(); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(OtaManageApplyEO::getVdr, vdrList); + List resList = this.list(queryWrapper); + return resList; + } + + @Override + public List getOtaTodoList(OtaManageReceiveNsdp otaManageReceiveNsdp) { + List resList = new ArrayList<>(); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + //查询所有此人权限 + List ompList = otaManagePermissionService.queryByUserId(userId); + //筛选版本号ID + List plannedList = ompList.stream().map(OtaManagePermission::getApplyId).distinct().collect(Collectors.toList()); + //查询所有VDR + List omrList = otaManageReceiveService.getReceiveByplannedList(plannedList); + + List vdrList = omrList.stream().map(OtaManageReceive::getId).distinct().collect(Collectors.toList()); + + List omaList = this.getListByVdrList(vdrList); + + for (OtaManagePermission omp : ompList) { + if (StringUtils.isNotEmpty(otaManageReceiveNsdp.getReleaseName()) && !omp.getApplyId().contains(otaManageReceiveNsdp.getReleaseName())) { + continue; + } + String vehicleStr = omp.getVehicle(); + String[] vehicleList = vehicleStr.split(","); + for (String vehicle : vehicleList) { + if (StringUtils.isNotEmpty(otaManageReceiveNsdp.getVehicle()) && !vehicle.contains(otaManageReceiveNsdp.getVehicle())) { + continue; + } + List omrVehicleList = omrList.stream() + .filter(obj -> StringUtils.isNotEmpty(obj.getPlannedBpLaunchBatch()) && obj.getPlannedBpLaunchBatch().equals(omp.getApplyId()) + && StringUtils.isNotEmpty(obj.getVehicleMatch()) && obj.getVehicleMatch().contains(vehicle)) + .collect(Collectors.toList()); + + for (OtaManageReceive mrVehicle : omrVehicleList) { + if (StringUtils.isNotEmpty(otaManageReceiveNsdp.getReleaseType()) && !otaManageReceiveNsdp.getReleaseType().equals(mrVehicle.getReleaseType())) { + continue; + } + if (!OtaHomoImpactEnum.YES.getValue().equals(mrVehicle.getHomologationImpact()) + && !OtaHomoImpactEnum.INTER_VALID.getValue().equals(mrVehicle.getHomologationImpact())) { + List applyList = omaList.stream() + .filter(obj -> StringUtils.isNotEmpty(obj.getVdr()) && obj.getVdr().equals(mrVehicle.getId()) + && StringUtils.isNotEmpty(obj.getVehicleType()) && obj.getVehicleType().equals(vehicle)) + .collect(Collectors.toList()); + if (CollectionUtils.isEmpty(applyList) || OtaStatusEnum.TO_BE_MATCHED.getKey().equals(applyList.get(0).getMatchStatus())) { + OtaManageReceiveNsdp omrn = new OtaManageReceiveNsdp(); + omrn.setId(UUID.randomUUID().toString().replace("-", "")); + omrn.setReleaseName(omp.getApplyId()); + omrn.setReleaseType(mrVehicle.getReleaseType()); + omrn.setVehicle(vehicle); + omrn.setReleaseDate(mrVehicle.getReleaseDate()); + resList.add(omrn); + break; + } + } + } + } + } + if (!resList.isEmpty()) { + //表头排序 + headSort(otaManageReceiveNsdp,resList); + } + return resList; + } + private void headSort(OtaManageReceiveNsdp otaManageReceiveNsdp, List resList) { + Collator comparator = Collator.getInstance(Locale.CHINESE); + // 软件版本, + if ("releaseName".equals(otaManageReceiveNsdp.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageReceiveNsdp.getOrderBy())) { + Collections.sort(resList, (e1, e2) -> { + String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseName()) ? e1.getReleaseName() : ""; + String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseName()) ? e2.getReleaseName() : ""; + return comparator.compare(e1ReleaseName, e2ReleaseName); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageReceiveNsdp.getOrderBy())) { + Collections.sort(resList, (e1, e2) -> { + String e1ReleaseName = StringUtils.isNotBlank(e1.getReleaseName()) ? e1.getReleaseName() : ""; + String e2ReleaseName = StringUtils.isNotBlank(e2.getReleaseName()) ? e2.getReleaseName() : ""; + return comparator.compare(e2ReleaseName, e1ReleaseName); + }); + } + } + // 发布类型 + if ("releaseType".equals(otaManageReceiveNsdp.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageReceiveNsdp.getOrderBy())) { + Collections.sort(resList, (e1, e2) -> { + String e1ReleaseType = StringUtils.isNotBlank(e1.getReleaseType()) ? e1.getReleaseType() : ""; + String e2ReleaseType = StringUtils.isNotBlank(e2.getReleaseType()) ? e2.getReleaseType() : ""; + return comparator.compare(e1ReleaseType, e2ReleaseType); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageReceiveNsdp.getOrderBy())) { + Collections.sort(resList, (e1, e2) -> { + String e1ReleaseType = StringUtils.isNotBlank(e1.getReleaseType()) ? e1.getReleaseType() : ""; + String e2ReleaseType = StringUtils.isNotBlank(e2.getReleaseType()) ? e2.getReleaseType() : ""; + return comparator.compare(e2ReleaseType, e1ReleaseType); + }); + } + } + // 适用车型, + if ("vehicle".equals(otaManageReceiveNsdp.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageReceiveNsdp.getOrderBy())) { + Collections.sort(resList, (e1, e2) -> { + String e1Vehicle= StringUtils.isNotBlank(e1.getVehicle()) ? e1.getVehicle() : ""; + String e2Vehicle= StringUtils.isNotBlank(e2.getVehicle()) ? e2.getVehicle() : ""; + return comparator.compare(e1Vehicle, e2Vehicle); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageReceiveNsdp.getOrderBy())) { + Collections.sort(resList, (e1, e2) -> { + String e1Vehicle= StringUtils.isNotBlank(e1.getVehicle()) ? e1.getVehicle() : ""; + String e2Vehicle= StringUtils.isNotBlank(e2.getVehicle()) ? e2.getVehicle() : ""; + return comparator.compare(e2Vehicle, e1Vehicle); + }); + } + } + // 软件发布时间, + if ("releaseDate".equals(otaManageReceiveNsdp.getOrderByField())) { + if (OrderEnum.POSITIVE.getValue().equals(otaManageReceiveNsdp.getOrderBy())) { + Collections.sort(resList, (e1, e2) -> { + String e1ReleaseDate = StringUtils.isNotBlank(e1.getReleaseDate()) ? e1.getReleaseDate() : ""; + String e2ReleaseDate = StringUtils.isNotBlank(e2.getReleaseDate()) ? e2.getReleaseDate() : ""; + return comparator.compare(e1ReleaseDate, e2ReleaseDate); + }); + } else if (OrderEnum.REVERSE.getValue().equals(otaManageReceiveNsdp.getOrderBy())) { + Collections.sort(resList, (e1, e2) -> { + String e1ReleaseDate = StringUtils.isNotBlank(e1.getReleaseDate()) ? e1.getReleaseDate() : ""; + String e2ReleaseDate = StringUtils.isNotBlank(e2.getReleaseDate()) ? e2.getReleaseDate() : ""; + return comparator.compare(e2ReleaseDate, e1ReleaseDate); + }); + } + } + + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageReceiveNsdpServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageReceiveNsdpServiceImpl.java index 14a33cf93..118c9cb12 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageReceiveNsdpServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageReceiveNsdpServiceImpl.java @@ -1,5 +1,6 @@ package com.jero.modules.ota.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.jero.modules.ota.entity.OtaManageReceiveNsdp; import com.jero.modules.ota.mapper.OtaManageReceiveNsdpMapper; import com.jero.modules.ota.service.IOtaManageReceiveNsdpService; @@ -91,4 +92,12 @@ public class OtaManageReceiveNsdpServiceImpl extends ServiceImpl getOtaManageReceiveNsdpSync() { return this.getBaseMapper().getOtaManageReceiveNsdpSync(); } + + + @Override + public List getListByReleaseName(String releaseName) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(OtaManageReceiveNsdp::getReleaseName, releaseName); + return this.list(queryWrapper); + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageReceiveServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageReceiveServiceImpl.java index 8292a10d1..01167b407 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageReceiveServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageReceiveServiceImpl.java @@ -4,9 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.jero.modules.ota.entity.OtaManageReceive; import com.jero.modules.ota.mapper.OtaManageReceiveMapper; import com.jero.modules.ota.service.IOtaManageReceiveService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; + +import java.util.ArrayList; import java.util.List; import java.util.Date; +import java.util.Map; +import java.util.stream.Collectors; + import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** @@ -100,6 +106,17 @@ public class OtaManageReceiveServiceImpl extends ServiceImpl getReceiveByplannedList(List plannedBpLaunchBatchList) { + if(CollectionUtils.isEmpty(plannedBpLaunchBatchList)){ + return new ArrayList<>(); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(OtaManageReceive::getPlannedBpLaunchBatch, plannedBpLaunchBatchList); + List resList = this.list(queryWrapper); + return resList; + } + @Override public List getReceiveSync() { return this.getBaseMapper().getReceiveSync(); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/vo/VersionVO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/vo/VersionVO.java index e8bf7f9bc..b53a538ad 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/vo/VersionVO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/vo/VersionVO.java @@ -62,6 +62,9 @@ public class VersionVO { private String versionName; @ApiModelProperty(value = "项目版本-id") - private java.lang.String projectVersion; + private String projectVersion; + + @ApiModelProperty(value = "适用车型") + private String vehicleType; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformProjectCertificationInventoryEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformProjectCertificationInventoryEOController.java new file mode 100644 index 000000000..624af347b --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformProjectCertificationInventoryEOController.java @@ -0,0 +1,376 @@ +package com.jero.modules.platform.controller; + +import com.alibaba.fastjson.JSONObject; +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.api.vo.Result; +import com.jero.common.aspect.annotation.AutoLog; +import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.query.QueryGenerator; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; +import com.jero.modules.platform.service.IPlatformProjectCertificationInventoryEOService; +import com.jero.modules.system.entity.SysRole; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + + +/** +* @Description: 项目库-认证清单表 +* @Author: jero-boot +* @Date: 2023-03-03 +* @Version: V1.0 +*/ +@Api(tags="平台件项目库-认证清单表") +@RestController +@RequestMapping("/platform/projectCertificationInventoryEO") +@Slf4j +public class PlatformProjectCertificationInventoryEOController extends JeroController { + @Autowired + private IPlatformProjectCertificationInventoryEOService platformProjectCertificationInventoryEOService; + + /** + * 分页列表查询 + * + * @param projectCertificationInventoryEO + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "项目库-认证清单表-分页列表查询") + @ApiOperation(value="项目库-认证清单表-分页列表查询", notes="项目库-认证清单表-分页列表查询") + @GetMapping(value = "/page") + public Result queryPageList(ProjectCertificationInventoryEO projectCertificationInventoryEO, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + @RequestParam(name="cut", defaultValue="cn") String cut, + HttpServletRequest req) { + String flowStatusStr = ""; + if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getFlowStatus())) { + flowStatusStr = projectCertificationInventoryEO.getFlowStatus(); + projectCertificationInventoryEO.setFlowStatus(null); + } + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(projectCertificationInventoryEO, req.getParameterMap()); + if (StringUtils.isNotEmpty(flowStatusStr)) { + String finalflowStatusStr = flowStatusStr.replaceAll("\\*",""); + queryWrapper.and(query -> { + query.lambda().like(ProjectCertificationInventoryEO::getFlowStatus, finalflowStatusStr); + if(StringUtils.contains(finalflowStatusStr,",")){ + String[] flowStatusArr = finalflowStatusStr.split(","); + for (String fs : flowStatusArr) { + query.or(q -> { + q.like("flow_status",fs); + }); + } + } + }); + } + queryWrapper.orderByDesc("create_time"); + Page page = new Page(pageNo, pageSize); + IPage pageList = this.platformProjectCertificationInventoryEOService.queryPage(queryWrapper,page,projectCertificationInventoryEO,cut); + return Result.OK(cut,pageList); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "项目库-认证清单表-列表查询") + @ApiOperation(value="项目库-认证清单表-列表查询", notes="项目库-认证清单表-列表查询") + @GetMapping(value = "/list") + public Result> queryList() { + List list = platformProjectCertificationInventoryEOService.queryList(); + return Result.OK(list); + } + + /** + * 添加 + * + * @param projectCertificationInventoryEO + * @return + */ + @AutoLog(value = "项目库-认证清单表-添加") + @ApiOperation(value="项目库-认证清单表-添加", notes="项目库-认证清单表-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody ProjectCertificationInventoryEO projectCertificationInventoryEO) { + platformProjectCertificationInventoryEOService.add(projectCertificationInventoryEO); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param projectCertificationInventoryEO + * @return + */ + @AutoLog(value = "项目库-认证清单表-编辑") + @ApiOperation(value="项目库-认证清单表-编辑", notes="项目库-认证清单表-编辑") + @PutMapping(value = "/edit") + public Result edit(@Validated @RequestBody ProjectCertificationInventoryEO projectCertificationInventoryEO) { + platformProjectCertificationInventoryEOService.editById(projectCertificationInventoryEO); + 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) { + platformProjectCertificationInventoryEOService.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.platformProjectCertificationInventoryEOService.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) { + ProjectCertificationInventoryEO projectCertificationInventoryEO = platformProjectCertificationInventoryEOService.queryById(id); + if(projectCertificationInventoryEO==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(projectCertificationInventoryEO); + } + + /** + * 导出excel + * + * @param request + * @param projectCertificationInventoryEO + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ProjectCertificationInventoryEO projectCertificationInventoryEO) { + return super.exportXls(request, projectCertificationInventoryEO, ProjectCertificationInventoryEO.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, ProjectCertificationInventoryEO.class); + } + + @AutoLog(value = "项目库-认证清单表-批量添加") + @ApiOperation(value="项目库-认证清单表-批量添加", notes="项目库-认证清单表-批量添加") + @PostMapping(value = "/batchAdd") + public Result batchAdd(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.batchAdd(json); + } + + @AutoLog(value = "项目库-认证清单表-批量设置") + @ApiOperation(value="项目库-认证清单表-批量设置", notes="项目库-认证清单表-批量设置") + @PostMapping(value = "/setBatch") + public Result setBatch(@RequestBody ProjectCertificationInventoryEO projectCertificationInventoryEO) { + return this.platformProjectCertificationInventoryEOService.setBatch(projectCertificationInventoryEO); + } + + @AutoLog(value = "项目库-认证清单表-studio发布") + @ApiOperation(value="项目库-认证清单表-studio发布", notes="项目库-认证清单表-studio发布") + @PostMapping(value = "/issue") + public Result issue(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.issue(json); + } + + @AutoLog(value = "项目库-认证清单表-当前登录用户角色") + @ApiOperation(value="项目库-认证清单表-当前登录用户角色", notes="项目库-认证清单表-当前登录用户角色") + @GetMapping(value = "/getRoleByUserId") + public Result> getRoleByUserId(@RequestParam Map params) { + return this.platformProjectCertificationInventoryEOService.getRoleByUserId(params); + } + + @AutoLog(value = "项目库-认证清单表-获取流程状态列表") + @ApiOperation(value="项目库-认证清单表-获取流程状态列表", notes="项目库-认证清单表-获取流程状态列表") + @GetMapping(value = "/getFlowStatusList") + public Result getFlowStatusList(@RequestParam("cut") String cut) { + return this.platformProjectCertificationInventoryEOService.getFlowStatusList(cut); + } + + @AutoLog(value = "项目库-认证清单表-认证流程统一提交任务接口") + @ApiOperation(value="项目库-认证清单表-认证流程统一提交任务接口", notes="项目库-认证清单表-认证流程统一提交任务接口") + @PostMapping(value = "/submitTask") + public Result submitTask(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.submitTask(json); + } + + @AutoLog(value = "项目库-认证清单表-批量保存") + @ApiOperation(value="项目库-认证清单表-批量保存", notes="项目库-认证清单表-批量保存") + @PostMapping(value = "/saveBatch") + public Result saveBatch(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.saveBatch(json); + } + + @AutoLog(value = "项目库-认证清单表-流程重置") + @ApiOperation(value="项目库-认证清单表-流程重置", notes="项目库-认证清单表-流程重置") + @PostMapping(value = "/resetFlow") + public Result resetFlow(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.resetFlow(json); + } + + @AutoLog(value = "项目库-认证清单表-转办") + @ApiOperation(value="项目库-认证清单表-转办", notes="项目库-认证清单表-转办") + @PostMapping(value = "/transferTask") + public Result transferTask(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.transferTask(json); + } + + @AutoLog(value = "项目库-认证清单表-催办") + @ApiOperation(value="项目库-认证清单表-催办", notes="项目库-认证清单表-催办") + @PostMapping(value = "/expediting") + public Result expediting(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.expediting(json); + } + + @AutoLog(value = "项目库-认证清单表-批量修改配置项") + @ApiOperation(value="项目库-认证清单表-批量修改配置项", notes="项目库-认证清单表-批量修改配置项") + @PostMapping(value = "/updateConfigItemBatch") + public Result updateConfigItemBatch(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.updateConfigItemBatch(json); + } + + @ApiOperation(value="项目库-认证清单表-模板下载", notes="项目库-认证清单表-模板下载") + @GetMapping(value = "/exportTemplate") + public void exportTemplate(ProjectCertificationInventoryEO projectCertificationInventoryEO, HttpServletResponse response, HttpServletRequest request) throws Exception { + platformProjectCertificationInventoryEOService.exportTemplate(projectCertificationInventoryEO,response,request); + } + + /** + * 导入数据 + * + * @param file + * @param projectCertificationInventoryEO + * @return + */ + @ApiOperation(value="项目库-认证清单表-导入数据", notes="项目库-认证清单表-导入数据") + @RequestMapping(value = "/importData", method = RequestMethod.POST) + public Result importData(@RequestParam(value = "file", required = false) MultipartFile file, + ProjectCertificationInventoryEO projectCertificationInventoryEO) { + platformProjectCertificationInventoryEOService.importData(file,projectCertificationInventoryEO); + return Result.OK("导入成功"); + } + /** + * 导出数据 + * @param request + * @param projectCertificationInventoryEO + */ + @ApiOperation(value="项目库-认证清单表-导出数据", notes="项目库-认证清单表-导出数据") + @RequestMapping(value = "/exportData",method = RequestMethod.GET) +// @RequiresPermissions("projectLawsInventory:exportData") + public void exportData(HttpServletResponse response, + HttpServletRequest request, + ProjectCertificationInventoryEO projectCertificationInventoryEO) { + platformProjectCertificationInventoryEOService.exportData(response,request, projectCertificationInventoryEO); + } + + @AutoLog(value = "项目库-认证清单表-调取添加") + @ApiOperation(value="项目库-认证清单表-调取添加", notes="项目库-认证清单表-调取添加") + @PostMapping(value = "/callAdd") + public Result callAdd(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.callAdd(json); + } + + @AutoLog(value = "项目库-认证清单表-引用交付物") + @ApiOperation(value="项目库-认证清单表-引用交付物", notes="项目库-认证清单表-引用交付物") + @PostMapping(value = "/citeDeliverable") + public Result citeDeliverable(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.citeDeliverable(json); + } + + /** + * 批量更新法规清单状态 + * @param json + * @return + */ + @AutoLog(value = "项目库-认证清单表-批量更新流程状态") + @ApiOperation(value="项目库-认证清单表-批量更新流程状态", notes="项目库-认证清单表-批量更新流程状态") + @PostMapping(value = "/updateStatusBatch") + public Result updateStatusBatch(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.updateStatusBatch(json); + } + + /** + * 添加配置 等同于 复制 + * @param json + * @return + */ + @AutoLog(value = "项目库-认证清单表-添加配置") + @ApiOperation(value="项目库-认证清单表-添加配置", notes="项目库-认证清单表-添加配置") + @PostMapping(value = "/addConfigByIds") + public Result addConfigByIds(@RequestBody JSONObject json) { + return this.platformProjectCertificationInventoryEOService.addConfigByIds(json); + } + + /** + * 获取责任人和接口人 + * @return + */ + @AutoLog(value = "项目库-认证清单表-获取责任人和接口人") + @ApiOperation(value="项目库-认证清单表-获取责任人和接口人", notes="项目库-认证清单表-获取责任人和接口人") + @GetMapping(value = "/queryDutyPersonByProjectId") + public Result queryDutyPersonByProjectId(@RequestParam Map params) { + return Result.OK(this.platformProjectCertificationInventoryEOService.queryDutyPersonByProjectId(params)); + } + + /** + * 匹配相关人员 + * @param params + * @return + */ + @AutoLog(value = "项目库-认证清单表-匹配相关人员") + @ApiOperation(value="项目库-认证清单表-匹配相关人员", notes="项目库-法规清单表-匹配相关人员") + @PostMapping(value = "/matchRelevantPeople") + public Result matchRelevantPeople(@RequestBody Map params){ + return this.platformProjectCertificationInventoryEOService.matchRelevantPeople(params); + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformProjectLawsInventoryEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformProjectLawsInventoryEOController.java new file mode 100644 index 000000000..1b4ce37e9 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformProjectLawsInventoryEOController.java @@ -0,0 +1,576 @@ +package com.jero.modules.platform.controller; + +import com.alibaba.fastjson.JSONObject; +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.itextpdf.text.DocumentException; +import com.jero.common.api.vo.Result; +import com.jero.common.aspect.annotation.AutoLog; +import com.jero.common.constant.enums.CutEnum; +import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.query.QueryGenerator; +import com.jero.common.util.PageUtil; +import com.jero.modules.document.entity.BussDocumentLibraryEO; +import com.jero.modules.document.service.IBussDocumentLibraryEOService; +import com.jero.modules.dummy.entity.DummyInventoryBaseEO; +import com.jero.modules.dummy.service.IDummyInventoryBaseEOService; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import com.jero.modules.project.service.IProjectLawsInventoryEOService; +import com.jero.modules.project.vo.ProjectTaskUrgVo; +import com.jero.modules.platform.service.IPlatformProjectLawsInventoryEOService; +import com.jero.modules.system.entity.SysRole; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + + +/** + * @Description: 项目库-法规清单表 + * @Author: jero-boot + * @Date: 2022-04-14 + * @Version: V1.0 + */ +@Api(tags="平台件项目库-法规清单表") +@RestController +@RequestMapping("/platform/projectLawsInventoryEO") +@Slf4j +public class PlatformProjectLawsInventoryEOController extends JeroController { + @Autowired + private IPlatformProjectLawsInventoryEOService platformProjectLawsInventoryEOService; + @Autowired + private IBussDocumentLibraryEOService bussDocumentLibraryEOService; + @Autowired + private IDummyInventoryBaseEOService dummyInventoryBaseEOService; + + /** + * 分页列表查询 + * + * @param projectLawsInventoryEO + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "项目库-法规清单表-分页列表查询") + @ApiOperation(value="项目库-法规清单表-分页列表查询", notes="项目库-法规清单表-分页列表查询") + @GetMapping(value = "/page") + public Result queryPageList(ProjectLawsInventoryEO projectLawsInventoryEO, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + IPage pageList = this.platformProjectLawsInventoryEOService.queryPage(projectLawsInventoryEO,pageNo,pageSize,req); + return Result.OK(pageList); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "项目库-法规清单表-列表查询") + @ApiOperation(value="项目库-法规清单表-列表查询", notes="项目库-法规清单表-列表查询") + @GetMapping(value = "/list") + @RequiresPermissions("projectLawsInventory:list") + public Result> queryList(ProjectLawsInventoryEO projectLawsInventoryEO,HttpServletRequest req) { + List list = platformProjectLawsInventoryEOService.queryList(projectLawsInventoryEO,req); + return Result.OK(projectLawsInventoryEO.getCut(),list); + } + + /** + * 添加 + * + * @param projectLawsInventoryEO + * @return + */ + @AutoLog(value = "项目库-法规清单表-添加") + @ApiOperation(value="项目库-法规清单表-添加", notes="项目库-法规清单表-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody ProjectLawsInventoryEO projectLawsInventoryEO) { + platformProjectLawsInventoryEOService.add(projectLawsInventoryEO); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param projectLawsInventoryEO + * @return + */ + @AutoLog(value = "项目库-法规清单表-编辑") + @ApiOperation(value="项目库-法规清单表-编辑", notes="项目库-法规清单表-编辑") + @PutMapping(value = "/edit") + public Result edit(@Validated @RequestBody ProjectLawsInventoryEO projectLawsInventoryEO) { + platformProjectLawsInventoryEOService.editById(projectLawsInventoryEO); + 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, + @RequestParam(name="projectLibraryId",required=true) String projectLibraryId, + @RequestParam(name="cut",required=true) String cut) { + platformProjectLawsInventoryEOService.deleteById(id,projectLibraryId,cut); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "项目库-法规清单表-批量删除") + @ApiOperation(value="项目库-法规清单表-批量删除", notes="项目库-法规清单表-批量删除") + @PostMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestBody JSONObject json) { + String ids = json.getString("ids"); + String projectLibraryId = json.getString("projectLibraryId"); + String cut = json.getString("cut"); + this.platformProjectLawsInventoryEOService.deleteByIds(Arrays.asList(ids.split(",")),projectLibraryId,cut); + 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) { + ProjectLawsInventoryEO projectLawsInventoryEO = platformProjectLawsInventoryEOService.queryById(id); + if(projectLawsInventoryEO==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(projectLawsInventoryEO); + } + + /** + * 导出excel + * + * @param request + * @param projectLawsInventoryEO + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ProjectLawsInventoryEO projectLawsInventoryEO) { + return super.exportXls(request, projectLawsInventoryEO, ProjectLawsInventoryEO.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, ProjectLawsInventoryEO.class); + } + + /** + * 批量更新法规清单状态 + * @param json + * @return + */ + @AutoLog(value = "项目库-法规清单表-批量更新状态") + @ApiOperation(value="项目库-法规清单表-批量更新状态", notes="项目库-法规清单表-批量更新状态") + @PostMapping(value = "/updateStatusBatch") + public Result updateStatusBatch(@RequestBody JSONObject json) { + return this.platformProjectLawsInventoryEOService.updateStatusBatch(json); + } + + /** + * 匹配相关人员 + * @param params + * @return + */ + @AutoLog(value = "项目库-法规清单表-匹配相关人员") + @ApiOperation(value="项目库-法规清单表-匹配相关人员", notes="项目库-法规清单表-匹配相关人员") + @PostMapping(value = "/matchRelevantPeople") + public Result matchRelevantPeople(@RequestBody Map params){ + return this.platformProjectLawsInventoryEOService.matchRelevantPeople(params); + } + + /** + * 流程调用接口 + * @param jsonObject + * @return + */ + @AutoLog(value = "项目库-法规清单表-流程调用") + @ApiOperation(value="项目库-法规清单表-流程调用", notes="项目库-法规清单表-流程调用") + @PostMapping(value = "/processCall") + public Result processCall(@RequestBody JSONObject jsonObject){ + return this.platformProjectLawsInventoryEOService.processCall(jsonObject); + } + + /** + * 通过id查询 + * @param params + * @return + */ + @AutoLog(value = "项目库-法规清单表-通过id与操作类型查询") + @ApiOperation(value="项目库-法规清单表-通过id与操作类型查询", notes="项目库-法规清单表-通过id与操作类型查询") + @GetMapping(value = "/queryProjectLawsInventoryInfoById") + public Result queryProjectLawsInventoryInfoById(@RequestParam Map params) { + List result = platformProjectLawsInventoryEOService.queryProjectLawsInventoryInfoById(params); + return Result.OK((String) params.get("cut"),result); + } + + @AutoLog(value = "法规清单添加调用文档库数据--分页") + @ApiOperation(value="法规清单添加调用文档库数据--分页", notes="法规清单添加调用文档库数据--分页") + @PostMapping(value = "/queryPageInfoBussDocument") + public Result queryPageInfo(@RequestBody BussDocumentLibraryEO bussDocumentLibraryEO, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bussDocumentLibraryEO, req.getParameterMap()); + Page page = new Page(bussDocumentLibraryEO.getPageNo(), bussDocumentLibraryEO.getPageSize()); + IPage pageList = bussDocumentLibraryEOService.queryPageInfoDummy(page, queryWrapper,bussDocumentLibraryEO); + return Result.OK(pageList); + } + + /** + * 复制 + * + * @param ids + * @return + */ + @AutoLog(value = "复制") + @ApiOperation(value="复制", notes="复制") + @GetMapping(value = "/copyInfoByIds") + public Result copyInfoByIds(@RequestParam(name="ids",required=true) String ids, + @RequestParam(name="cut",required=true) String cut, + @RequestParam(name="operateType",required=true) String operateType) { + try { + platformProjectLawsInventoryEOService.copyInfoByIds(ids,operateType); + } catch (Exception e) { + if(CutEnum.CN.getValue().equals(cut)){ + return Result.error("复制失败"); + }else{ + return Result.error("Copy the failure"); + } + } + if(CutEnum.CN.getValue().equals(cut)){ + return Result.OK("复制成功"); + }else{ + return Result.OK("Copy success"); + } + } + + + /** + * 批量设置 + * + * @param projectLawsInventoryEO + * @return + */ + @AutoLog(value = "批量设置") + @ApiOperation(value="批量设置", notes="批量设置") + @PostMapping(value = "/setBatch") + public Result setBatch(@RequestBody ProjectLawsInventoryEO projectLawsInventoryEO) { + String cut = projectLawsInventoryEO.getCut(); + try { + platformProjectLawsInventoryEOService.setBatch(projectLawsInventoryEO); + } catch (Exception e) { + e.printStackTrace(); + log.error("批量设置失败:" + e.getMessage()); + if(CutEnum.CN.getValue().equals(cut)){ + return Result.error("批量设置失败!"); + }else{ + return Result.error("Batch set success"); + } + } + if(CutEnum.CN.getValue().equals(cut)){ + return Result.OK("批量设置成功"); + }else{ + return Result.OK("Batch set success"); + } + } + + /** + * 调取虚拟清单数据 + * + * @param dummyInventoryBaseEO + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "调取虚拟清单数据") + @ApiOperation(value="调取虚拟清单数据", notes="调取虚拟清单数据") + @PostMapping(value = "/getPageInfoDummy") + public Result getPageInfoDummy(@RequestBody DummyInventoryBaseEO dummyInventoryBaseEO, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { +// dummyInventoryBaseEO.setName("*发*"); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(dummyInventoryBaseEO, req.getParameterMap()); + queryWrapper.orderByDesc("create_time"); + Page page = new Page(pageNo, pageSize); + IPage pageList = dummyInventoryBaseEOService.getPageInfoDummy(page,queryWrapper); + return Result.OK(dummyInventoryBaseEO.getCut(),pageList); + } + + + @ApiOperation(value = "模板下载") + @GetMapping(value = "/exportTemplate") + public void exportTemplate(ProjectLawsInventoryEO projectLawsInventoryEO, HttpServletResponse response, HttpServletRequest request) throws Exception { + platformProjectLawsInventoryEOService.exportTemplate(projectLawsInventoryEO,response,request); + } + + /** + * 导出数据 + * @param request + * @param projectLawsInventoryEO + */ + @RequestMapping(value = "/exportData") + @RequiresPermissions("projectLawsInventory:exportData") + public void exportData(HttpServletResponse response, + HttpServletRequest request, + ProjectLawsInventoryEO projectLawsInventoryEO) { + platformProjectLawsInventoryEOService.exportData(response,request, projectLawsInventoryEO); + } + + /** + * 导入数据 + * + * @param file + * @param projectLawsInventoryEO + * @return + */ + @RequestMapping(value = "/importData", method = RequestMethod.POST) + public Result importData(@RequestParam(value = "file", required = false) MultipartFile file, + ProjectLawsInventoryEO projectLawsInventoryEO) { + platformProjectLawsInventoryEOService.importData(file,projectLawsInventoryEO); + return Result.OK("导入成功"); + } + + + @AutoLog(value = "变更") + @ApiOperation(value="变更", notes="变更") + @PostMapping(value = "/change") + public Result change(@RequestBody JSONObject params) { + return this.platformProjectLawsInventoryEOService.change(params); + } + + @AutoLog(value = "下载pdf报告") + @ApiOperation(value="下载pdf报告", notes="下载pdf报告") + @GetMapping(value = "/downloadReport") + public void downloadReport(@RequestParam Map params, HttpServletRequest req, HttpServletResponse resp) throws DocumentException { + this.platformProjectLawsInventoryEOService.downloadReport(params,req,resp); + } + + /** + * 列表查询条件 标识传 1-->用于查询文档库字段属 + * 法规清单添加调取文档库时高级搜索条件 + * @param flag + * @return + */ + @AutoLog(value = "法规清单添加调取文档库时高级搜索条件") + @ApiOperation(value="法规清单添加调取文档库时高级搜索条件", notes="法规清单添加调取文档库时高级搜索条件") + @GetMapping(value = "/queryConditionInventory") + public Result>> queryConditionInventory(@RequestParam(name="flag",required=true) String flag, + @RequestParam(name="cut",required=true) String cut) { + List> list = bussDocumentLibraryEOService.queryConditionInventory(flag,cut); + return Result.OK(list); + } + + + @ApiOperation(value="法规清单中添加调用文档库数据--分页", notes="法规清单中添加调用文档库数据--分页") + @PostMapping(value = "/queryPageDummy") + @ResponseBody + public net.sf.json.JSONObject queryPageDummy(@RequestBody Map parameter) { + IPage infoPage = bussDocumentLibraryEOService.getPageDummy(parameter); + Result ok = Result.OK(infoPage); + net.sf.json.JSONObject jsonResult = net.sf.json.JSONObject.fromObject(ok); + return jsonResult; + } + + /** + * + * @param params + * cut:中英文标识 + * id:法规清单id + * @param req + * @param resp + * @throws DocumentException + */ + @AutoLog(value = "下载docx报告") + @ApiOperation(value="下载docx报告", notes="下载docx报告") + @GetMapping(value = "/downloadDocxReport") + public void downloadDocxReport(@RequestParam Map params, HttpServletRequest req, HttpServletResponse resp) throws DocumentException { + this.platformProjectLawsInventoryEOService.downloadDocxReport(params,req,resp); + } + + @AutoLog(value = "催办") + @ApiOperation(value="催办", notes="催办") + @PostMapping(value = "/expediting") + public Result expediting(@RequestBody JSONObject json) { + return this.platformProjectLawsInventoryEOService.expediting(json); + } + + /** + * 当前登录用户角色 + * @return + */ + @ApiOperation(value = "当前登录用户角色") + @RequestMapping(value = "/getRoleByUserId", method = RequestMethod.GET) + public Result> getRoleByUserId(String projectLibraryId,String cut) { + Result> result = new Result<>(); + List list = platformProjectLawsInventoryEOService.getRoleByUserId(projectLibraryId,cut); + if(list==null||list.size()<=0) { + result.error500("未找到角色信息"); + }else { + result.setResult(list); + result.setSuccess(true); + } + return result; + } + + + @AutoLog(value = "任务清单催办") + @ApiOperation(value="任务清单催办", notes="任务清单催办") + @PostMapping(value = "/taskUrg") + public Result taskUrg(@RequestBody ProjectTaskUrgVo projectTaskUrgVo) { + return this.platformProjectLawsInventoryEOService.taskUrg(projectTaskUrgVo); + } + + + @AutoLog(value = "项目库-法规清单表-根据项目库id更新符合性流程发起人、责任人接口") + @ApiOperation(value="项目库-法规清单表-根据项目库id更新符合性流程发起人、责任人接口", notes="项目库-法规清单表-根据项目库id更新符合性流程发起人、责任人接口") + @GetMapping(value = "/updateFlowInfoByProjectLibraryIds") + public Result updateFlowInfoByProjectLibraryIds(@RequestParam("projectLibraryIds") String projectLibraryIds){ + return this.platformProjectLawsInventoryEOService.updateFlowInfoByProjectLibraryIds(projectLibraryIds); + } + + @AutoLog(value = "项目库-法规清单表-studio发布") + @ApiOperation(value="项目库-法规清单表-studio发布", notes="项目库-法规清单表-studio发布") + @PostMapping(value = "/studioPublish") + public Result studioPublish(@RequestBody JSONObject json) { + return this.platformProjectLawsInventoryEOService.studioPublish(json); + } + + @AutoLog(value = "项目库-法规清单表-studio撤回") + @ApiOperation(value="项目库-法规清单表-studio撤回", notes="项目库-法规清单表-studio撤回") + @PostMapping(value = "/studioWithdrew") + public Result studioWithdrew(@RequestBody JSONObject json) { + return this.platformProjectLawsInventoryEOService.studioWithdrew(json); + } + + @AutoLog(value = "项目库-法规清单表-法规工程师退回") + @ApiOperation(value="项目库-法规清单表-法规工程师退回", notes="项目库-法规清单表-法规工程师退回") + @PostMapping(value = "/regulationOwnerReturned") + public Result regulationOwnerReturned(@RequestBody JSONObject json) { + return this.platformProjectLawsInventoryEOService.regulationOwnerReturned(json); + } + + @AutoLog(value = "流程重置-迁移法规清单流程历史数据专用") + @ApiOperation(value="流程重置-迁移法规清单流程历史数据专用", notes="流程重置-迁移法规清单流程历史数据专用") + @PostMapping(value = "/resetFlowTemp") + public Result resetFlowTemp(@RequestBody JSONObject params) { + return this.platformProjectLawsInventoryEOService.resetFlowTemp(params); + } + + /** + * 批量更新法规清单状态 + * @param json + * @return + */ + @AutoLog(value = "项目库-法规清单表-批量更新流程状态") + @ApiOperation(value="项目库-法规清单表-批量更新流程状态", notes="项目库-法规清单表-批量更新流程状态") + @PostMapping(value = "/updateFlowStatusBatch") + public Result updateFlowStatusBatch(@RequestBody JSONObject json) { + return this.platformProjectLawsInventoryEOService.updateFlowStatusBatch(json); + } + + @AutoLog(value = "项目库-法规清单表-引用交付物") + @ApiOperation(value="项目库-法规清单表-引用交付物", notes="项目库-法规清单表-引用交付物") + @PostMapping(value = "/citeDeliverable") + public Result citeDeliverable(@RequestBody JSONObject json) { + return this.platformProjectLawsInventoryEOService.citeDeliverable(json); + } + + @AutoLog(value = "项目库-法规清单表-强制转办") + @ApiOperation(value="项目库-法规清单表-强制转办", notes="项目库-法规清单表-强制转办") + @PostMapping(value = "/compulsoryTransfer") + public Result compulsoryTransfer(@RequestBody JSONObject json) { + return this.platformProjectLawsInventoryEOService.compulsoryTransfer(json); + } + + /** + * 通过projectId查询责任人 + * + * @return + */ + @AutoLog(value = "项目库-法规清单表-通过projectId查询责任人") + @ApiOperation(value="项目库-法规清单表-通过projectId查询责任人", notes="项目库-法规清单表-通过projectId查询责任人") + @GetMapping(value = "/queryDutyPersonByProjectId") + public Result queryDutyPersonByProjectId(@RequestParam Map params){ + Map>> res = this.platformProjectLawsInventoryEOService.queryDutyPersonByProjectId(params); + return Result.OK(res); + } + + /** + * 分页查询不符合项列表 + * @return + */ + @AutoLog(value = "项目库-法规清单表-查询不符合项列表") + @ApiOperation(value="项目库-法规清单表-查询不符合项列表", notes="项目库-法规清单表-查询不符合项列表") + @GetMapping(value = "/queryNotComplianList") + public Result queryNotComplianList(@RequestParam Map params) { + List> result = this.platformProjectLawsInventoryEOService.queryNotComplianList(params); + Page pages = PageUtil.getPages(Integer.parseInt((String) params.get("pageNo")), Integer.parseInt((String) params.get("pageSize")), result); + return Result.OK(pages); + } + + /** + * 导出不符合项列表 + * @param request + * @param params + */ + @AutoLog(value = "项目库-法规清单表-导出不符合项列表") + @ApiOperation(value="项目库-法规清单表-导出不符合项列表", notes="项目库-法规清单表-导出不符合项列表") + @RequestMapping(value = "/exportNotComplianList") + public void exportNotComplianList(HttpServletResponse response, + HttpServletRequest request, + @RequestBody Map params) { + this.platformProjectLawsInventoryEOService.exportNotComplianList(response,request, params); + } + + @AutoLog(value = "项目库-法规清单表-定版校验") + @ApiOperation(value="项目库-法规清单表-定版校验", notes="项目库-法规清单表-定版校验") + @GetMapping(value = "/finalizationVerify") + public Result finalizationVerify(@RequestParam Map params){ + return this.platformProjectLawsInventoryEOService.finalizationVerify(params); + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformProjectLibraryBaseController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformProjectLibraryBaseController.java new file mode 100644 index 000000000..9307bbfe8 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformProjectLibraryBaseController.java @@ -0,0 +1,310 @@ +package com.jero.modules.platform.controller; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +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.system.base.controller.JeroController; +import com.jero.common.system.vo.DictModel; +import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.platform.service.IPlatformProjectLibraryBaseService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.text.ParseException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + + +/** + * @Description: 项目库基础表 + * @Author: jero-boot + * @Date: 2022-04-11 + * @Version: V1.0 + */ +@Api(tags="平台件项目库") +@RestController +@RequestMapping("/platform/projectLibraryBase") +@Slf4j +public class PlatformProjectLibraryBaseController extends JeroController { + @Autowired + private IPlatformProjectLibraryBaseService platformIProjectLibraryBaseService; + + /** + * 分页列表查询 + * + * @return + */ + @AutoLog(value = "项目库基础表-分页列表查询") + @ApiOperation(value="项目库基础表-分页列表查询", notes="项目库基础表-分页列表查询") + @PostMapping(value = "/page") + public Result queryPageList(@RequestBody Map params) { + List pageList= platformIProjectLibraryBaseService.queryPageList(params); + Page pages = platformIProjectLibraryBaseService.getPages(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()), pageList); + return Result.OK(params.get("cut").toString(),pages); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "项目库基础表-列表查询") + @ApiOperation(value="项目库基础表-列表查询", notes="项目库基础表-列表查询") + @GetMapping(value = "/list") + public Result> queryList(ProjectLibraryBase projectLibraryBase) { + List list = platformIProjectLibraryBaseService.getList(projectLibraryBase); + return Result.OK(list); + } + + /** + * 添加 + * + * @param projectLibraryBase + * @return + */ + @AutoLog(value = "项目库基础表-添加") + @ApiOperation(value="项目库基础表-添加", notes="项目库基础表-添加") + @RequiresPermissions("projectLibraryBase:add") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody ProjectLibraryBase projectLibraryBase) throws ParseException { + platformIProjectLibraryBaseService.add(projectLibraryBase); + return Result.OK("添加成功!"); + } + /** + * 项目扩展(添加子项目子项目基本信息、相关人员名单、法规/认证任务计划与被扩展项目保持一致) + * + * @param projectLibraryBase + * @return + */ + @AutoLog(value = "项目扩展(添加子项目)") + @ApiOperation(value="项目扩展(添加子项目)", notes="项目扩展(添加子项目)") + @RequiresPermissions("projectLibraryBase:add") + @PostMapping(value = "/addChild") + public Result addChild(@Validated @RequestBody ProjectLibraryBase projectLibraryBase) throws ParseException { + platformIProjectLibraryBaseService.addChild(projectLibraryBase); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param projectLibraryBase + * @return + */ + @AutoLog(value = "项目库基础表-编辑") + @ApiOperation(value="项目库基础表-编辑", notes="项目库基础表-编辑") + @RequiresPermissions("projectLibraryBase:edit") + @PutMapping(value = "/edit") + public Result edit(@Validated @RequestBody ProjectLibraryBase projectLibraryBase) { + platformIProjectLibraryBaseService.editById(projectLibraryBase); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "项目库基础表-通过id删除") + @ApiOperation(value="项目库基础表-通过id删除", notes="项目库基础表-通过id删除") + @RequiresPermissions("projectLibraryBase:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id, + @RequestParam(name="cut",required=true) String cut) { + platformIProjectLibraryBaseService.deleteById(id,cut); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "项目库基础表-批量删除") + @ApiOperation(value="项目库基础表-批量删除", notes="项目库基础表-批量删除") + @RequiresPermissions("projectLibraryBase:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids, + @RequestParam(name="cut",required=true) String cut) { + this.platformIProjectLibraryBaseService.deleteByIds(Arrays.asList(ids.split(",")),cut); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "项目库基础表-通过id查询") + @ApiOperation(value="项目库基础表-通过id查询", notes="项目库基础表-通过id查询") + @RequiresPermissions("projectLibraryBase:queryById") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id, + @RequestParam(name="cut",required=true) String cut) { + List data = platformIProjectLibraryBaseService.queryById(id,cut); + if(data==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(cut,data); + } + + /** + * 导出excel + * + * @param request + * @param projectLibraryBase + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ProjectLibraryBase projectLibraryBase) { + return super.exportXls(request, projectLibraryBase, ProjectLibraryBase.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, ProjectLibraryBase.class); + } + + /** + * 项目详情-统计接口 + * @param id 项目库id + * @return + */ + @AutoLog(value = "项目详情-统计接口") + @ApiOperation(value="项目详情-统计接口", notes="项目详情-统计接口") + @GetMapping(value = "/getProjectDetailsStatistics") + public Result getProjectDetailsStatistics(@RequestParam(name="id",required=true) String id, + @RequestParam(name="cut",required=true) String cut) { + Map data = platformIProjectLibraryBaseService.getProjectDetailsStatistics(id); + return Result.OK(cut,data); + } + + /** + * 项目详情-统计接口-根据领域分组 + * @return + */ + @AutoLog(value = "项目详情-统计接口-根据领域分组") + @ApiOperation(value="项目详情-统计接口-根据领域分组", notes="项目详情-统计接口-根据领域分组") + @GetMapping(value = "/getProjectDetailsStatisticsGroupByTerritory") + public Result getProjectDetailsStatisticsGroupByTerritory(@RequestParam Map params) { + Map data = platformIProjectLibraryBaseService.getProjectDetailsStatisticsGroupByTerritory(params); + return Result.OK((String)params.get("cut"),data); + } + + /** + * 导出excel + * + * @param request + * @param params + */ + @RequestMapping(value = "/exportProjectDetailsStatisticsGroupByTerritoryXls") + public void exportProjectDetailsStatisticsGroupByTerritoryXls(HttpServletResponse response,HttpServletRequest request, @RequestParam Map params) { + platformIProjectLibraryBaseService.exportProjectDetailsStatisticsGroupByTerritoryXls(response,request, params); + } + + + /** + * 项目置顶,取消置顶(只置顶主项目) + * @param id + * @param flag 0为置顶, 1为取消置顶 + * @return + */ + @AutoLog(value = "项目置顶,取消置顶(只置顶主项目)") + @ApiOperation(value="项目置顶,取消置顶(只置顶主项目)", notes="项目置顶,取消置顶(只置顶主项目)") + @GetMapping(value = "/top") + public Result top(String id,String flag) { + platformIProjectLibraryBaseService.top(id,flag); + return Result.OK("编辑成功!"); + } + + /** + * 获取项目所有的版本(主版本和子版本的集合) + * @param id 项目id + * @return + */ + @AutoLog(value = "获取项目所有的版本(主版本和子版本的集合)") + @ApiOperation(value="获取项目所有的版本(主版本和子版本的集合)", notes="获取项目所有的版本(主版本和子版本的集合)") + @GetMapping(value = "/getVersionsInfo") + public Result getVersionsInfo(String id) { + List versionsInfoList = platformIProjectLibraryBaseService.getVersionsInfo(id); + return Result.OK(versionsInfoList); + } + + /** + * 版本统计 + * @return + */ + @AutoLog(value = "版本统计") + @ApiOperation(value="版本统计)", notes="版本统计") + @PostMapping(value = "/versionStatistics") + public Result versionStatistics(@RequestBody Map params) { + List projectLibraryBasesList = platformIProjectLibraryBaseService.versionStatistics(String.valueOf(params.get("id"))); + Page pages = platformIProjectLibraryBaseService.getPages(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()), projectLibraryBasesList); + return Result.OK(pages); + } + + @AutoLog(value = "对接火山引擎接口getProjectInfo") + @ApiOperation(value="对接火山引擎接口-获取项目统计信息1", notes="对接火山引擎接口-获取项目统计信息1") + @PostMapping(value = "/getProjectInfo") + public Result getProjectInfo(){ + JSONArray resList = platformIProjectLibraryBaseService.getProjectInfo(); + return Result.OK(resList); + } + + @AutoLog(value = "对接火山引擎接口getProjectProgressInfo") + @ApiOperation(value="对接火山引擎接口-获取项目统计信息2", notes="对接火山引擎接口-获取项目统计信息2") + @PostMapping(value = "/getProjectProgressInfo") + public Result getProjectProgressInfo(){ + JSONArray resList = this.platformIProjectLibraryBaseService.getProjectProgressInfo(); + return Result.OK(resList); + } + + // 导出项目进度统计(状态导出) + @RequestMapping(value = "/exportProjectProgressStatisticsXls") + public void exportProjectProgressStatisticsXls(HttpServletResponse response,HttpServletRequest request, @RequestParam Map params) { + this.platformIProjectLibraryBaseService.exportProjectProgressStatisticsXls(response,request, params); + } + + @AutoLog(value = "获取用户在该项目中所有的责任领域") + @ApiOperation(value="获取用户在该项目中所有的责任领域", notes="获取用户在该项目中所有的责任领域") + @GetMapping(value = "/getUserAllDutyTerritoryList") + public Result> getUserAllDutyTerritoryList(@RequestParam Map params){ + List resList = this.platformIProjectLibraryBaseService.getUserAllDutyTerritoryList(params); + return Result.OK(resList); + } + + @AutoLog(value = "全局替换用户") + @ApiOperation(value="全局替换用户", notes="全局替换用户") + @PostMapping(value = "/overallReplacementUser") + public Result overallReplacementUser(@RequestBody JSONObject json){ + return this.platformIProjectLibraryBaseService.overallReplacementUser(json); + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformTaskPlanningEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformTaskPlanningEOController.java new file mode 100644 index 000000000..e63cfacc7 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/PlatformTaskPlanningEOController.java @@ -0,0 +1,212 @@ +package com.jero.modules.platform.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +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.api.vo.Result; +import com.jero.common.aspect.annotation.AutoLog; +import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.query.QueryGenerator; +import com.jero.modules.platform.entity.PlatformTaskPlanningEO; +import com.jero.modules.platform.service.IPlatformTaskPlanningEOService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + + +/** + * @Description: 平台件合规认证计划 + * @Author: jero-boot + * @Date: 2023-09-14 + * @Version: V1.0 + */ +@Api(tags="平台件合规认证计划") +@RestController +@RequestMapping("/platform/platformTaskPlanningEO") +@Slf4j +public class PlatformTaskPlanningEOController extends JeroController { + @Autowired + private IPlatformTaskPlanningEOService platformTaskPlanningEOService; + + /** + * 分页列表查询 + * + * @param platformTaskPlanningEO + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "平台件合规认证计划-分页列表查询") + @ApiOperation(value="平台件合规认证计划-分页列表查询", notes="平台件合规认证计划-分页列表查询") + @GetMapping(value = "/page") + public Result queryPageList(PlatformTaskPlanningEO platformTaskPlanningEO, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(platformTaskPlanningEO, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = platformTaskPlanningEOService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "平台件合规认证计划-列表查询") + @ApiOperation(value="平台件合规认证计划-列表查询", notes="平台件合规认证计划-列表查询") + @GetMapping(value = "/list") + public Result queryList(String projectId) { + List platformTaskPlanningEOList = platformTaskPlanningEOService.queryList(projectId); + return Result.OK(platformTaskPlanningEOList); + } + @AutoLog(value = "平台件合规认证计划-编辑数据回显") + @ApiOperation(value="平台件合规认证计划-编辑数据回显", notes="平台件合规认证计划-编辑数据回显") + @GetMapping(value = "/queryListUpdate") + public Result queryListUpdate(String projectId) { + Map result = platformTaskPlanningEOService.queryListUpdate(projectId); + return Result.OK(result); + } + + /** + * 添加 + * + * @param platformTaskPlanningEO + * @return + */ + @AutoLog(value = "平台件合规认证计划-添加") + @ApiOperation(value="平台件合规认证计划-添加", notes="平台件合规认证计划-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody PlatformTaskPlanningEO platformTaskPlanningEO) { + platformTaskPlanningEOService.add(platformTaskPlanningEO); + return Result.OK("添加成功!"); + } + /** + * 添加 + * + * @param data + * @return + */ + @AutoLog(value = "平台件合规认证计划-批量添加") + @ApiOperation(value="平台件合规认证计划-批量添加", notes="平台件合规认证计划-批量添加") + @PostMapping(value = "/addBatch") + public Result addBatch(@RequestBody Map data) { +// JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(data.get("list"))); +// JSONArray jsonArrayUp = JSONArray.parseArray(JSON.toJSONString(data.get("listUp"))); +// JSONArray jsonArrayDown = JSONArray.parseArray(JSON.toJSONString(data.get("listDown"))); +// List platformTaskPlanningEOListUp = jsonArray.toJavaList(PlatformTaskPlanningEO.class); +// List platformTaskPlanningEOListDown = jsonArray.toJavaList(PlatformTaskPlanningEO.class); +// platformTaskPlanningEOService.addBatch(platformTaskPlanningEOListUp,platformTaskPlanningEOListDown); + JSONArray jsonArrayUp = JSONArray.parseArray(JSON.toJSONString(data.get("listUp"))); + JSONArray jsonArrayDown = JSONArray.parseArray(JSON.toJSONString(data.get("listDown"))); + List platformTaskPlanningEOListUp = jsonArrayUp.toJavaList(PlatformTaskPlanningEO.class); + List platformTaskPlanningEOListDown = jsonArrayDown.toJavaList(PlatformTaskPlanningEO.class); + platformTaskPlanningEOService.addBatch(platformTaskPlanningEOListUp,platformTaskPlanningEOListDown); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param platformTaskPlanningEO + * @return + */ + @AutoLog(value = "平台件合规认证计划-编辑") + @ApiOperation(value="平台件合规认证计划-编辑", notes="平台件合规认证计划-编辑") + @PutMapping(value = "/edit") + public Result edit(@Validated @RequestBody PlatformTaskPlanningEO platformTaskPlanningEO) { + platformTaskPlanningEOService.editById(platformTaskPlanningEO); + 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) { + platformTaskPlanningEOService.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.platformTaskPlanningEOService.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) { + PlatformTaskPlanningEO platformTaskPlanningEO = platformTaskPlanningEOService.queryById(id); + if(platformTaskPlanningEO==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(platformTaskPlanningEO); + } + + /** + * 导出excel + * + * @param request + * @param platformTaskPlanningEO + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, PlatformTaskPlanningEO platformTaskPlanningEO) { + return super.exportXls(request, platformTaskPlanningEO, PlatformTaskPlanningEO.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, PlatformTaskPlanningEO.class); + } + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/platformProjectNameInfoEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/platformProjectNameInfoEOController.java new file mode 100644 index 000000000..b857754e3 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/controller/platformProjectNameInfoEOController.java @@ -0,0 +1,204 @@ +package com.jero.modules.platform.controller; + +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.api.vo.Result; +import com.jero.common.aspect.annotation.AutoLog; +import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.query.QueryGenerator; +import com.jero.modules.platform.service.IPlatformProjectNameInfoEOService; +import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.project.entity.ProjectNameInfoEO; +import com.jero.modules.project.service.IProjectNameInfoEOService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; + + +/** + * @Description: 项目名信息表 + * @Author: jero-boot + * @Date: 2022-04-18 + * @Version: V1.0 + */ +@Api(tags="平台件-项目名信息表") +@RestController +@RequestMapping("/platform/projectNameInfoEO") +@Slf4j +public class platformProjectNameInfoEOController extends JeroController { + @Autowired + private IPlatformProjectNameInfoEOService platformProjectNameInfoEOService; + + /** + * 分页列表查询 + * + * @param projectNameInfoEO + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "项目名信息表-分页列表查询") + @ApiOperation(value="项目名信息表-分页列表查询", notes="项目名信息表-分页列表查询") + @GetMapping(value = "/page") + public Result queryPageList(ProjectNameInfoEO projectNameInfoEO, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(projectNameInfoEO, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = platformProjectNameInfoEOService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "项目名信息表-列表查询") + @ApiOperation(value="项目名信息表-列表查询", notes="项目名信息表-列表查询") + @GetMapping(value = "/list") + public Result> queryList() { + List list = platformProjectNameInfoEOService.queryList(); + return Result.OK(list); + } + /** + * 返回项目全拼 + * + * @return + */ + @AutoLog(value = "返回项目全拼") + @ApiOperation(value="返回项目全拼", notes="返回项目全拼") + @GetMapping(value = "/queryProjectNameList") + public Result> queryProjectNameList(String cut) { + List list = platformProjectNameInfoEOService.queryProjectNameList(cut); + return Result.OK(list); + } + + /** + * 添加 + * + * @param projectNameInfoEO + * @return + */ + @AutoLog(value = "项目名信息表-添加") + @ApiOperation(value="项目名信息表-添加", notes="项目名信息表-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody ProjectNameInfoEO projectNameInfoEO) { + platformProjectNameInfoEOService.add(projectNameInfoEO); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param projectNameInfoEO + * @return + */ + @AutoLog(value = "项目名信息表-编辑") + @ApiOperation(value="项目名信息表-编辑", notes="项目名信息表-编辑") + @PutMapping(value = "/edit") + public Result edit(@Validated @RequestBody ProjectNameInfoEO projectNameInfoEO) { + platformProjectNameInfoEOService.editById(projectNameInfoEO); + 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) { + platformProjectNameInfoEOService.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.platformProjectNameInfoEOService.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) { + ProjectNameInfoEO projectNameInfoEO = platformProjectNameInfoEOService.queryById(id); + if(projectNameInfoEO==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(projectNameInfoEO); + } + + /** + * 导出excel + * + * @param request + * @param projectNameInfoEO + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ProjectNameInfoEO projectNameInfoEO) { + return super.exportXls(request, projectNameInfoEO, ProjectNameInfoEO.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, ProjectNameInfoEO.class); + } + + /** + * 接收space系统数据 + * + * @return + */ +// @AutoLog(value = "项目名信息表-space") +// @ApiOperation(value="项目名信息表-space", notes="项目名信息表-space") +// @RequestMapping(value = "/getSpaceInfo", method = RequestMethod.POST) +// public void getSpaceInfo(@RequestParam(name="cut",required=true) String cut) { +// platformProjectNameInfoEOService.getSpaceInfo(cut); +// } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/entity/PlatformTaskPlanningEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/entity/PlatformTaskPlanningEO.java new file mode 100644 index 000000000..fc9e52a8f --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/entity/PlatformTaskPlanningEO.java @@ -0,0 +1,99 @@ +package com.jero.modules.platform.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + + +/** + * @Description: 平台件合规认证计划 + * @Author: jero-boot + * @Date: 2023-09-14 + * @Version: V1.0 + */ +@Data +@TableName("platform_task_planning") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="platform_task_planning对象", description="平台件合规认证计划") +public class PlatformTaskPlanningEO 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; + + /**节点名称*/ + @Excel(name = "节点名称", width = 15) + @ApiModelProperty(value = "节点名称") + private java.lang.String nodeName; + + /**节点时间*/ + @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 nodeTime; + + /**项目id*/ + @Excel(name = "项目id", width = 15) + @ApiModelProperty(value = "项目id") + private java.lang.String projectId; + + @ApiModelProperty(value = "字段名与项目库保持一致") + @TableField(exist = false) + private java.lang.String name; + + /**节点时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "字段名与项目库保持一致") + @TableField(exist = false) + private java.util.Date time; + + @TableField(exist = false) + private String status; + + @TableField(exist = false) + private boolean isG; + + //标识(用来区分上下两部分数据,up->上,down->下) + private String Flag; + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/enums/UpAndDownEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/enums/UpAndDownEnum.java new file mode 100644 index 000000000..2bd57ebfb --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/enums/UpAndDownEnum.java @@ -0,0 +1,45 @@ +package com.jero.modules.platform.enums; + +/** + * 任务状态枚举类 + */ +public enum UpAndDownEnum { + UP("上部分","up"), + DOWN("下部分","down"), + ; + + + String name; + String value; + + private UpAndDownEnum(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public static String getTextByValue(String value) { + UpAndDownEnum[] values = values(); + for (UpAndDownEnum taskStatusEnum : values) { + if (taskStatusEnum.value.equals(value)) { + return taskStatusEnum.name; + } + } + return null; + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectCertificationInventoryEOMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectCertificationInventoryEOMapper.java new file mode 100644 index 000000000..4294baa50 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectCertificationInventoryEOMapper.java @@ -0,0 +1,14 @@ +package com.jero.modules.platform.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; + +/** + * @Description: 项目库-认证清单表 + * @Author: jero-boot + * @Date: 2023-03-03 + * @Version: V1.0 + */ +public interface PlatformProjectCertificationInventoryEOMapper extends BaseMapper { + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectLawsInventoryEOMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectLawsInventoryEOMapper.java new file mode 100644 index 000000000..9b09e8bb8 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectLawsInventoryEOMapper.java @@ -0,0 +1,49 @@ +package com.jero.modules.platform.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 项目库-法规清单表 + * @Author: jero-boot + * @Date: 2022-04-14 + * @Version: V1.0 + */ +public interface PlatformProjectLawsInventoryEOMapper extends BaseMapper { + + /** + * 获取清单确认统计 + * @param projectLibraryId 项目库id + * @return + */ + List> getlistingToConfirmStatistics(@Param("projectLibraryId") String projectLibraryId); + + /** + * 获取清单确认统计 + * @param projectLibraryId 项目库id + * @return + */ + List> getTaskToConfirmStatistics(@Param("projectLibraryId")String projectLibraryId); + + /** + * 统计该项目中,某一个 清单确认状态的数据 根据领域分组 + * @param projectLibraryId 项目库id + * @param inventoryAffirmStatus 清单确认状态 + * @return + */ + List> getListingToConfirmStatisticsGroupByTerritory(@Param("projectLibraryId") String projectLibraryId,@Param("inventoryAffirmStatus") String inventoryAffirmStatus); + + /** + * 统计该项目中,某一个 任务确认状态的数据 根据领域分组 + * @param projectLibraryId + * @param taskAffirmStatus + * @return + */ + List> getTaskToConfirmStatisticsGroupByTerritory(@Param("projectLibraryId") String projectLibraryId, @Param("taskAffirmStatus") String taskAffirmStatus); + + List> queryNotComplianList(@Param("params") Map params); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectLibraryBaseMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectLibraryBaseMapper.java new file mode 100644 index 000000000..049396638 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectLibraryBaseMapper.java @@ -0,0 +1,32 @@ +package com.jero.modules.platform.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jero.modules.project.entity.ProjectLibraryBase; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 项目库基础表 + * @Author: jero-boot + * @Date: 2022-04-11 + * @Version: V1.0 + */ +public interface PlatformProjectLibraryBaseMapper extends BaseMapper { + /**分页列表*/ + List queryPageList(@Param("params") Map params); + List queryMaimList(); +// IPage queryPageList(IPage page, Map params); + + List getList(@Param("projectLibraryBase") ProjectLibraryBase projectLibraryBase); + + /**根据id查询*/ + List queryById(String id); + + ProjectLibraryBase selectProjectName(@Param("projectLibraryId") String projectLibraryId); + + List getListByIds(@Param("idList") List idList); + + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectNameInfoEOMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectNameInfoEOMapper.java new file mode 100644 index 000000000..3e0b0008b --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformProjectNameInfoEOMapper.java @@ -0,0 +1,20 @@ +package com.jero.modules.platform.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jero.modules.project.entity.ProjectNameInfoEO; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * @Description: 项目名信息表 + * @Author: jero-boot + * @Date: 2022-04-18 + * @Version: V1.0 + */ +public interface PlatformProjectNameInfoEOMapper extends BaseMapper { + @Select("select pni.id,pni.project_name,pyni.id as year_id,pyni.year_name,pni.vehicle_platform,pni.digital_platform\n" + + "from project_name_info as pni\n" + + "left join project_year_name_info as pyni on pni.id=pyni.project_name_id;") + List selectProjectNameAndYear(); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformTaskPlanningEOMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformTaskPlanningEOMapper.java new file mode 100644 index 000000000..a7ba6a47d --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/PlatformTaskPlanningEOMapper.java @@ -0,0 +1,14 @@ +package com.jero.modules.platform.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jero.modules.platform.entity.PlatformTaskPlanningEO; + +/** + * @Description: 平台件合规认证计划 + * @Author: jero-boot + * @Date: 2023-09-14 + * @Version: V1.0 + */ +public interface PlatformTaskPlanningEOMapper extends BaseMapper { + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectCertificationInventoryEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectCertificationInventoryEOMapper.xml new file mode 100644 index 000000000..a2946df5a --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectCertificationInventoryEOMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectLawsInventoryEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectLawsInventoryEOMapper.xml new file mode 100644 index 000000000..4d2e84cbc --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectLawsInventoryEOMapper.xml @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and temp.serial_number like CONCAT(CONCAT('%',#{params.serialNumber}),'%') + + + and temp.title like CONCAT(CONCAT('%',#{params.title}),'%') + + + and temp.duty_territory like CONCAT(CONCAT('%',#{params.dutyTerritory}),'%') + + + + + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectLibraryBaseMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectLibraryBaseMapper.xml new file mode 100644 index 000000000..39c14ed4e --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectLibraryBaseMapper.xml @@ -0,0 +1,331 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select + plb.id, + plb.project_name_id, + pni.project_name as project_name, + pyni.id as year_name_id, + pyni.year_name, + plb.target_market, + plb.project_status, + plb.studio_engineer, + studiouser.username as studio_engineer_name, + plb.certification_engineer, + plb.vehicle_platform, + plb.digital_platform, + plb.ipd_info, + plb.vehicle_development_plan, + plb.attestation_plan, + plb.create_by, + plb.create_time, + plb.sys_org_code, + plb.update_by, + plb.update_time, + plb.parent_id, + plb.project_version, + plb.explanation, + plb.software_version, + plb.sort, + plb.flag, + plb.brand, + plb.power, + plb.producer, + plb.duty_depart, + plb.regulation_owner_id, + plb.engineering_interface_person, + plb.brand_label, + plb.product_model, + plb.cell_enterprise, + plb.assembly_enterprise, + plb.part_number_cn, + plb.part_number_en, + plb.filing_code, + plb.supplier_code, + plb.product_type_code, + plb.battery_type_code, + plb.specification_code, + plb.traceability_code, + plb.ymd_number, + plb.size, + plb.rated_capacity, + plb.nominal_voltage, + plb.rated_mass, + plb.module_number, + plb.connection_type, + plb.module_specification_code, + plb.cooling_method, + plb.filing_completion_time, + plb.remark, + sdi.item_text brandText, + sdi.en_name brandTextEn + from project_library_base as plb + left join project_name_info as pni on plb.project_name_id=pni.id + left join sys_user as studiouser on plb.studio_engineer=studiouser.id + left join project_year_name_info as pyni on plb.year_name_id=pyni.id + left join sys_dict_item as sdi on sdi.item_value = plb.brand + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectNameInfoEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectNameInfoEOMapper.xml new file mode 100644 index 000000000..7063f6552 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformProjectNameInfoEOMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformTaskPlanningEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformTaskPlanningEOMapper.xml new file mode 100644 index 000000000..440389db1 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/mapper/xml/PlatformTaskPlanningEOMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectCertificationInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectCertificationInventoryEOService.java new file mode 100644 index 000000000..28f988d02 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectCertificationInventoryEOService.java @@ -0,0 +1,341 @@ +package com.jero.modules.platform.service; + +import com.alibaba.fastjson.JSONObject; +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.baomidou.mybatisplus.extension.service.IService; +import com.jero.common.api.vo.Result; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; +import com.jero.modules.system.entity.SysCategory; +import com.jero.modules.system.entity.SysDictItem; +import com.jero.modules.system.entity.SysRole; +import com.jero.modules.system.entity.SysUser; +import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; +import com.jero.modules.todoCenter.entity.ProcessInfoEO; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @Description: 项目库-认证清单表 + * @Author: jero-boot + * @Date: 2023-03-03 + * @Version: V1.0 + */ +public interface IPlatformProjectCertificationInventoryEOService extends IService { + + /** + * 保存 + * + * @param projectCertificationInventoryEO + * @return + */ + void add(ProjectCertificationInventoryEO projectCertificationInventoryEO); + + /** + * 更新 + * + * @param projectCertificationInventoryEO + * @return + */ + void editById(ProjectCertificationInventoryEO projectCertificationInventoryEO); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + ProjectCertificationInventoryEO queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(); + + /** + * 批量添加 + * @param json + * @return + */ + Result batchAdd(JSONObject json); + + /** + * 批量设置 + * @param projectCertificationInventoryEO + * @return + */ + Result setBatch(ProjectCertificationInventoryEO projectCertificationInventoryEO); + + /** + * 处理数据 + * @param datas + * @param cut + */ + void disposeData(List datas, String cut); + + /** + * 导入时的数据处理 + * @param datas + * @param cut + */ + void importDisposeData(List datas, String cut); + + String getTreeNameImport(String cut, List categoryList, List technologyTerritoryList); + + String getTreeName(String cut, List categoryList, List technologyTerritoryList); + + /** + * studio发布 + * @param json + * @return + */ + Result issue(JSONObject json); + + void addProcessInfoEO(ProcessInfoEO processInfoEO, String projectLibraryId); + + void addProcessInfoDetailEO(List processInfoDetailEOList, String processInfoId, String taskDefinitionKey); + + Result> getRoleByUserId(Map params); + + Result getFlowStatusList(String cut); + + IPage queryPage(QueryWrapper queryWrapper, + Page page, + ProjectCertificationInventoryEO projectCertificationInventoryEO, + String cut); + + void createQueryPermission(QueryWrapper queryWrapper, String roleCode); + + /** + * 认证流程统一提交任务 + * @param json + * @return + */ + Result submitTask(JSONObject json); + + /** + * 认证工程师发起任务 + * @param json + * @return + */ + Result certificationInitiatingTask(JSONObject json); + + /** + * 批量保存 + * @param json + * @return + */ + Result saveBatch(JSONObject json); + + /** + * 流程重置 + * @param json + * @return + */ + Result resetFlow(JSONObject json); + + /** + * 转办任务 + * @param json + * @return + */ + Result transferTask(JSONObject json); + + /** + * 催办任务 + * @param json + * @return + */ + Result expediting(JSONObject json); + + Map getCertificationInventoryLinkHrefFeishu(String projectLibraryId,String PRN_CN,String PRN_EN); + + Map getStandNameAndItemName(List projectCertificationInventoryEOList); + + /** + * 模板下载 + * @param projectCertificationInventoryEO + * @param response + * @param request + */ + void exportTemplate(ProjectCertificationInventoryEO projectCertificationInventoryEO, HttpServletResponse response, HttpServletRequest request); + + /** + * 批量修改配置项 + * @param json + * @return + */ + Result updateConfigItemBatch(JSONObject json); + + /** + * 调取添加 + * @param json + * @return + */ + Result callAdd(JSONObject json); + + /** + * 导入数据 + * @param file + * @param projectCertificationInventoryEO + */ + void importData(MultipartFile file, ProjectCertificationInventoryEO projectCertificationInventoryEO); + + /** + * projectCertificationInventoryEO + * @param response + * @param request + * @param projectCertificationInventoryEO + */ + void exportData(HttpServletResponse response, HttpServletRequest request, ProjectCertificationInventoryEO projectCertificationInventoryEO); + + /** + * 引用交付物 + * @param json + * @return + */ + Result citeDeliverable(JSONObject json); + + /** + * 根据模板返送消息 + * @param projectCertificationInventoryEOS + * @param templeteId + * @param userIdList + * @param userInfoList + */ + void sendMessageByTemplateId(List projectCertificationInventoryEOS, String templeteId, List userIdList, List userInfoList, Date endTimeString, String taskDefinitionKey); + + /** + * 数据唯一校验。 + * @param projectCertificationInventoryEOList + * @param cut + * @return + */ + List dataUniqueCheck(List projectCertificationInventoryEOList, String cut,List result,String projectLibraryId); + + /** + * + * @param json + * @return + */ + Result updateStatusBatch(JSONObject json); + + /** + * 添加配置 + * @param json + * @return + */ + Result addConfigByIds(JSONObject json); + String handlePhoneLink(String id, String prn_cn, String key); + void certificationInventoryEOListSortByEndTimeAsc(List projectCertificationInventoryEOList); + void certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(List projectCertificationInventoryEOList); + void certificationInventoryEOListSortByTaskConfirmEndTimeAsc(List projectCertificationInventoryEOList); + Map>> queryDutyPersonByProjectId(Map params); + + /** + * 获取任务确认统计信息 + * @param pciEoList + * @return + */ + List> getTaskToConfirmStatistics(List pciEoList); + + /** + * 获取Pre-Homo统计信息 + * @param pciEoList + * @return + */ + List> getPrehomoStatistice(List pciEoList); + + /** + * 获取认证进度统计信息 全部 + * @param pciEoList + * @return + */ + List> getAllCertificationProgressStatistics(List pciEoList); + + /** + * 获取认证进度统计信息 整车 + * @param pciEoList + * @return + */ + List> getCarCertificationProgressStatistics(List pciEoList); + + /** + * 获取认证进度统计信息 零部件 + * @param pciEoList + * @return + */ + List> getPartCertificationProgressStatistics(List pciEoList); + + /** + * 按照认证任务确认状态分组 + * @param pciEos + * @return + */ + Map groupByFGRwqrStatus(List pciEos); + + /** + * 按照preHomo确认状态分组 + * @param pciEos + * @return + */ + Map groupByPreHomoStatus(List pciEos); + + /** + * 根据认证进度分组 + * @param pciEos + * @return + */ + Map groupByCertificationProgress(List pciEos); + + /** + * 同步待办中心明细数据-认证清单 截止日期 + * @param endTime + * @param editEndTimeCertificationInventoryEOS + */ + void syncProcessInfoDetailEndTime(Date endTime, List editEndTimeCertificationInventoryEOS); + + /** + * 获取用户的责任领域数组 + * @param params + * @return + */ + List getUserDutyTerritoryList(Map params); + + /** + * 替换用户 + * @param json + */ + void replacementUser(JSONObject json); + + /** + * 匹配相关人员 + * @param params + * @return + */ + Result matchRelevantPeople(Map params); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectLawsInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectLawsInventoryEOService.java new file mode 100644 index 000000000..e12e83503 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectLawsInventoryEOService.java @@ -0,0 +1,325 @@ +package com.jero.modules.platform.service; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.itextpdf.text.DocumentException; +import com.jero.common.api.vo.Result; +import com.jero.common.constant.enums.MessageTypeEnum; +import com.jero.common.system.vo.LoginUser; +import com.jero.modules.feishu.vo.FeishuMsgVo; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import com.jero.modules.project.vo.ProjectTaskUrgVo; +import com.jero.modules.system.entity.SysCategory; +import com.jero.modules.system.entity.SysDictItem; +import com.jero.modules.system.entity.SysRole; +import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; +import com.jero.modules.todoCenter.entity.ProcessInfoEO; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @Description: 项目库-法规清单表 + * @Author: jero-boot + * @Date: 2022-04-14 + * @Version: V1.0 + */ +public interface IPlatformProjectLawsInventoryEOService extends IService { + + /** + * 保存 + * + * @param projectLawsInventoryEO + * @return + */ + void add(ProjectLawsInventoryEO projectLawsInventoryEO); + + /** + * 更新 + * + * @param projectLawsInventoryEO + * @return + */ + void editById(ProjectLawsInventoryEO projectLawsInventoryEO); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id,String projectLibraryId,String cut); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids,String projectLibraryId,String cut); + + /** + * 通过id查询 + * + * @param id + * @return + */ + ProjectLawsInventoryEO queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(ProjectLawsInventoryEO projectLawsInventoryEO, HttpServletRequest req); + + /** + * 批量更新状态 + * @param json + * @return + */ + Result updateStatusBatch(JSONObject json); + + void sendMessage(String msgTitle, String msgContent, List userIdList, String projectLibraryId, Map params, FeishuMsgVo feishuMsgVo, MessageTypeEnum messageType,String initiator); + + /** + * 匹配相关人员 + * @param params + * @return + */ + Result matchRelevantPeople(Map params); + + /** + * 流程调用 + * @param jsonObject + * @return + */ + Result processCall(JSONObject jsonObject); + + List queryProjectLawsInventoryInfoById(Map params); + + + void copyInfoByIds(String ids,String operateType); + + /** + * 批量设置 + * @param projectLawsInventoryEO + */ + void setBatch(ProjectLawsInventoryEO projectLawsInventoryEO); + + /** + * 模板下载 + * @param projectLawsInventoryEO + * @param response + * @param request + */ + void exportTemplate(ProjectLawsInventoryEO projectLawsInventoryEO, HttpServletResponse response, HttpServletRequest request); + + void exportData(HttpServletResponse response, + HttpServletRequest request, + ProjectLawsInventoryEO projectLawsInventoryEO); + + void importData(MultipartFile file, + ProjectLawsInventoryEO projectLawsInventoryEO); + + void dataDispose(List list, LoginUser currentUser, int isProjectRole, String cut); + + Result change(JSONObject parmas); + + /** + * 下载pdf报告 + * @param params + * @param req + * @param resp + * @throws DocumentException + */ + void downloadReport(Map params,HttpServletRequest req, HttpServletResponse resp)throws DocumentException; + + /** + * 下载docx报告 + * @param params + * @param req + * @param resp + */ + void downloadDocxReport(Map params, HttpServletRequest req, HttpServletResponse resp); + + /** + * 催办 + * @param json + * @return + */ + Result expediting(JSONObject json); + + List getRoleByUserId(String projectLibraryId,String cut); + + void addProcessInfo(ProcessInfoEO processInfoEO, String projectLibraryId, Date endTime); + + void addProcessInfoDetail(String processInfoId, List processInfoDetailEOList, Date endTime); + + Result taskUrg(ProjectTaskUrgVo projectTaskUrgVo); + + Result updateFlowInfoByProjectLibraryIds(String projectLibraryIds); + void updateFlowInfo(ProjectLawsInventoryEO projectLawsInventoryEO); + /** + * studio发布,启动清单确认流程 + * @param json + * @return + */ + Result studioPublish(JSONObject json); + + /** + * studio撤回 + * @param json + * @return + */ + Result studioWithdrew(JSONObject json); + + /** + * 法规工程师退回 + * @param json + * @return + */ + Result regulationOwnerReturned(JSONObject json); + + /** + * 根据id获取交付物类型展示名称 + * @param projectLawsInventoryId + * @param cut + * @param flowType + * @return + */ + String getDeliverableTypeNameById(String projectLawsInventoryId, String cut, String flowType,List projectLawsInventoryEOList,List categoryList); + + /** + * 根据id获取责任领域展示名称 + * @param projectLawsInventoryId + * @param cut + * @param projectLawsInventoryEOList + * @param sysDictItems + * @param dicCode + * @return + */ + String getDutyTerritoryNameById(String projectLawsInventoryId, String cut, List projectLawsInventoryEOList, List sysDictItems,String dicCode); + + void sendMessageByTemplateId(String templeteId,Map params); + + Map getProjectLawsInventoryLinkHrefFeishu(String projectLibraryId, String PRN_CN, String PRN_EN,String roleOpen); + + /** + * 获取待办中心跳转链接 + * @param projectLibraryId + * @param todoCenterParams + * @return + */ + Map getToDoCenterLinkHrefFeishu(String projectLibraryId, Map todoCenterParams); + + /** + * 法规清单根据清单确认截至日期顺序排序 + * @param projectLawsInventoryEOS + */ + void lawsInventoryEOListSortByInventoryAffirmDueDate(List projectLawsInventoryEOS); + + /** + * 法规清单根据设计符合性截至日期顺序排序 + * @param projectLawsInventoryEOS + */ + void lawsInventoryEOListSortByDesignDueDate(List projectLawsInventoryEOS); + + /** + * 法规清单根据验证符合性截至日期顺序排序 + * @param projectLawsInventoryEOS + */ + void lawsInventoryEOListSortByVerifyDueDate(List projectLawsInventoryEOS); + + /** + * 创建查询权限,2023-04-06 修改UAT问题第22条 + * @param isProjectRole + * @param currentUser + */ + void createQueryPermission(int isProjectRole, LoginUser currentUser, QueryWrapper projectLawsInventoryEOQueryWrapper); + + Result resetFlowTemp(JSONObject parmas); + + /** + * 批量更新流程状态 + * @param json + * @return + */ + Result updateFlowStatusBatch(JSONObject json); + + Result citeDeliverable(JSONObject json); + + Result compulsoryTransfer(JSONObject json); + + Map>> queryDutyPersonByProjectId(Map params); + + /** + * 获取任务确认统计信息 + * @param projectLawsInventoryEOList + * @return + */ + List> getTaskToConfirmStatistics(List projectLawsInventoryEOList); + + /** + * 获取设计符合性统计信息 + * @param projectLawsInventoryEOList + * @return + */ + List> getDesignComplianceStatistice(List projectLawsInventoryEOList); + + /** + * 获取验证符合性统计信息 + * @param projectLawsInventoryEOList + * @return + */ + List> getVerifyComplianceStatistice(List projectLawsInventoryEOList); + + List> queryNotComplianList(Map params); + + void exportNotComplianList(HttpServletResponse response, HttpServletRequest request, Map params); + + /** + * 按照法规任务确认状态分组 + * @param pliEos + * @return + */ + Map groupByFGRwqrStatus(List pliEos); + + /** + * 按照设计符合性状态分组 + * @param pliEos + * @return + */ + Map groupByDesignStatus(List pliEos); + + /** + * 按照验证符合性状态分组 + * @param pliEos + * @return + */ + Map groupByVerifyStatus(List pliEos); + + IPage queryPage(ProjectLawsInventoryEO projectLawsInventoryEO, Integer pageNo, Integer pageSize, HttpServletRequest req); + + Result finalizationVerify(Map params); + + /** + * 获取用户的责任领域数组 + * @param params + * @return + */ + List getUserDutyTerritoryList(Map params); + + /*** + * 替换用户 + * @param params + */ + void replacementUser(JSONObject json); + int checkUserRole(String projectLibraryId, String currentUserId, String lawsInventoryId); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectLibraryBaseService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectLibraryBaseService.java new file mode 100644 index 000000000..5b067b8be --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectLibraryBaseService.java @@ -0,0 +1,191 @@ +package com.jero.modules.platform.service; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.jero.common.api.vo.Result; +import com.jero.common.system.vo.DictModel; +import com.jero.modules.project.entity.ProjectLibraryBase; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.text.ParseException; +import java.util.List; +import java.util.Map; + +/** + * @Description: 项目库基础表 + * @Author: jero-boot + * @Date: 2022-04-11 + * @Version: V1.0 + */ +public interface IPlatformProjectLibraryBaseService extends IService { + + /** + * 保存 + * + * @param projectLibraryBase + * @return + */ + void add(ProjectLibraryBase projectLibraryBase) throws ParseException; + + /** + * 项目扩展(添加子项目-子项目基本信息、相关人员名单、法规/认证任务计划与被扩展项目保持一致) + * + * @param projectLibraryBase + * @return + */ + void addChild(ProjectLibraryBase projectLibraryBase) throws ParseException; + + /** + * 更新 + * + * @param projectLibraryBase + * @return + */ + void editById(ProjectLibraryBase projectLibraryBase); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id, String cut); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids,String cut); + + /** + * 通过id查询 + * + * @param id + * @return + */ + List queryById(String id,String cut); + + /** + * 列表查询 + * + * @return + */ + List getList(ProjectLibraryBase projectLibraryBase); + + /** + * 分页列表查询 + * + * @return + */ + List queryPageList(Map params); +// IPage queryPageList(Map params); + + /** + * 项目详情-统计接口 + * @param id + * @return + */ + Map getProjectDetailsStatistics(String id); + + /** + * 项目详情-统计接口-根据领域分组 + * @param params + * @return + */ + Map getProjectDetailsStatisticsGroupByTerritory(Map params); + + void exportProjectDetailsStatisticsGroupByTerritoryXls(HttpServletResponse response, HttpServletRequest request, Map params); + + void checkData(String id, String cut); + + void disposeData(List records,String cut,boolean disposeTargetMarketFlag); + + Page getPages(Integer currentPage, Integer pageSize, List list); + + /** + * 项目置顶,取消置顶(只置顶主项目) + * @param id + * @param flag 0为置顶, 1为取消置顶 + * @return + */ + void top(String id,String flag); + + /** + * 获取项目所有的版本(主版本和子版本的集合) + * @param id + * @return + */ + List getVersionsInfo(String id); + + /** + * 版本统计 + * @param id + * @return + */ + List versionStatistics(String id); + + /** + * 通过主项目id和子项目版本号 + * @param version + * @param parentId + * @return + */ + String getIdByVersionAndParentId(String version, String parentId); + + /** + * 查询主项目及其所有子项目 + * @param parentId + * @return + */ + List getParentAndChildern(String parentId); + + /** + * 根据id查询项目库详情信息 发送飞书消息时使用,之前的 queryById不太兼容 + * @param projectLibraryId + * @return + */ + ProjectLibraryBase selectById(String projectLibraryId); + + /** + * 对接火山引擎接口-获取项目统计信息 + * @return + */ + JSONArray getProjectInfo(); + + /** + * 对接火山引擎接口-获取项目统计信息 + * @return + */ + JSONArray getProjectProgressInfo(); + + /** + * 导出项目进度统计(状态导出) + * @param response + * @param request + * @param params + */ + void exportProjectProgressStatisticsXls(HttpServletResponse response, HttpServletRequest request, Map params); + + /** + * 获取用户在该项目中所有的责任领域数组 + * @param params + * @return + */ + List getUserAllDutyTerritoryList(Map params); + + /** + * 全局替换用户 + * @param json + * @return + */ + Result overallReplacementUser(JSONObject json); + + List queryList(List projectIdList); + + List getListByIds(List projectIdList); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectNameInfoEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectNameInfoEOService.java new file mode 100644 index 000000000..d0505f985 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformProjectNameInfoEOService.java @@ -0,0 +1,73 @@ +package com.jero.modules.platform.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.project.entity.ProjectNameInfoEO; + +import java.util.List; + +/** + * @Description: 项目名信息表 + * @Author: jero-boot + * @Date: 2022-04-18 + * @Version: V1.0 + */ +public interface IPlatformProjectNameInfoEOService extends IService { + + /** + * 保存 + * + * @param projectNameInfoEO + * @return + */ + void add(ProjectNameInfoEO projectNameInfoEO); + + /** + * 更新 + * + * @param projectNameInfoEO + * @return + */ + void editById(ProjectNameInfoEO projectNameInfoEO); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + ProjectNameInfoEO queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(); + + /** + * 返回项目全拼 + * @return + */ + List queryProjectNameList(String cut); + + + + //void getSpaceInfo(String cut); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformTaskPlanningEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformTaskPlanningEOService.java new file mode 100644 index 000000000..475b182cf --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/IPlatformTaskPlanningEOService.java @@ -0,0 +1,76 @@ +package com.jero.modules.platform.service; + +import com.jero.modules.platform.entity.PlatformTaskPlanningEO; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; +import java.util.Map; + +/** + * @Description: 平台件合规认证计划 + * @Author: jero-boot + * @Date: 2023-09-14 + * @Version: V1.0 + */ +public interface IPlatformTaskPlanningEOService extends IService { + + /** + * 保存 + * + * @param platformTaskPlanningEO + * @return + */ + void add(PlatformTaskPlanningEO platformTaskPlanningEO); + + /** + * 平台件合规认证计划-批量添加 + * @param platformTaskPlanningEOListUp + * @param platformTaskPlanningEOListDown + */ + void addBatch(List platformTaskPlanningEOListUp,List platformTaskPlanningEOListDown); + + /** + * 更新 + * + * @param platformTaskPlanningEO + * @return + */ + void editById(PlatformTaskPlanningEO platformTaskPlanningEO); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + PlatformTaskPlanningEO queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(String projectId); + + /** + * 平台件合规认证计划-编辑数据回显 + * @param projectId + * @return + */ + Map queryListUpdate(String projectId); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectCertificationInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectCertificationInventoryEOServiceImpl.java new file mode 100644 index 000000000..e01abb68b --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectCertificationInventoryEOServiceImpl.java @@ -0,0 +1,7124 @@ +package com.jero.modules.platform.service.impl; + +import cn.hutool.core.util.URLUtil; +import cn.hutool.core.util.ZipUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.utils.IOUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.api.vo.Result; +import com.jero.common.constant.enums.CutEnum; +import com.jero.common.exception.JeroBootException; +import com.jero.common.system.query.QueryGenerator; +import com.jero.common.system.vo.LoginUser; +import com.jero.common.util.DateUtils; +import com.jero.common.util.oss.CosBootUtil; +import com.jero.modules.authDummy.entity.AuthDummyInventoryInfoEO; +import com.jero.modules.authDummy.service.IAuthDummyInventoryInfoEOService; +import com.jero.modules.document.entity.BussDocumentLibraryEO; +import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper; +import com.jero.modules.document.service.IBussDocumentLibraryEOService; +import com.jero.modules.dummy.enums.OrderEnum; +import com.jero.modules.feishu.enums.TemplateInfoEnum2; +import com.jero.modules.feishu.service.IFeishuService; +import com.jero.modules.oss.entity.OSSFile; +import com.jero.modules.oss.service.IOSSFileService; +import com.jero.modules.platform.mapper.PlatformProjectCertificationInventoryEOMapper; +import com.jero.modules.platform.mapper.PlatformProjectLibraryBaseMapper; +import com.jero.modules.platform.service.IPlatformProjectCertificationInventoryEOService; +import com.jero.modules.platform.service.IPlatformProjectLawsInventoryEOService; +import com.jero.modules.platform.service.IPlatformProjectLibraryBaseService; +import com.jero.modules.project.entity.ProjectCertificationInventoryDutyEnginnerEO; +import com.jero.modules.project.entity.ProjectCertificationInventoryDutyEnginnerEOEnPlatform; +import com.jero.modules.project.entity.ProjectCertificationInventoryDutyEnginnerEOPlatform; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; +import com.jero.modules.project.entity.ProjectCertificationInventoryEOEnPlatform; +import com.jero.modules.project.entity.ProjectCertificationInventoryEOPlatform; +import com.jero.modules.project.entity.ProjectCertificationInventoryLogEO; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.project.entity.ProjectLibraryRoleRelEO; +import com.jero.modules.project.entity.ProjectRelatedPersonnel; +import com.jero.modules.project.entity.ProjectUserPermission; +import com.jero.modules.project.enums.CertificationFlowNodeEnum; +import com.jero.modules.project.enums.CertificationInventoryFlowStatusEnum; +import com.jero.modules.project.enums.CertificationProgressEnum; +import com.jero.modules.project.enums.JumpLinkEnum; +import com.jero.modules.project.enums.OperatorTypeEnum; +import com.jero.modules.project.enums.PermissionDescriptionEnum; +import com.jero.modules.project.enums.ProjectInventoryFieldEnum; +import com.jero.modules.project.enums.ProjectMessageEnum; +import com.jero.modules.project.enums.ProjectUserLocationEnum; +import com.jero.modules.project.enums.ReviewResultEnum; +import com.jero.modules.project.enums.RoleRelModelTypeEnum; +import com.jero.modules.project.enums.TaskAffirmStatusEnum; +import com.jero.modules.project.enums.TaskStatusEnum; +import com.jero.modules.project.mapper.ProjectRelatedPersonnelMapper; +import com.jero.modules.project.service.IProjectCertificationInventoryLogEOService; +import com.jero.modules.project.service.IProjectLibraryRoleRelEOService; +import com.jero.modules.project.service.IProjectRelatedPersonnelService; +import com.jero.modules.project.service.IProjectUserPermissionService; +import com.jero.modules.split.common.FileUnZip; +import com.jero.modules.system.entity.SysCategory; +import com.jero.modules.system.entity.SysDictItem; +import com.jero.modules.system.entity.SysRole; +import com.jero.modules.system.entity.SysUser; +import com.jero.modules.system.enums.ProjectRoleEnum; +import com.jero.modules.system.enums.SysCategoryValueTypeEnum; +import com.jero.modules.system.mapper.SysCategoryMapper; +import com.jero.modules.system.mapper.SysRoleMapper; +import com.jero.modules.system.service.IProjectUserDutyTerritoryService; +import com.jero.modules.system.service.ISysCategoryService; +import com.jero.modules.system.service.ISysDictItemService; +import com.jero.modules.system.service.ISysUserService; +import com.jero.modules.system.service.impl.SysDictItemServiceImpl; +import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; +import com.jero.modules.todoCenter.entity.ProcessInfoEO; +import com.jero.modules.todoCenter.enums.TodoCenterStatusEnum; +import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService; +import com.jero.modules.todoCenter.service.IProcessInfoEOService; +import com.jero.modules.wkflow.enums.FlowTypeEnum; +import com.jero.modules.wkflow.service.IProcessHistoryEOService; +import lombok.SneakyThrows; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; +import org.apache.poi.hssf.usermodel.HSSFRichTextString; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.apache.shiro.SecurityUtils; +import org.aspectj.util.FileUtil; +import org.jeecgframework.poi.excel.ExcelExportUtil; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.enmus.ExcelType; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.Collator; +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +import static com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl.copyFile; + +/** + * @Description: 项目库-认证清单表 + * @Author: jero-boot + * @Date: 2023-03-03 + * @Version: V1.0 + */ +@Service +@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class) +public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceImpl implements IPlatformProjectCertificationInventoryEOService { + + private static DecimalFormat df = new DecimalFormat("#.00"); + private static String percentSign = "%"; + + @Autowired + private ISysUserService sysUserService; + @Autowired + private ISysCategoryService sysCategoryService; + @Autowired + private ISysDictItemService sysDictItemService; + @Autowired + private SysDictItemServiceImpl sysDictItemServiceImpl; + @Autowired + private IPlatformProjectLibraryBaseService platformProjectLibraryBaseService; + @Autowired + private IProcessInfoEOService processInfoEOService; + @Autowired + private IProcessInfoDetailEOService processInfoDetailEOService; + @Autowired + private IProjectRelatedPersonnelService projectRelatedPersonnelService; + @Autowired + private ProjectRelatedPersonnelMapper projectRelatedPersonnelMapper; + @Autowired + private SysRoleMapper sysRoleMapper; + @Autowired + private IFeishuService feishuService; + @Autowired + private IAuthDummyInventoryInfoEOService authDummyInventoryInfoEOService; + @Autowired + private IProjectCertificationInventoryLogEOService projectCertificationInventoryLogEOService; + @Autowired + private IPlatformProjectCertificationInventoryEOService platformProjectCertificationInventoryEOService; + @Autowired + private IProjectUserDutyTerritoryService projectUserDutyTerritoryService; + + @Autowired + private BussDocumentLibraryEOMapper bussDocumentLibraryEOMapper; + @Autowired + private IProjectUserPermissionService projectUserPermissionService; + @Autowired + private IPlatformProjectLawsInventoryEOService platformProjectLawsInventoryEOService; + + @Autowired + private PlatformProjectLibraryBaseMapper platformProjectLibraryBaseMapper; + + + @Value(value = "${jero.backUrl}") + private String backUrl; + @Value(value = "${jero.backUrlPhone}") + private String backUrlPhone; + + @Value(value = "${jero.path.upload}") + private String uploadpath; + @Autowired + private IOSSFileService ossFileService; + + @Autowired + SysCategoryMapper sysCategoryMapper; + @Autowired + private IBussDocumentLibraryEOService iBussDocumentLibraryEOService; + @Autowired + private IProjectRelatedPersonnelService iProjectRelatedPersonnelService; + @Autowired + private IOSSFileService iOSSFileService; + @Autowired + private IProjectLibraryRoleRelEOService projectLibraryRoleRelEOService; + @Autowired + private IProcessHistoryEOService processHistoryEOService; + + /** + * 保存 + * + * @param projectCertificationInventoryEO + * @return + */ + @Override + public void add(ProjectCertificationInventoryEO projectCertificationInventoryEO) { + Date now = new Date(); + projectCertificationInventoryEO.setCreateTime(now); + projectCertificationInventoryEO.setUpdateTime(now); + save(projectCertificationInventoryEO); + } + + /** + * 更新 + * + * @param projectCertificationInventoryEO + * @return + */ + @Override + public void editById(ProjectCertificationInventoryEO projectCertificationInventoryEO) { + //获取当前用户 + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + QueryWrapper certificationQueryWrap = new QueryWrapper<>(); + certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId()); + List oldPciEoList = this.list(certificationQueryWrap); + if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getSdt())) { + // 编辑工程接口人处理逻辑 + this.editSdt(projectCertificationInventoryEO, oldPciEoList, currentUser); + } + if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())) { + // 编辑责任人处理逻辑 + this.editDutyPerson(projectCertificationInventoryEO, oldPciEoList, currentUser); + } + if (projectCertificationInventoryEO.getEndTime() != null) { + // 编辑截至日期处理逻辑 + this.editEndTime(projectCertificationInventoryEO, oldPciEoList, currentUser); + } + if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType())) { + // 编辑交付物类型逻辑 + this.editDeliverableType(projectCertificationInventoryEO, oldPciEoList, currentUser); + } + if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())) { + // 编辑交付物模板逻辑 + this.editDeliverableTemplate(projectCertificationInventoryEO, oldPciEoList, currentUser); + + } + + // 获取编辑前的数据 + ProjectCertificationInventoryEO editBeforePciEo = this.queryById(projectCertificationInventoryEO.getId()); + Map savePciLogParams = new HashMap<>(); + List editBeforePciList = new ArrayList<>(); + editBeforePciList.add(editBeforePciEo); + List editAfterPciList = new ArrayList<>(); + editAfterPciList.add(projectCertificationInventoryEO); + savePciLogParams.put("editBeforePciList",editBeforePciList); + savePciLogParams.put("editAfterPciList",editAfterPciList); + savePciLogParams.put("operatorType",OperatorTypeEnum.CERTIFICATION_INVENTORY_EDIT.getValue()); + this.saveProjectCertificationInventoryLog(savePciLogParams); + + Date now = new Date(); + projectCertificationInventoryEO.setUpdateTime(now); + saveOrUpdate(projectCertificationInventoryEO); + + + //获取当前的projectId + String projectId = projectCertificationInventoryEO.getProjectLibraryId(); + String cut = projectCertificationInventoryEO.getCut(); + Map params = new HashMap<>(); + params.put("projectLibraryId",projectId); + params.put("userId",currentUser.getId()); + params.put("modelType",RoleRelModelTypeEnum.CERTIFICATION_INVENTORY.getValue()); + ProjectLibraryRoleRelEO projectLibraryRoleRelEO = projectLibraryRoleRelEOService.queryByProjectLibraryIdAndUserId(params); + String roleCode = projectLibraryRoleRelEO.getRoleCode(); + +// //判断当前用户与studio工程师是否一致,一致的话具有studio角色的切换 +// if(studionList.contains(currentUser)){ +// //用户有studio工程师的操作 +// } + + //获取当前的责任人 + String dutyPerson = projectCertificationInventoryEO.getDutyPerson(); + //获取当前的责任领域 + List dutyTerritoryList = new ArrayList<>(); + dutyTerritoryList = Arrays.asList(projectCertificationInventoryEO.getDutyTerritory().split(",")); + dutyTerritoryList = dutyTerritoryList.stream().distinct().collect(Collectors.toList()); + + //根据责任领域个projectId去查相关人员名单 + List projectRelatedPersonnelList = projectRelatedPersonnelService.queryByProjectIdAndDutyTerritoy(projectId, dutyTerritoryList); + + List allList = new ArrayList<>(); + List enginnerList = new ArrayList<>(); + List lawEnginnerList = new ArrayList<>(); + List enginnerLawSetList = new ArrayList<>(); + List enginnerAttSetList = new ArrayList<>(); + //根据相关人员名单获取的工程接口人 + for(ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList){ + String enginneringInterfacePerson = relatedPersonnel.getEngineeringInterfacePerson(); + if(!StringUtils.isEmpty(enginneringInterfacePerson)){ + enginnerList = Arrays.stream(enginneringInterfacePerson.split(",")).collect(Collectors.toList()); + allList.addAll(enginnerList); + } + } + //获取相关人员名单中的法规工程师 + for(ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList){ + String lawEngineer = relatedPersonnel.getLawEngineer(); + if(!StringUtils.isEmpty(lawEngineer)){ + lawEnginnerList = Arrays.stream(lawEngineer.split(",")).collect(Collectors.toList()); + allList.addAll(lawEnginnerList); + } + } + //获取相关人员名单中的工程接口-法规工程师设置 + for(ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList){ + String engineerLawSet = relatedPersonnel.getEngineerLawSet(); + if(!StringUtils.isEmpty(engineerLawSet)){ + enginnerLawSetList = Arrays.stream(engineerLawSet.split(",")).collect(Collectors.toList()); + allList.addAll(enginnerLawSetList); + } + } + //获取相关人员名单中的工程接口-认证工程师设置 + for(ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList){ + String engineerAttSet = relatedPersonnel.getEngineerAttSet(); + if(!StringUtils.isEmpty(engineerAttSet)){ + enginnerAttSetList = Arrays.stream(engineerAttSet.split(",")).collect(Collectors.toList()); + allList.addAll(enginnerAttSetList); + } + } + //获取当前项目库id的studio工程师和认证工程师 + List studionList = new ArrayList<>(); + List certificationEngineerList = new ArrayList<>(); + List projectLibraryBases = platformProjectLibraryBaseService.queryById(projectId, cut); + for(ProjectLibraryBase projectLibraryBase : projectLibraryBases){ + studionList.add(projectLibraryBase.getStudioEngineer()); + + String certificationEngineer = projectLibraryBase.getCertificationEngineer(); + if(!StringUtils.isEmpty(certificationEngineer)){ + certificationEngineerList = Arrays.stream(certificationEngineer.split(",")).collect(Collectors.toList()); + allList.addAll(certificationEngineerList); + } + } +// studionList = studionList.stream().distinct().collect(Collectors.toList()); +// certificationEngineerList = certificationEngineerList.stream().distinct().collect(Collectors.toList()); + + allList = allList.stream().filter(all -> { + return StringUtils.isNotBlank(all); + }).distinct().collect(Collectors.toList()); + /** + for(String all : allList){ + if(all.equals("")){ + allList.remove(all); + } + } + */ + //遍历所有人alllist中是否包含责任人,如果包含,不用操作。 + //-------如果不包含,再去判断当前用户的角色是studio、法规还是认证 + for(ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList){ + if(allList.size()>0){ + if(!allList.contains(dutyPerson)){ + if (StringUtils.isNotEmpty(roleCode)) { + if(roleCode.equals(com.jero.modules.project.enums.ProjectRoleEnum.STUDIO_ENGINEER.getValue())){ + if(relatedPersonnel.getEngineeringInterfacePerson() != null){ + String engineeringInterfacePerson = dutyPerson+","+relatedPersonnel.getEngineeringInterfacePerson(); + relatedPersonnel.setEngineeringInterfacePerson(engineeringInterfacePerson); + }else { + relatedPersonnel.setEngineeringInterfacePerson(dutyPerson); + } + }else if(roleCode.equals(com.jero.modules.project.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue())){ + if(relatedPersonnel.getEngineerLawSet() != null){ + String engineerLawSet = dutyPerson+","+relatedPersonnel.getEngineerLawSet(); + relatedPersonnel.setEngineerLawSet(engineerLawSet); + }else { + relatedPersonnel.setEngineerLawSet(dutyPerson); + } + }else if(roleCode.equals(com.jero.modules.project.enums.ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())){ + if(relatedPersonnel.getEngineerAttSet() !=null){ + String engineerAttSet = dutyPerson+","+relatedPersonnel.getEngineerAttSet(); + relatedPersonnel.setEngineerAttSet(engineerAttSet); + }else { + relatedPersonnel.setEngineerAttSet(dutyPerson); + } + } + } + } + } + } +// for(ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList){ +// //如果工程接口人不为空的话 +// if(enginnerList.size()>0){ +// //判断哪个不存在 再去去存入 +// if(!enginnerList.contains(dutyPerson)){ +// relatedPersonnel.setEngineerAttSet(dutyPerson); +//// projectRelatedPersonnelService.editById(relatedPersonnel); +// } +// }else { +// //工程接口人为空的话,直接将责任设置到认证工程师下 +// relatedPersonnel.setEngineerAttSet(dutyPerson); +//// projectRelatedPersonnelService.editById(relatedPersonnel); +// } +// } + + this.projectRelatedPersonnelService.updateBatchById(projectRelatedPersonnelList); + + //设置权限 先删后加 + List adds = new ArrayList<>(); + if (ObjectUtils.isNotEmpty(projectCertificationInventoryEO.getSdt())) { + setProjectCertificationInventoryPermission(projectCertificationInventoryEO.getSdt(), projectCertificationInventoryEO.getProjectLibraryId(), projectCertificationInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_SDT.getValue()); + } + if (ObjectUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())) { + setProjectCertificationInventoryPermission(projectCertificationInventoryEO.getDutyPerson(), projectCertificationInventoryEO.getProjectLibraryId(), projectCertificationInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_DP.getValue()); + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + } + + private void editDeliverableTemplate(ProjectCertificationInventoryEO newPciEo, List oldPciEoList, LoginUser currentUser) { + String newDeliverableTemplate = newPciEo.getDeliverableTemplate(); + List oldPciEos = oldPciEoList.stream().filter(pldPciEo -> { + boolean flag = ( + !newDeliverableTemplate.equals(pldPciEo.getDeliverableTemplate()) + && ( + StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(oldPciEos)){ + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(oldPciEos.get(0).getProjectLibraryId()); + if(ObjectUtils.isNotEmpty(projectLibraryBase)){ + int role = checkUserRole(oldPciEos.get(0).getProjectLibraryId(),currentUser.getId()); + for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) { + String msgTitleCn = ""; + String msgTitleEn = ""; + String taskDefinitionKey = ""; + if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + msgTitleCn = ProjectMessageEnum.RZRWQR.getCnName(); + msgTitleEn = ProjectMessageEnum.RZRWQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(); + }else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())) { + msgTitleCn = ProjectMessageEnum.PREHOMEQR.getCnName(); + msgTitleEn = ProjectMessageEnum.PREHOMEQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_HANDLING.getKey(); + } + List userIdList = new ArrayList<>(); + userIdList.add(oldPciEo.getDutyPerson()); + if(role == ProjectRoleEnum.STUDIO_ENGINEER.getIntValue()){ + userIdList.addAll(Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","))); + } + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + oldPciEo.setEndTime(newPciEo.getEndTime()); + List PciEoList = new ArrayList<>(); + PciEoList.add(oldPciEo); + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + oldPciEo.getEndTime(), + taskDefinitionKey, + msgTitleCn, + msgTitleEn, + ProjectMessageEnum.RZRWJFWMBBXG.getCnName(), + ProjectMessageEnum.RZRWJFWMBBXG.getEnName() + ); + } + } + } + } + + private void editDeliverableType(ProjectCertificationInventoryEO newPciEo, List oldPciEoList, LoginUser currentUser) { + String newDeliverableType = newPciEo.getDeliverableType(); + List oldPciEos = oldPciEoList.stream().filter(pldPciEo -> { + boolean flag = ( + !newDeliverableType.equals(pldPciEo.getDeliverableType()) + && ( + StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(oldPciEos)){ + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(oldPciEos.get(0).getProjectLibraryId()); + if(ObjectUtils.isNotEmpty(projectLibraryBase)){ + int role = checkUserRole(oldPciEos.get(0).getProjectLibraryId(),currentUser.getId()); + for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) { + String msgTitleCn = ""; + String msgTitleEn = ""; + String taskDefinitionKey = ""; + if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + msgTitleCn = ProjectMessageEnum.RZRWQR.getCnName(); + msgTitleEn = ProjectMessageEnum.RZRWQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(); + }else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())) { + msgTitleCn = ProjectMessageEnum.PREHOMEQR.getCnName(); + msgTitleEn = ProjectMessageEnum.PREHOMEQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_HANDLING.getKey(); + } + List userIdList = new ArrayList<>(); + userIdList.add(oldPciEo.getDutyPerson()); + if(role == ProjectRoleEnum.STUDIO_ENGINEER.getIntValue()){ + if(StringUtils.isNotBlank(projectLibraryBase.getCertificationEngineer())){ + userIdList.addAll(Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","))); + } + } + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + oldPciEo.setEndTime(newPciEo.getEndTime()); + List PciEoList = new ArrayList<>(); + PciEoList.add(oldPciEo); + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + oldPciEo.getEndTime(), + taskDefinitionKey, + msgTitleCn, + msgTitleEn, + ProjectMessageEnum.RZRWJFWLXBXG.getCnName(), + ProjectMessageEnum.RZRWJFWLXBXG.getEnName() + ); + } + } + } + } + + /** + * 编辑工程接口人处理逻辑 + */ + private void editSdt(ProjectCertificationInventoryEO pciEo, List oldPciEoList,LoginUser currentUser) { + // 过滤出来,旧数据的接口人与新修改的接口人不是同一个人 + List oldPciEos = oldPciEoList.stream().filter(oldPciEo -> { + boolean flag = ( + !StringUtils.equals(oldPciEo.getDutyPerson(), pciEo.getDutyPerson()) + && ( + StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) { + List userIdList = new ArrayList<>(); + userIdList.add(oldPciEo.getSdt()); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + + List PciEoList = new ArrayList<>(); + PciEoList.add(oldPciEo); + if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(), + ProjectMessageEnum.RZRWQR.getCnName(), + ProjectMessageEnum.RZRWQR.getEnName(), + ProjectMessageEnum.RWBFQRCH.getCnName(), + ProjectMessageEnum.RWBFQRCH.getEnName() + ); + }else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){ + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey(), + ProjectMessageEnum.PREHOMEQR.getCnName(), + ProjectMessageEnum.PREHOMEQR.getEnName(), + ProjectMessageEnum.RWBFQRCH.getCnName(), + ProjectMessageEnum.RWBFQRCH.getEnName() + ); + } + } + if (CollectionUtils.isNotEmpty(oldPciEos)) { + List userIdList = oldPciEos.stream().map(ProjectCertificationInventoryEO::getSdt).distinct().collect(Collectors.toList()); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + if (StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + this.sendMessageByTemplateId( + oldPciEos, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(), + ProjectMessageEnum.RZRWQR.getCnName(), + ProjectMessageEnum.RZRWQR.getEnName(), + ProjectMessageEnum.RZQRRWYQ.getCnName(), + ProjectMessageEnum.RZQRRWYQ.getEnName() + ); + }else if(StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){ + this.sendMessageByTemplateId( + oldPciEos, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey(), + ProjectMessageEnum.PREHOMEQR.getCnName(), + ProjectMessageEnum.PREHOMEQR.getEnName(), + ProjectMessageEnum.RZQRRWYQ.getCnName(), + ProjectMessageEnum.RZQRRWYQ.getEnName() + ); + } + } + } + + /** + * 编辑责任人处理逻辑 + * @param pciEo + */ + private void editDutyPerson(ProjectCertificationInventoryEO pciEo,List oldPciEoList,LoginUser currentUser) { + // 过滤出来,旧数据的责任人与新修改的责任人不是同一个人,并且流程状态是 任务待确认、结果待提交、审查退回的数据,这三个状态的流程数据在责任人节点。 + List oldPciEos = oldPciEoList.stream().filter(oldPciEo -> { + boolean flag = ( + !StringUtils.equals(oldPciEo.getDutyPerson(), pciEo.getDutyPerson()) + && ( + StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) { + List userIdList = new ArrayList<>(); + userIdList.add(oldPciEo.getDutyPerson()); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + List PciEoList = new ArrayList<>(); + PciEoList.add(oldPciEo); + if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(), + ProjectMessageEnum.RZRWQR.getCnName(), + ProjectMessageEnum.RZRWQR.getEnName(), + ProjectMessageEnum.RWBFQRCH.getCnName(), + ProjectMessageEnum.RWBFQRCH.getEnName() + ); + }else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){ + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey(), + ProjectMessageEnum.PREHOMEQR.getCnName(), + ProjectMessageEnum.PREHOMEQR.getEnName(), + ProjectMessageEnum.RWBFQRCH.getCnName(), + ProjectMessageEnum.RWBFQRCH.getEnName() + ); + } + } + if (CollectionUtils.isNotEmpty(oldPciEos)) { + List userIdList = oldPciEos.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + if (StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + this.sendMessageByTemplateId( + oldPciEos, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(), + ProjectMessageEnum.RZRWQR.getCnName(), + ProjectMessageEnum.RZRWQR.getEnName(), + ProjectMessageEnum.RZQRRWYQ.getCnName(), + ProjectMessageEnum.RZQRRWYQ.getEnName() + ); + }else if(StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){ + this.sendMessageByTemplateId( + oldPciEos, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey(), + ProjectMessageEnum.PREHOMEQR.getCnName(), + ProjectMessageEnum.PREHOMEQR.getEnName(), + ProjectMessageEnum.RZQRRWYQ.getCnName(), + ProjectMessageEnum.RZQRRWYQ.getEnName() + ); + } + + // 如果责任人有变更,将之前责任人的待办中心任务,移交给新的责任人。 + QueryWrapper detailQueryWrap = new QueryWrapper<>(); + List idList = Arrays.asList(pciEo.getId().split(",")); + detailQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, idList); + detailQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType, FlowTypeEnum.CERTIFICATION_LC.getValue()); + detailQueryWrap.lambda().eq(ProcessInfoDetailEO::getStatus, TaskStatusEnum.NOT_DONE.getValue()); + List taskDefinitionKeyList = new ArrayList<>(); + taskDefinitionKeyList.add(CertificationFlowNodeEnum.ZRRJSRW.getKey()); + taskDefinitionKeyList.add(CertificationFlowNodeEnum.ZRRTJRW.getKey()); + detailQueryWrap.lambda().in(ProcessInfoDetailEO::getTaskDefinitionKey, taskDefinitionKeyList); + + List processInfoDetailEOList = this.processInfoDetailEOService.list(detailQueryWrap); + if (CollectionUtils.isNotEmpty(processInfoDetailEOList)) { + processInfoDetailEOList.forEach(detail -> { + detail.setUserId(pciEo.getDutyPerson()); + }); + this.processInfoDetailEOService.updateBatchById(processInfoDetailEOList); + } + } + } + + /** + * 编辑截止日期处理逻辑 + * @param newPciEo 最新编辑的认证清单信息 + * @param oldPciEoList 旧的认证清单数组 + */ + private void editEndTime(ProjectCertificationInventoryEO newPciEo, List oldPciEoList,LoginUser currentUser) { + Date newEndTime = newPciEo.getEndTime(); + // 过滤出来,旧的截止日期不等于更改后的新截止日期,并且数据状态为 任务待确认、结果待提交、审查退回的数据。 + List oldPciEos = oldPciEoList.stream().filter(pldPciEo -> { + boolean flag = ( + !newEndTime.equals(pldPciEo.getEndTime()) + && ( + StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(oldPciEos)){ + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(oldPciEos.get(0).getProjectLibraryId()); + if(ObjectUtils.isNotEmpty(projectLibraryBase)){ + // 同步更新待办中心-流程明细截止日期 + this.syncProcessInfoDetailEndTime(newEndTime, oldPciEos); + int role = checkUserRole(oldPciEos.get(0).getProjectLibraryId(),currentUser.getId()); + for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) { + String msgTitleCn = ""; + String msgTitleEn = ""; + String taskDefinitionKey = ""; + if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + msgTitleCn = ProjectMessageEnum.RZRWQR.getCnName(); + msgTitleEn = ProjectMessageEnum.RZRWQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(); + }else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())) { + msgTitleCn = ProjectMessageEnum.PREHOMEQR.getCnName(); + msgTitleEn = ProjectMessageEnum.PREHOMEQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_HANDLING.getKey(); + } + List userIdList = new ArrayList<>(); + userIdList.add(oldPciEo.getDutyPerson()); + if(role == ProjectRoleEnum.STUDIO_ENGINEER.getIntValue()){ + if(StringUtils.isNotBlank(projectLibraryBase.getCertificationEngineer())){ + userIdList.addAll(Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","))); + } + }else if(role == ProjectRoleEnum.HOMOLOGATION_ENGINEER.getIntValue()){ + userIdList.add(projectLibraryBase.getStudioEngineer()); + } + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + oldPciEo.setEndTime(newPciEo.getEndTime()); + List PciEoList = new ArrayList<>(); + PciEoList.add(oldPciEo); + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + oldPciEo.getEndTime(), + taskDefinitionKey, + msgTitleCn, + msgTitleEn, + ProjectMessageEnum.RZRWJZSJBXG.getCnName(), + ProjectMessageEnum.RZRWJZSJBXG.getEnName() + ); + } + } + } + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @Override + public void deleteById(String id) { + removeById(id); + + QueryWrapper detailRemoveWrap = new QueryWrapper<>(); + detailRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId,id); + this.processInfoDetailEOService.remove(detailRemoveWrap); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @Override + public void deleteByIds(List ids) { + QueryWrapper queryWrap = new QueryWrapper<>(); + queryWrap.lambda().in(ProjectCertificationInventoryEO::getId,ids); + List list = this.list(queryWrap); + removeByIds(ids); + + QueryWrapper detailRemoveWrap = new QueryWrapper<>(); + detailRemoveWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId,ids); + detailRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,list.get(0).getProjectLibraryId()); + this.processInfoDetailEOService.remove(detailRemoveWrap); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @Override + public ProjectCertificationInventoryEO queryById(String id) { + return getById(id); + } + + /** + * 列表查询 + * + * @return + */ + @Override + public List queryList() { + return list(); + } + + @Override + public Result batchAdd(JSONObject json) { + String cut = json.getString("cut"); + List result = new ArrayList<>(); + if(StringUtils.equals(cut,CutEnum.CN.getValue())){ + result.add("添加成功!"); + }else { + result.add("Successfully added!"); + } + try { + String serialNumber = json.getString("serialNumber"); + String wvtaId = json.getString("wvtaId"); + String bussDocumentLibraryId = json.getString("bussDocumentLibraryId"); + String projectLibraryId = json.getString("projectLibraryId"); + + + JSONArray dataList = json.getJSONArray("dataList"); + List projectCertificationInventoryEOList = new ArrayList<>(); + ProjectCertificationInventoryEO projectCertificationInventoryEO = null; + for (Object data : dataList) { + projectCertificationInventoryEO = JSONObject.parseObject(JSONObject.toJSONString(data),ProjectCertificationInventoryEO.class); + projectCertificationInventoryEO.setSerialNumber(serialNumber); + projectCertificationInventoryEO.setWvtaId(wvtaId); + projectCertificationInventoryEO.setBussDocumentLibraryId(bussDocumentLibraryId); + projectCertificationInventoryEO.setProjectLibraryId(projectLibraryId); + projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + projectCertificationInventoryEO.setCertificationProgress(CertificationProgressEnum.NOT_START.getValue()); + projectCertificationInventoryEOList.add(projectCertificationInventoryEO); + } + // 处理提示信息, 类别+检验项目+配置项+编号+责任领域 作为唯一检验 + // List saveDataList = this.dataUniqueCheck(projectCertificationInventoryEOList,cut,result,projectLibraryId); + + if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ + this.saveBatch(projectCertificationInventoryEOList); + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD.getValue()); + + Date now = new Date(); + //设置权限 先删后加 + List adds = new ArrayList<>(); + for (ProjectCertificationInventoryEO pci: projectCertificationInventoryEOList) { + if (ObjectUtils.isNotEmpty(pci.getSdt())) { + setProjectCertificationInventoryPermission(pci.getSdt(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_SDT.getValue()); + } + if (ObjectUtils.isNotEmpty(pci.getDutyPerson())) { + setProjectCertificationInventoryPermission(pci.getDutyPerson(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_DP.getValue()); + } + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + } + }catch (Exception ex){ + ex.printStackTrace(); + log.error("批量添加认证清单失败:" + ex.getMessage()); + throw new JeroBootException("添加失败!"); + } + return Result.OK(result); + } + + @Override + public Result setBatch(ProjectCertificationInventoryEO projectCertificationInventoryEO) { + //获取当前用户 + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String ids = projectCertificationInventoryEO.getIds(); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行批量设置!"); + } + try { + List idList = Arrays.asList(ids.split(",")); + + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,idList); + List pciEoList = this.list(pciQueryWrap); + + List updateList = new ArrayList<>(); + for (String id : idList) { + ProjectCertificationInventoryEO updateProjectCertificationInventoryEO = new ProjectCertificationInventoryEO(); + BeanUtils.copyProperties(projectCertificationInventoryEO,updateProjectCertificationInventoryEO); + updateProjectCertificationInventoryEO.setId(id); + + /** + * 2023-03-30 17.36新增该需求。 + * 如果用户批量设置了工程接口人字段 + * 那就需要判断所选数据中责任人是否为空 + * 如果责任人字段为空时 需要将工程接口人带入到所选数据的责任人字段中 + */ + if(StringUtils.isNotBlank(projectCertificationInventoryEO.getSdt())){ + List pciEoListTemp = pciEoList.stream().filter(pciEo -> { + boolean flag = false; + if (StringUtils.equals(pciEo.getId(), id)) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(pciEoListTemp)){ + ProjectCertificationInventoryEO pciEo = pciEoListTemp.get(0); + if(StringUtils.isEmpty(pciEo.getDutyPerson())){ + updateProjectCertificationInventoryEO.setDutyPerson(projectCertificationInventoryEO.getSdt()); + } + } + } + + updateList.add(updateProjectCertificationInventoryEO); + } + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getSdt())){ + // 编辑工程接口人处理逻辑 + this.editSdt(projectCertificationInventoryEO,pciEoList,currentUser); + } + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){ + // 编辑责任人处理逻辑 + this.editDutyPerson(projectCertificationInventoryEO,pciEoList,currentUser); + } + if(projectCertificationInventoryEO.getEndTime() != null){ + // 编辑截至日期处理逻辑 + this.editEndTime(projectCertificationInventoryEO, pciEoList,currentUser); + } + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType()) ){ + // 编辑交付物类型逻辑 + this.editDeliverableType(projectCertificationInventoryEO, pciEoList, currentUser); + } + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())){ + // 编辑交付物模板逻辑 + this.editDeliverableTemplate(projectCertificationInventoryEO, pciEoList, currentUser); + } + +// List flowStatusList = new ArrayList<>(); +// flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); +// +// QueryWrapper certificationQueryWrap = new QueryWrapper<>(); +// certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,idList); +//// certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); +// List projectCertificationInventoryEOS = this.list(certificationQueryWrap); +// +// if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOS)){ +// List pciEoListTemp = projectCertificationInventoryEOS.stream().filter(certificationInventory -> { +// boolean flag = false; +// if(StringUtils.equals(certificationInventory.getFlowStatus(),CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())){ +// if(projectCertificationInventoryEO.getEndTime() != null && certificationInventory.getEndTime() != null){ +// if(!projectCertificationInventoryEO.getEndTime().equals(certificationInventory.getEndTime())){ +// flag = true; +// } +// } +// } +// return flag; +// }).collect(Collectors.toList()); +// +// if (CollectionUtils.isNotEmpty(pciEoListTemp)) { +// ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(pciEoListTemp.get(0).getProjectLibraryId()); +// if(ObjectUtils.isNotEmpty(projectLibraryBase)){ +// List userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); +// List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); +// +// this.sendMessageByTemplateId( +// pciEoListTemp, +// TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(), +// userIdList, +// userInfoList, +// projectCertificationInventoryEO.getEndTime(),"" +// ); +// } +// } +// +// this.syncProcessInfoDetailEndTime(projectCertificationInventoryEO.getEndTime(),projectCertificationInventoryEOS); +// } + if(CollectionUtils.isNotEmpty(updateList)){ + this.updateBatchById(updateList); + } + + Date now = new Date(); + //设置权限 先删后加 + List adds = new ArrayList<>(); + for (ProjectCertificationInventoryEO pci: updateList) { + if (ObjectUtils.isNotEmpty(pci.getSdt())) { + setProjectCertificationInventoryPermission(pci.getSdt(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_SDT.getValue()); + } + if (ObjectUtils.isNotEmpty(pci.getDutyPerson())) { + setProjectCertificationInventoryPermission(pci.getDutyPerson(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_DP.getValue()); + } + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + }catch (Exception ex){ + ex.printStackTrace(); + log.error("批量设置失败:" + ex.getMessage()); + throw new JeroBootException("批量设置失败!"); + } + return Result.OK("批量设置成功!"); + } + + /** + * 根据模板发送消息 + */ + @Override + public void sendMessageByTemplateId(List projectCertificationInventoryEOS, + String templeteId, + List userIdList, + List userInfoList, + Date endTime, + String taskDefinitionKey){ + this.sendMessageByTemplateId(projectCertificationInventoryEOS,templeteId,userIdList,userInfoList,endTime,taskDefinitionKey,"","","",""); + } + + /** + * 根据模板发送消息(可发送公共消息) + */ + private void sendMessageByTemplateId(List projectCertificationInventoryEOS, + String templeteId, + List userIdList, + List userInfoList, + Date endTime, + String taskDefinitionKey, + String msgTitleCn, + String msgTitleEn, + String contentCn, + String contentEn){ + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectCertificationInventoryEOS.get(0).getProjectLibraryId()); + if(ObjectUtils.isNotEmpty(projectLibraryBase)){ + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + // 获取认证清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + String hrefFeishu_CN_P = (String) hrefFeishuMap.get("hrefFeishu_CN_P"); + if(StringUtils.isNotEmpty(taskDefinitionKey)){ + hrefFeishu_CN_P = this.handlePhoneLink(projectLibraryBase.getId(),PRN_CN,taskDefinitionKey); + } + + Map standNameAndItemName = this.platformProjectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOS); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + try { + for (String userId : userIdList) { + String thirdId = this.sysUserService.getUserThirdIdByUserId(userInfoList,userId); + + if(StringUtils.isNotEmpty(thirdId)){ + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 +// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOS); +// Date endTime = projectCertificationInventoryEOS.get(0).getEndTime(); + + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", templeteId); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + if(StringUtils.isNotEmpty(msgTitleCn)){ + templateVariableMap.put("msgTitleCn",msgTitleCn); + } + if(StringUtils.isNotEmpty(msgTitleEn)){ + templateVariableMap.put("msgTitleEn",msgTitleEn); + } + if(StringUtils.isNotEmpty(contentCn)){ + templateVariableMap.put("contentCn",contentCn); + } + if(StringUtils.isNotEmpty(contentEn)){ + templateVariableMap.put("contentEn",contentEn); + } + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); + + templateVariableMap.put("operateUserName",currentUser.getUsername()); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + } + } + + /** + * 处理提示信息 + * @param projectCertificationInventoryEOList + * @param cut + * @param result + */ + @Override + public List dataUniqueCheck(List projectCertificationInventoryEOList, String cut,List result,String projectLibraryId) { + List pciSaveList = new ArrayList<>(); + + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); + List allDataList = this.list(pciQueryWrap); + // 重复数据数组 + List duplicateDataList = allDataList.stream().filter(data -> { + boolean flag = false; + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + boolean categoryFlag = StringUtils.equals(projectCertificationInventoryEO.getCategory(), data.getCategory()); + boolean inspectionItemFlag = StringUtils.equals(projectCertificationInventoryEO.getInspectionItem(), data.getInspectionItem()); + boolean configItemFlag = StringUtils.equals(projectCertificationInventoryEO.getConfigItem(), data.getConfigItem()); + boolean serialNumberFlag = StringUtils.equals(projectCertificationInventoryEO.getSerialNumber(), data.getSerialNumber()); + boolean dutyTerritoryFlag = StringUtils.equals(projectCertificationInventoryEO.getDutyTerritory(), data.getDutyTerritory()); + // 类别+检验项目+配置项+编号+责任领域 作为唯一检验 + if(categoryFlag && inspectionItemFlag && configItemFlag && serialNumberFlag && dutyTerritoryFlag){ + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(duplicateDataList)){ + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + result.add("您所选的数据中包含当前项目中已包含的条目信息,已为您过滤添加。"); + }else { + result.add("The data you have selected contains item information already included in the current project, which has been filtered and added for you."); + } + } + + // 过滤重复的数据 + pciSaveList = projectCertificationInventoryEOList.stream().filter(pciEO -> { + boolean flag = true; + for (ProjectCertificationInventoryEO allData : allDataList) { + boolean categoryFlag = StringUtils.equals(pciEO.getCategory(), allData.getCategory()); + boolean inspectionItemFlag = StringUtils.equals(pciEO.getInspectionItem(), allData.getInspectionItem()); + boolean configItemFlag = StringUtils.equals(pciEO.getConfigItem(), allData.getConfigItem()); + boolean serialNumberFlag = StringUtils.equals(pciEO.getSerialNumber(), allData.getSerialNumber()); + boolean dutyTerritoryFlag = StringUtils.equals(pciEO.getDutyTerritory(), allData.getDutyTerritory()); + // 类别+检验项目+配置项+编号+责任领域 作为唯一检验 + if(categoryFlag && inspectionItemFlag && configItemFlag && serialNumberFlag && dutyTerritoryFlag){ + flag = false; + break; + } + } + return flag; + }).collect(Collectors.toList()); + return pciSaveList; + } + + @Override + public Result updateStatusBatch(JSONObject json) { + String ids = json.getString("ids"); + String flowStatus = json.getString("flowStatus"); + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if(StringUtils.isNotEmpty(ids)){ + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,Arrays.asList(ids.split(","))); + List pciEoList = this.list(pciQueryWrap); + if(CollectionUtils.isNotEmpty(pciEoList)){ + pciEoList.forEach(pciEo -> { + pciEo.setFlowStatus(flowStatus); + processHistoryEOService.add(pciEo.getId(),CertificationFlowNodeEnum.TASK_SS.getKey(),currentUser.getId(),null,null,null); + }); + this.updateBatchById(pciEoList); + + // 如果是责任人操作补充提交按钮。给责任人生成对应待办中心的待办任务。 + if(StringUtils.equals(flowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())){ + List processInfoDetailEOList = new ArrayList<>(); + pciEoList.forEach(pciEo -> { + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setUserId(pciEo.getDutyPerson()); + processInfoDetailEO.setEndTime(pciEo.getEndTime()); + processInfoDetailEO.setProjectLawsInventoryId(pciEo.getId()); + processInfoDetailEOList.add(processInfoDetailEO); + }); + + // 给责任人分配待办中心的任务 (待提交) + this.addProcessInfoDetailEO(processInfoDetailEOList,pciEoList.get(0).getProjectLibraryId(),CertificationFlowNodeEnum.ZRRTJRW.getKey()); + } + } + } + return new Result<>().success("批量更新状态成功!"); + } + + @Override + public void importDisposeData(List datas, String cut) { + if(CollectionUtils.isNotEmpty(datas)){ + List categoryList = this.sysCategoryService.list(); + List sysDictItems = this.sysDictItemServiceImpl.getBaseMapper().selectItemsAll(); + + List userNameList = new ArrayList<>(); + + userNameList.addAll(datas.stream().map(ProjectCertificationInventoryEO::getSdtName).collect(Collectors.toList())); + userNameList.addAll(datas.stream().map(ProjectCertificationInventoryEO::getDutyPersonName).collect(Collectors.toList())); + List sysUserList = this.sysUserService.queryUserIdListByNameList(userNameList); + + for(ProjectCertificationInventoryEO data : datas){ + //通过工程接口人名字获取sdt + if(StringUtils.isNotEmpty(data.getSdtName())){ + String sdt = sysUserList.stream().filter(sysUser -> { + boolean flag = false; + if (StringUtils.equals(sysUser.getUsername(), data.getSdtName())) { + flag = true; + } + return flag; + }).map(SysUser::getId).collect(Collectors.joining(",")); + data.setSdt(sdt); + } + //通过责任人的名字获取dutyperson + if(StringUtils.isNotEmpty(data.getDutyPersonName())){ + String dutyPerson = sysUserList.stream().filter(sysUser -> { + boolean flag = false; + if (StringUtils.equals(sysUser.getUsername(), data.getDutyPersonName())) { + flag = true; + } + return flag; + }).map(SysUser::getId).collect(Collectors.joining(",")); + data.setDutyPerson(dutyPerson); + } + //交付物类型 + if(CutEnum.CN.getValue().equals(cut)){ + if(StringUtils.isNotEmpty(data.getDeliverableTypeName())){ + String deliverableType = this.getTreeNameImport(cut, categoryList, Arrays.asList(data.getDeliverableTypeName().split(","))); + data.setDeliverableType(deliverableType); + + String valueType = categoryList.stream().filter(category -> { + boolean flag = false; + if (StringUtils.equals(data.getDeliverableTypeName(), category.getName())) { + flag = true; + } + return flag; + }).map(SysCategory::getValueType).distinct().collect(Collectors.joining(",")); + data.setValueType(valueType); + } + }else { + if(StringUtils.isNotEmpty(data.getDeliverableTypeNameEn())){ + + String deliverableType = this.getTreeNameImport(CutEnum.EN.getValue(), categoryList, Arrays.asList(data.getDeliverableTypeNameEn().split(","))); + data.setDeliverableType(deliverableType); + + String valueType = categoryList.stream().filter(category -> { + boolean flag = false; + if (StringUtils.equals(data.getDeliverableTypeNameEn(), category.getEnName())) { + flag = true; + } + return flag; + }).map(SysCategory::getValueType).distinct().collect(Collectors.joining(",")); + data.setValueType(valueType); + } + } + //责任领域 + if(StringUtils.isNotEmpty(data.getDutyTerritoryName())){ + String dutyTerritory = this.sysDictItemService.disposeShowDictItemText(sysDictItems,data.getDutyTerritoryName(),cut, ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()); + data.setDutyTerritory(dutyTerritory); + } + //通过编号查找文档库的id + if(StringUtils.isNotEmpty(data.getSerialNumber())){ + BussDocumentLibraryEO bySerialNumber = bussDocumentLibraryEOMapper.getBySerialNumber(data.getSerialNumber()); + data.setBussDocumentLibraryId(bySerialNumber.getId()); + } + List list = new ArrayList<>(); + list.add(data); + if (list!=null&&list.size()>0) { + platformProjectCertificationInventoryEOService.saveBatch(list); + } + Date now = new Date(); + //设置权限 先删后加 + List adds = new ArrayList<>(); + for (ProjectCertificationInventoryEO pci: list) { + if (ObjectUtils.isNotEmpty(pci.getSdt())) { + setProjectCertificationInventoryPermission(pci.getSdt(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_SDT.getValue()); + } + if (ObjectUtils.isNotEmpty(pci.getDutyPerson())) { + setProjectCertificationInventoryPermission(pci.getDutyPerson(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_DP.getValue()); + } + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + } + } + } + + @Override + public String getTreeNameImport(String cut, List categoryList, List technologyTerritoryList) { + StringBuilder sb = new StringBuilder(); + for (String technologyTerritory : technologyTerritoryList) { + List collect = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(cut)){ + collect = categoryList.stream().filter(e -> technologyTerritory.equals(e.getName())).collect(Collectors.toList()); + }else { + collect = categoryList.stream().filter(e -> technologyTerritory.equals(e.getEnName())).collect(Collectors.toList()); + } + if(collect!=null&&collect.size()>0){ + sb.append(collect.get(0).getId()); + } + } + String technologyTerritoryId = ""; + if (StringUtils.isNotBlank(sb)) { + technologyTerritoryId = sb.substring(0, sb.length()-0); + } + return technologyTerritoryId; + } + + @Override + public void disposeData(List datas, String cut) { + if (CollectionUtils.isNotEmpty(datas)) { + List categoryList = this.sysCategoryService.list(); + List sysDictItems = this.sysDictItemServiceImpl.getBaseMapper().selectItemsAll(); + List certificationProgress = this.sysDictItemServiceImpl.selectItemsByDictCode("certification_progress"); + + List userIdList = new ArrayList<>(); + + userIdList.addAll(datas.stream().map(ProjectCertificationInventoryEO::getSdt).collect(Collectors.toList())); + userIdList.addAll(datas.stream().map(ProjectCertificationInventoryEO::getDutyPerson).collect(Collectors.toList())); + List sysUserList = this.sysUserService.querySysUserListByIdList(userIdList); + + for (ProjectCertificationInventoryEO data : datas) { + if(StringUtils.isNotEmpty(data.getSdt())){ + String sdtName = sysUserList.stream().filter(sysUser -> { + boolean flag = false; + if (StringUtils.equals(sysUser.getId(), data.getSdt())) { + flag = true; + } + return flag; + }).map(SysUser::getUsername).collect(Collectors.joining(",")); + data.setSdtName(sdtName); + } + if(StringUtils.isNotEmpty(data.getDutyPerson())){ + String dutyPersonName = sysUserList.stream().filter(sysUser -> { + boolean flag = false; + if (StringUtils.equals(sysUser.getId(), data.getDutyPerson())) { + flag = true; + } + return flag; + }).map(SysUser::getUsername).collect(Collectors.joining(",")); + data.setDutyPersonName(dutyPersonName); + } + if(StringUtils.isNotEmpty(data.getFlowStatus())){ + data.setFlowStatusName(CertificationInventoryFlowStatusEnum.getTextByValue(data.getFlowStatus(),cut)); + } + if(StringUtils.isNotEmpty(data.getDeliverableType())){ + String deliverableTypeName = this.getTreeName(cut, categoryList, Arrays.asList(data.getDeliverableType().split(","))); + data.setDeliverableTypeName(deliverableTypeName); + + String deliverableTypeNameEn = this.getTreeName(CutEnum.EN.getValue(), categoryList, Arrays.asList(data.getDeliverableType().split(","))); + data.setDeliverableTypeNameEn(deliverableTypeNameEn); + + String valueType = categoryList.stream().filter(category -> { + boolean flag = false; + if (StringUtils.equals(data.getDeliverableType(), category.getId())) { + flag = true; + } + return flag; + }).map(SysCategory::getValueType).distinct().collect(Collectors.joining(",")); + data.setValueType(valueType); + } + if(StringUtils.isNotEmpty(data.getDutyTerritory())){ + String dutyTerritoryName = this.sysDictItemService.disposeShowDictItemValue(sysDictItems,data.getDutyTerritory(),cut, ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()); + data.setDutyTerritoryName(dutyTerritoryName); + } + if(StringUtils.isNotEmpty(data.getCertificationProgress())){ + String certificationProgress_dictText = ""; + List collect = certificationProgress.stream() + .filter(dict -> StringUtils.equals(dict.getItemValue(), data.getCertificationProgress())) + .collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(collect)){ + if(StringUtils.equals(cut,CutEnum.CN.getValue())){ + certificationProgress_dictText = collect.get(0).getItemText(); + }else if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + certificationProgress_dictText = collect.get(0).getEnName(); + } + } + data.setCertificationProgress_dictText(certificationProgress_dictText); + } +// String GetEndTime = String.valueOf(data.getEndTime()); +// if(StringUtils.isNotEmpty(GetEndTime)){ +// Date endTime = new Date(); +// if(StringUtils.equals(cut,CutEnum.CN.getValue())){ +// endTime = data.getEndTime(); +// }else { +// endTime = data.getEndTime(); +// } +// data.setEndTimeStr(String.valueOf(endTime)); +// } + if(StringUtils.isNotEmpty(data.getAttestationType())){ + String attestationTypeName = this.sysDictItemService.disposeShowDictItemValue(sysDictItems,data.getAttestationType(),cut, "ren4_zheng4_qing1_dan1_-_ren4_zheng4_lei4_xing2"); + data.setAttestationTypeName(attestationTypeName); + } + + if(StringUtils.isNotEmpty(data.getCertificationProgress())){ + String cpNumber = CertificationProgressEnum.getNumberByValue(data.getCertificationProgress()); + data.setCertificationProgressNumber(cpNumber); + } + } + } + } + + + + @Override + public String getTreeName(String cut, List categoryList, List technologyTerritoryList) { + StringBuilder sb = new StringBuilder(); + for (String technologyTerritory : technologyTerritoryList) { + List collect = categoryList.stream().filter(e -> technologyTerritory.equals(e.getId())).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()+ ","); + } + } + } + String technologyTerritoryName = ""; + if (StringUtils.isNotBlank(sb)) { + technologyTerritoryName = sb.substring(0, sb.length() - 1); + } + return technologyTerritoryName; + } + + + /** + * 发布 + * @param json + * @return + */ + @Override + public Result issue(JSONObject json) { + String ids = json.getString("ids"); + String projectLibraryId = json.getString("projectLibraryId"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行发布!"); + } + String inventoryVerifyEndTimeStr = json.getString("inventoryVerifyEndTime"); + Date inventoryVerifyEndTime = DateUtils.str2Date(inventoryVerifyEndTimeStr, DateUtils.date_sdf.get()); + + String cut = json.getString("cut"); + + List idList = Arrays.asList(ids.split(",")); + + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()); + + // 根据页面选择的认证清单数据id,查询出状态为’清单待发布‘的数据,进行发布处理 + QueryWrapper certificationQueryWrap = new QueryWrapper<>(); + certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,idList); + certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.list(certificationQueryWrap); + + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + throw new JeroBootException("Select at least one data flow whose status is' List to be released or Certification returned '!"); + }else { + throw new JeroBootException("至少选择一条数据流程状态为'清单待发布 或 认证退回'的数据!"); + } + + } + List processInfoDetailEOList = new ArrayList<>(); + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + // 将数据的状态更新为:清单待校核,更新截止时间。等待认证工程师进行操作。 + projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + projectCertificationInventoryEO.setInventoryVerifyEndTime(inventoryVerifyEndTime); + processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.LIST_CONFIRMATION.getKey(),currentUser.getId(),null,null,null); + } + + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_ISSUE.getValue()); + + this.updateBatchById(projectCertificationInventoryEOList); + + // 根据项目库id查询当前项目认证清单数据,获取清单校核截止时间 最早的一个时间 + flowStatusList.clear(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()); + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); + pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List pciEoList = this.list(pciQueryWrap); + if(CollectionUtils.isNotEmpty(pciEoList)){ + List inventoryVerifyEndTimeList = pciEoList.stream().map(ProjectCertificationInventoryEO::getInventoryVerifyEndTime).distinct().collect(Collectors.toList()); + inventoryVerifyEndTimeList.add(inventoryVerifyEndTime); + Collections.sort(inventoryVerifyEndTimeList, (d1, d2) -> d1.compareTo(d2)); // 根据时间顺序排序 + inventoryVerifyEndTime = inventoryVerifyEndTimeList.get(0); + } + + // 获取项目信息,获取认证工程师,给认证工程师分配待办任务 + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if(ObjectUtils.isNotEmpty(projectLibraryBase)){ + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + if(ObjectUtils.isEmpty(projectLibraryBase)){ + throw new JeroBootException("无法获取项目信息,请稍后重试!"); + } + String certificationEngineer = projectLibraryBase.getCertificationEngineer(); + if(StringUtils.isEmpty(certificationEngineer)){ + if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + throw new JeroBootException("There is no certified engineer in this project. Please maintain the certified engineer first!"); + }else { + throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!"); + } + } + + List certificationEngineerIdList = Arrays.asList(certificationEngineer.split(",")); + // 给认证工程师分配任务 + for (String userId : certificationEngineerIdList) { + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setUserId(userId); + processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSJSRW.getKey()); + processInfoDetailEO.setCreateTime(new Date()); + processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); + processInfoDetailEO.setProcessInfoId(projectLibraryId); + processInfoDetailEO.setActiProcInstId(projectLibraryId); + processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); + processInfoDetailEO.setEndTime(inventoryVerifyEndTime); + processInfoDetailEOList.add(processInfoDetailEO); + } + + ProcessInfoEO processInfoEO = new ProcessInfoEO(); + this.addProcessInfoEO(processInfoEO,projectLibraryId); + + // 删除该项目数据的待办任务,key为 认证工程师接受任务的数据 + QueryWrapper deleteDetailWrap = new QueryWrapper<>(); + deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,processInfoEO.getId()); + deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSJSRW.getKey()); + deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); + this.processInfoDetailEOService.remove(deleteDetailWrap); + this.processInfoDetailEOService.saveBatch(processInfoDetailEOList); + + // 获取认证清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryId, PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + String hrefFeishu_CN_P = (String) hrefFeishuMap.get("hrefFeishu_CN_P"); + + + List certificationEngineerUserInfoList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + Date finalInventoryVerifyEndTime = inventoryVerifyEndTime; + certificationEngineerIdList.forEach(userId -> { + try { + String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerUserInfoList,userId); + + if(StringUtils.isNotEmpty(thirdId)){ + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE2.getValue()); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(finalInventoryVerifyEndTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); + + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + }); + } + + return Result.OK("发布成功!"); + } + + + /** + * 添加流程信息 + * @param processInfoEO + * @param projectLibraryId + */ + @Override + public void addProcessInfoEO(ProcessInfoEO processInfoEO,String projectLibraryId){ + processInfoEO.setId(projectLibraryId); + processInfoEO.setProjectLibraryId(projectLibraryId); + processInfoEO.setActiProcInstId(projectLibraryId); + processInfoEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); + // processInfoEO.setStatus(TodoCenterStatusEnum.LIST_TO_CONFIRM.getValue()); + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + processInfoEO.setCreateBy(currentUser.getId()); + + QueryWrapper deleteWrap = new QueryWrapper<>(); + deleteWrap.lambda().eq(ProcessInfoEO::getId,projectLibraryId); + this.processInfoEOService.remove(deleteWrap); + this.processInfoEOService.add(processInfoEO); + } + + /** + * 添加流程信息,用户的待办信息。 + * @param processInfoDetailEOList + * @param processInfoId + */ + @Override + public void addProcessInfoDetailEO(List processInfoDetailEOList,String processInfoId,String taskDefinitionKey){ + processInfoDetailEOList.forEach(detail -> { + detail.setActiProcInstId(processInfoId); + detail.setProcessInfoId(processInfoId); + detail.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); + detail.setTaskDefinitionKey(taskDefinitionKey); + detail.setStatus(TaskStatusEnum.NOT_DONE.getValue()); + detail.setCreateTime(new Date()); + }); + + List userIdList = processInfoDetailEOList.stream().map(ProcessInfoDetailEO::getUserId).distinct().collect(Collectors.toList()); + QueryWrapper removeWrap = new QueryWrapper<>(); + removeWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,processInfoId); + removeWrap.lambda().in(ProcessInfoDetailEO::getUserId,userIdList); + removeWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,taskDefinitionKey); + if(!StringUtils.equals(taskDefinitionKey,CertificationFlowNodeEnum.RZGCSSC.getKey())){ + List dataIdList = processInfoDetailEOList.stream().map(ProcessInfoDetailEO::getProjectLawsInventoryId).distinct().collect(Collectors.toList()); + removeWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId,dataIdList); + } + // 删除用户在这个认证清单流程中其它的待办任务 + this.processInfoDetailEOService.remove(removeWrap); + + this.processInfoDetailEOService.saveBatch(processInfoDetailEOList); + } + + @Override + public Result> getRoleByUserId(Map params) { + Result> result = new Result<>(); + String projectLibraryId = (String) params.get("projectLibraryId"); + String cut = (String) params.get("cut"); + + List sysRoles = new LinkedList<>(); + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + List projectLibraryBases = platformProjectLibraryBaseService.queryById(projectLibraryId, null); + + + //1、判断当前登录用户是否为该平台件项目的的法规工程师 + if(!projectLibraryBases.isEmpty() && loginUser.getUsername().equals(projectLibraryBases.get(0).getCreateBy())){ + SysRole sysRole = new SysRole(); + sysRole.setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getName()); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getCode()); + } + sysRoles.add(sysRole); + } + + // 接口人 + QueryWrapper querySdtCountWrap = new QueryWrapper<>(); + querySdtCountWrap.lambda().eq(ProjectCertificationInventoryEO::getSdt, loginUser.getId()); + querySdtCountWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryId); + Integer sdtCount = this.baseMapper.selectCount(querySdtCountWrap); + if (sdtCount > 0) { + SysRole sysRole = new SysRole(); + sysRole.setRoleCode(ProjectRoleEnum.INTERFACE_PERSON.getValue()); + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + sysRole.setRoleName(ProjectRoleEnum.INTERFACE_PERSON.getName()); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + sysRole.setRoleName(ProjectRoleEnum.INTERFACE_PERSON.getCode()); + } + sysRoles.add(sysRole); + } + + // 责任人 + QueryWrapper queryDutyPersonCountWrap = new QueryWrapper<>(); + queryDutyPersonCountWrap.lambda().eq(ProjectCertificationInventoryEO::getDutyPerson, loginUser.getId()); + queryDutyPersonCountWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryId); + Integer dutyPersonCount = this.baseMapper.selectCount(queryDutyPersonCountWrap); + if (dutyPersonCount > 0) { + SysRole sysRole = new SysRole(); + sysRole.setRoleCode(ProjectRoleEnum.PERSON_LIABLE.getValue()); + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + sysRole.setRoleName(ProjectRoleEnum.PERSON_LIABLE.getName()); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + sysRole.setRoleName(ProjectRoleEnum.PERSON_LIABLE.getCode()); + } + sysRoles.add(sysRole); + } + + // 领导、系统管理员、Viewer、品牌管理员 处理 + List roleList = this.sysRoleMapper.getRoleByUserId(loginUser.getId()); + if (roleList.size() != 0) { + List manager = roleList.stream().filter(e -> ProjectRoleEnum.MANAGER.getCode().equals(e.getRoleCode())).collect(Collectors.toList()); + List admin = roleList.stream().filter(e -> ProjectRoleEnum.ADMIN.getCode().equals(e.getRoleCode())).collect(Collectors.toList()); + List Viewer = roleList.stream().filter(e -> ProjectRoleEnum.VIEWER.getCode().equals(e.getRoleCode())).collect(Collectors.toList()); + List brandAdministrator = roleList.stream().filter(e -> ProjectRoleEnum.BRAND_ADMINISTRATOR.getCode().equals(e.getRoleCode())).collect(Collectors.toList()); + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + if (manager.size() != 0) { + manager.get(0).setRoleCode(ProjectRoleEnum.MANAGER.getValue()); + sysRoles.addAll(manager); + } + if (admin.size() != 0) { + admin.get(0).setRoleCode(ProjectRoleEnum.ADMIN.getValue()); + sysRoles.addAll(admin); + } + if (Viewer.size() != 0) { + Viewer.get(0).setRoleCode(ProjectRoleEnum.VIEWER.getValue()); + sysRoles.addAll(Viewer); + } + if (brandAdministrator.size() != 0) { + brandAdministrator.get(0).setRoleCode(ProjectRoleEnum.BRAND_ADMINISTRATOR.getValue()); + sysRoles.addAll(brandAdministrator); + } + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + if (manager.size() != 0) { + manager.get(0).setRoleCode(ProjectRoleEnum.MANAGER.getValue()); + manager.get(0).setRoleName(ProjectRoleEnum.MANAGER.getCode()); + sysRoles.addAll(manager); + } + if (admin.size() != 0) { + admin.get(0).setRoleCode(ProjectRoleEnum.ADMIN.getValue()); + admin.get(0).setRoleName(ProjectRoleEnum.ADMIN.getCode()); + sysRoles.addAll(admin); + } + if (Viewer.size() != 0) { + Viewer.get(0).setRoleCode(ProjectRoleEnum.VIEWER.getValue()); + Viewer.get(0).setRoleName(ProjectRoleEnum.VIEWER.getCode()); + sysRoles.addAll(Viewer); + } + if (brandAdministrator.size() != 0) { + brandAdministrator.get(0).setRoleCode(ProjectRoleEnum.BRAND_ADMINISTRATOR.getValue()); + brandAdministrator.get(0).setRoleName(ProjectRoleEnum.BRAND_ADMINISTRATOR.getCode()); + sysRoles.addAll(brandAdministrator); + } + } + } + + if (sysRoles == null || sysRoles.size() <= 0) { + result.error500("未找到角色信息"); + } else { + result.setResult(sysRoles); + result.setSuccess(true); + } + return result; + } + + @Override + public Result getFlowStatusList(String cut) { + List> result = new ArrayList<>(); + CertificationInventoryFlowStatusEnum[] values = CertificationInventoryFlowStatusEnum.values(); + for (CertificationInventoryFlowStatusEnum value : values) { + Map flowStatusMap = new HashMap<>(); + String name = value.getCnName(); + if(!CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getCnName().equals(name) + && !CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getEnName().equals(name) + && !CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getCnName().equals(name) + && !CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getEnName().equals(name)){ + if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + name = value.getEnName(); + } + flowStatusMap.put("name",name); + flowStatusMap.put("value",value.getValue()); + result.add(flowStatusMap); + } + } + return Result.OK(result); + } + + @Override + public IPage queryPage(QueryWrapper queryWrapper, + Page page, + ProjectCertificationInventoryEO projectCertificationInventoryEO, + String cut) { + + String roleCode = projectCertificationInventoryEO.getRoleCode(); + // 创建查询权限 + this.createQueryPermission(queryWrapper,roleCode); + // 根据一级责任领域(统计节点),查询该一级责任领域下所有子责任领域的法规清单数据。 + String dutyTerritoryStr = ""; + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getFirstLevelDutyTerritory())){ + queryWrapper.lambda().like(ProjectCertificationInventoryEO::getDutyDepart,projectCertificationInventoryEO.getFirstLevelDutyTerritory()); + } + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + int isProjectRole = Integer.parseInt(roleCode); + if (isProjectRole == Integer.parseInt(com.jero.modules.project.enums.ProjectRoleEnum.VIEWER.getValue())) { + //查当前用户Viewer对应责任领域 + List dutyTerritoryList = this.projectUserDutyTerritoryService.queryDutyTerritoryByUserId(currentUser.getId()); + if (ObjectUtils.isNotEmpty(dutyTerritoryList)) { + queryWrapper.and(query -> { + for (String duty : dutyTerritoryList) { + query.or(q -> { + q.like("duty_territory", duty); + }); + } + }); + } + } + IPage pageList = this.page(page, queryWrapper); + this.disposeData(pageList.getRecords(),cut); + List records = this.hearSort(projectCertificationInventoryEO, pageList.getRecords()); + pageList.setRecords(records); + return pageList; + } + + /** + * 表头排序 + * @param pciEo + * @param datas + * @return + */ + private List hearSort(ProjectCertificationInventoryEO pciEo, List datas) { + String orderBy = pciEo.getOrderBy(); + String orderByField = pciEo.getOrderByField(); + if(ObjectUtils.isNotEmpty(orderByField)){ + Collator comparator = Collator.getInstance(Locale.CHINESE); + // 类别 category + if(StringUtils.equals("category",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1Category = (StringUtils.isNotEmpty(e1.getCategory()) ? e1.getCategory() : ""); + String e2Category = (StringUtils.isNotEmpty(e2.getCategory()) ? e2.getCategory() : ""); + return comparator.compare(e1Category,e2Category); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1Category = (StringUtils.isNotEmpty(e1.getCategory()) ? e1.getCategory() : ""); + String e2Category = (StringUtils.isNotEmpty(e2.getCategory()) ? e2.getCategory() : ""); + return comparator.compare(e2Category,e1Category); + }); + } + } + + // 检验项目 inspectionItem + if(StringUtils.equals("inspectionItem",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1InspectionItem = (StringUtils.isNotEmpty(e1.getInspectionItem()) ? e1.getInspectionItem() : ""); + String e2InspectionItem = (StringUtils.isNotEmpty(e2.getInspectionItem()) ? e2.getInspectionItem() : ""); + return comparator.compare(e1InspectionItem,e2InspectionItem); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1InspectionItem = (StringUtils.isNotEmpty(e1.getInspectionItem()) ? e1.getInspectionItem() : ""); + String e2InspectionItem = (StringUtils.isNotEmpty(e2.getInspectionItem()) ? e2.getInspectionItem() : ""); + return comparator.compare(e2InspectionItem,e1InspectionItem); + }); + } + } + + // 认证类型 attestationTypeName + if(StringUtils.equals("attestationTypeName",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1AttestationTypeName = (StringUtils.isNotEmpty(e1.getAttestationTypeName()) ? e1.getAttestationTypeName() : ""); + String e2AttestationTypeName = (StringUtils.isNotEmpty(e2.getAttestationTypeName()) ? e2.getAttestationTypeName() : ""); + return comparator.compare(e1AttestationTypeName,e2AttestationTypeName); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1AttestationTypeName = (StringUtils.isNotEmpty(e1.getAttestationTypeName()) ? e1.getAttestationTypeName() : ""); + String e2AttestationTypeName = (StringUtils.isNotEmpty(e2.getAttestationTypeName()) ? e2.getAttestationTypeName() : ""); + return comparator.compare(e2AttestationTypeName,e1AttestationTypeName); + }); + } + } + + // WVTA ID wvtaId + if(StringUtils.equals("wvtaId",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1WvtaId = (StringUtils.isNotEmpty(e1.getWvtaId()) ? e1.getWvtaId() : ""); + String e2WvtaId = (StringUtils.isNotEmpty(e2.getWvtaId()) ? e2.getWvtaId() : ""); + return comparator.compare(e1WvtaId,e2WvtaId); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1WvtaId = (StringUtils.isNotEmpty(e1.getWvtaId()) ? e1.getWvtaId() : ""); + String e2WvtaId = (StringUtils.isNotEmpty(e2.getWvtaId()) ? e2.getWvtaId() : ""); + return comparator.compare(e2WvtaId,e1WvtaId); + }); + } + } + + // 标准编号 serialNumber + if(StringUtils.equals("serialNumber",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1SerialNumber = (StringUtils.isNotEmpty(e1.getSerialNumber()) ? e1.getSerialNumber() : ""); + String e2SerialNumber = (StringUtils.isNotEmpty(e2.getSerialNumber()) ? e2.getSerialNumber() : ""); + return comparator.compare(e1SerialNumber,e2SerialNumber); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1SerialNumber = (StringUtils.isNotEmpty(e1.getSerialNumber()) ? e1.getSerialNumber() : ""); + String e2SerialNumber = (StringUtils.isNotEmpty(e2.getSerialNumber()) ? e2.getSerialNumber() : ""); + return comparator.compare(e2SerialNumber,e1SerialNumber); + }); + } + } + + // 责任领域 dutyTerritoryName + if(StringUtils.equals("dutyTerritoryName",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1DutyTerritoryName = (StringUtils.isNotEmpty(e1.getDutyTerritoryName()) ? e1.getDutyTerritoryName() : ""); + String e2DutyTerritoryName = (StringUtils.isNotEmpty(e2.getDutyTerritoryName()) ? e2.getDutyTerritoryName() : ""); + return comparator.compare(e1DutyTerritoryName,e2DutyTerritoryName); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1DutyTerritoryName = (StringUtils.isNotEmpty(e1.getDutyTerritoryName()) ? e1.getDutyTerritoryName() : ""); + String e2DutyTerritoryName = (StringUtils.isNotEmpty(e2.getDutyTerritoryName()) ? e2.getDutyTerritoryName() : ""); + return comparator.compare(e2DutyTerritoryName,e1DutyTerritoryName); + }); + } + } + + // 工程接口人 sdtName + if(StringUtils.equals("sdtName",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1SdtName = (StringUtils.isNotEmpty(e1.getSdtName()) ? e1.getSdtName() : ""); + String e2SdtName = (StringUtils.isNotEmpty(e2.getSdtName()) ? e2.getSdtName() : ""); + return comparator.compare(e1SdtName,e2SdtName); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1SdtName = (StringUtils.isNotEmpty(e1.getSdtName()) ? e1.getSdtName() : ""); + String e2SdtName = (StringUtils.isNotEmpty(e2.getSdtName()) ? e2.getSdtName() : ""); + return comparator.compare(e2SdtName,e1SdtName); + }); + } + } + + // 责任人 dutyPersonName + if(StringUtils.equals("dutyPersonName",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1DutyPersonName = (StringUtils.isNotEmpty(e1.getDutyPersonName()) ? e1.getDutyPersonName() : ""); + String e2DutyPersonName = (StringUtils.isNotEmpty(e2.getDutyPersonName()) ? e2.getDutyPersonName() : ""); + return comparator.compare(e1DutyPersonName,e2DutyPersonName); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1DutyPersonName = (StringUtils.isNotEmpty(e1.getDutyPersonName()) ? e1.getDutyPersonName() : ""); + String e2DutyPersonName = (StringUtils.isNotEmpty(e2.getDutyPersonName()) ? e2.getDutyPersonName() : ""); + return comparator.compare(e2DutyPersonName,e1DutyPersonName); + }); + } + } + + // 交付物类型 deliverableTypeName + if(StringUtils.equals("deliverableTypeName",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1DeliverableTypeName = (StringUtils.isNotEmpty(e1.getDeliverableTypeName()) ? e1.getDeliverableTypeName() : ""); + String e2DeliverableTypeName = (StringUtils.isNotEmpty(e2.getDeliverableTypeName()) ? e2.getDeliverableTypeName() : ""); + return comparator.compare(e1DeliverableTypeName,e2DeliverableTypeName); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1DeliverableTypeName = (StringUtils.isNotEmpty(e1.getDeliverableTypeName()) ? e1.getDeliverableTypeName() : ""); + String e2DeliverableTypeName = (StringUtils.isNotEmpty(e2.getDeliverableTypeName()) ? e2.getDeliverableTypeName() : ""); + return comparator.compare(e2DeliverableTypeName,e1DeliverableTypeName); + }); + } + } + + // 截止日期 endTime + if(StringUtils.equals("endTime",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1EndTime = (e1.getEndTime() != null ? DateUtils.formatDate(e1.getEndTime()) : ""); + String e2EndTime = (e2.getEndTime() != null ? DateUtils.formatDate(e2.getEndTime()) : ""); + return comparator.compare(e1EndTime,e2EndTime); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1EndTime = (e1.getEndTime() != null ? DateUtils.formatDate(e1.getEndTime()) : ""); + String e2EndTime = (e2.getEndTime() != null ? DateUtils.formatDate(e2.getEndTime()) : ""); + return comparator.compare(e2EndTime,e1EndTime); + }); + } + } + + // 流程状态 flowStatusName + if(StringUtils.equals("flowStatusName",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1FlowStatusName = (StringUtils.isNotEmpty(e1.getFlowStatusName()) ? e1.getFlowStatusName() : ""); + String e2FlowStatusName = (StringUtils.isNotEmpty(e2.getFlowStatusName()) ? e2.getFlowStatusName() : ""); + return comparator.compare(e1FlowStatusName,e2FlowStatusName); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1FlowStatusName = (StringUtils.isNotEmpty(e1.getFlowStatusName()) ? e1.getFlowStatusName() : ""); + String e2FlowStatusName = (StringUtils.isNotEmpty(e2.getFlowStatusName()) ? e2.getFlowStatusName() : ""); + return comparator.compare(e2FlowStatusName,e1FlowStatusName); + }); + } + } + + // 认证进度 certificationProgress + if(StringUtils.equals("certificationProgress",orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1, e2)->{ + String e1CertificationProgressNumber = (StringUtils.isNotEmpty(e1.getCertificationProgressNumber()) ? e1.getCertificationProgressNumber() : ""); + String e2CertificationProgressNumber = (StringUtils.isNotEmpty(e2.getCertificationProgressNumber()) ? e2.getCertificationProgressNumber() : ""); + return comparator.compare(e1CertificationProgressNumber,e2CertificationProgressNumber); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(datas,(e1,e2)->{ + String e1CertificationProgressNumber = (StringUtils.isNotEmpty(e1.getCertificationProgressNumber()) ? e1.getCertificationProgressNumber() : ""); + String e2CertificationProgressNumber = (StringUtils.isNotEmpty(e2.getCertificationProgressNumber()) ? e2.getCertificationProgressNumber() : ""); + return comparator.compare(e2CertificationProgressNumber,e1CertificationProgressNumber); + }); + } + } + } + return datas; + } + + @Override + public void createQueryPermission(QueryWrapper queryWrapper, String roleCode) { + /** + * 处理查询权限 + * studio、法规工程师、领导、系统管理员、Viewer、品牌管理员: 可以查询所有数据 + * 认证工程师:可以查询所有数据 + * 接口人:可查看所有接口人为自己的数据 + * 责任人:可以查看流程状态为:任务待确认、结果待提交 、审查通过(并且责任人为自己) + */ + ProjectRoleEnum projectRoleEnum = ProjectRoleEnum.getByValue(roleCode); + if(ObjectUtils.isEmpty(projectRoleEnum)){ + throw new JeroBootException("当前用户角色有误,请重新选择后角色进行操作!"); + } + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + switch (projectRoleEnum){ + case STUDIO_ENGINEER: + break; + case REGULATI_ENGINEER: + break; + case MANAGER: + break; + case ADMIN: + break; + case VIEWER: + break; + case BRAND_ADMINISTRATOR: + break; + case HOMOLOGATION_ENGINEER: + break; + case INTERFACE_PERSON: + queryWrapper.lambda().eq(ProjectCertificationInventoryEO::getSdt,currentUser.getId()); + break; + case PERSON_LIABLE: + /*List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()); + + queryWrapper.lambda().and(queryWrap -> { + queryWrap.and(query -> { + query.eq(ProjectCertificationInventoryEO::getDutyPerson,currentUser.getId()); + query.in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + }).or(query -> { + query.eq(ProjectCertificationInventoryEO::getSdt,currentUser.getId()); + query.eq(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()); + }); + });*/ + // 修改UAT问题清单 82条 + queryWrapper.lambda().eq(ProjectCertificationInventoryEO::getDutyPerson,currentUser.getId()); + break; + default: + throw new JeroBootException("当前用户角色有误,请重新选择后角色进行操作!"); + } + } + + + @Override + public Result submitTask(JSONObject json) { + if (!json.containsKey("nodeKey")) { + throw new JeroBootException("nodeKey不能为空,请联系管理员!"); + } + + String nodeKey = json.getString("nodeKey"); + + CertificationFlowNodeEnum flowNodeEnum = CertificationFlowNodeEnum.getEnumByKey(nodeKey); + if(ObjectUtils.isEmpty(flowNodeEnum)){ + throw new JeroBootException("根据" + nodeKey + " 的操作节点没有获取到节点信息,请联系管理员!"); + } + + String projectLibraryId = json.getString("projectLibraryId"); + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if(ObjectUtils.isEmpty(projectLibraryBase)){ + throw new JeroBootException("无法获取项目库信息,项目库id为:" + projectLibraryId + " 请联系管理员!"); + } + json.put("projectLibraryBase",projectLibraryBase); + + + switch (flowNodeEnum){ + case RZGCSJSRW: + return this.certificationInitiatingTask(json); + case RZGCSTHRW: + return this.certificationReturnedStudioTask(json); + case ZRRJSRW: + return this.dutyPersonAcceptTask(json); + case ZRRJJRW: + return this.dutyPersonRejectTask(json); + case ZRRTJRW: + return this.dutyPersonSubmitTask(json); + case RZGCSSC: + + break; + case RZGCSSC_TG: + return this.certificationReviewThrough(json); + case RZGCSSC_TH: + return this.certificationReviewReturned(json); + default: + throw new JeroBootException(nodeKey + " 的操作节点传递有误,请联系管理员!"); + } + + return Result.OK("提交任务成功!"); + } + + /** + * 认证工程师审查退回 + * @param json + * @return + */ + private Result certificationReviewReturned(JSONObject json) { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + String reasonForReturn = json.getString("reasonForReturn"); + + List idList = Arrays.asList(ids.split(",")); + + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + throw new JeroBootException("至少选择一条数据流程状态为'结果待审查'的数据!"); + } + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()); + projectCertificationInventoryEO.setReasonForReturn(reasonForReturn); + processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_REVIEW.getKey(),currentUser.getId(),ReviewResultEnum.RETURNED.getValue(),reasonForReturn,null); + } + + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_RETURNED.getValue()); + + ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); + List dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList); + + // 获取当前项目下,认证清单,截止日期最早的一个,更新到流程明细表中,认证工程师审查任务节点的截止时间中 + flowStatusList.clear(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + this.updateProcessInfoDetailEndTime( + flowStatusList, + CertificationFlowNodeEnum.RZGCSSC.getKey(), + projectLibraryBase, + "end_time", + idList + ); + try { + // 给责任人分配待办中心的任务 + List processInfoDetailEOList = new ArrayList<>(); + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setUserId(projectCertificationInventoryEO.getDutyPerson()); + processInfoDetailEO.setEndTime(projectCertificationInventoryEO.getEndTime()); + processInfoDetailEO.setProjectLawsInventoryId(projectCertificationInventoryEO.getId()); + processInfoDetailEOList.add(processInfoDetailEO); + } + this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.ZRRTJRW.getKey()); + + // 更新数据状态为 审查退回 + this.updateBatchById(projectCertificationInventoryEOList); + + List flowStatus = new ArrayList<>(); + flowStatus.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + + // 更新该项目认证流程中,认证工程师的任务状态。 + // 如果还有 结果待审查 的数据,不做操作,如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办 flowStatus + this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSSC.getKey(),flowStatus); + + this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); + this.sendMessageByTemplateId( + projectCertificationInventoryEOList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE24.getValue(), + dutyPersonIdList, + dutyPersonList, + projectCertificationInventoryEOList.get(0).getEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey() + ); + }catch (Exception ex){ + ex.printStackTrace(); + log.error("认证工程师-审批退回失败:" + ex.getMessage()); + throw new JeroBootException("审批退回失败!"); + } + + return Result.OK("审批退回成功!"); + } + + /** + * 认证工程师审查通过 + * @param json + * @return + */ + private Result certificationReviewThrough(JSONObject json) { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + List idList = Arrays.asList(ids.split(",")); + + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + throw new JeroBootException("至少选择一条数据流程状态为'结果待审查'的数据!"); + } + + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()); + processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_REVIEW.getKey(),currentUser.getId(),null,null,null); + + } + + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_THROUGH.getValue()); + + ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); + List dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList); + + // 获取当前项目下,认证清单,截止日期最早的一个,更新到流程明细表中,认证工程师审查任务节点的截止时间中 + this.updateProcessInfoDetailEndTime( + flowStatusList, + CertificationFlowNodeEnum.RZGCSSC.getKey(), + projectLibraryBase, + "end_time", + idList + ); + try { + // 更新数据状态为 审查通过 + this.updateBatchById(projectCertificationInventoryEOList); + + List flowStatus = new ArrayList<>(); + flowStatus.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + + // 更新该项目认证流程中,认证工程师的任务状态。 + // 如果还有 结果待审查 的数据,不做操作,如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办 flowStatus + this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSSC.getKey(),flowStatus); + + this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); + this.sendMessageByTemplateId( + projectCertificationInventoryEOList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE25.getValue(), + dutyPersonIdList, + dutyPersonList, + projectCertificationInventoryEOList.get(0).getEndTime(),"" + ); + }catch (Exception ex){ + ex.printStackTrace(); + log.error("认证工程师-审批通过失败:" + ex.getMessage()); + throw new JeroBootException("审批通过失败!"); + } + + + return Result.OK("审批通过成功!"); + } + + /** + * 更新截止日期 + * @param flowStatusList + * @param taskDefinitionKey + * @param projectLibraryBase + */ + private void updateProcessInfoDetailEndTime(List flowStatusList, + String taskDefinitionKey, + ProjectLibraryBase projectLibraryBase, + String orderByField, + List excludeIdList) { + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryBase.getId()); + pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus, flowStatusList); + if(CollectionUtils.isNotEmpty(excludeIdList)){ + pciQueryWrap.lambda().notIn(ProjectCertificationInventoryEO::getId, excludeIdList); + } + pciQueryWrap.orderByAsc(orderByField); + List pciEoList = this.list(pciQueryWrap); + if(CollectionUtils.isNotEmpty(pciEoList)){ + Date endTime = null; + if(StringUtils.equals("inventory_verify_end_time",orderByField)){ + endTime = pciEoList.get(0).getInventoryVerifyEndTime(); + } else if(StringUtils.equals("end_time",orderByField)){ + endTime = pciEoList.get(0).getEndTime(); + } + + QueryWrapper detailQueryWrapper = new QueryWrapper<>(); + detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); + detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,taskDefinitionKey); + List detailEOList = this.processInfoDetailEOService.list(detailQueryWrapper); + Date finalEndTime = endTime; + detailEOList.forEach(detailEO -> { + detailEO.setEndTime(finalEndTime); + }); + this.processInfoDetailEOService.updateBatchById(detailEOList); + } + } + + /** + * 更新任务状态为已办 + * @param projectLibraryBase + */ + private void updateProcessInfoDetailStatus(ProjectLibraryBase projectLibraryBase,String taskDefinitionKey,List flowStatusList) { + + QueryWrapper queryCountWrap = new QueryWrapper<>(); + queryCountWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryBase.getId()); + queryCountWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + int notDoneCount = this.count(queryCountWrap); + + if(notDoneCount == 0){ + QueryWrapper detailQueryWrapper = new QueryWrapper<>(); + detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); + detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,taskDefinitionKey); + List detailEOList = this.processInfoDetailEOService.list(detailQueryWrapper); + + for (ProcessInfoDetailEO processInfoDetailEO : detailEOList) { + processInfoDetailEO.setStatus(TaskStatusEnum.HAVE_DONE.getValue()); + } + + this.processInfoDetailEOService.updateBatchById(detailEOList); + } + } + + + /** + * 责任人提交任务 + * @param json + * @return + */ + private Result dutyPersonSubmitTask(JSONObject json) { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + List idList = Arrays.asList(ids.split(",")); + + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.list(queryWrapper); + this.disposeData(projectCertificationInventoryEOList,CutEnum.CN.getValue()); + + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + throw new JeroBootException("至少选择一条数据流程状态为'结果待提交 或 审查退回'的数据!"); + } + this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); + + ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); + + String lawsEngineer = projectLibraryBase.getCreateBy(); + SysUser userByName = sysUserService.getUserByName(lawsEngineer); + + // 根据项目库id查询当前项目认证清单数据,获取数据状态为 结果待审查的 截止时间 最早的一个时间 + Date endTime = null; + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryBase.getId()); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + pciQueryWrap.lambda().isNotNull(ProjectCertificationInventoryEO::getEndTime); + List pciEoList = this.list(pciQueryWrap); + if(CollectionUtils.isNotEmpty(pciEoList) || CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ + List endTimeList = new ArrayList<>(); + // 本次提交之前数据库里面存在的截止时间 + List oldEndTimeList = pciEoList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList()); + endTimeList.addAll(oldEndTimeList); + // 当前要提交的数据截止时间 + List newEndTimeList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList()); + endTimeList.addAll(newEndTimeList); + + endTimeList = endTimeList.stream().distinct().collect(Collectors.toList()); + Collections.sort(endTimeList, (d1, d2) -> d1.compareTo(d2)); // 根据时间顺序排序 + endTime = endTimeList.get(0); + } + + List processInfoDetailEOList = new ArrayList<>(); + // 给法规工程师分配任务 + if(ObjectUtils.isNotEmpty(userByName)){ + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setUserId(userByName.getId()); + processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSSC.getKey()); + processInfoDetailEO.setCreateTime(new Date()); + processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); + processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId()); + processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId()); + processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); + processInfoDetailEO.setEndTime(endTime); + processInfoDetailEOList.add(processInfoDetailEO); + } + // 数据更新为结果待审查 + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_HANDLING.getKey(),currentUser.getId(),null,null,projectCertificationInventoryEO.getDeliveryResult()); + } + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue()); + + try { + this.updateBatchById(projectCertificationInventoryEOList); + + List certificationIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getId).distinct().collect(Collectors.toList()); + + // 将当前责任人的待办任务转为已办 + LambdaUpdateWrapper detailUpdateWrap = new LambdaUpdateWrapper<>(); + detailUpdateWrap.eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId()); + detailUpdateWrap.eq(ProcessInfoDetailEO::getUserId,currentUser.getId()); + detailUpdateWrap.eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.ZRRTJRW.getKey()); + detailUpdateWrap.in(ProcessInfoDetailEO::getProjectLawsInventoryId,certificationIdList); + detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue()); + detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateTime,new Date()); + detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername()); + this.processInfoDetailEOService.update(detailUpdateWrap); + + // 给法规工程师分配待办中心的任务 认证工程师审查 + this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.RZGCSSC.getKey()); + + List sysUserList = new ArrayList<>(); + sysUserList.add(userByName); + this.sendMessageByTemplateId( + projectCertificationInventoryEOList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(), + Arrays.asList(userByName.getId().split(",")), + sysUserList, + endTime, + CertificationFlowNodeEnum.TASK_REVIEW.getKey() + ); + + }catch (Exception ex){ + ex.printStackTrace(); + log.error("责任人-提交任务失败:" + ex.getMessage()); + throw new JeroBootException("提交任务失败!"); + } + + return Result.OK("提交任务成功!"); + } +// private Result dutyPersonSubmitTask(JSONObject json) { +// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// +// String ids = json.getString("ids"); +// if(StringUtils.isEmpty(ids)){ +// throw new JeroBootException("至少选择一条数据进行操作!"); +// } +// List idList = Arrays.asList(ids.split(",")); +// +// List flowStatusList = new ArrayList<>(); +// flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()); +// flowStatusList.add(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()); +// +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); +// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); +// List projectCertificationInventoryEOList = this.list(queryWrapper); +// this.disposeData(projectCertificationInventoryEOList,CutEnum.CN.getValue()); +// +// if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ +// throw new JeroBootException("至少选择一条数据流程状态为'结果待提交 或 审查退回'的数据!"); +// } +// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); +// +// ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); +// +// // 给认证工程师分配待办中心的任务 +// String certificationEngineer = projectLibraryBase.getCertificationEngineer(); +// if(StringUtils.isEmpty(certificationEngineer)){ +// throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!"); +// } +// +// // 根据项目库id查询当前项目认证清单数据,获取数据状态为 结果待审查的 截止时间 最早的一个时间 +// Date endTime = null; +// QueryWrapper pciQueryWrap = new QueryWrapper<>(); +// pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryBase.getId()); +// pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); +// pciQueryWrap.lambda().isNotNull(ProjectCertificationInventoryEO::getEndTime); +// List pciEoList = this.list(pciQueryWrap); +// if(CollectionUtils.isNotEmpty(pciEoList) || CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ +// List endTimeList = new ArrayList<>(); +// // 本次提交之前数据库里面存在的截止时间 +// List oldEndTimeList = pciEoList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList()); +// endTimeList.addAll(oldEndTimeList); +// // 当前要提交的数据截止时间 +// List newEndTimeList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList()); +// endTimeList.addAll(newEndTimeList); +// +// endTimeList = endTimeList.stream().distinct().collect(Collectors.toList()); +// Collections.sort(endTimeList, (d1, d2) -> d1.compareTo(d2)); // 根据时间顺序排序 +// endTime = endTimeList.get(0); +// } +// +// List processInfoDetailEOList = new ArrayList<>(); +// List certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); +// // 给认证工程师分配任务 +// for (String userId : certificationEngineerList) { +// ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); +// processInfoDetailEO.setUserId(userId); +// processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSSC.getKey()); +// processInfoDetailEO.setCreateTime(new Date()); +// processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); +// processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId()); +// processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId()); +// processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); +// processInfoDetailEO.setEndTime(endTime); +// processInfoDetailEOList.add(processInfoDetailEO); +// } +// // 数据更新为结果待审查 +// for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { +// projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); +// processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_HANDLING.getKey(),currentUser.getId(),null,null,projectCertificationInventoryEO.getDeliveryResult()); +// +// } +// +// this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue()); +// +// List certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); +// +// try { +// this.updateBatchById(projectCertificationInventoryEOList); +// +// List certificationIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getId).distinct().collect(Collectors.toList()); +// +// // 将当前责任人的待办任务转为已办 +// LambdaUpdateWrapper detailUpdateWrap = new LambdaUpdateWrapper<>(); +// detailUpdateWrap.eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId()); +// detailUpdateWrap.eq(ProcessInfoDetailEO::getUserId,currentUser.getId()); +// detailUpdateWrap.eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.ZRRTJRW.getKey()); +// detailUpdateWrap.in(ProcessInfoDetailEO::getProjectLawsInventoryId,certificationIdList); +// detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue()); +// detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateTime,new Date()); +// detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername()); +// this.processInfoDetailEOService.update(detailUpdateWrap); +// +// // 给认证工程师分配待办中心的任务 认证工程师审查 +// this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.RZGCSSC.getKey()); +// this.sendMessageByTemplateId( +// projectCertificationInventoryEOList, +// TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(), +// certificationEngineerList, +// certificationEngineers, +// endTime, +// CertificationFlowNodeEnum.TASK_REVIEW.getKey() +// ); +// }catch (Exception ex){ +// ex.printStackTrace(); +// log.error("责任人-提交任务失败:" + ex.getMessage()); +// throw new JeroBootException("提交任务失败!"); +// } +// +// return Result.OK("提交任务成功!"); +// } + + /** + * 责任人接受任务 + * @param json + * @return + */ + private Result dutyPersonAcceptTask(JSONObject json) { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + List idList = Arrays.asList(ids.split(",")); + + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + throw new JeroBootException("至少选择一条数据流程状态为'任务待确认'的数据!"); + } + + ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); + String certificationEngineer = projectLibraryBase.getCertificationEngineer(); +// if(StringUtils.isEmpty(certificationEngineer)){ +// throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!"); +// } + + List processInfoDetailEOList = new ArrayList<>(); + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()); + + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setUserId(projectCertificationInventoryEO.getDutyPerson()); + processInfoDetailEO.setEndTime(projectCertificationInventoryEO.getEndTime()); + processInfoDetailEO.setProjectLawsInventoryId(projectCertificationInventoryEO.getId()); + processInfoDetailEOList.add(processInfoDetailEO); + processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(),currentUser.getId(),ReviewResultEnum.ACCEPTED.getValue(),null,null); + + } + + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_ACCEPT_TASK.getValue()); + + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + // 获取认证清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + String hrefFeishu_CN_P = this.handlePhoneLink(projectLibraryBase.getId(),PRN_CN,CertificationFlowNodeEnum.TASK_HANDLING.getKey()); + + Map standNameAndItemName = this.platformProjectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + try { + List certificationIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getId).distinct().collect(Collectors.toList()); + // 将当前责任人的待办任务转为已办 + LambdaUpdateWrapper detailUpdateWrap = new LambdaUpdateWrapper<>(); + detailUpdateWrap.eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId()); + detailUpdateWrap.eq(ProcessInfoDetailEO::getUserId,currentUser.getId()); + detailUpdateWrap.eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.ZRRJSRW.getKey()); + detailUpdateWrap.in(ProcessInfoDetailEO::getProjectLawsInventoryId,certificationIdList); + detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue()); + detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateTime,new Date()); + detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername()); + this.processInfoDetailEOService.update(detailUpdateWrap); + + // 给责任人分配待办中心的任务 (待提交) + this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.ZRRTJRW.getKey()); + + // 责任人接受任务,将数据的状态更新为 结果待提交。 + this.updateBatchById(projectCertificationInventoryEOList); + + +// List certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); +// List certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); + try { +// for (String userId : certificationEngineerList) { +// String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId); +// +// if(StringUtils.isNotEmpty(thirdId)){ +// // 根据结束时间进行排序,获取最近的时间,发消息时使用。 +// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); +// Date endTime = projectCertificationInventoryEOList.get(0).getEndTime(); +// +// JSONObject larkMesJson = new JSONObject(); +// larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE12.getValue()); +// larkMesJson.put("userIds",thirdId); +// +// Map templateVariableMap = new HashMap<>(); +// templateVariableMap.put("projectNameCn",PRN_CN); +// templateVariableMap.put("projectNameEn",PRN_EN); +// templateVariableMap.put("standName",standName); +// templateVariableMap.put("itemName",itemName); +// templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); +// templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); +// templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); +// templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); +// templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); +// templateVariableMap.put("operateUserName",currentUser.getUsername()); +// +// +// larkMesJson.put("templateVariableMap",templateVariableMap); +// this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); +// } +// } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + }catch (Exception ex){ + ex.printStackTrace(); + log.error("责任人-接受任务失败:" + ex.getMessage()); + throw new JeroBootException("接受任务失败!"); + } + + return Result.OK("接受任务成功!"); + } + + /** + * 责任人拒绝任务 + * @param json + * @return + */ + private Result dutyPersonRejectTask(JSONObject json) { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + String reasonForReturn = json.getString("reasonForReturn"); + + List idList = Arrays.asList(ids.split(",")); + + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + throw new JeroBootException("至少选择一条数据流程状态为'任务待确认'的数据!"); + } + + ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); + + // 给认证工程师分配待办中心的任务 +// String certificationEngineer = projectLibraryBase.getCertificationEngineer(); +// if(StringUtils.isEmpty(certificationEngineer)){ +// throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!"); +// } + String lawsEngineer = projectLibraryBase.getCreateBy(); + SysUser userByName = sysUserService.getUserByName(lawsEngineer); + + + + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()); + projectCertificationInventoryEO.setReasonForReturn(reasonForReturn); + processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(),currentUser.getId(),ReviewResultEnum.REJECTED.getValue(),reasonForReturn,null); + + } + + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_REJECT_TASK.getValue()); + + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + // 获取认证清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + String hrefFeishu_CN_P = (String) hrefFeishuMap.get("hrefFeishu_CN_P"); + + Map standNameAndItemName = this.platformProjectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + try { + List certificationIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getId).distinct().collect(Collectors.toList()); + // 将当前责任人的待办任务转为已办 + LambdaUpdateWrapper detailUpdateWrap = new LambdaUpdateWrapper<>(); + detailUpdateWrap.eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId()); + detailUpdateWrap.eq(ProcessInfoDetailEO::getUserId,currentUser.getId()); + detailUpdateWrap.eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.ZRRJSRW.getKey()); + detailUpdateWrap.in(ProcessInfoDetailEO::getProjectLawsInventoryId,certificationIdList); + detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue()); + detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateTime,new Date()); + detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername()); + this.processInfoDetailEOService.update(detailUpdateWrap); + + this.certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(projectCertificationInventoryEOList); + + List processInfoDetailEOList = new ArrayList<>(); +// List certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); + // 给认证工程师分配任务 + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setUserId(userByName.getId()); + processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSJSRW.getKey()); + processInfoDetailEO.setCreateTime(new Date()); + processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); + processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId()); + processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId()); + processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); + processInfoDetailEO.setEndTime(projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime()); + processInfoDetailEOList.add(processInfoDetailEO); + + // 删除该项目数据的待办任务,key为 认证工程师接受任务的数据 + QueryWrapper deleteDetailWrap = new QueryWrapper<>(); + deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId()); + deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSJSRW.getKey()); + deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); + this.processInfoDetailEOService.remove(deleteDetailWrap); + this.processInfoDetailEOService.saveBatch(processInfoDetailEOList); + + // 责任人接受任务,将数据的状态更新为 结果待提交。 + this.updateBatchById(projectCertificationInventoryEOList); + try { + if(ObjectUtils.isNotEmpty(userByName) && StringUtils.isNotBlank(userByName.getThirdId())){ + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 +// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); + Date endTime = projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime(); + + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE11.getValue()); + larkMesJson.put("userIds",userByName.getThirdId()); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); + templateVariableMap.put("operateUserName",currentUser.getUsername()); + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + }catch (Exception ex){ + ex.printStackTrace(); + log.error("责任人-拒绝任务失败:" + ex.getMessage()); + throw new JeroBootException("拒绝任务失败!"); + } + return Result.OK("拒绝任务成功!"); + } +// private Result dutyPersonRejectTask(JSONObject json) { +// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// +// String ids = json.getString("ids"); +// if(StringUtils.isEmpty(ids)){ +// throw new JeroBootException("至少选择一条数据进行操作!"); +// } +// String reasonForReturn = json.getString("reasonForReturn"); +// +// List idList = Arrays.asList(ids.split(",")); +// +// List flowStatusList = new ArrayList<>(); +// flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); +// +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); +// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); +// List projectCertificationInventoryEOList = this.list(queryWrapper); +// +// if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ +// throw new JeroBootException("至少选择一条数据流程状态为'任务待确认'的数据!"); +// } +// +// ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); +// +// // 给认证工程师分配待办中心的任务 +// String certificationEngineer = projectLibraryBase.getCertificationEngineer(); +// if(StringUtils.isEmpty(certificationEngineer)){ +// throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!"); +// } +// +// for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { +// projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()); +// projectCertificationInventoryEO.setReasonForReturn(reasonForReturn); +// processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(),currentUser.getId(),ReviewResultEnum.REJECTED.getValue(),reasonForReturn,null); +// +// } +// +// this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_REJECT_TASK.getValue()); +// +// String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 +// String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 +// +// // 获取认证清单 - 飞书跳转链接 +// Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); +// String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); +// String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); +// String hrefFeishu_CN_P = (String) hrefFeishuMap.get("hrefFeishu_CN_P"); +// +// Map standNameAndItemName = this.platformProjectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOList); +// String standName = (String) standNameAndItemName.get("standName"); +// String itemName = (String) standNameAndItemName.get("itemName"); +// +// try { +// List certificationIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getId).distinct().collect(Collectors.toList()); +// // 将当前责任人的待办任务转为已办 +// LambdaUpdateWrapper detailUpdateWrap = new LambdaUpdateWrapper<>(); +// detailUpdateWrap.eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId()); +// detailUpdateWrap.eq(ProcessInfoDetailEO::getUserId,currentUser.getId()); +// detailUpdateWrap.eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.ZRRJSRW.getKey()); +// detailUpdateWrap.in(ProcessInfoDetailEO::getProjectLawsInventoryId,certificationIdList); +// detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue()); +// detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateTime,new Date()); +// detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername()); +// this.processInfoDetailEOService.update(detailUpdateWrap); +// +// this.certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(projectCertificationInventoryEOList); +// +// List processInfoDetailEOList = new ArrayList<>(); +// List certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); +// // 给认证工程师分配任务 +// for (String userId : certificationEngineerList) { +// ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); +// processInfoDetailEO.setUserId(userId); +// processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSJSRW.getKey()); +// processInfoDetailEO.setCreateTime(new Date()); +// processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); +// processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId()); +// processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId()); +// processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); +// processInfoDetailEO.setEndTime(projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime()); +// processInfoDetailEOList.add(processInfoDetailEO); +// } +// +// // 删除该项目数据的待办任务,key为 认证工程师接受任务的数据 +// QueryWrapper deleteDetailWrap = new QueryWrapper<>(); +// deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId()); +// deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSJSRW.getKey()); +// deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); +// this.processInfoDetailEOService.remove(deleteDetailWrap); +// this.processInfoDetailEOService.saveBatch(processInfoDetailEOList); +// +// // 责任人接受任务,将数据的状态更新为 结果待提交。 +// this.updateBatchById(projectCertificationInventoryEOList); +// +// List certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); +// try { +// for (String userId : certificationEngineerList) { +// String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId); +// +// if(StringUtils.isNotEmpty(thirdId)){ +// // 根据结束时间进行排序,获取最近的时间,发消息时使用。 +//// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); +// Date endTime = projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime(); +// +// JSONObject larkMesJson = new JSONObject(); +// larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE11.getValue()); +// larkMesJson.put("userIds",thirdId); +// +// Map templateVariableMap = new HashMap<>(); +// templateVariableMap.put("projectNameCn",PRN_CN); +// templateVariableMap.put("projectNameEn",PRN_EN); +// templateVariableMap.put("standName",standName); +// templateVariableMap.put("itemName",itemName); +// templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); +// templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); +// templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); +// templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); +// templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); +// +// templateVariableMap.put("operateUserName",currentUser.getUsername()); +// +// larkMesJson.put("templateVariableMap",templateVariableMap); +// this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); +// } +// } +// } catch (Exception e) { +// log.error("飞书消息推送失败"); +// } +// }catch (Exception ex){ +// ex.printStackTrace(); +// log.error("责任人-拒绝任务失败:" + ex.getMessage()); +// throw new JeroBootException("拒绝任务失败!"); +// } +// return Result.OK("拒绝任务成功!"); +// } + + /** + * 认证工程师退回至studio任务 + * @param json + * @return + */ + private Result certificationReturnedStudioTask(JSONObject json) { + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + String reasonForReturn = json.getString("reasonForReturn"); + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + List idList = Arrays.asList(ids.split(",")); + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + throw new JeroBootException("至少选择一条数据流程状态为'清单待校核 或 责任人拒绝的数据'!"); + } + + ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); + if (StringUtils.isEmpty(projectLibraryBase.getStudioEngineer())) { + throw new JeroBootException("该项目的studio为空,请维护studio后再进行退回操作!"); + } + + List studioEngineerUserInfo = this.sysUserService.querySysUserListByIdList(Arrays.asList(projectLibraryBase.getStudioEngineer().split(","))); + + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + // 获取认证清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + String hrefFeishu_CN_P = (String) hrefFeishuMap.get("hrefFeishu_CN_P"); + + // 给studio分配待办中心任务 + /*List processInfoDetailEOList = new ArrayList<>(); + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setUserId(projectLibraryBase.getStudioEngineer()); + processInfoDetailEOList.add(processInfoDetailEO); + this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.STUDIOFQ.getKey());*/ + + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + Collections.sort(projectCertificationInventoryEOList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getEndTime() != null && p2.getEndTime() != null){ + return p1.getEndTime().compareTo(p2.getEndTime()); + } + return 1; + } + }); + + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()); + } + + for (ProjectCertificationInventoryEO pciEo : projectCertificationInventoryEOList) { + pciEo.setReasonForReturn(reasonForReturn); + processHistoryEOService.add(pciEo.getId(),CertificationFlowNodeEnum.CHECKLIST_VERIFICATION.getKey(),currentUser.getId(),ReviewResultEnum.RETURNED.getValue(),reasonForReturn,null); + + } + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_RETURNED_STUDIO_TASK.getValue()); + + Map standNameAndItemName = this.getStandNameAndItemName(projectCertificationInventoryEOList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + try { + // 认证工程师退回任务到studio,将数据的状态更新为 认证退回 + this.updateBatchById(projectCertificationInventoryEOList); + + // 更新该项目认证流程中,认证工程师的任务状态。 + // 如果还有 清单待校核、责任人拒绝 状态的数据,不做操作,如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办 + this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSJSRW.getKey(),flowStatusList); + + try { + String thirdId = this.sysUserService.getUserThirdIdByUserId(studioEngineerUserInfo,projectLibraryBase.getStudioEngineer()); + + if(StringUtils.isNotEmpty(thirdId)){ + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + /*Collections.sort(projectCertificationInventoryEOList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getEndTime() != null && p2.getEndTime() != null){ + return p1.getEndTime().compareTo(p2.getEndTime()); + } + return 1; + } + }); + Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();*/ + this.certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(projectCertificationInventoryEOList); + Date endTime = projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime(); + + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE3.getValue()); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); + + templateVariableMap.put("certificationEngineer",currentUser.getUsername()); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + }catch (Exception ex){ + ex.printStackTrace(); + log.error("认证工程师-退回认证清单任务失败:" + ex.getMessage()); + throw new JeroBootException("退回任务失败!"); + } + + return Result.OK("退回任务成功!"); + } + + /** + * 认证工程师发起任务 + * @param json + * @return + */ + @Override + public Result certificationInitiatingTask(JSONObject json) { + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + String taskConfirmEndTimeStr = json.getString("taskConfirmEndTime"); + Date taskConfirmEndTime = DateUtils.str2Date(taskConfirmEndTimeStr, DateUtils.date_sdf.get()); + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + List idList = Arrays.asList(ids.split(",")); + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + throw new JeroBootException("至少选择一条数据流程状态为'清单待校核 或 责任人拒绝的数据'!"); + } + + ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class); + if (ObjectUtils.isEmpty(projectLibraryBase)) { + throw new JeroBootException("无法获取项目库信息"); + } + + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + // 获取认证清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + //飞书手机跳转链接 + String hrefFeishu_CN_P = this.handlePhoneLink(projectLibraryBase.getId(),PRN_CN,CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey()); + + Map> certifycationInventoryListByDutyPersonMap = projectCertificationInventoryEOList.stream().collect(Collectors.groupingBy(ProjectCertificationInventoryEO::getDutyPerson)); + try { + // 给责任人分配待办中心的任务 + List processInfoDetailEOList = new ArrayList<>(); + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); + projectCertificationInventoryEO.setTaskConfirmEndTime(taskConfirmEndTime); + + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setUserId(projectCertificationInventoryEO.getDutyPerson()); + processInfoDetailEO.setEndTime(taskConfirmEndTime); + processInfoDetailEO.setProjectLawsInventoryId(projectCertificationInventoryEO.getId()); + processInfoDetailEOList.add(processInfoDetailEO); + + processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.CHECKLIST_VERIFICATION.getKey(),currentUser.getId(),null,null,null); + + } + + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_INITIATING_TASK.getValue()); + + String projectLibraryId = json.getString("projectLibraryId"); + ProcessInfoEO processInfoEO = new ProcessInfoEO(); + this.addProcessInfoEO(processInfoEO,projectLibraryId); + this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.ZRRJSRW.getKey()); + + // 认证工程师发起任务,将数据的状态更新为 任务待确认。 + this.updateBatchById(projectCertificationInventoryEOList); + + // 获取当前项目下,认证清单,清单校核截止日期最早的一个,更新到流程明细表中,认证工程师接受任务节点的截止时间中 + this.updateProcessInfoDetailEndTime( + flowStatusList, + CertificationFlowNodeEnum.RZGCSJSRW.getKey(), + projectLibraryBase, + "inventory_verify_end_time", + idList + ); + + // 更新该项目认证流程中,认证工程师的任务状态。 + // 如果还有 清单待校核、责任人拒绝 状态的数据,不做操作,如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办 + this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSJSRW.getKey(),flowStatusList); + + List dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList); + + for (Map.Entry> dataByDutyPersonMap : certifycationInventoryListByDutyPersonMap.entrySet()) { + String dutyPersonUserId = dataByDutyPersonMap.getKey(); + List dutyPersonDataList = dataByDutyPersonMap.getValue(); + if(CollectionUtils.isEmpty(dutyPersonDataList)){ + continue; + } + + Map standNameAndItemName = this.platformProjectCertificationInventoryEOService.getStandNameAndItemName(dutyPersonDataList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + try { + String thirdId = this.sysUserService.getUserThirdIdByUserId(dutyPersonList,dutyPersonUserId); + + if(StringUtils.isNotEmpty(thirdId)){ + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 +// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); +// Date endTime = projectCertificationInventoryEOList.get(0).getEndTime(); + + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE10.getValue()); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getRegulationOwnerIdName()); + templateVariableMap.put("endTime",DateUtils.formatDate(taskConfirmEndTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); + + templateVariableMap.put("certificationEngineer",currentUser.getUsername()); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + } + + }catch (Exception ex){ + ex.printStackTrace(); + log.error("认证工程师-发起认证清单任务失败:" + ex.getMessage()); + throw new JeroBootException("发起任务失败!"); + } + + return Result.OK("发起任务成功!"); + } + + @Override + public String handlePhoneLink(String id, String prn_cn, String key) { + String hrefFeishu_CN_P = backUrlPhone + + JumpLinkEnum.PRE_TASK_HANDING_PHONE.getLink() + "?isDisplay=false&projectLibraryId=" + id + + "&projectName=" + prn_cn + "&taskDefinitionKey=" + key + "&TaskKeyName="+CertificationFlowNodeEnum.getTextByValue(key, CutEnum.CN.getValue()); + ; + return URLUtil.encode(hrefFeishu_CN_P); + } + + /** + * 认证清单数据排序,根据截至时间顺序排序 + * @param projectCertificationInventoryEOList + */ + @Override + public void certificationInventoryEOListSortByEndTimeAsc(List projectCertificationInventoryEOList) { + Collections.sort(projectCertificationInventoryEOList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getEndTime() != null && p2.getEndTime() != null){ + return p1.getEndTime().compareTo(p2.getEndTime()); + } + return 1; + } + }); + } + + /** + * 认证清单数据排序,根据清单校核截至时间顺序排序 + * @param pciEoList + */ + @Override + public void certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(List pciEoList) { + Collections.sort(pciEoList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getInventoryVerifyEndTime() != null && p2.getInventoryVerifyEndTime() != null){ + return p1.getInventoryVerifyEndTime().compareTo(p2.getInventoryVerifyEndTime()); + } + return 1; + } + }); + } + /** + * 认证清单数据排序,根据任务确认截至时间顺序排序 + * @param pciEoList + */ + @Override + public void certificationInventoryEOListSortByTaskConfirmEndTimeAsc(List pciEoList) { + Collections.sort(pciEoList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getTaskConfirmEndTime() != null && p2.getTaskConfirmEndTime() != null){ + return p1.getTaskConfirmEndTime().compareTo(p2.getTaskConfirmEndTime()); + } + return 1; + } + }); + } + + @Override + public List> getTaskToConfirmStatistics(List pciEoList) { + List> result = new ArrayList<>(); + + int notStartedCount = 0; + int toConfirmCount = 0; + int acceptedCount = 0; + int rejectedCount = 0; + if(CollectionUtils.isNotEmpty(pciEoList)){ + // 未发起 + notStartedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + return flag; + }).count(); + // 待确认 + toConfirmCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).count(); + // 接受 + acceptedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ); + return flag; + }).count(); + // 拒绝 + rejectedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) + ); + return flag; + }).count(); + } + Map notStartedMap = new HashMap<>(); + Map toConfirmMap = new HashMap<>(); + Map acceptedMap = new HashMap<>(); + Map rejectedMap = new HashMap<>(); + + notStartedMap.put("taskAffirmStatus",TaskAffirmStatusEnum.NOT_STARTED.getValue()); + notStartedMap.put("taskAffirmStatusCount",notStartedCount); + + toConfirmMap.put("taskAffirmStatus",TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + toConfirmMap.put("taskAffirmStatusCount",toConfirmCount); + + acceptedMap.put("taskAffirmStatus",TaskAffirmStatusEnum.ACCEPTED.getValue()); + acceptedMap.put("taskAffirmStatusCount",acceptedCount); + + rejectedMap.put("taskAffirmStatus",TaskAffirmStatusEnum.REJECTED.getValue()); + rejectedMap.put("taskAffirmStatusCount",rejectedCount); + + result.add(notStartedMap); + result.add(toConfirmMap); + result.add(acceptedMap); + result.add(rejectedMap); + return result; + } + + @Override + public List> getPrehomoStatistice(List pciEoList) { + List> result = new ArrayList<>(); + + int notStartedCount = 0; + int toConfirmCount = 0; + int acceptedCount = 0; + int rejectedCount = 0; + if(CollectionUtils.isNotEmpty(pciEoList)){ + // 未发起 + notStartedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) + ); + return flag; + }).count(); + // 待确认 + toConfirmCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + ); + return flag; + }).count(); + // 审查通过 + acceptedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()) + ); + return flag; + }).count(); + // 审查退回 + rejectedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ); + return flag; + }).count(); + } + Map notStartedMap = new HashMap<>(); + Map toConfirmMap = new HashMap<>(); + Map acceptedMap = new HashMap<>(); + Map rejectedMap = new HashMap<>(); + + notStartedMap.put("taskAffirmStatus",TaskAffirmStatusEnum.NOT_STARTED.getValue()); + notStartedMap.put("taskAffirmStatusCount",notStartedCount); + + toConfirmMap.put("taskAffirmStatus", TodoCenterStatusEnum.TO_SUBMIT.getValue()); +// toConfirmMap.put("taskAffirmStatus",TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + toConfirmMap.put("taskAffirmStatusCount",toConfirmCount); + + acceptedMap.put("taskAffirmStatus",CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()); + acceptedMap.put("taskAffirmStatusCount",acceptedCount); + + rejectedMap.put("taskAffirmStatus",CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()); + rejectedMap.put("taskAffirmStatusCount",rejectedCount); + + result.add(notStartedMap); + result.add(toConfirmMap); + result.add(acceptedMap); + result.add(rejectedMap); + return result; + } + + @Override + public List> getAllCertificationProgressStatistics(List pciEoList) { + List> result = new ArrayList<>(); + + int notStartedCount = 0; + int inProgressCount = 0; + int testPassedCount = 0; + int testFailedCount = 0; + if(CollectionUtils.isNotEmpty(pciEoList)){ + // 未开始 + notStartedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.NOT_START.getValue()) + ); + return flag; + }).count(); + // 进行中 + inProgressCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.IN_PROGRESS.getValue()) + || StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) + ); + return flag; + }).count(); + // 实验通过 + testPassedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.TEST_PASSED.getValue()) + || StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) + ); + return flag; + }).count(); + // 实验失败 + testFailedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.TEST_FAILED.getValue()) + ); + return flag; + }).count(); + } + Map notStartedMap = new HashMap<>(); + Map inProgressMap = new HashMap<>(); + Map testPassedMap = new HashMap<>(); + Map testFailedMap = new HashMap<>(); + + notStartedMap.put("certificationProgress",CertificationProgressEnum.NOT_START.getValue()); + notStartedMap.put("certificationProgressCount",notStartedCount); + + inProgressMap.put("certificationProgress",CertificationProgressEnum.IN_PROGRESS.getValue()); + inProgressMap.put("certificationProgressCount",inProgressCount); + + testPassedMap.put("certificationProgress",CertificationProgressEnum.TEST_PASSED.getValue()); + testPassedMap.put("certificationProgressCount",testPassedCount); + + testFailedMap.put("certificationProgress",CertificationProgressEnum.TEST_FAILED.getValue()); + testFailedMap.put("certificationProgressCount",testFailedCount); + + result.add(notStartedMap); + result.add(inProgressMap); + result.add(testPassedMap); + result.add(testFailedMap); + return result; + } + + @Override + public List> getCarCertificationProgressStatistics(List pciEoList) { + List> result = new ArrayList<>(); + + int notStartedCount = 0; + int inProgressCount = 0; + int testPassedCount = 0; + int testFailedCount = 0; + if(CollectionUtils.isNotEmpty(pciEoList)){ + // 未开始 + notStartedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.NOT_START.getValue()) + ); + return flag; + }).count(); + // 进行中 + inProgressCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.IN_PROGRESS.getValue()) + ); + return flag; + }).count(); + // 实验通过 + testPassedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.TEST_PASSED.getValue()) + ); + return flag; + }).count(); + // 实验失败 + testFailedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.TEST_FAILED.getValue()) + ); + return flag; + }).count(); + } + Map notStartedMap = new HashMap<>(); + Map inProgressMap = new HashMap<>(); + Map testPassedMap = new HashMap<>(); + Map testFailedMap = new HashMap<>(); + + notStartedMap.put("certificationProgress",CertificationProgressEnum.NOT_START.getValue()); + notStartedMap.put("certificationProgressCount",notStartedCount); + + inProgressMap.put("certificationProgress",CertificationProgressEnum.IN_PROGRESS.getValue()); + inProgressMap.put("certificationProgressCount",inProgressCount); + + testPassedMap.put("certificationProgress",CertificationProgressEnum.TEST_PASSED.getValue()); + testPassedMap.put("certificationProgressCount",testPassedCount); + + testFailedMap.put("certificationProgress",CertificationProgressEnum.TEST_FAILED.getValue()); + testFailedMap.put("certificationProgressCount",testFailedCount); + + result.add(notStartedMap); + result.add(inProgressMap); + result.add(testPassedMap); + result.add(testFailedMap); + return result; + } + + @Override + public List> getPartCertificationProgressStatistics(List pciEoList) { + List> result = new ArrayList<>(); + + int notSubmitCount = 0; + int reportSubmitCount = 0; + int storedCount = 0; + if(CollectionUtils.isNotEmpty(pciEoList)){ + // 部件报告未提交 + notSubmitCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) + ); + return flag; + }).count(); + // 部件报告已提交 + reportSubmitCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) + ); + return flag; + }).count(); + // 部件报告已入库 + storedCount = (int) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) + ); + return flag; + }).count(); + } + Map notSubmitMap = new HashMap<>(); + Map reportSubmitMap = new HashMap<>(); + Map storedMap = new HashMap<>(); + + notSubmitMap.put("certificationProgress",CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()); + notSubmitMap.put("certificationProgressCount",notSubmitCount); + + reportSubmitMap.put("certificationProgress",CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()); + reportSubmitMap.put("certificationProgressCount",reportSubmitCount); + + storedMap.put("certificationProgress",CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()); + storedMap.put("certificationProgressCount",storedCount); + + result.add(notSubmitMap); + result.add(reportSubmitMap); + result.add(storedMap); + return result; + } + + @Override + public Result saveBatch(JSONObject json) { + Date now = new Date(); + if (!json.containsKey("dataList")) { + throw new JeroBootException("无法获取需要保存的数据,请检查!"); + } + JSONArray dataList = json.getJSONArray("dataList"); + List projectCertificationInventoryEOList = new ArrayList<>(); + ProjectCertificationInventoryEO projectCertificationInventoryEO = null; + //设置权限 先删后加 + List adds = new ArrayList<>(); + for (Object data : dataList) { + projectCertificationInventoryEO = JSONObject.parseObject(JSONObject.toJSONString(data),ProjectCertificationInventoryEO.class); + projectCertificationInventoryEOList.add(projectCertificationInventoryEO); + if(ObjectUtils.isNotEmpty(projectCertificationInventoryEO.getSdt())){ + setProjectCertificationInventoryPermission(projectCertificationInventoryEO.getSdt(), projectCertificationInventoryEO.getProjectLibraryId(), projectCertificationInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_SDT.getValue()); + } + if(ObjectUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){ + setProjectCertificationInventoryPermission(projectCertificationInventoryEO.getDutyPerson(), projectCertificationInventoryEO.getProjectLibraryId(), projectCertificationInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_DP.getValue()); + } + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + throw new JeroBootException("无法获取需要保存的数据,请检查!"); + } + this.updateBatchById(projectCertificationInventoryEOList); + return Result.OK("保存成功!"); + } + + @Override + public Result resetFlow(JSONObject json) { + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行流程重置!"); + } + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + String operatorType = json.getString("operatorType"); + + String projectLibraryId = json.getString("projectLibraryId"); + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if(ObjectUtils.isEmpty(projectLibraryBase)){ + throw new JeroBootException("无法获取项目库信息,项目库id为:" + projectLibraryId + " 请联系管理员!"); + } + List certificationEngineerIdList = new ArrayList<>(); + List certificationEngineerList = new ArrayList<>(); + if(StringUtils.isNotBlank(projectLibraryBase.getCertificationEngineer())){ + certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + } + + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + // 获取认证清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryId, PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + String hrefFeishu_CN_P = (String) hrefFeishuMap.get("hrefFeishu_CN_P"); + + + List idList = Arrays.asList(ids.split(",")); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().ne(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + Collections.sort(projectCertificationInventoryEOList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getEndTime() != null && p2.getEndTime() != null){ + return p1.getEndTime().compareTo(p2.getEndTime()); + } + return 1; + } + }); + + Map standNameAndItemName = this.getStandNameAndItemName(projectCertificationInventoryEOList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + try { + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + // 把交付结果、截止日期清空,流程状态 设置为 清单待发布 + LambdaUpdateWrapper updateWrap = new LambdaUpdateWrapper<>(); + updateWrap.set(ProjectCertificationInventoryEO::getDeliveryResult,null); + // 流程重置,清空截止日期, 撤回不清空。 对应禅道问题:67048 + if(StringUtils.equals(operatorType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_RESET.getValue())){ + updateWrap.set(ProjectCertificationInventoryEO::getEndTime,null); + } + + updateWrap.set(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + updateWrap.eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId()); + this.update(updateWrap); + } + processHistoryEOService.deleteByPId(ids); + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,operatorType); + + // 处理待办中心相关数据 + // 更新该项目认证流程中,认证工程师的任务状态。 + // 认证工程师接受任务节点 + List rzgcsjsrwFlowStatusList = new ArrayList<>(); + rzgcsjsrwFlowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + rzgcsjsrwFlowStatusList.add(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()); + this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSJSRW.getKey(),rzgcsjsrwFlowStatusList); + + // 认证工程师审查节点 如果还有 结果待审查 的数据,不做操作,如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办 + List rzgcsscFlowStatusList = new ArrayList<>(); + rzgcsscFlowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSSC.getKey(),rzgcsscFlowStatusList); + + // 删除其它用户的待办任务 + QueryWrapper detailRemoveWrap = new QueryWrapper<>(); + detailRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId()); + detailRemoveWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); + detailRemoveWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId,idList); + this.processInfoDetailEOService.remove(detailRemoveWrap); + + try { + if(CollectionUtils.isNotEmpty(certificationEngineerList)){ + for (String certificationEngineerId : certificationEngineerIdList) { + String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerList,certificationEngineerId); + + if(StringUtils.isNotEmpty(thirdId)){ + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + Collections.sort(projectCertificationInventoryEOList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getEndTime() != null && p2.getEndTime() != null){ + return p1.getEndTime().compareTo(p2.getEndTime()); + } + return 1; + } + }); + Date endTime = projectCertificationInventoryEOList.get(0).getEndTime(); + + JSONObject larkMesJson = new JSONObject(); + if(StringUtils.equals(operatorType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_WITHDRAW.getValue())){ + this.certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(projectCertificationInventoryEOList); + endTime = projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE4.getValue()); + }else if(StringUtils.equals(operatorType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_RESET.getValue())){ + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE5.getValue()); + } + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + + }catch (Exception ex){ + ex.printStackTrace(); + log.error("studio-流程重置失败:" + ex.getMessage()); + throw new JeroBootException("流程重置失败!"); + } + return Result.OK("流程重置成功!"); + } + + @Override + public Result transferTask(JSONObject json) { + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + + String projectLibraryId = json.getString("projectLibraryId"); + String transferUserId = json.getString("transferUserId"); + SysUser transferUserInfo = this.sysUserService.getById(transferUserId); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if(ObjectUtils.isEmpty(projectLibraryBase)){ + throw new JeroBootException("无法获取项目库信息,项目库id为:" + projectLibraryId + " 请联系管理员!"); + } + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List idList = Arrays.asList(ids.split(",")); + + // 流程状态为 任务待确认、待提交、 审查退回 。 能转办 + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getDutyPerson,currentUser.getId()); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + throw new JeroBootException("至少选择一条数据流程状态为'任务待确认 或 结果待提交 或 审查退回'的数据进行转办操作!"); + } + + List projectCertificationInventoryLogEOList = new ArrayList<>(); + projectCertificationInventoryEOList.forEach(certificationInventory -> { + certificationInventory.setDutyPerson(transferUserId); + + String contentCn = "\"" + currentUser.getUsername() + "\"" +"将流程发送至" +"\""+ transferUserInfo.getUsername() + "\"办理" ; + String contentEn = "\"" + currentUser.getUsername() + "\"" +" sends the process to "+"\""+ transferUserInfo.getUsername() + "\" for handling" ; + ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO(); + projectCertificationInventoryLogEO.setProjectCertificationInventoryId(certificationInventory.getId()); + projectCertificationInventoryLogEO.setContentCn(contentCn); + projectCertificationInventoryLogEO.setContentEn(contentEn); + projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_TRANSFER_TASK.getValue()); + projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO); + if(certificationInventory.getFlowStatus().equals(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())){ + processHistoryEOService.add(certificationInventory.getId(),CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(),currentUser.getId(),ReviewResultEnum.TRANSFER.getValue(),null,null); + }else{ + processHistoryEOService.add(certificationInventory.getId(),CertificationFlowNodeEnum.TASK_HANDLING.getKey(),currentUser.getId(),ReviewResultEnum.TRANSFER.getValue(),null,null); + } + }); + + if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){ + this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList); + } + + this.updateBatchById(projectCertificationInventoryEOList); + //设置权限 先删后加 + Date now = new Date(); + List adds = new ArrayList<>(); + for (ProjectCertificationInventoryEO pci:projectCertificationInventoryEOList) { + if (ObjectUtils.isNotEmpty(pci.getSdt())) { + setProjectCertificationInventoryPermission(pci.getSdt(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_SDT.getValue()); + } + if (ObjectUtils.isNotEmpty(pci.getDutyPerson())) { + setProjectCertificationInventoryPermission(pci.getDutyPerson(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_DP.getValue()); + } + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + + Collections.sort(projectCertificationInventoryEOList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getEndTime() != null && p2.getEndTime() != null){ + return p1.getEndTime().compareTo(p2.getEndTime()); + } + return 1; + } + }); + + QueryWrapper detailQueryWrap = new QueryWrapper<>(); + detailQueryWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryId); + detailQueryWrap.lambda().eq(ProcessInfoDetailEO::getUserId,currentUser.getId()); + detailQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId,idList); + List processInfoDetailEOList = this.processInfoDetailEOService.list(detailQueryWrap); + if(CollectionUtils.isNotEmpty(processInfoDetailEOList)){ + processInfoDetailEOList.forEach(detail -> { + detail.setUserId(transferUserId); + }); + this.processInfoDetailEOService.updateBatchById(processInfoDetailEOList); + } + + List userIdList = Arrays.asList(transferUserId.split(",")); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + this.sendMessageByTemplateId( + projectCertificationInventoryEOList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE17.getValue(), + userIdList, + userInfoList, + projectCertificationInventoryEOList.get(0).getEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey() + ); + + // 获取认证清单 - 飞书跳转链接 + // 2023-03-15 去掉此消息 + /*Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + + Map standNameAndItemName = this.getStandNameAndItemName(projectCertificationInventoryEOList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + SysUser sysUser = this.sysUserService.getBaseMapper().selectById(transferUserId); + if (StringUtils.isNotEmpty(sysUser.getThirdId())) { + try { + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE9.getValue()); + larkMesJson.put("userIds",sysUser.getThirdId()); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn", PRN_CN); + templateVariableMap.put("projectNameEn", PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator", projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime", DateUtils.formatDate(projectCertificationInventoryEOList.get(0).getEndTime())); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + }*/ + + return Result.OK("转办成功!"); + } + + @Override + public Result expediting(JSONObject json) { + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + + String projectLibraryId = json.getString("projectLibraryId"); + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + if(ObjectUtils.isEmpty(projectLibraryBase)){ + throw new JeroBootException("无法获取项目库信息,项目库id为:" + projectLibraryId + " 请联系管理员!"); + } + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List idList = Arrays.asList(ids.split(",")); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); +// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getDutyPerson,currentUser.getId()); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ + // 获取认证清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryId, PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + String hrefFeishu_CN_P = (String) hrefFeishuMap.get("hrefFeishu_CN_P"); + + /** + * studio催办:除了 清单待发布、审查通过、认证退回 的 催办当前办理人 + * 认证工程师催办:任务待确认、结果待提交、审查退回 的 催办当前办理人 + * 接口人催办:任务待确认 、结果待提交、审查退回 的 催办当前办理人 + */ + String operatorType = json.getString("operatorType"); + if(StringUtils.equals(operatorType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_EXPEDITING.getValue())){ + // 结果待审查 + List toBeReviewedCiEoList = projectCertificationInventoryEOList.stream().filter(data -> { + return (StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue())); + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(toBeReviewedCiEoList)){ + String certificationEngineerIds = projectLibraryBase.getCertificationEngineer(); + if(StringUtils.isNotEmpty(certificationEngineerIds)){ + List certificationEngineerIdList = Arrays.asList(certificationEngineerIds.split(",")); + + List certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + Collections.sort(toBeReviewedCiEoList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getEndTime() != null && p2.getEndTime() != null){ + return p1.getEndTime().compareTo(p2.getEndTime()); + } + return 1; + } + }); + Date endTime = toBeReviewedCiEoList.get(0).getEndTime(); + + Map standNameAndItemName = this.getStandNameAndItemName(toBeReviewedCiEoList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + if(CollectionUtils.isNotEmpty(certificationEngineerList)){ + for (String certificationEngineerId : certificationEngineerIdList) { + String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerList,certificationEngineerId); + + if(StringUtils.isNotEmpty(thirdId)){ + try { + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE1.getValue()); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); + + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("viewBtnUrlEnPhone",hrefFeishu_CN_P); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + } + } + } + } + } + + // 清单待校核、责任人拒绝 + List toBeCheckedCiEoList = projectCertificationInventoryEOList.stream().filter(data -> { + return (StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue())); + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeCheckedCiEoList)) { + String certificationEngineerIds = projectLibraryBase.getCertificationEngineer(); + if(StringUtils.isNotEmpty(certificationEngineerIds)){ + List certificationEngineerIdList = Arrays.asList(certificationEngineerIds.split(",")); + + List certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + Collections.sort(toBeCheckedCiEoList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getInventoryVerifyEndTime() != null && p2.getInventoryVerifyEndTime() != null){ + return p1.getInventoryVerifyEndTime().compareTo(p2.getInventoryVerifyEndTime()); + } + return 1; + } + }); + Date inventoryVerifyEndTime = toBeCheckedCiEoList.get(0).getInventoryVerifyEndTime(); + + Map standNameAndItemName = this.getStandNameAndItemName(toBeCheckedCiEoList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + if(CollectionUtils.isNotEmpty(certificationEngineerList)){ + for (String certificationEngineerId : certificationEngineerIdList) { + String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerList,certificationEngineerId); + + if(StringUtils.isNotEmpty(thirdId)){ + try { + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE1.getValue()); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(inventoryVerifyEndTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("viewBtnUrlEnPhone",hrefFeishu_CN_P); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + } + } + } + } + } + } + + List dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList); + + Map> certifycationInventoryListByDutyPersonMap = projectCertificationInventoryEOList.stream().filter(data -> { + return (StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())); + }).collect(Collectors.groupingBy(ProjectCertificationInventoryEO::getDutyPerson)); + + if(!ObjectUtils.isEmpty(certifycationInventoryListByDutyPersonMap) && CollectionUtils.isNotEmpty(dutyPersonList)){ + for (Map.Entry> map : certifycationInventoryListByDutyPersonMap.entrySet()) { + String key = map.getKey(); + List userIdList = Arrays.asList(key.split(",")); + + // 任务待确认状态的数据:发送认证任务确认的催办消息 + List toBeConfirmedPciEoList = map.getValue().stream().filter(pciEo -> { + boolean flag = false; + if(StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + this.certificationInventoryEOListSortByTaskConfirmEndTimeAsc(toBeConfirmedPciEoList); + if (CollectionUtils.isNotEmpty(toBeConfirmedPciEoList)) { + Date taskConfirmEndTime = toBeConfirmedPciEoList.get(0).getTaskConfirmEndTime(); + // 给责任人发消息 + this.sendMessageByTemplateId( + toBeConfirmedPciEoList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE16.getValue(), + userIdList, + dutyPersonList, + taskConfirmEndTime, + CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey() + ); + } + + List toBeSubmitOrReturnPciEoList = map.getValue().stream().filter(pciEo -> { + boolean flag = false; + if(StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(toBeSubmitOrReturnPciEoList)) { + this.certificationInventoryEOListSortByTaskConfirmEndTimeAsc(toBeSubmitOrReturnPciEoList); + // 给责任人发消息 + this.sendMessageByTemplateId( + toBeSubmitOrReturnPciEoList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE18.getValue(), + userIdList, + dutyPersonList, + toBeSubmitOrReturnPciEoList.get(0).getTaskConfirmEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey() + ); + } + + /*// 待提交数据 单独发消息 + List toBeSubmitDataList = value.stream().filter(v -> { + boolean flag = false; + if(StringUtils.equals(v.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeSubmitDataList)) { + + this.sendMessageByTemplateId( + toBeSubmitDataList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE18.getValue(), + userIdList, + dutyPersonList + ); + }*/ + + /*String thirdId = this.sysUserService.getUserThirdIdByUserId(dutyPersonList,key); + + if(StringUtils.isNotEmpty(thirdId)){ + // 过滤掉 待提交的数据,正常发消息 + value = value.stream().filter(v -> { + boolean flag = false; + if(!StringUtils.equals(v.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + Collections.sort(value, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getEndTime() != null && p2.getEndTime() != null){ + return p1.getEndTime().compareTo(p2.getEndTime()); + } + return 1; + } + }); + Map standNameAndItemName = this.getStandNameAndItemName(value); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + Date endTime = value.get(0).getEndTime(); + + try { + JSONObject larkMesJson = new JSONObject(); + + String templateId = TemplateInfoEnum2.CERTIFICATION_MESSAGE1.getValue(); + if(StringUtils.equals(operatorType,OperatorTypeEnum.CERTIFICATION_INVENTORY_CERTIFICATION_ENGINEER_EXPEDITING.getValue())){ + templateId = TemplateInfoEnum2.CERTIFICATION_MESSAGE16.getValue(); + } + + larkMesJson.put("template_id", templateId); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + }*/ + } + } + } + + return Result.OK("催办成功!"); + } + + /** + * 获取标准编号和检验项目 发飞书消息使用 + * @param projectCertificationInventoryEOList + * @return + */ + @Override + public Map getStandNameAndItemName(List projectCertificationInventoryEOList){ + Map result = new HashMap<>(); + StringBuilder standNameSb = new StringBuilder(); + StringBuilder itemNameSb = new StringBuilder(); + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getInspectionItem())){ + itemNameSb.append(projectCertificationInventoryEO.getInspectionItem()).append(","); + } + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getSerialNumber())){ + standNameSb.append(projectCertificationInventoryEO.getSerialNumber()).append(","); + } + } + + String standName = ""; + if(StringUtils.isNotEmpty(standNameSb.toString())){ + standName = standNameSb.toString().substring(0,standNameSb.toString().length()-1); + } + String itemName = ""; + if(StringUtils.isNotEmpty(itemNameSb.toString())){ + itemName = itemNameSb.toString().substring(0,itemNameSb.toString().length()-1); + } + + result.put("standName",standName); + result.put("itemName",itemName); + return result; + } + + /** + * 获取认证清单飞书跳转链接 + * @param projectLibraryId + * @param PRN_CN + * @param PRN_EN + * @return + */ + @Override + public Map getCertificationInventoryLinkHrefFeishu(String projectLibraryId,String PRN_CN,String PRN_EN){ + Map result = new HashMap<>(); + + String hrefFeishu_CN = backUrl + + JumpLinkEnum.CERTIFICATION_INVENTORY_LINK.getLink() + + projectLibraryId + + JumpLinkEnum.CERTIFICATION_INVENTORY_LINK.getType() + + "&projectName=" + PRN_CN; + + //飞书跳转链接 + String hrefFeishu_EN = backUrl + + JumpLinkEnum.CERTIFICATION_INVENTORY_LINK.getLink() + + projectLibraryId + + JumpLinkEnum.CERTIFICATION_INVENTORY_LINK.getType() + + "&projectName=" + PRN_EN; + + //飞书手机跳转链接 + String hrefFeishu_CN_P = backUrlPhone + + JumpLinkEnum.TO_DO_CENTER_PHONE.getLink()+ "?keyWord=" + PRN_CN; + + + result.put("hrefFeishu_CN", URLUtil.encode(hrefFeishu_CN)); + result.put("hrefFeishu_EN",URLUtil.encode(hrefFeishu_EN)); + result.put("hrefFeishu_CN_P",URLUtil.encode(hrefFeishu_CN_P)); + return result; + } + + + @Override + public Result updateConfigItemBatch(JSONObject json) { + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + + String configItem = json.getString("configItem"); + String sdt = json.getString("sdt");//工程接口人 + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("请选择一个配置!"); + } + QueryWrapper queryWrap = new QueryWrapper<>(); + queryWrap.lambda().in(ProjectCertificationInventoryEO::getId,ids.split(",")); + List projectCertificationInventoryEOList = this.list(queryWrap); + projectCertificationInventoryEOList.forEach(certificationInventoryEO -> { + certificationInventoryEO.setConfigItem(configItem); + certificationInventoryEO.setSdt(sdt); + }); + + this.updateBatchById(projectCertificationInventoryEOList); + return Result.OK("修改配置成功!"); + } + + @Override + public Result callAdd(JSONObject json) { + String cut = json.getString("cut"); + List result = new ArrayList<>(); + if(StringUtils.equals(cut,CutEnum.CN.getValue())){ + result.add("调取成功!"); + }else { + result.add("Successfully retrieved!"); + } + + String authDummyInventoryBaseId = json.getString("authDummyInventoryBaseId"); + if(StringUtils.isEmpty(authDummyInventoryBaseId)){ + throw new JeroBootException("请选择一个认证虚拟清单进行操作!"); + } + + String authDummyInventoryInfoIds = json.getString("authDummyInventoryInfoIds"); + if(StringUtils.isEmpty(authDummyInventoryInfoIds)){ + throw new JeroBootException("至少选择一条数据进行调取!"); + } + + String projectLibraryId = json.getString("projectLibraryId"); + + QueryWrapper authDummyInfoQueryWrap = new QueryWrapper<>(); + authDummyInfoQueryWrap.lambda().in(AuthDummyInventoryInfoEO::getId,authDummyInventoryInfoIds.split(",")); + List authDummyInventoryInfoEOList = this.authDummyInventoryInfoEOService.list(authDummyInfoQueryWrap); + + if(CollectionUtils.isNotEmpty(authDummyInventoryInfoEOList)){ + // 获取该项目相关人员名单信息,用于根据责任领域配置数据 自动设置责任人、接口人。 + QueryWrapper prpQueryWrap = new QueryWrapper<>(); + prpQueryWrap.lambda().eq(ProjectRelatedPersonnel::getProjectId,projectLibraryId); + List prpEoList = this.projectRelatedPersonnelService.list(prpQueryWrap); + + QueryWrapper lawsInventoryEOQueryWrap = new QueryWrapper<>(); + lawsInventoryEOQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); + List projectLawsInventoryEOList = this.platformProjectLawsInventoryEOService.list(lawsInventoryEOQueryWrap); + + List projectCertificationInventoryEOList = new ArrayList<>(); + + List noSerialNumberList = new ArrayList<>(); + + for (AuthDummyInventoryInfoEO authDummyInventoryInfoEO : authDummyInventoryInfoEOList) { + if(CollectionUtils.isEmpty(projectLawsInventoryEOList)){ + break; + } + + // 根据选择调取的数据法规编号,跟当前项目中 法规清单数据法规编号对比,如果有,则加入,如果没有,则不加入。 + List lawsInventoryEOListTemp = projectLawsInventoryEOList.stream().filter(lawsInventoryEO -> { + boolean flag = false; + String adiSn = authDummyInventoryInfoEO.getSerialNumber(); + BussDocumentLibraryEO bl = iBussDocumentLibraryEOService.getBySerialNumber(adiSn); + if(ObjectUtils.isNotEmpty(bl)){ + if (StringUtils.equals(bl.getId(), lawsInventoryEO.getStandId())) { + flag = true; + } + } + + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(lawsInventoryEOListTemp)){ + ProjectCertificationInventoryEO projectCertificationInventoryEOTemp = new ProjectCertificationInventoryEO(); + BeanUtils.copyProperties(authDummyInventoryInfoEO,projectCertificationInventoryEOTemp); + + String dutyTerritory = projectCertificationInventoryEOTemp.getDutyTerritory(); + if(StringUtils.isNotEmpty(dutyTerritory)){ + if(CollectionUtils.isNotEmpty(prpEoList)){ + List prpEoListTemp = prpEoList.stream().filter(prpEo -> { + boolean flag = false; + if (StringUtils.equals(prpEo.getDutyTerritory(), dutyTerritory)) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(prpEoListTemp)){ + List engineeringInterfacePersonIdList = new ArrayList<>(); + ProjectRelatedPersonnel prpEo = prpEoListTemp.get(0); + if(StringUtils.isNotBlank(prpEo.getEngineeringInterfacePerson())){ + List engineeringInterfacePersonList = Arrays.asList(prpEo.getEngineeringInterfacePerson().split(",")); + engineeringInterfacePersonIdList.addAll(engineeringInterfacePersonList); + } + if(StringUtils.isNotBlank(prpEo.getEngineerAttSet())){ + List engineerAttSetList = Arrays.asList(prpEo.getEngineerAttSet().split(",")); + engineeringInterfacePersonIdList.addAll(engineerAttSetList); + } + if(StringUtils.isNotBlank(prpEo.getEngineerLawSet())){ + List engineerLawSetList = Arrays.asList(prpEo.getEngineerLawSet().split(",")); + engineeringInterfacePersonIdList.addAll(engineerLawSetList); + } + + engineeringInterfacePersonIdList = engineeringInterfacePersonIdList.stream().distinct().collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(engineeringInterfacePersonIdList) && engineeringInterfacePersonIdList.size() == 1){ + projectCertificationInventoryEOTemp.setSdt(engineeringInterfacePersonIdList.get(0)); + projectCertificationInventoryEOTemp.setDutyPerson(engineeringInterfacePersonIdList.get(0)); + } + } + } + } + + projectCertificationInventoryEOTemp.setId(UUID.randomUUID().toString().replace("-", "")); + projectCertificationInventoryEOTemp.setProjectLibraryId(projectLibraryId); + projectCertificationInventoryEOTemp.setFlowStatus(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); +// projectCertificationInventoryEOTemp.setFlowStatus(CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); + projectCertificationInventoryEOTemp.setCreateTime(new Date()); + projectCertificationInventoryEOTemp.setUpdateTime(new Date()); + projectCertificationInventoryEOTemp.setCertificationProgress(CertificationProgressEnum.NOT_START.getValue()); + projectCertificationInventoryEOList.add(projectCertificationInventoryEOTemp); + }else { + noSerialNumberList.add(authDummyInventoryInfoEO.getSerialNumber()); + } + } + + + if(CollectionUtils.isNotEmpty(noSerialNumberList)){ + // 判断调取的数据中,是否有 在当前项目库法规清单中 没有的编号 + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + result.add("您所选的数据中包含当前项目中不包含的法规编号信息,已为您过滤添加。"); + }else { + result.add("The data you have selected contains regulatory number information that is not included in the current project, and has been filtered and added for you."); + } + } + +// List saveDataList = this.dataUniqueCheck(projectCertificationInventoryEOList, cut, result, projectLibraryId); + + this.saveBatch(projectCertificationInventoryEOList); + + // 设置历史log(修改历史) + this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_CALL_ADD.getValue()); + + Date now = new Date(); + //设置权限 先删后加 + List adds = new ArrayList<>(); + for (ProjectCertificationInventoryEO pci: projectCertificationInventoryEOList) { + if (ObjectUtils.isNotEmpty(pci.getSdt())) { + setProjectCertificationInventoryPermission(pci.getSdt(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_SDT.getValue()); + } + if (ObjectUtils.isNotEmpty(pci.getDutyPerson())) { + setProjectCertificationInventoryPermission(pci.getDutyPerson(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_DP.getValue()); + } + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + } + + return Result.OK(result); + } + + /** + * 数据导入 + * @param file + * @param projectCertificationInventoryEO + */ + @SneakyThrows + @Override + public void importData(MultipartFile file, ProjectCertificationInventoryEO projectCertificationInventoryEO) { + String title = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + title = "*类别,*检验项目,*认证类型,*WVTA ID," + + "*标准编号,*责任领域,*工程接口人,*责任人," + + "交付物模板,*交付物类型,*截止日期,报告编号,产品型号,生产企业名称,备注"; + }else { + title = "*Category,*Inspection Items,*Certification Type,*WVTA ID," + + "*Standard No,*Responsible Field,*Eng. Interface,*Assignee," + + "Deliverable Template,*Deliverable Type,*Due Date,Report No,Product Model,Name Of Manufacturer,Remark"; + } + + int pos = file.getOriginalFilename().lastIndexOf("."); + String str = file.getOriginalFilename().substring(pos + 1).toLowerCase(); + String filenameorg = file.getOriginalFilename().substring(0, pos); + //判断上传文件必须是zip + if (!str.equals("zip")) { + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + throw new JeroBootException("请上传zip格式的文件或rar格式的文件"); + }else{ + throw new JeroBootException("Please upload a zip file or rar file"); + } + + } + String path = uploadpath + File.separator + "modal" + File.separator + filenameorg + System.currentTimeMillis(); + File saveDirectory = new File(path); + if (!saveDirectory.isDirectory()) { + saveDirectory.mkdir(); + } + FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + File.separator + file.getOriginalFilename())); + //解压缩 + String zipEntryName = ""; + if (str.equals("zip")) { + zipEntryName = FileUnZip.unZipFiles(path + File.separator + file.getOriginalFilename(), path); + } + + + //判断压缩包下是否只有一个文件夹 + File fileTemp = new File(path); + int length = fileTemp.listFiles().length; + if (length > 2) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + throw new JeroBootException("压缩包中必须有且仅有一个文件夹,请重新上传"); + }else{ + throw new JeroBootException("There must be only one folder in the compressed package Please upload it again"); + } + + } + File fileNew = new File(zipEntryName); + List fileList = new ArrayList<>(); + for (File file1 : fileNew.listFiles()) { + if (file1.getName().contains(".xls") || file1.getName().contains(".xlsx")) { + fileList.add(file1); + } + } + if (fileList.size() == 0) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + throw new JeroBootException("压缩包根目录下没有excel作为导入数据,请重新上传"); + }else{ + throw new JeroBootException("Excel does not exist in the root directory of the compressed package Please upload it again"); + } + + } else if (fileList.size() > 1) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + throw new JeroBootException("压缩包根目录下仅能存在一个excel为导入数据,请重新上传"); + }else{ + throw new JeroBootException("Only one Excel file can be imported in the compressed package root directory. Please upload data again"); + } + + } + + // 数据相关处理, + // 1.获取其中的Excel, + List excelfilelist = FileUnZip.readImpExcelFile(zipEntryName); + System.gc(); + if (excelfilelist.size() < 1) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + throw new JeroBootException("压缩包内没有上传Excel数据"); + }else{ + throw new JeroBootException("No Excel data is uploaded in the compressed package"); + } + + } else if (excelfilelist.size() > 1) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + throw new JeroBootException("压缩包内有多个Excel数据源"); + }else{ + throw new JeroBootException("There are multiple Excel data sources in the zip package"); + } + + } + List datas = new ArrayList<>(); + File excelFile = excelfilelist.get(0); + Workbook workbook = WorkbookFactory.create(excelFile); + List> dataList = new ArrayList<>(); + if (workbook != null) { + DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + Sheet sheet = workbook.getSheetAt(0); + if (sheet != null) { + StringBuilder headerSb = new StringBuilder(); + int rowNos = sheet.getLastRowNum();// 得到excel的总记录条数 + for (int i = 0; i <= rowNos; i++) { + Row row = sheet.getRow(i); + Row headerRow = sheet.getRow(i); + boolean isBlank = isRowEmpty(row); + String key = ""; + if (row != null && !isBlank) { + int columNos = headerRow.getLastCellNum();// 表头总共的列数 + Map rowList = new LinkedHashMap<>(); + for (int j = 0; j < columNos; j++) { + Cell cell = row.getCell(j); + Cell headerCell = headerRow.getCell(j); + if (cell != null) { + if (i == 0) { + cell.setCellType(HSSFCell.CELL_TYPE_STRING); + headerSb.append(cell.getStringCellValue() + ","); + if(j == 15){ + break; + } + } else if(i > 1){ + List headList = Arrays.asList(headerSb.toString().split(",")); + String field =""; + if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) { + Date d = cell.getDateCellValue(); + field = fieldConvert(headList.get(j)); + rowList.put(field, df.format(d)); + } else { + field = fieldConvert(headList.get(j)); + cell.setCellType(HSSFCell.CELL_TYPE_STRING); + String stringCellValue = cell.getStringCellValue(); + if (StringUtils.isNotBlank(stringCellValue)) { + String replace = stringCellValue.replace(",", ","); + rowList.put(field, replace); + } else { + rowList.put(field, ""); + } + } + } + } + } + if (i > 1) { + dataList.add(rowList); + } + } + } + if (dataList.size() == 0) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + throw new JeroBootException("请填写必填字段内容,带*的为必填"); + }else{ + throw new JeroBootException("Please fill in the required fields marked with *"); + } + + }else{ + //数据转换 JSON.parseObject(JSON.toJSONString(map), MyUser.class) + for (Map stringStringMap : dataList) { + ProjectCertificationInventoryEO projectCertificationInventoryEOTemp = JSON.parseObject(JSON.toJSONString(stringStringMap), ProjectCertificationInventoryEO.class); + projectCertificationInventoryEOTemp.setCut(projectCertificationInventoryEO.getCut()); + projectCertificationInventoryEOTemp.setProjectLibraryId(projectCertificationInventoryEO.getProjectLibraryId()); + projectCertificationInventoryEOTemp.setFlowStatus(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + projectCertificationInventoryEOTemp.setCertificationProgress(CertificationProgressEnum.NOT_START.getValue()); + datas.add(projectCertificationInventoryEOTemp); + } + } + // 校验头部是否符合模板 + String substring = headerSb.toString(); + if (substring.endsWith(",") || substring.endsWith(",")){ + substring = headerSb.substring(0, headerSb.length() - 1); + } + + String excelHeader = substring.toString(); + if (!title.equals(excelHeader)) { + workbook.close(); + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + throw new JeroBootException("读取失败,请严格按照模板文件导入数据"); + }else{ + throw new JeroBootException("The data fails to be read. Import data strictly according to the template file"); + } + } + //必填项校验 + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + for(int k = 0 ; k categoryList = sysCategoryService.list(); + //普通数据字典 + List dictItemList = sysDictItemServiceImpl.selectItemsAll(); + importDatas(datas, dictItemList, zipEntryName,saveDirectory,projectCertificationInventoryEO,categoryList); +// String cut = projectCertificationInventoryEO.getCut(); +// importDisposeData(datas,cut); + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + + } + + private void importDatas(List datas, + List dictItemList, String zipEntryName, + File saveDirectory, ProjectCertificationInventoryEO projectCertificationInventoryEOTemp, + List categoryList) { + List msgList = new ArrayList<>(); + //模板数据验证 + msgList = dataTemplateVerify(datas, dictItemList, zipEntryName, projectCertificationInventoryEOTemp, categoryList); + + if (msgList.size() > 0) { + //返回报错信息 + String html = ""; + for (String s : msgList) { + html += s + "
"; + } + FileUnZip.deleteDir(saveDirectory); + throw new JeroBootException(html); + }else { + if (datas.size() != 0) { + this.saveBatch(datas); + + this.saveProjectCertificationInventoryLog(datas,OperatorTypeEnum.CERTIFICATION_INVENTORY_IMPORT_ADD.getValue()); + + Date now = new Date(); + //设置权限 先删后加 + List adds = new ArrayList<>(); + for (ProjectCertificationInventoryEO pci: datas) { + if (ObjectUtils.isNotEmpty(pci.getSdt())) { + setProjectCertificationInventoryPermission(pci.getSdt(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_SDT.getValue()); + } + if (ObjectUtils.isNotEmpty(pci.getDutyPerson())) { + setProjectCertificationInventoryPermission(pci.getDutyPerson(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_DP.getValue()); + } + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + } + } + } + + //模板数据验证 + private List dataTemplateVerify(List datas, + List dictItemList, String zipEntryName, + ProjectCertificationInventoryEO projectCertificationInventoryEOTemp, + List categoryList) { + String dictId = sysCategoryMapper.getDictId("ren4_zheng4_-_jiao1_fu4_wu4_lei4_xing2"); + List collect = categoryList.stream().filter(e -> e.getSysDictId().equals(dictId)).collect(Collectors.toList()); + List treeNameList = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){ + treeNameList = collect.stream().map(SysCategory::getName).collect(Collectors.toList()); + }else{ + treeNameList = collect.stream().map(SysCategory::getEnName).collect(Collectors.toList()); + } + int i = 2; + List msgList = new ArrayList<>(); + String value = ""; + boolean flag = true; + +// List listUserName = new ArrayList<>(); +// listUserName = sysUserMapper.getListUserName(); +// listUserName = listUserName.stream().distinct().collect(Collectors.toList()); + + List userNameList = datas.stream().map(ProjectCertificationInventoryEO::getDutyPersonName).distinct().collect(Collectors.toList()); + List listUserName = this.sysUserService.querySysUserByUserNameList(userNameList); + + //编号验证 + verifySerialNumber(datas,projectCertificationInventoryEOTemp); + + List userIdList = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(datas)){ + //sdtName + List collect1 = datas.stream().filter(e -> StringUtils.isNotBlank(e.getSdtName())) + .map(ProjectCertificationInventoryEO::getSdtName).distinct().collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect1)){ + userIdList.addAll(collect1); + } + } + List userList = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(userIdList)){ + userList = sysUserService.queryUserIdListByNameList(userIdList); + } + + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : datas) { + i++; + String errorMsg = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){ + errorMsg = "第" + i + "行:"; + }else{ + errorMsg = i + " line:"; + } + //类别 + String category = projectCertificationInventoryEO.getCategory(); + //检验项目 + String inspectionItem = projectCertificationInventoryEO.getInspectionItem(); + //配置项 + String configItem = projectCertificationInventoryEO.getConfigItem(); + //WVTA ID + String wvtaId = projectCertificationInventoryEO.getWvtaId(); + //标准编号 + String serialNumber = projectCertificationInventoryEO.getSerialNumber(); + //责任领域 + String dutyTerritory = projectCertificationInventoryEO.getDutyTerritoryName(); + //工程接口人engineeringInterfacePerson + String sdt = projectCertificationInventoryEO.getSdtName(); + //责任人 + String dutyPerson = projectCertificationInventoryEO.getDutyPersonName();; + //交付物类型 + String deliverableType = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + deliverableType = projectCertificationInventoryEO.getDeliverableTypeName(); + }else { + deliverableType = projectCertificationInventoryEO.getDeliverableTypeNameEn(); + } + + //截止时间 + String endTime = projectCertificationInventoryEO.getEndTimeStr(); + //报告编号 + String reportNumber = projectCertificationInventoryEO.getReportNumber(); + //产品型号 + String productModel = projectCertificationInventoryEO.getProductModel(); + //生产企业名称 + String productionEnterpriseName = projectCertificationInventoryEO.getProductionEnterpriseName(); + + //文件 + //交付物模板 + String deliverableTemplate = projectCertificationInventoryEO.getDeliverableTemplateName(); + + // 认证类型 + String attestationTypeName = projectCertificationInventoryEO.getAttestationTypeName(); + + + + + //编号必填 +// flag = must(projectCertificationInventoryEO, errorMsg, msgList, serialNumber, "编号", "Standard No"); + + + + //类别 + if(StringUtils.isNotBlank(category)){ + if(category.length() > 300){ + String message = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){ + message = errorMsg + "类别不能超过300个字符"; + }else{ + message = errorMsg + " The Category cannot contain more than 300 characters"; + } + msgList.add(message); + } + } + //检验项目 + if(StringUtils.isNotBlank(inspectionItem)){ + if(inspectionItem.length() > 300){ + String message = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){ + message = errorMsg + "检验项目不能超过300个字符"; + }else{ + message = errorMsg + " The InspectionItem cannot contain more than 300 characters"; + } + msgList.add(message); + } + } + //配置项 + if(StringUtils.isNotBlank(configItem)){ + if(configItem.length() > 300){ + String message = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){ + message = errorMsg + "配置项不能超过300个字符"; + }else{ + message = errorMsg + " The ConfigItem cannot contain more than 300 characters"; + } + msgList.add(message); + } + } + //WVTA ID + if(StringUtils.isNotBlank(wvtaId)){ + if(wvtaId.length() > 300){ + String message = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){ + message = errorMsg + "WVTA ID不能超过300个字符"; + }else{ + message = errorMsg + " The WVTA ID cannot contain more than 300 characters"; + } + msgList.add(message); + } + } + + //责任领域 + if(StringUtils.isNotBlank(dutyTerritory)){ + value = pullMore(dictItemList, projectCertificationInventoryEO, errorMsg, dutyTerritory,msgList,"责任领域","Responsible Field","duty_territory"); + if(StringUtils.isNotBlank(value)){ + projectCertificationInventoryEO.setDutyTerritory(value); + List list = Arrays.asList(value.split(",")); + List ddList = dictItemList.stream().filter(e -> "duty_territory".equals(e.getDictCode()) && list.contains(e.getItemValue())).collect(Collectors.toList()); + List valueList = ddList.stream().map(SysDictItem::getStatNode).collect(Collectors.toList()); + projectCertificationInventoryEO.setDutyDepart(StringUtils.join(valueList,",")); + + } + } + //工程接口人(责任领域下的工程接口人) + Map objectMap = iProjectRelatedPersonnelService.queryPersonByProjectId(projectCertificationInventoryEOTemp.getProjectLibraryId(), value); + + //工程接口人 + List> mapPersonList = (List>) objectMap.get("engineeringInterfacePersonList"); + + + String nameCn = ""; + String nameEn = ""; + //工程接口人 + if(StringUtils.isNotBlank(sdt)){ + nameCn = "工程接口人"; + nameEn = "Eng. Interface "; + //验证人员是否存在 + List sysUsers = userList.stream().filter(e -> sdt.equals(e.getUsername())).collect(Collectors.toList()); + personnelVerify(projectCertificationInventoryEO, errorMsg, msgList, sdt, sysUsers,nameCn,nameEn, com.jero.modules.project.enums.ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue()); +// personnelVerify(projectCertificationInventoryEO, errorMsg, msgList, sdt, mapPersonList,nameCn,nameEn, com.jero.modules.project.enums.ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue()); + } + + //责任人 + if(StringUtils.isNotBlank(dutyPerson)){ + nameCn = "责任人"; + nameEn = "Assignee"; + //验证人员是否存在 + personDutyPerson(projectCertificationInventoryEO, errorMsg, msgList, dutyPerson, listUserName,nameCn,nameEn); + } + + //交付物模板 + value = templateTransition(zipEntryName, projectCertificationInventoryEO, errorMsg, deliverableTemplate,msgList,"交付物模板","Deliverable Template"); + if(StringUtils.isNotBlank(value)){ + projectCertificationInventoryEO.setDeliverableTemplate(value); + } + + //交付物类型 + if(StringUtils.isNotEmpty(deliverableType)){ + value = tree(categoryList,treeNameList, projectCertificationInventoryEO, errorMsg, deliverableType,msgList,"交付物类型","Deliverable Type","deliverable_template"); + if(StringUtils.isNotBlank(value)){ + String treeId = getTreeId(categoryList, projectCertificationInventoryEOTemp, treeNameList, value); + projectCertificationInventoryEO.setDeliverableType(treeId); + } + } + + //截止时间 +// SimpleDateFormat sd = new SimpleDateFormat(); +// String endTimeStr = sd.format(endTime); + + flag = dateVerify(projectCertificationInventoryEO, errorMsg, endTime,msgList,"截止日期","Due Date"); + if(flag){ + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); + Date date = null; + try { + if(!endTime.contains("-")){ + endTime = DateUtils.coverDate(endTime); + } + date = sd.parse(endTime); + } catch (ParseException e) { + e.printStackTrace(); + } + projectCertificationInventoryEO.setEndTime(date); + } + + //报告编号 + if(StringUtils.isNotBlank(reportNumber)){ + if(reportNumber.length() > 200){ + String message = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){ + message = errorMsg + "报告编号不能超过200个字符"; + }else{ + message = errorMsg + " The Report No cannot contain more than 200 characters"; + } + msgList.add(message); + } + } + //产品型号 + if(StringUtils.isNotBlank(productModel)){ + if(productModel.length() > 200){ + String message = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){ + message = errorMsg + "产品型号不能超过200个字符"; + }else{ + message = errorMsg + " The Product Model cannot contain more than 200 characters"; + } + msgList.add(message); + } + } + //生产企业名称 + if(StringUtils.isNotBlank(productionEnterpriseName)){ + if(productionEnterpriseName.length() > 200){ + String message = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){ + message = errorMsg + "生产企业名称不能超过200个字符"; + }else{ + message = errorMsg + " The Name Of Manufacturer cannot contain more than 200 characters"; + } + msgList.add(message); + } + } + + if (StringUtils.isNotEmpty(attestationTypeName)) { + value = pullMore(dictItemList, projectCertificationInventoryEO, errorMsg, attestationTypeName,msgList,"认证类型","Certification Type","ren4_zheng4_qing1_dan1_-_ren4_zheng4_lei4_xing2"); + if(StringUtils.isNotBlank(value)){ + projectCertificationInventoryEO.setAttestationType(value); + } + } + + } + return msgList; + } + //必填 + private boolean must(ProjectCertificationInventoryEO projectCertificationInventoryEO, String errorMsg, + List msgList, String serialNumber,String nameCn,String nameEn) { + int errorCount = 0; + if(StringUtils.isBlank(serialNumber)){ + errorCount ++; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + errorMsg += nameCn + "为必填项,不能为空, "; + }else{ + errorMsg += nameEn + "This parameter is mandatory and cannot be empty, "; + } + msgList.add(errorMsg); + } + if(errorCount == 0){ + return true; + }else{ + return false; + } + } + + private boolean dateVerify(ProjectCertificationInventoryEO projectCertificationInventoryEO, + String errorMsg, String field, List msgList, String nameCn, String nameEn) { + + //判断格式是否正确 + boolean flag = true; + if(ObjectUtils.isNotEmpty(field)){ +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// String format = sdf.format(field); + if (!DateUtils.isValidDate(field)) { + flag = false; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + errorMsg += nameCn + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日"; + }else{ + errorMsg += nameEn + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日"; + } + msgList.add(errorMsg); + }else{ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date now = new Date(); + String nowStr = sdf.format(now); +// String fieldStr = sdf.format(field); + Date now1 = null; + Date field1 = null; + try { + if(!field.contains("-")){ + field = DateUtils.coverDate(field); + } + now1 = sdf.parse(nowStr); + field1 = sdf.parse(field); + long day = now1.getTime()-field1.getTime(); + if(day>0){ + flag = false; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + errorMsg += nameCn + "不能导入今天之前的日期"; + }else{ + errorMsg += nameEn + " Cannot import dates before today"; + } + msgList.add(errorMsg); + } + } catch (ParseException e) { + e.printStackTrace(); + } + } + } + return flag; + } + + private String templateTransition(String zipEntryName, + ProjectCertificationInventoryEO projectCertificationInventoryEO, + String errorMsg, String deliverableTemplate, List msgList, + String nameCn, String nameEn) { + String value = ""; + if (StringUtils.isNotBlank(deliverableTemplate)) { + StringBuilder sb = new StringBuilder(); + for (String fileName : deliverableTemplate.split(",")) { + List nowFileList = new ArrayList<>(); + + nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName,projectCertificationInventoryEO.getCut(),errorMsg,msgList,nameCn,nameEn); + + if (nowFileList.size() == 0) { +// if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ +// errorMsg += "压缩包中没有" + fileName + "文件; "; +// }else{ +// errorMsg += " Not in the zip package" + fileName + "file; "; +// } +// msgList.add(errorMsg); + } else { + try { + FileInputStream input = new FileInputStream(nowFileList.get(0)); + MultipartFile multipartFile = + new MockMultipartFile(nowFileList.get(0).getName(), nowFileList.get(0).getName(), "text/plain", input); + //文件存入文件表 + OSSFile ossFile = iOSSFileService.uploadLocalOfCos(multipartFile, "", null,null); + if (ObjectUtils.isNotEmpty(ossFile)) { + sb.append(ossFile.getId() + ","); + } + } catch (IOException e) { + log.error("认证清单导入"+e.getMessage()); + } + } + } + if (StringUtils.isNotBlank(sb)) { + value = sb.substring(0, sb.length() - 1); + } + } + return value; + } + + private String getTreeId(List categoryList, + ProjectCertificationInventoryEO projectCertificationInventoryEOTemp, + List treeNameList, String value) { + StringBuilder sb = new StringBuilder(); + for (String valueTemp : value.split(",")) { + if (treeNameList.contains(valueTemp)) { + List sysCategoryList = new ArrayList<>(); + if (CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())) { + sysCategoryList = categoryList.stream().filter(e -> e.getName().equals(valueTemp)).collect(Collectors.toList()); + } else { + sysCategoryList = categoryList.stream().filter(e -> e.getEnName().equals(valueTemp)).collect(Collectors.toList()); + } + if (sysCategoryList.size() != 0) { + sb.append(sysCategoryList.get(0).getId() + ","); + } + } + } + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + return substring; + } + return null; + } + + private String tree(List categoryList, List nameList, + ProjectCertificationInventoryEO projectCertificationInventoryEO, + String errorMsg, String value, List msgList, + String nameCn, String nameEn, String dictCode) { + if (StringUtils.isNotBlank(value)) { + StringBuilder sb = new StringBuilder(); + for (String s : value.split(",")) { + if(!nameList.contains(s)){ + sb.append(s+","); + } + } + if(StringUtils.isNotBlank(sb)){ + String substring = sb.substring(0, sb.length() - 1); + if (CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())) { + errorMsg += nameCn + "中的" + substring + "与数据字典不匹配"; + } else { + errorMsg += nameEn + " " + substring + " does not match the data dictionary"; + } + msgList.add(errorMsg); + }else{ + StringBuilder sbTemp = new StringBuilder(); + for (String s : value.split(",")) { + List collect = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + collect = categoryList.stream().filter(e -> s.equals(e.getName())).collect(Collectors.toList()); + if(collect.size() != 0){ + sbTemp.append(collect.get(0).getName()+","); + } + }else{ + collect = categoryList.stream().filter(e -> s.equals(e.getEnName())).collect(Collectors.toList()); + if(collect.size() != 0){ + sbTemp.append(collect.get(0).getEnName()+","); + } + } + } + if(StringUtils.isNotBlank(sbTemp)){ + String substring = sbTemp.substring(0, sbTemp.length() - 1); + return substring; + } + } + } + return null; + } + private void personDutyPerson(ProjectCertificationInventoryEO projectCertificationInventoryEO, + String errorMsg, List msgList, String regulationOwnerId, + List listUserName ,String nameCn, String nameEn){ + //单选 + if(regulationOwnerId.contains(",")){ + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + errorMsg += nameCn + "导入只能填写一个用户名, "; + }else{ + errorMsg += "Only one user name can be entered for"+ nameEn +"import, "; + } + msgList.add(errorMsg); + } + + int count =0; + for(SysUser name : listUserName){ + if(StringUtils.isNotEmpty(name.getUsername())){ + if(name.getUsername().equals(regulationOwnerId)){ + count++; + String id = name.getId(); + projectCertificationInventoryEO.setDutyPerson(id); + break; + } + } + } + if(count==0){ + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + errorMsg += nameCn+regulationOwnerId+"与所有人员名单不匹配, "; + }else{ + errorMsg += nameEn+regulationOwnerId+"does not match a person with all person list, "; + } + msgList.add(errorMsg); + } + } + private void personnelVerify(ProjectCertificationInventoryEO projectCertificationInventoryEO, + String errorMsg, List msgList, String regulationOwnerId, + List sysUserList, String nameCn, String nameEn, String fieldNumber) { + //单选 + if(regulationOwnerId.contains(",")){ + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + errorMsg += nameCn + "导入只能填写一个用户名"; + }else{ + errorMsg += "Only one user name can be entered for"+ nameEn +"import"; + } + msgList.add(errorMsg); + } + + if(ObjectUtils.isNotEmpty(sysUserList)){ + if(com.jero.modules.project.enums.ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue().equals(fieldNumber)){ + projectCertificationInventoryEO.setSdt(sysUserList.get(0).getId()); + } + }else{ + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + errorMsg += nameCn+regulationOwnerId+"不存在"; + }else{ + errorMsg += nameEn+regulationOwnerId+"absent"; + } + msgList.add(errorMsg); + } + } +// private void personnelVerify(ProjectCertificationInventoryEO projectCertificationInventoryEO, +// String errorMsg, List msgList, String regulationOwnerId, +// List> mapList, String nameCn, String nameEn, String fieldNumber) { +// //单选 +// if(regulationOwnerId.contains(",")){ +// if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ +// errorMsg += nameCn + "导入只能填写一个用户名"; +// }else{ +// errorMsg += "Only one user name can be entered for"+ nameEn +"import"; +// } +// msgList.add(errorMsg); +// } +// +// if(mapList.size() != 0){ +// int count = 0; +// for (Map stringStringMap : mapList) { +// String name = stringStringMap.get("name"); +// if(regulationOwnerId.equals(name)){ +// count ++; +// if(com.jero.modules.project.enums.ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue().equals(fieldNumber)){ +// projectCertificationInventoryEO.setSdt(stringStringMap.get("value")); +// } +// break; +// } +// } +// if(count == 0){ +// if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ +// errorMsg += nameCn+regulationOwnerId+"与相关人员名单中责任领域下的人员不匹配"; +// }else{ +// errorMsg += nameEn+regulationOwnerId+"does not match a person under the Responsible Field in the relevant person list"; +// } +// msgList.add(errorMsg); +// } +// }else{ +// if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ +// errorMsg += nameCn+regulationOwnerId+"与相关人员名单中责任领域下的人员不匹配"; +// }else{ +// errorMsg += nameEn+regulationOwnerId+"does not match a person under the Responsible Field in the relevant person list"; +// } +// msgList.add(errorMsg); +// } +// } + + private String pullMore(List dictItemList, ProjectCertificationInventoryEO projectCertificationInventoryEO, + String errorMsg, String value, List msgList, + String nameCn, String nameEn, String dictCode) { + List valueList = new ArrayList<>(); + if (StringUtils.isNotBlank(value)) { + List list = Arrays.asList(value.split(",")); + List sysDictItemList = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + sysDictItemList = dictItemList.stream().filter(e ->dictCode.equals(e.getDictCode()) && list.contains(e.getItemText())).collect(Collectors.toList()); + }else{ + sysDictItemList = dictItemList.stream().filter(e ->dictCode.equals(e.getDictCode()) && list.contains(e.getEnName())).collect(Collectors.toList()); + } + + if(list.size() == sysDictItemList.size()){ + valueList = sysDictItemList.stream().map(SysDictItem::getItemValue).collect(Collectors.toList()); + + }else{ + //数据中有与数据字典不匹配的值 + List finalValueList = valueList; + List diffList = list.stream().filter(e -> !finalValueList.contains(e)).collect(Collectors.toList()); + if (CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())) { + errorMsg += nameCn + "中的" + StringUtils.join(diffList,",") + "与数据字典不匹配"; + } else { + errorMsg += nameEn + " " + StringUtils.join(diffList,",") + " does not match the data dictionary"; + } + msgList.add(errorMsg); + } + } + return StringUtils.join(valueList,","); + } + + + //编号验证 + private void verifySerialNumber(List datas, + ProjectCertificationInventoryEO projectCertificationInventoryEOTemp) { + + + List serialNumberList = datas.stream().map(ProjectCertificationInventoryEO::getSerialNumber).collect(Collectors.toList()); + //1. 验证标准号在文档库中是否存在 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(BussDocumentLibraryEO::getSerialNumber,serialNumberList); + List bussDocumentLibraryEOList = iBussDocumentLibraryEOService.list(wrapper); + //文档库中可能存在重复的标准号 + List serialNumberListTemp = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).distinct().collect(Collectors.toList()); + if(serialNumberList.size() != serialNumberListTemp.size()){ + //存在文档库没有的数据 + List collect = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList()); + List serialNumbers = serialNumberList.stream().filter(e -> !collect.contains(e)).collect(Collectors.toList()); + if(serialNumbers.size() > 0){ + if(CutEnum.CN.getValue().equals(datas.get(0).getCut())){ + throw new JeroBootException(StringUtils.join(serialNumbers,",")+"文档库中不存在,不能添加"); + }else{ + throw new JeroBootException(StringUtils.join(serialNumbers,",")+" does not exist in the document library and cannot be added"); + } + } + }else{ + //验证编号在法规清单中是否存在 + LambdaQueryWrapper lwrapper = new LambdaQueryWrapper<>(); + lwrapper.in(ProjectLawsInventoryEO::getSerialNumber,serialNumberList); + List projectLawsInventoryEOList = platformProjectLawsInventoryEOService.list(lwrapper); + List LawSerialNumberListTemp = projectLawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.toList()); + if(serialNumberList.size() != LawSerialNumberListTemp.size()){ + //存在法规清单中没有的数据 + List collect = projectLawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).collect(Collectors.toList()); + List serialNumbers = serialNumberList.stream().filter(e -> !collect.contains(e)).collect(Collectors.toList()); + if(serialNumbers.size() > 0){ + if(CutEnum.CN.getValue().equals(datas.get(0).getCut())){ + throw new JeroBootException(StringUtils.join(serialNumbers,",")+"法规清单中不存在,不能添加"); + }else{ + throw new JeroBootException(StringUtils.join(serialNumbers,",")+" does not exist in the project laws and cannot be added"); + } + } + } +// else{ +// for (ProjectCertificationInventoryEO projectCertificationInventoryEO : datas) { +// List collect = bussDocumentLibraryEOList.stream() +// .filter(e -> e.getSerialNumber().equals(projectCertificationInventoryEO.getSerialNumber())).collect(Collectors.toList()); +// projectCertificationInventoryEO.setBussDocumentLibraryId(collect.get(0).getId()); +// } +// } + } + + } + public static List copy(List list, + Class clazz) { + String oldOb = JSON.toJSONString(list); + return JSON.parseArray(oldOb, clazz); + } + + + /** + * 导出数据 + * @param response + * @param request + * @param projectCertificationInventoryEO + */ + @Override + public void exportData(HttpServletResponse response, HttpServletRequest request, ProjectCertificationInventoryEO projectCertificationInventoryEO) { + List dataList = new ArrayList<>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(projectCertificationInventoryEO,request.getParameterMap()); + queryWrapper.in("project_library_id",projectCertificationInventoryEO.getProjectLibraryId()); + if(StringUtils.isNotBlank(projectCertificationInventoryEO.getIds())){ + queryWrapper.in("id",Arrays.asList(projectCertificationInventoryEO.getIds().split(","))); + } + queryWrapper.orderByDesc("create_time"); + //获取当前的projectId + String projectId = projectCertificationInventoryEO.getProjectLibraryId(); + //获取当前用户 + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + Map params = new HashMap<>(); + params.put("projectLibraryId",projectId); + params.put("userId",currentUser.getId()); + params.put("modelType",RoleRelModelTypeEnum.CERTIFICATION_INVENTORY.getValue()); + ProjectLibraryRoleRelEO projectLibraryRoleRelEO = projectLibraryRoleRelEOService.queryByProjectLibraryIdAndUserId(params); + String roleCode = projectLibraryRoleRelEO.getRoleCode(); + // 创建查询权限 + this.createQueryPermission(queryWrapper,roleCode); + //导出的数据 + dataList = this.list(queryWrapper); + //文件 + List fileInfos = getOssFiles(dataList); + //处理文件名称 + + String fileName = ""; + for (int i = 0; i < dataList.size(); i++) { + if(StringUtils.isNotEmpty(dataList.get(i).getDeliverableTemplate())){ + String deliverableTemplateName = template(fileInfos, dataList.get(i).getDeliverableTemplate()); + dataList.get(i).setDeliverableTemplateName(deliverableTemplateName); + } + } + String cut = projectCertificationInventoryEO.getCut(); + disposeData(dataList,cut); + List copy = copy(dataList,ProjectCertificationInventoryDutyEnginnerEO.class); + + + + OutputStream os = null; + try { + response.setContentType("application/force-download"); + Workbook workbook = new XSSFWorkbook(); + String path = uploadpath + "/tempZip"; + File fileTemp = new File(path); + if (fileTemp.exists()) { + fileTemp.delete(); + } + fileTemp.mkdirs(); + //文件 + exportFile(dataList,fileInfos); + + + for(int i =0 ;i projectCertificationInventoryDutyEnginnerEOPlatformList = new ArrayList<>(); + for (ProjectCertificationInventoryDutyEnginnerEO projectCertificationInventoryDutyEnginnerEO : copy) { + ProjectCertificationInventoryDutyEnginnerEOPlatform projectCertificationInventoryDutyEnginnerEOPlatform = new ProjectCertificationInventoryDutyEnginnerEOPlatform(); + BeanUtils.copyProperties(projectCertificationInventoryDutyEnginnerEO,projectCertificationInventoryDutyEnginnerEOPlatform); + projectCertificationInventoryDutyEnginnerEOPlatformList.add(projectCertificationInventoryDutyEnginnerEOPlatform); + } + workbook = ExcelExportUtil.exportExcel(exportParams, ProjectCertificationInventoryDutyEnginnerEOPlatform.class, projectCertificationInventoryDutyEnginnerEOPlatformList); + }else{ + List projectCertificationInventoryEOPlatformList = new ArrayList<>(); + for (ProjectCertificationInventoryEO certificationInventoryEO : dataList) { + ProjectCertificationInventoryEOPlatform projectCertificationInventoryEOPlatform = new ProjectCertificationInventoryEOPlatform(); + BeanUtils.copyProperties(certificationInventoryEO,projectCertificationInventoryEOPlatform); + projectCertificationInventoryEOPlatformList.add(projectCertificationInventoryEOPlatform); + } + workbook = ExcelExportUtil.exportExcel(exportParams, ProjectCertificationInventoryEOPlatform.class, projectCertificationInventoryEOPlatformList); + } + }else{ + if(ProjectRoleEnum.INTERFACE_PERSON.getValue().equals(roleCode) || + ProjectRoleEnum.PERSON_LIABLE.getValue().equals(roleCode)){ +// List copyEn = new ArrayList<>(); +// for (ProjectCertificationInventoryDutyEnginnerEO projectCertificationInventoryDutyEnginnerEOTemp : copy) { +// ProjectCertificationInventoryDutyEnginnerEOEn projectCertificationInventoryDutyEnginnerEOEn = new ProjectCertificationInventoryDutyEnginnerEOEn(); +// BeanUtils.copyProperties(projectCertificationInventoryDutyEnginnerEOTemp,projectCertificationInventoryDutyEnginnerEOEn); +// copyEn.add(projectCertificationInventoryDutyEnginnerEOEn); +// } + List copyEn = new ArrayList<>(); + for (ProjectCertificationInventoryDutyEnginnerEO projectCertificationInventoryDutyEnginnerEOTemp : copy) { + ProjectCertificationInventoryDutyEnginnerEOEnPlatform projectCertificationInventoryDutyEnginnerEOEnPlatform = new ProjectCertificationInventoryDutyEnginnerEOEnPlatform(); + BeanUtils.copyProperties(projectCertificationInventoryDutyEnginnerEOTemp,projectCertificationInventoryDutyEnginnerEOEnPlatform); + copyEn.add(projectCertificationInventoryDutyEnginnerEOEnPlatform); + } + workbook = ExcelExportUtil.exportExcel(exportParams, ProjectCertificationInventoryDutyEnginnerEOEnPlatform.class, copyEn); + }else{ +// List dataListEn = new ArrayList<>(); +// for (ProjectCertificationInventoryEO projectCertificationInventoryEOTemp : dataList) { +// ProjectCertificationInventoryEOEn projectCertificationInventoryEOEn = new ProjectCertificationInventoryEOEn(); +// BeanUtils.copyProperties(projectCertificationInventoryEOTemp,projectCertificationInventoryEOEn); +// dataListEn.add(projectCertificationInventoryEOEn); +// } + List dataListEn = new ArrayList<>(); + for (ProjectCertificationInventoryEO projectCertificationInventoryEOTemp : dataList) { + ProjectCertificationInventoryEOEnPlatform projectCertificationInventoryEOEnPlatform = new ProjectCertificationInventoryEOEnPlatform(); + BeanUtils.copyProperties(projectCertificationInventoryEOTemp,projectCertificationInventoryEOEnPlatform); + dataListEn.add(projectCertificationInventoryEOEnPlatform); + } + //下拉选中英文转换 +// transition(dataListEn,projectCertificationInventoryEO); + workbook = ExcelExportUtil.exportExcel(exportParams, ProjectCertificationInventoryEOEnPlatform.class, dataListEn); + } + } + workbook.write(excelOS); + excelOS.flush(); + + ZipUtil.zip(path, path + ".zip"); + //文件 + FileInputStream fis = new FileInputStream(path + ".zip"); + os = response.getOutputStream(); + + int len = 0; + while ((len = fis.read()) != -1) { + os.write(len); + } + os.flush(); + fis.close(); + } catch (IOException e) { + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + throw new JeroBootException("下载文件失败"); + }else{ + throw new JeroBootException("Failed to download file"); + } + } finally { + IOUtils.closeQuietly(os); + File file = new File(uploadpath + "/tempZip"); + FileUtil.deleteContents(file); + } + + } + + private void exportFile(List dataList, List fileInfos) throws IOException{ + if(fileInfos.size() != 0){ + for(ProjectCertificationInventoryEO projectCertificationInventoryEO : dataList){ + String deliverableTemplate = projectCertificationInventoryEO.getDeliverableTemplate(); + String serialNumber = projectCertificationInventoryEO.getSerialNumber(); + String deliveryResult = projectCertificationInventoryEO.getDeliveryResult(); + if(StringUtils.isBlank(serialNumber)){ + continue; + } + List deliverableTemplateFileList = new ArrayList<>(); + List deliveryResultList = new ArrayList<>(); + List oSSFileList = new ArrayList<>(); + if(StringUtils.isNotBlank(deliverableTemplate)){ + deliverableTemplateFileList = fileInfos.stream().filter(e -> deliverableTemplate.contains(e.getId())).collect(Collectors.toList()); + oSSFileList.addAll(deliverableTemplateFileList); + } + if(StringUtils.isNotBlank(deliveryResult) && projectCertificationInventoryEO.getValueType().equals(SysCategoryValueTypeEnum.FILE.getValue())){ + deliveryResultList = fileInfos.stream().filter(e -> deliveryResult.contains(e.getId())).collect(Collectors.toList()); + oSSFileList.addAll(deliveryResultList); + + } + if(oSSFileList.size() != 0){ + if(serialNumber.contains("/")){ + serialNumber = serialNumber.replaceAll("/","-"); + } + String fileNowPath = uploadpath + "/tempZip/" + serialNumber; + File file = new File(fileNowPath); + if (file.exists()) { + file.delete(); + } + file.mkdirs(); + for (OSSFile ossFile : oSSFileList) { + String url = ossFile.getUrl(); + if(StringUtils.isNotBlank(url)){ + //判断文件是否存在 + boolean b = CosBootUtil.doesObjectExist(url); + if(b){ + InputStream download = CosBootUtil.download(url); + copyFile(download, fileNowPath + File.separator + ossFile.getFileName()); + } + } + } + } + } + + } + } + + private String template(List fileInfos, String value) { + StringBuilder sb = new StringBuilder(); + for (String s : value.split(",")) { + List collect = fileInfos.stream().filter(e -> s.equals(e.getId())).collect(Collectors.toList()); + if(collect.size() != 0){ + sb.append(collect.get(0).getFileName()+","); + } + } + String substring = ""; + if(StringUtils.isNotBlank(sb)){ + substring = sb.substring(0, sb.length() - 1); + } + return substring; + } + + private List getOssFiles(List dataList) { + List fileIdList = new ArrayList<>(); + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : dataList) { + if(StringUtils.isNotBlank(projectCertificationInventoryEO.getDeliverableTemplate())){ + fileIdList.add(projectCertificationInventoryEO.getDeliverableTemplate()); + } + if(StringUtils.isNotBlank(projectCertificationInventoryEO.getDeliveryResult())){ + fileIdList.add(projectCertificationInventoryEO.getDeliveryResult()); + } + } + //查询所有的文件 + List fileInfos = new ArrayList<>(); + if(fileIdList.size() != 0){ + fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ",")); + } + return fileInfos; + } + + private String pull(List sysDictItems, String field,String dictCode) { + if(StringUtils.isBlank(field)){ + return null; + } + StringBuilder sb = new StringBuilder(); + for (String s : field.split(",")) { + List collect = sysDictItems.stream().filter(e -> dictCode.equals(e.getDictCode()) && s.equals(e.getItemValue())).collect(Collectors.toList()); + if(collect.size() != 0){ + sb.append(collect.get(0).getEnName() + ","); + } + } + if(StringUtils.isNotBlank(sb)){ + String substring = sb.substring(0, sb.length() - 1); + return substring; + } + return null; + } + + + //判断row是否为空 空返回true + public boolean isRowEmpty(Row row) { + if (null == row) { + return true; + } + int firstCellNum = row.getFirstCellNum(); //第一个列位置 + int lastCellNum = row.getLastCellNum(); //最后一列位置 + int nullCellNum = 0; //空列数量 + for (int c = firstCellNum; c < lastCellNum; c++) { + Cell cell = row.getCell(c); + if (null == cell) { + nullCellNum++; + continue; + } + String value = ""; + switch (cell.getCellType()) { + case HSSFCell.CELL_TYPE_NUMERIC: // 数字 + //如果为时间格式的内容 + value = String.valueOf(cell.getNumericCellValue()); + break; + case HSSFCell.CELL_TYPE_STRING: // 字符串 + value = cell.getStringCellValue(); + break; + case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean + value = cell.getBooleanCellValue() + ""; + break; + case HSSFCell.CELL_TYPE_FORMULA: // 公式 + value = cell.getCellFormula() + ""; + break; + default: + break; + } + if (org.apache.commons.lang.StringUtils.isEmpty(value)) { + nullCellNum++; + } + } + //所有列都为空 + if (nullCellNum == (lastCellNum - firstCellNum)) { + return true; + } + return false; + } + + private String fieldConvert(String field){ + if (field == null) return null; + switch (field) { + case "*类别": return "category"; + case "*检验项目": return "inspectionItem"; + case "*配置项": return "configItem"; + case "*WVTA ID": return "wvtaId"; + case "*标准编号": return "serialNumber"; + case "*责任领域": return "dutyTerritoryName"; + case "*认证类型": return "attestationTypeName"; + case "*工程接口人": return "sdtName"; + case "*责任人": return "dutyPersonName"; + case "*交付物类型": return "deliverableTypeName"; + case "交付物模板": return "deliverableTemplateName"; + case "交付结果": return "deliveryResult"; + case "截止日期": return "endTime"; + case "*截止日期": return "endTimeStr"; + case "流程状态": return "flowStatus"; + case "报告编号": return "reportNumber"; + case "产品型号": return "productModel"; + case "生产企业名称": return "productionEnterpriseName"; + case "认证进度": return "certificationProgress"; + case "备注": return "remark"; + + case "*Category": return "category"; + case "*Inspection Items": return "inspectionItem"; + case "*Configuration Item": return "configItem"; + case "*Standard No": return "serialNumber"; + case "*Responsible Field": return "dutyTerritoryName"; + case "*Certification Type": return "attestationTypeName"; + case "*Eng. Interface": return "sdtName"; + case "*Assignee": return "dutyPersonName"; + case "*Deliverable Type": return "deliverableTypeNameEn"; + case "Deliverable Template": return "deliverableTemplateName"; + case "Deliverables Result": return "deliveryResult"; + case "Due Date": return "endTime"; + case "*Due Date": return "endTimeStr"; + case "Process Status": return "flowStatus"; + case "Report No": return "reportNumber"; + case "Product Model": return "productModel"; + case "Name Of Manufacturer": return "productionEnterpriseName"; + case "Homologation Progress": return "certificationProgress"; + case "Remark": return "remark"; + + default: return null; + //"Deliverable Type,Deliverable Template,initiator,Assignee,Due Date," + + } + } + + /** + * 模板下载 + * @param projectCertificationInventoryEO + * @param response + * @param request + */ + @Override + public void exportTemplate(ProjectCertificationInventoryEO projectCertificationInventoryEO, HttpServletResponse response, HttpServletRequest request) { + OutputStream os = null; + HSSFWorkbook workbook = new HSSFWorkbook(); + String fileOriName = "认证清单导入模板.xls"; + String filePath = uploadpath + File.separator + fileOriName; + + try { + String title = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + title = "*类别,*检验项目,*认证类型,*WVTA ID," + + "*标准编号,*责任领域,*工程接口人,*责任人," + + "交付物模板,*交付物类型,*截止日期,报告编号,产品型号,生产企业名称,备注"; + }else { + title = "*Category,*Inspection Items,*Certification Type,*WVTA ID," + + "*Standard No,*Responsible Field,*Eng. Interface,*Assignee," + + "Deliverable Template,*Deliverable Type,*Due Date,Report No,Product Model,Name Of Manufacturer,Remark"; + } + + List list = Arrays.asList(title.split(",")); + int index = 0; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + index = list.indexOf("备注") + 1; + }else{ + index = list.indexOf("Remark") + 1; + } + + //创建临时文件夹 + File nowFile = new File(filePath); + if (nowFile.exists()) { + nowFile.delete(); + } + nowFile.mkdirs(); + HSSFSheet sheet = workbook.createSheet("认证清单导入模板"); + sheet.setDefaultColumnWidth(16);//列宽 + + HSSFCellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setDataFormat((short) 49); + sheet.setDefaultColumnStyle(10,cellStyle); + +// cellStyle.setWrapText(true);//自动换行 +// cellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中 +// cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中 + + HSSFCellStyle cellStyleTemp = workbook.createCellStyle(); + cellStyleTemp.setWrapText(true);//自动换行 + + CellRangeAddress region = + new CellRangeAddress(1, 1, 0, 14); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列 + sheet.addMergedRegion(region); + String explain= ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ + explain = "填写说明\n" + + "1.导入数据从第三行开始\n" + + "2.所有带*号的字段必须填写\n"+ + "3.责任人,交付物类型,工程接口人,编号,责任领域,字段是单选属性,必须和系统中的对应字段选项相匹配\n" + + "4.类别,WVTA ID,检验项目,填写文本内容\n" + + "5.交付物模板字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件,假设在AAA标准号下放置了B.docx,则应填写AAA/B.docx"; + }else{ + explain = "Filling explanation\n" + + "1.Import data starts at the third line\n" + + "2.All fields marked with * must be filled in\n"+ + "3.Assignee,Deliverable Type,Eng. Interface,Standard No,Responsible Field,Fields are radio attributes that must match the corresponding field option in the system\n" + + "4.Category,WVTA ID,Configuration Item,Fill in the text\n" + + "5.Deliverable Template,When filling in the field, you need to create a folder in the directory of the same level as the file with the name of the standard number and place the file in the folder. If b. docx is stored under the AAA standard number, enter AAA/B. docx"; + } + for(int i = 0; i < 2; i++){ + //表头 + Row row = sheet.createRow(i);//开始创建标题行 + String[] headerArr = title.split(","); + if(i == 0 ){ + for (int m = 0; m < headerArr.length; m++) { + if(m < index){ + row.createCell(m).setCellValue(headerArr[m]); + }else { + break; + } + } + }else { + short height = (short) (6 * 252); + row.setHeight((short) height); + Cell cell = row.createCell(0); + cell.setCellStyle(cellStyleTemp); + cell.setCellValue(new HSSFRichTextString(explain)); + } + } + response.setHeader("Content-Disposition", + "attachment; filename=\"" + fileOriName + ".xls"); + response.setContentType("application/force-download"); + response.flushBuffer(); + os = response.getOutputStream(); + workbook.write(os); + }catch (Exception e){ + e.printStackTrace(); + throw new JeroBootException("下载文件失败,请重试"); + }finally { + IOUtils.closeQuietly(os); + } + } + + + @Override + public Result citeDeliverable(JSONObject json) { + String cut = json.getString("cut"); + String resultMsg = ""; + if(StringUtils.equals(cut,CutEnum.CN.getValue())){ + resultMsg = "引用交付物成功!"; + }else { + resultMsg = "Successfully referenced deliverables!"; + } + + + String projectCertificationInventoryIds = json.getString("projectCertificationInventoryIds"); + if(StringUtils.isEmpty(projectCertificationInventoryIds)){ + throw new JeroBootException("请选择需要引用的认证清单数据!"); + } + String projectLibraryId = json.getString("projectLibraryId"); + + String citeProjectLibraryId = json.getString("citeProjectLibraryId"); + if(StringUtils.isEmpty(citeProjectLibraryId)){ + throw new JeroBootException("请选择引用的项目!"); + } + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,projectCertificationInventoryIds.split(",")); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ + QueryWrapper citeQueryWrapper = new QueryWrapper<>(); + citeQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,citeProjectLibraryId); + citeQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()); + List citeProjectCertificationInventoryEOList = this.baseMapper.selectList(citeQueryWrapper); + + if(CollectionUtils.isNotEmpty(citeProjectCertificationInventoryEOList)){ + + +// citeProjectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getInspectionItem).distinct().collect(Collectors.joining(",")); +// return Result.OK("所选检验项目"+""+"暂未维护,需要进行手动填写。"); + //The review passed data in the selected reference project is empty, please reselect! + // 没有引用的数据 检验项目集合,给到前端进行展示。 + List noCiteInspectionItem = new ArrayList<>(); + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + String deliveryResult = ""; + for (ProjectCertificationInventoryEO citeProjectCertificationInventoryEO : citeProjectCertificationInventoryEOList) { + // 匹配数据 类别、检验项目、配置项、标准编号、交付物类型完全一致,并且数据的状态为 审查完成 + boolean flag = ( + StringUtils.equals(projectCertificationInventoryEO.getCategory(),citeProjectCertificationInventoryEO.getCategory()) + && StringUtils.equals(projectCertificationInventoryEO.getInspectionItem(),citeProjectCertificationInventoryEO.getInspectionItem()) + && StringUtils.equals(projectCertificationInventoryEO.getConfigItem(),citeProjectCertificationInventoryEO.getConfigItem()) + && StringUtils.equals(projectCertificationInventoryEO.getSerialNumber(),citeProjectCertificationInventoryEO.getSerialNumber()) + && StringUtils.equals(projectCertificationInventoryEO.getDeliverableType(),citeProjectCertificationInventoryEO.getDeliverableType()) + ); + + if(flag){ + deliveryResult = citeProjectCertificationInventoryEO.getDeliveryResult(); + break; + } + } + if(StringUtils.isNotBlank(deliveryResult)){ + projectCertificationInventoryEO.setDeliveryResult(deliveryResult); + }else { + noCiteInspectionItem.add(projectCertificationInventoryEO.getInspectionItem() + "-" +projectCertificationInventoryEO.getConfigItem()); + } + } + + this.updateBatchById(projectCertificationInventoryEOList); + + // 如果有 (没有引用的数据 检验项目集合,给到前端进行展示。) + if(CollectionUtils.isNotEmpty(noCiteInspectionItem)){ + String noCiteInspectionItemStr = noCiteInspectionItem.stream().distinct().collect(Collectors.joining(",")); + if(StringUtils.equals(cut,CutEnum.CN.getValue())){ + resultMsg = "所选检验项目"+noCiteInspectionItemStr+"暂未维护,需要进行手动填写。"; + }else { + resultMsg = "The selected inspection characteristic "+noCiteInspectionItemStr+" is not currently maintained and needs to be manually filled in."; + } + } + }else { + // 如果引用的项目中没有审查完成的数据 ,提示用户。 + if(StringUtils.equals(cut,CutEnum.CN.getValue())){ + resultMsg = "所选引用项目中审查通过数据为空,请重新选择!"; + }else { + resultMsg = "The review passed data in the selected reference project is empty, please reselect!"; + } + } + } + + return Result.OK(resultMsg); + } + + private void setProjectCertificationInventoryPermission(String userId, String projectId,String certificationInventoryId,Date now, List adds, String belong) { + QueryWrapper del = new QueryWrapper<>(); + del.eq("project_id", projectId) + .eq("belong", belong) + .eq("description", PermissionDescriptionEnum.PROJECT_CERTIFICATION_INVENTORY.getValue() + certificationInventoryId); + projectUserPermissionService.remove(del); + + ProjectUserPermission permission = new ProjectUserPermission(); + permission.setProjectId(projectId); + permission.setUserId(userId); + permission.setBelong(belong); + permission.setDescription(PermissionDescriptionEnum.PROJECT_CERTIFICATION_INVENTORY.getValue() + certificationInventoryId); + permission.setCreateTime(now); + permission.setUpdateTime(now); + adds.add(permission); + } + + /** + * 保存认证清单修改历史 + * @param pciList + * @param operateType + */ + public void saveProjectCertificationInventoryLog(List pciList,String operateType){ + if(CollectionUtils.isNotEmpty(pciList)){ + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String projectLibraryId = pciList.get(0).getProjectLibraryId(); + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if(ObjectUtils.isNotEmpty(projectLibraryBase)){ + List studioEngineerUserInfo = new ArrayList<>(); + if(StringUtils.isNotBlank(projectLibraryBase.getStudioEngineer())){ + studioEngineerUserInfo = this.sysUserService.querySysUserListByIdList(Arrays.asList(projectLibraryBase.getStudioEngineer().split(","))); + } + String certificationEngineerUserNames = ""; + if(StringUtils.isNotBlank(projectLibraryBase.getCertificationEngineer())){ + List certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + List certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + certificationEngineerUserNames = certificationEngineerList.stream().map(SysUser::getUsername).distinct().collect(Collectors.joining(",")); + } + + List pciLogEOList = new ArrayList<>(); + for (ProjectCertificationInventoryEO pci : pciList) { + StringBuilder contentCnSb = new StringBuilder(); + StringBuilder contentEnSb = new StringBuilder(); + if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 "); + contentCnSb.append("\"").append(pci.getCategory()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getSerialNumber()).append("\"").append(" "); + + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added "); + contentEnSb.append("\"").append(pci.getCategory()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getSerialNumber()).append("\""); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_ISSUE.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("发布了认证清单"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" has published a certification list"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_RETURNED.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("审核退回"); + contentCnSb.append(",退回原因:\"").append(pci.getReasonForReturn()).append("\""); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" review and returned"); + contentEnSb.append(",Reason for return:\"").append(pci.getReasonForReturn()).append("\""); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_REVIEW_THROUGH.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("审核通过"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" pass the audit"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue())){ + if (StringUtils.equals(pci.getValueType(), SysCategoryValueTypeEnum.FILE.getValue())) { + String fileName = "N/A"; + if (StringUtils.isNotEmpty(pci.getDeliveryResult())) { + fileName = this.ossFileService.getFileInfos(pci.getDeliveryResult()).stream().map(OSSFile::getFileName).distinct().collect(Collectors.joining(",")); + } + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("提交了附件 ").append(fileName); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" submitted attachment ").append(fileName); + }else { + String deliveryResult = (StringUtils.isNotEmpty(pci.getDeliveryResult()) ? pci.getDeliveryResult() : "N/A"); + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("提交了交付结果为").append(deliveryResult); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" submitted a delivery result of ").append(deliveryResult); + } + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_ACCEPT_TASK.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("接受了任务信息"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" accepts the task information"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_REJECT_TASK.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("退回了任务信息"); + contentCnSb.append(",拒绝原因:\"").append(pci.getReasonForReturn()).append("\""); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" returned the task information"); + contentEnSb.append(",Reject for Reason:\"").append(pci.getReasonForReturn()).append("\""); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_RETURNED_STUDIO_TASK.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("拒绝,流程退回至") + .append("\"").append(studioEngineerUserInfo.get(0).getUsername()).append("\""); + contentCnSb.append(",退回原因:\"").append(pci.getReasonForReturn()).append("\""); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" refuses, and the process returns to ") + .append("\"").append(studioEngineerUserInfo.get(0).getUsername()).append("\""); + contentEnSb.append(",Reason for return:\"").append(pci.getReasonForReturn()).append("\""); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_INITIATING_TASK.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("发起了Pre-Homo流程"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" initiates the Pre-Homo process"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_RESET.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("操作了流程重置功能"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" has operated the process reset function"); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_WITHDRAW.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("从").append("\"").append(certificationEngineerUserNames).append("\"撤回了流程"); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" withdrew the process from \"").append(certificationEngineerUserNames).append("\""); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_CALL_ADD.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 "); + contentCnSb.append("\"").append(pci.getCategory()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getSerialNumber()).append("\"").append(" "); + + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added "); + contentEnSb.append("\"").append(pci.getCategory()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getSerialNumber()).append("\""); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_IMPORT_ADD.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 "); + contentCnSb.append("\"").append(pci.getCategory()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getSerialNumber()).append("\"").append(" "); + + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added "); + contentEnSb.append("\"").append(pci.getCategory()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getSerialNumber()).append("\""); + } else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD_CONFIG.getValue())){ + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 "); + contentCnSb.append("\"").append(pci.getCategory()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" "); + contentCnSb.append("\"").append(pci.getSerialNumber()).append("\"").append(" "); + + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added "); + contentEnSb.append("\"").append(pci.getCategory()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" "); + contentEnSb.append("\"").append(pci.getSerialNumber()).append("\""); + } + + ProjectCertificationInventoryLogEO pciLogEO = new ProjectCertificationInventoryLogEO(); + pciLogEO.setProjectCertificationInventoryId(pci.getId()); + pciLogEO.setContentCn(contentCnSb.toString()); + pciLogEO.setContentEn(contentEnSb.toString()); + pciLogEO.setOperatorType(operateType); + pciLogEOList.add(pciLogEO); + } + + if(CollectionUtils.isNotEmpty(pciLogEOList)){ + this.projectCertificationInventoryLogEOService.insertBatch(pciLogEOList); + } + } + } + } + + /** + * 保存认证清单修改历史(编辑、批量设置专用) + * @param params + */ + public void saveProjectCertificationInventoryLog(Map params){ + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List editBeforePciList = (List) params.get("editBeforePciList"); + List editAfterPciList = (List) params.get("editAfterPciList"); + String operatorType = (String) params.get("operatorType"); + + if(CollectionUtils.isNotEmpty(editBeforePciList) && CollectionUtils.isNotEmpty(editAfterPciList)){ + List categoryList = this.sysCategoryService.list(); + List sysDictItems = this.sysDictItemServiceImpl.getBaseMapper().selectItemsAll(); + + List beforeSdtUserIdList = editBeforePciList.stream().map(ProjectCertificationInventoryEO::getSdt).distinct().collect(Collectors.toList()); + List beforeDutyPersonUserIdList = editBeforePciList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + + List afterSdtUserIdList = editAfterPciList.stream().map(ProjectCertificationInventoryEO::getSdt).distinct().collect(Collectors.toList()); + List afterDutyPersonUserIdList = editAfterPciList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List userIdList = new ArrayList<>(); + userIdList.addAll(beforeSdtUserIdList); + userIdList.addAll(beforeDutyPersonUserIdList); + userIdList.addAll(afterSdtUserIdList); + userIdList.addAll(afterDutyPersonUserIdList); + List userList = this.sysUserService.querySysUserListByIdList(userIdList); + + List beforeDeliverableTemplateIdList = editBeforePciList.stream().map(ProjectCertificationInventoryEO::getDeliverableTemplate).distinct().collect(Collectors.toList()); + List afterDeliverableTemplateIdList = editAfterPciList.stream().map(ProjectCertificationInventoryEO::getDeliverableTemplate).distinct().collect(Collectors.toList()); + List allDeliverableTemplateIdList = new ArrayList<>(); + allDeliverableTemplateIdList.addAll(beforeDeliverableTemplateIdList); + allDeliverableTemplateIdList.addAll(afterDeliverableTemplateIdList); + List allDeliverableTemplateList = this.ossFileService.getFileInfos(allDeliverableTemplateIdList.stream().distinct().collect(Collectors.joining(","))); + + List pciLogEOList = new ArrayList<>(); + + for (ProjectCertificationInventoryEO editAfterPciEo : editAfterPciList) { + List editBeforePciListTemp = editBeforePciList.stream().filter(editBeforePciEo -> { + boolean flag = false; + if (StringUtils.equals(editAfterPciEo.getId(), editBeforePciEo.getId())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(editBeforePciListTemp)){ + boolean savePciLogFlag = false; + ProjectCertificationInventoryEO editBeforePciEo = editBeforePciListTemp.get(0); + + if(ObjectUtils.isNotEmpty(editBeforePciEo)){ + StringBuilder contentCnSb = new StringBuilder(); + contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("将"); + StringBuilder contentEnSb = new StringBuilder(); + contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" changes the "); + + if(!StringUtils.equals(editBeforePciEo.getWvtaId(),editAfterPciEo.getWvtaId())){ + contentCnSb.append("\"").append("WVTA ID").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getWvtaId()) ? editBeforePciEo.getWvtaId() : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getWvtaId()) ? editAfterPciEo.getWvtaId() : "空") + .append(","); + + contentEnSb.append("\"").append("WVTA ID").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getWvtaId()) ? editBeforePciEo.getWvtaId() : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getWvtaId()) ? editAfterPciEo.getWvtaId() : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getCategory(),editAfterPciEo.getCategory())){ + contentCnSb.append("\"").append("类别").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getCategory()) ? editBeforePciEo.getCategory() : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getCategory()) ? editAfterPciEo.getCategory() : "空") + .append(","); + + contentEnSb.append("\"").append("Category").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getCategory()) ? editBeforePciEo.getCategory() : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getCategory()) ? editAfterPciEo.getCategory() : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getInspectionItem(),editAfterPciEo.getInspectionItem())){ + contentCnSb.append("\"").append("检验项目").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getInspectionItem()) ? editBeforePciEo.getInspectionItem() : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getInspectionItem()) ? editAfterPciEo.getInspectionItem() : "空") + .append(","); + + contentEnSb.append("\"").append("Inspection Items").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getInspectionItem()) ? editBeforePciEo.getInspectionItem() : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getInspectionItem()) ? editAfterPciEo.getInspectionItem() : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getConfigItem(),editAfterPciEo.getConfigItem())){ + contentCnSb.append("\"").append("配置项").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getConfigItem()) ? editBeforePciEo.getConfigItem() : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getConfigItem()) ? editAfterPciEo.getConfigItem() : "空") + .append(","); + + contentEnSb.append("\"").append("Configuration Item").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getConfigItem()) ? editBeforePciEo.getConfigItem() : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getConfigItem()) ? editAfterPciEo.getConfigItem() : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getDutyTerritory(),editAfterPciEo.getDutyTerritory())){ + String beforeDutyTerritoryNameCn = this.sysDictItemService.disposeShowDictItemValue( + sysDictItems, + editBeforePciEo.getDutyTerritory(), + CutEnum.CN.getValue(), + ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue() + ); + String beforeDutyTerritoryNameEn = this.sysDictItemService.disposeShowDictItemValue( + sysDictItems, + editBeforePciEo.getDutyTerritory(), + CutEnum.EN.getValue(), + ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue() + ); + + String afterDutyTerritoryNameCn = this.sysDictItemService.disposeShowDictItemValue( + sysDictItems, + editAfterPciEo.getDutyTerritory(), + CutEnum.CN.getValue(), + ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue() + ); + String afterDutyTerritoryNameEn = this.sysDictItemService.disposeShowDictItemValue( + sysDictItems, + editAfterPciEo.getDutyTerritory(), + CutEnum.EN.getValue(), + ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue() + ); + + contentCnSb.append("\"").append("责任领域").append("\" ") + .append(StringUtils.isNotEmpty(beforeDutyTerritoryNameCn) ? beforeDutyTerritoryNameCn : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterDutyTerritoryNameCn) ? afterDutyTerritoryNameCn : "空") + .append(","); + + contentEnSb.append("\"").append("Responsible Field").append("\" ") + .append(StringUtils.isNotEmpty(beforeDutyTerritoryNameEn) ? beforeDutyTerritoryNameEn : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterDutyTerritoryNameEn) ? afterDutyTerritoryNameEn : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getDeliverableType(),editAfterPciEo.getDeliverableType())){ + String beforeDeliverableTypeNameCn = this.getTreeName(CutEnum.CN.getValue(), categoryList, Arrays.asList(editBeforePciEo.getDeliverableType().split(","))); + String beforeDeliverableTypeNameEn = this.getTreeName(CutEnum.EN.getValue(), categoryList, Arrays.asList(editBeforePciEo.getDeliverableType().split(","))); + + String afterDeliverableTypeNameCn = this.getTreeName(CutEnum.CN.getValue(), categoryList, Arrays.asList(editAfterPciEo.getDeliverableType().split(","))); + String afterDeliverableTypeNameEn = this.getTreeName(CutEnum.EN.getValue(), categoryList, Arrays.asList(editAfterPciEo.getDeliverableType().split(","))); + + contentCnSb.append("\"").append("交付物类型").append("\" ") + .append(StringUtils.isNotEmpty(beforeDeliverableTypeNameCn) ? beforeDeliverableTypeNameCn : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterDeliverableTypeNameCn) ? afterDeliverableTypeNameCn : "空") + .append(","); + + contentEnSb.append("\"").append("Deliverable Type").append("\" ") + .append(StringUtils.isNotEmpty(beforeDeliverableTypeNameEn) ? beforeDeliverableTypeNameEn : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterDeliverableTypeNameEn) ? afterDeliverableTypeNameEn : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getDeliverableTemplate(),editAfterPciEo.getDeliverableTemplate())){ + String[] beforeDeliverableTemplateArr = StringUtils.isNotEmpty(editBeforePciEo.getDeliverableTemplate()) ? editBeforePciEo.getDeliverableTemplate().split(",") : null; + String[] afterDeliverableTemplateArr = StringUtils.isNotEmpty(editAfterPciEo.getDeliverableTemplate()) ? editAfterPciEo.getDeliverableTemplate().split(",") : null; + + String beforeDeliverableTemplateName = allDeliverableTemplateList.stream().filter(file -> { + boolean flag = false; + if(beforeDeliverableTemplateArr != null){ + for (String beforeDeliverableTemplate : beforeDeliverableTemplateArr) { + if(StringUtils.equals(file.getId(),beforeDeliverableTemplate)){ + flag = true; + } + } + } + return flag; + }).map(OSSFile::getFileName).collect(Collectors.joining(",")); + + String afterDeliverableTemplateName = allDeliverableTemplateList.stream().filter(file -> { + boolean flag = false; + if(afterDeliverableTemplateArr != null){ + for (String afterDeliverableTemplate : afterDeliverableTemplateArr) { + if(StringUtils.equals(file.getId(),afterDeliverableTemplate)){ + flag = true; + } + } + } + return flag; + }).map(OSSFile::getFileName).collect(Collectors.joining(",")); + + contentCnSb.append("\"").append("交付物模板").append("\" ") + .append(StringUtils.isNotEmpty(beforeDeliverableTemplateName) ? beforeDeliverableTemplateName : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterDeliverableTemplateName) ? afterDeliverableTemplateName : "空") + .append(","); + + contentEnSb.append("\"").append("Deliverable Template").append("\" ") + .append(StringUtils.isNotEmpty(beforeDeliverableTemplateName) ? beforeDeliverableTemplateName : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterDeliverableTemplateName) ? afterDeliverableTemplateName : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getSdt(),editAfterPciEo.getSdt())){ + String beforeSdtUserName = this.sysUserService.getUsernameByUserId(userList,editBeforePciEo.getSdt()); + String afterSdtUserName = this.sysUserService.getUsernameByUserId(userList,editAfterPciEo.getSdt()); + + contentCnSb.append("\"").append("工程接口人").append("\" ") + .append(StringUtils.isNotEmpty(beforeSdtUserName) ? beforeSdtUserName : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterSdtUserName) ? afterSdtUserName : "空") + .append(","); + + contentEnSb.append("\"").append("Eng. Interface").append("\" ") + .append(StringUtils.isNotEmpty(beforeSdtUserName) ? beforeSdtUserName : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterSdtUserName) ? afterSdtUserName : "null") + .append(","); + + savePciLogFlag = true; + } + String beforeEndTimeStr = ""; + if(editBeforePciEo.getEndTime() != null){ + beforeEndTimeStr = DateUtils.formatDate(editBeforePciEo.getEndTime()); + } + String afterEndTimeStr = ""; + if(editAfterPciEo.getEndTime() != null){ + afterEndTimeStr = DateUtils.formatDate(editAfterPciEo.getEndTime()); + } + if(!StringUtils.equals(beforeEndTimeStr,afterEndTimeStr)){ + contentCnSb.append("\"").append("截止日期").append("\" ") + .append(StringUtils.isNotEmpty(beforeEndTimeStr) ? beforeEndTimeStr : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterEndTimeStr) ? afterEndTimeStr : "空") + .append(","); + + contentEnSb.append("\"").append("Due Date").append("\" ") + .append(StringUtils.isNotEmpty(beforeEndTimeStr) ? beforeEndTimeStr : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterEndTimeStr) ? afterEndTimeStr : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getDutyPerson(),editAfterPciEo.getDutyPerson())){ + String beforeDutyPersonUserName = this.sysUserService.getUsernameByUserId(userList,editBeforePciEo.getDutyPerson()); + String afterDutyPersonUserName = this.sysUserService.getUsernameByUserId(userList,editAfterPciEo.getDutyPerson()); + + contentCnSb.append("\"").append("责任人").append("\" ") + .append(StringUtils.isNotEmpty(beforeDutyPersonUserName) ? beforeDutyPersonUserName : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(afterDutyPersonUserName) ? afterDutyPersonUserName : "空") + .append(","); + + contentEnSb.append("\"").append("Assignee").append("\" ") + .append(StringUtils.isNotEmpty(beforeDutyPersonUserName) ? beforeDutyPersonUserName : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(afterDutyPersonUserName) ? afterDutyPersonUserName : "null") + .append(","); + + savePciLogFlag = true; + } + if(!StringUtils.equals(editBeforePciEo.getRemark(),editAfterPciEo.getRemark())){ + contentCnSb.append("\"").append("备注").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getRemark()) ? editBeforePciEo.getRemark() : "空") + .append(" 修改为 ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getRemark()) ? editAfterPciEo.getRemark() : "空") + .append(","); + + contentEnSb.append("\"").append("Remark").append("\" ") + .append(StringUtils.isNotEmpty(editBeforePciEo.getRemark()) ? editBeforePciEo.getRemark() : "null") + .append(" to ") + .append(StringUtils.isNotEmpty(editAfterPciEo.getRemark()) ? editAfterPciEo.getRemark() : "null") + .append(","); + + savePciLogFlag = true; + } + + if(savePciLogFlag){ + ProjectCertificationInventoryLogEO pciLogEO = new ProjectCertificationInventoryLogEO(); + pciLogEO.setProjectCertificationInventoryId(editAfterPciEo.getId()); + pciLogEO.setContentCn(contentCnSb.toString().substring(0,contentCnSb.toString().length()-1)); + pciLogEO.setContentEn(contentEnSb.toString().substring(0,contentEnSb.toString().length()-1)); + pciLogEO.setOperatorType(operatorType); + pciLogEOList.add(pciLogEO); + } + } + } + } + if(CollectionUtils.isNotEmpty(pciLogEOList)){ + this.projectCertificationInventoryLogEOService.insertBatch(pciLogEOList); + } + } + } + + + @Override + public Result addConfigByIds(JSONObject json) { + String ids = json.getString("ids"); + String configItem = json.getString("configItem"); + if (StringUtils.isEmpty(ids)) { + throw new JeroBootException("至少选择一条数据进行添加配置操作!"); + } + List addConfigPciEoList = new ArrayList<>(); + + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,Arrays.asList(ids.split(","))); + List pciEoList = this.list(pciQueryWrap); + + pciEoList.forEach(pciEo -> { + ProjectCertificationInventoryEO addConfigPciEo = new ProjectCertificationInventoryEO(); + BeanUtils.copyProperties(pciEo,addConfigPciEo); + addConfigPciEo.setId(UUID.randomUUID().toString().replace("-","")); + addConfigPciEo.setConfigItem(configItem); + addConfigPciEoList.add(addConfigPciEo); + }); + + if(CollectionUtils.isNotEmpty(addConfigPciEoList)){ + this.saveBatch(addConfigPciEoList); + + // 设置历史log(修改历史) + this.saveProjectCertificationInventoryLog(addConfigPciEoList,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD_CONFIG.getValue()); + + Date now = new Date(); + //设置权限 先删后加 + List adds = new ArrayList<>(); + for (ProjectCertificationInventoryEO pci: addConfigPciEoList) { + if (ObjectUtils.isNotEmpty(pci.getSdt())) { + setProjectCertificationInventoryPermission(pci.getSdt(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_SDT.getValue()); + } + if (ObjectUtils.isNotEmpty(pci.getDutyPerson())) { + setProjectCertificationInventoryPermission(pci.getDutyPerson(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_DP.getValue()); + } + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + } + + return Result.OK("添加配置成功!"); + } + + @Override + public Map groupByFGRwqrStatus(List pciEos) { + Map result = new HashMap<>(); + Map projectScheduleExportMap = new HashMap<>(); + + double toBeReleasedCount = 0; + double toBeVerifiedCount = 0; + double toBeConfirmedCount = 0; + double acceptCount = 0; + double refuseCount = 0; + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + if(CollectionUtils.isNotEmpty(pciEos)){ + List toBeReleased = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List toBeVerified = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List toBeConfirmed = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List accept = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List refuse = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + toBeReleasedCount = toBeReleased.size(); + toBeVerifiedCount = toBeVerified.size(); + toBeConfirmedCount = toBeConfirmed.size(); + acceptCount = accept.size(); + refuseCount = refuse.size(); + + count = toBeReleasedCount + toBeVerifiedCount + toBeConfirmedCount + acceptCount + refuseCount; + if(count <= 0){ + percentage = 0; + }else{ + // 计算百分比 + percentage = acceptCount / count * 100; + } + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + + projectScheduleExportMap.put("toBeReleased",toBeReleasedCount); + projectScheduleExportMap.put("toBeVerified",toBeVerifiedCount); + projectScheduleExportMap.put("toBeConfirmed",toBeConfirmedCount); + projectScheduleExportMap.put("accept",acceptCount); + projectScheduleExportMap.put("refuse",refuseCount); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } + + @Override + public Map groupByPreHomoStatus(List pciEos) { + Map result = new HashMap<>(); + Map projectScheduleExportMap = new HashMap<>(); + + double notStartCount = 0; // 未发起 + double toBeSubmittedCount = 0; // 待提交 + double toBeReviewedCount = 0; // 待审查 + double acceptCount = 0; // 审查通过 + double refuseCount = 0; // 审查退回 + double taskTerminationCount = 0; // 任务终止 + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + if(CollectionUtils.isNotEmpty(pciEos)){ + List notStart = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List toBeSubmitted = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List toBeReviewed = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List accept = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List refuse = pciEos.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + notStartCount = notStart.size(); + toBeSubmittedCount = toBeSubmitted.size(); + toBeReviewedCount = toBeReviewed.size(); + acceptCount = accept.size(); + refuseCount = refuse.size(); + + count = notStartCount + toBeSubmittedCount + toBeReviewedCount + acceptCount + refuseCount; + if(count <= 0){ + percentage = 0; + }else{ + // 计算百分比 + percentage = acceptCount / count * 100; + } + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + + projectScheduleExportMap.put("notStartCount",notStartCount); + projectScheduleExportMap.put("toBeSubmittedCount",toBeSubmittedCount); + projectScheduleExportMap.put("toBeReviewedCount",toBeReviewedCount); + projectScheduleExportMap.put("accept",acceptCount); + projectScheduleExportMap.put("refuse",refuseCount); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } + + @Override + public Map groupByCertificationProgress(List pciEos) { + Map result = new HashMap<>(); + Map projectScheduleExportMap = new HashMap<>(); + + double notStartCount = 0; // 待开始 + double inProgressCount = 0; // 进行中 + double testPassedCount = 0; // 实验通过 + double testFailedCount = 0; // 实验失败 + double notSubmitCount = 0; // 部件报告未上传 + double reportSubmitCount = 0; // 部件报告已上传 + double storedCount = 0; // 部件报告已入库 + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + + if(CollectionUtils.isNotEmpty(pciEos)){ + // 未开始 + List notStartPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.NOT_START.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + notStartCount = (double) notStartPciEoList.size(); + + // 进行中 + List inProgressPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.IN_PROGRESS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + inProgressCount = (double) inProgressPciEoList.size(); + + // 实验通过 + List testPassedPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_PASSED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + testPassedCount = (double) testPassedPciEoList.size(); + + // 实验失败 + List testFailedPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_FAILED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + testFailedCount = (double) testFailedPciEoList.size(); + + // 部件报告未提交 + List notSubmitPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + notSubmitCount = (double) notSubmitPciEoList.size(); + + // 部件报告已提交 + List reportSubmitPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + reportSubmitCount = (double) reportSubmitPciEoList.size(); + + // 部件报告已入库 + List storedPciEoList = pciEos.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + storedCount = (double) storedPciEoList.size(); + + count = notStartCount + inProgressCount + testPassedCount + testFailedCount + testFailedCount + notSubmitCount + reportSubmitCount + storedCount; + if(count<=0){ + percentage = 0; + }else { + // 计算百分比 + percentage = testPassedCount / count * 100; + } + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + projectScheduleExportMap.put("notStartCount",notStartCount); + projectScheduleExportMap.put("inProgressCount",inProgressCount); + projectScheduleExportMap.put("testPassedCount",testPassedCount); + projectScheduleExportMap.put("testFailedCount",testFailedCount); + projectScheduleExportMap.put("notSubmitCount",notSubmitCount); + projectScheduleExportMap.put("reportSubmitCount",reportSubmitCount); + projectScheduleExportMap.put("storedCount",storedCount); + projectScheduleExportMap.put("count",count); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } + + @Override + public void syncProcessInfoDetailEndTime(Date newEndTime, List pciEoList) { + pciEoList = pciEoList.stream().filter(pciEo -> { + boolean flag = false; + if(null != newEndTime && !newEndTime.equals(pciEo.getEndTime())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(pciEoList)){ + List pciIdList = pciEoList.stream().map(ProjectCertificationInventoryEO::getId).distinct().collect(Collectors.toList()); + + QueryWrapper pidQueryWrap = new QueryWrapper<>(); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); + pidQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId,pciIdList); + List pidEoList = this.processInfoDetailEOService.list(pidQueryWrap); + + if(CollectionUtils.isNotEmpty(pidEoList)){ + List updatePidEoList = new ArrayList<>(); + for (ProjectCertificationInventoryEO pciEo : pciEoList) { + String pciEoId = pciEo.getId(); + String flowStatus = pciEo.getFlowStatus(); + // 如果该数据为 结果待提交或审查退回的时候 + if (StringUtils.equals(flowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(flowStatus,CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) ) { + List pidEoListTemp = pidEoList.stream().filter(pidEo -> { + boolean flag = ( + StringUtils.equals(pidEo.getProjectLawsInventoryId(),pciEoId) + && StringUtils.equals(pidEo.getStatus(),TaskStatusEnum.NOT_DONE.getValue()) + && StringUtils.equals(pidEo.getTaskDefinitionKey(),CertificationFlowNodeEnum.ZRRTJRW.getKey()) + ); + return flag; + }).collect(Collectors.toList()); + updatePidEoList.addAll(pidEoListTemp); + }else if(StringUtils.equals(flowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue())){ + List pidEoListTemp = pidEoList.stream().filter(pidEo -> { + boolean flag = ( + StringUtils.equals(pidEo.getProjectLawsInventoryId(),pciEoId) + && StringUtils.equals(flowStatus,TaskStatusEnum.NOT_DONE.getValue()) + && StringUtils.equals(pidEo.getTaskDefinitionKey(),CertificationFlowNodeEnum.RZGCSSC.getKey()) + ); + return flag; + }).collect(Collectors.toList()); + updatePidEoList.addAll(pidEoListTemp); + } + } + + if(CollectionUtils.isNotEmpty(updatePidEoList)){ + updatePidEoList.forEach(pidEo -> pidEo.setEndTime(newEndTime)); + this.processInfoDetailEOService.updateBatchById(updatePidEoList); + } + } + } + } + + @Override + public Map>> queryDutyPersonByProjectId(Map params) { + Map>> result = new HashMap<>(); + String projectLibraryId = (String) params.get("projectLibraryId"); + if(StringUtils.isNotEmpty(projectLibraryId)) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryId); + List pciList = this.list(queryWrapper); + List dutyList = new ArrayList<>(); + List interfaceList = new ArrayList<>(); + for (ProjectCertificationInventoryEO pci : pciList) { + if(StringUtils.isNotEmpty(pci.getDutyPerson())){ + dutyList.add(pci.getDutyPerson()); + } + if(StringUtils.isNotEmpty(pci.getSdt())){ + interfaceList.add(pci.getSdt()); + } + } + if(CollectionUtils.isNotEmpty(dutyList)){ + List> resList = new ArrayList<>(); + List userList = this.sysUserService.querySysUserListByIdList(dutyList); + if(CollectionUtils.isNotEmpty(userList)){ + for (SysUser user : userList) { + Map userMap = new HashMap<>(); + userMap.put("id",user.getId()); + userMap.put("userName",user.getUsername()); + resList.add(userMap); + } + } + result.put("dutyList",resList); + } + + if(CollectionUtils.isNotEmpty(interfaceList)){ + List> resList = new ArrayList<>(); + List userList = this.sysUserService.querySysUserListByIdList(interfaceList); + if(CollectionUtils.isNotEmpty(userList)){ + for (SysUser user : userList) { + Map userMap = new HashMap<>(); + userMap.put("id",user.getId()); + userMap.put("userName",user.getUsername()); + resList.add(userMap); + } + } + result.put("interfaceList",resList); + } + } + return result; + } + + @Override + public List getUserDutyTerritoryList(Map params) { + List result = new ArrayList<>(); + String userId = (String) params.get("userId"); + String projectLibraryId = (String) params.get("projectLibraryId"); + List dutyTerritorySdiList = (List) params.get("dutyTerritorySdiList"); + + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); + pciQueryWrap.and(pciQuery -> { + pciQuery.lambda().eq(ProjectCertificationInventoryEO::getDutyPerson,userId) + .or().eq(ProjectCertificationInventoryEO::getSdt,userId); + }); + List pciEoList = this.list(pciQueryWrap); + + if(CollectionUtils.isNotEmpty(pciEoList)){ + List dutyTerritoryIdList = Arrays.asList( + pciEoList.stream().map(ProjectCertificationInventoryEO::getDutyTerritory).collect(Collectors.joining(",")).split(",") + ).stream().distinct().collect(Collectors.toList()); + + result = dutyTerritorySdiList.stream().filter(dutyTerritory -> { + boolean flag = false; + for (String dutyTerritoryId : dutyTerritoryIdList) { + if (StringUtils.equals(dutyTerritoryId, dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + + return result; + } + + @Override + public void replacementUser(JSONObject json) { + //获取当前用户 + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = json.getString("userId"); + String projectLibraryId = json.getString("projectLibraryId"); + List> replacementUserList = (List>) json.get("replacementUserList"); + + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryId); + List pciEoList = this.list(pciQueryWrap); + + List updateEoList = new ArrayList<>(); + for (Map replacementUserMap : replacementUserList) { + String dutyTerritory = (String) replacementUserMap.get("dutyTerritory"); + String newUserId = (String) replacementUserMap.get("newUserId"); + if (StringUtils.isNotEmpty(newUserId)) { + for (ProjectCertificationInventoryEO pciEo : pciEoList) { + if (StringUtils.equals(pciEo.getDutyTerritory(), dutyTerritory)) { + if (StringUtils.equals(pciEo.getDutyPerson(), userId)) { + ProjectCertificationInventoryEO newPciEo = new ProjectCertificationInventoryEO(); + newPciEo.setId(pciEo.getId()); + newPciEo.setDutyPerson(newUserId); + +// QueryWrapper certificationQueryWrap = new QueryWrapper<>(); +// certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,pciEo.getId()); +// List oldPciEoList = this.list(certificationQueryWrap); + List oldPciEoList = pciEoList.stream().filter(p -> StringUtils.equals(p.getId(),pciEo.getId())).distinct().collect(Collectors.toList()); + // 编辑责任人处理逻辑 + this.editDutyPerson(newPciEo, oldPciEoList,currentUser); + + pciEo.setDutyPerson(newUserId); + } + if (StringUtils.equals(pciEo.getSdt(), userId)) { + pciEo.setSdt(newUserId); + } + updateEoList.add(pciEo); + } + } + } + } + + if (CollectionUtils.isNotEmpty(updateEoList)) { + this.updateBatchById(updateEoList); + } + } + + + /** + * 匹配相关人员 + * + * @param params + * @return + */ + @Override + public Result matchRelevantPeople(Map params) { + String projectLibraryId = (String) params.get("projectLibraryId");//项目id + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + int isProjectRole = this.checkUserRole(projectLibraryId, currentUser.getId()); + //验证用户是否是该项目的studio工程师,或者认证工程师,才能匹配相关人员 + if (isProjectRole == Integer.parseInt(com.jero.modules.project.enums.ProjectRoleEnum.STUDIO_ENGINEER.getValue()) + ||isProjectRole == Integer.parseInt(com.jero.modules.project.enums.ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())) { + //获取当前项目中的相关人员信息 + QueryWrapper queryProjectPerson = new QueryWrapper<>(); + queryProjectPerson.lambda().eq(ProjectRelatedPersonnel::getProjectId, projectLibraryId); + List projectRelatedPersonnels = this.projectRelatedPersonnelMapper.selectList(queryProjectPerson); + + if (CollectionUtils.isNotEmpty(projectRelatedPersonnels)) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); + List certificationInventoryEOs = this.list(queryWrapper); + List updateList = new ArrayList<>(); + for (ProjectCertificationInventoryEO certificationInventoryEO : certificationInventoryEOs) { + //只留下清单状态为 未发起、认证退回的认证清单。 + if(CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue().equals(certificationInventoryEO.getFlowStatus()) + ||CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue().equals(certificationInventoryEO.getFlowStatus())){ + String dutyTerritory = certificationInventoryEO.getDutyTerritory(); + if (StringUtils.isNotEmpty(dutyTerritory)) { + List projectRelatedPersonnelTempList = projectRelatedPersonnels.stream().filter(relatedPersonnel -> { + boolean flag = false; + for (String duty : dutyTerritory.split(",")) { + if (StringUtils.equals(duty, relatedPersonnel.getDutyTerritory())) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(projectRelatedPersonnelTempList)) { + List relatedPerson = new ArrayList<>(); + for (ProjectRelatedPersonnel prp : projectRelatedPersonnelTempList) { + String engineeringInterfacePerson = prp.getEngineeringInterfacePerson(); + if (StringUtils.isNotEmpty(engineeringInterfacePerson)) { + for (String eip : engineeringInterfacePerson.split(",")) { + if (StringUtils.isNotEmpty(eip)) { + relatedPerson.add(eip); + } + } + } + } + if (CollectionUtils.isNotEmpty(relatedPerson) && relatedPerson.size() == 1) { + certificationInventoryEO.setSdt(relatedPerson.get(0)); + certificationInventoryEO.setDutyPerson(relatedPerson.get(0)); + updateList.add(certificationInventoryEO); + } + } + } + } + } + if(CollectionUtils.isNotEmpty(updateList)) { + this.updateBatchById(updateList); + } + } else { + throw new JeroBootException("当前项目中,未找到相关维护人员信息"); + } + } else { + throw new JeroBootException("当前操作用户不是该项目的studio工程师或认证工程师,没有权限操作!"); + } + + //更新log +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// String username = sysUser.getUsername(); +// String contentLog = username + "带入了相关人员名单信息"; +// String enContentLog = username + " brought in the list information of relevant personnel."; +// projectLawsInventoryLogEOService.updateLog(contentLog, projectLibraryId, CutEnum.CN.getValue()); +// projectLawsInventoryLogEOService.updateLog(enContentLog, projectLibraryId, CutEnum.EN.getValue()); + + return new Result<>().success("带入成功!"); + } + + /** + * 验证用户在该项目中的角色 + * + * @param projectLibraryId 项目库id + * @param currentUserId 登录人id + * @return + */ + public int checkUserRole(String projectLibraryId, String currentUserId) { + int result = -1; + try { + QueryWrapper projectLibraryBaseQueryWrapper = new QueryWrapper<>(); + projectLibraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getId, projectLibraryId); + projectLibraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getStudioEngineer, currentUserId); + Integer projectLibrayBaseCount = platformProjectLibraryBaseMapper.selectCount(projectLibraryBaseQueryWrapper); + if (projectLibrayBaseCount > 0) { + result = Integer.parseInt(com.jero.modules.project.enums.ProjectRoleEnum.STUDIO_ENGINEER.getValue()); + if(result == -1){ + result = Integer.parseInt(com.jero.modules.project.enums.ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue()); + } + } + } catch (Exception ex) { + log.error("验证用户在该项目中的角色失败:" + ex.getMessage()); + throw new JeroBootException("验证用户在该项目中的角色失败!"); + } + return result; + } + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectLawsInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectLawsInventoryEOServiceImpl.java new file mode 100644 index 000000000..f25ae55b1 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectLawsInventoryEOServiceImpl.java @@ -0,0 +1,11965 @@ +package com.jero.modules.platform.service.impl; + +import cn.hutool.core.util.URLUtil; +import cn.hutool.core.util.ZipUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.utils.IOUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.itextpdf.text.Chapter; +import com.itextpdf.text.Document; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.Element; +import com.itextpdf.text.Font; +import com.itextpdf.text.PageSize; +import com.itextpdf.text.Paragraph; +import com.itextpdf.text.Phrase; +import com.itextpdf.text.Section; +import com.itextpdf.text.pdf.BaseFont; +import com.itextpdf.text.pdf.PdfPCell; +import com.itextpdf.text.pdf.PdfPTable; +import com.itextpdf.text.pdf.PdfWriter; +import com.jero.common.api.vo.Result; +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.MessageType2Enum; +import com.jero.common.constant.enums.MessageTypeEnum; +import com.jero.common.constant.enums.MsgColorEnum; +import com.jero.common.exception.JeroBootException; +import com.jero.common.system.query.QueryGenerator; +import com.jero.common.system.vo.DictModel; +import com.jero.common.system.vo.LoginUser; +import com.jero.common.util.DateUtils; +import com.jero.common.util.oss.CosBootUtil; +import com.jero.modules.document.entity.BussDocumentLibraryEO; +import com.jero.modules.document.service.IBussDocumentLibraryEOService; +import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl; +import com.jero.modules.dummy.entity.DummyInventoryBaseEO; +import com.jero.modules.dummy.entity.DummyInventoryInfoEO; +import com.jero.modules.dummy.enums.AttestationRankEnum; +import com.jero.modules.dummy.enums.OrderEnum; +import com.jero.modules.dummy.service.IDummyInventoryInfoEOService; +import com.jero.modules.dummy.service.impl.DummyInventoryBaseEOServiceImpl; +import com.jero.modules.enums.DictCodeEnum; +import com.jero.modules.feishu.enums.TemplateInfoEnum2; +import com.jero.modules.feishu.service.IFeishuService; +import com.jero.modules.feishu.vo.FeishuMsg2Vo; +import com.jero.modules.feishu.vo.FeishuMsgVo; +import com.jero.modules.message.websocket.WebSocket; +import com.jero.modules.oss.entity.OSSFile; +import com.jero.modules.oss.service.IOSSFileService; +import com.jero.modules.platform.mapper.PlatformProjectLawsInventoryEOMapper; +import com.jero.modules.platform.mapper.PlatformProjectLibraryBaseMapper; +import com.jero.modules.platform.mapper.PlatformProjectNameInfoEOMapper; +import com.jero.modules.platform.service.IPlatformProjectLawsInventoryEOService; +import com.jero.modules.project.entity.ConditionAssessmentEO; +import com.jero.modules.project.entity.ProblemManagementEO; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import com.jero.modules.project.entity.ProjectLawsInventoryEOEn; +import com.jero.modules.project.entity.ProjectLawsInventoryRejectCauseEO; +import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.project.entity.ProjectNameInfoEO; +import com.jero.modules.project.entity.ProjectRelatedPersonnel; +import com.jero.modules.project.entity.ProjectTaskInventoryDetailEO; +import com.jero.modules.project.entity.ProjectTaskInventoryEO; +import com.jero.modules.project.entity.ProjectUserPermission; +import com.jero.modules.project.entity.ProjectYearNameInfoEO; +import com.jero.modules.project.enums.CertificationProgressEnum; +import com.jero.modules.project.enums.ColourEnum; +import com.jero.modules.project.enums.ComplianceFlowStatusEnum; +import com.jero.modules.project.enums.CurrentProjectStatusEnum; +import com.jero.modules.project.enums.DataEnum; +import com.jero.modules.project.enums.DataSourceEnum; +import com.jero.modules.project.enums.DesignComplianceStatusEnum; +import com.jero.modules.project.enums.InventoryAffirmNodeEnum; +import com.jero.modules.project.enums.InventoryAffirmStatusEnum; +import com.jero.modules.project.enums.JumpLinkEnum; +import com.jero.modules.project.enums.MsgTypeEnum; +import com.jero.modules.project.enums.OperatorResultEnum; +import com.jero.modules.project.enums.OperatorTypeEnum; +import com.jero.modules.project.enums.PermissionDescriptionEnum; +import com.jero.modules.project.enums.ProjectInventoryFieldEnum; +import com.jero.modules.project.enums.ProjectRoleEnum; +import com.jero.modules.project.enums.ProjectUserLocationEnum; +import com.jero.modules.project.enums.RequestSourceEnum; +import com.jero.modules.project.enums.TaskAffirmStatusEnum; +import com.jero.modules.project.enums.TaskStatusEnum; +import com.jero.modules.project.mapper.ProblemManagementEOMapper; +import com.jero.modules.project.mapper.ProjectRelatedPersonnelMapper; +import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper; +import com.jero.modules.project.service.IConditionAssessmentEOService; +import com.jero.modules.project.service.IProjectLawsInventoryRejectCauseEOService; +import com.jero.modules.project.service.IProjectRelatedPersonnelService; +import com.jero.modules.project.service.IProjectTaskInventoryDetailEOService; +import com.jero.modules.project.service.IProjectTaskInventoryEOService; +import com.jero.modules.project.service.IProjectUserPermissionService; +import com.jero.modules.project.service.editImpl.ProjectLawsInventoryEOEditServiceImpl; +import com.jero.modules.project.service.impl.ProblemManagementEOServiceImpl; +import com.jero.modules.project.service.impl.ProjectLawsInventoryLogEOServiceImpl; +import com.jero.modules.project.service.impl.ProjectLibraryBaseServiceImpl; +import com.jero.modules.project.service.impl.ProjectRelatedPersonnelServiceImpl; +import com.jero.modules.project.util.WordUtil; +import com.jero.modules.project.vo.NcrTrackVO; +import com.jero.modules.project.vo.ProblemManagementVO; +import com.jero.modules.project.vo.ProjectTaskUrgVo; +import com.jero.modules.split.common.FileUnZip; +import com.jero.modules.system.entity.SysAnnouncement; +import com.jero.modules.system.entity.SysCategory; +import com.jero.modules.system.entity.SysDictItem; +import com.jero.modules.system.entity.SysRole; +import com.jero.modules.system.entity.SysUser; +import com.jero.modules.system.enums.DicCodeEnum; +import com.jero.modules.system.mapper.SysCategoryMapper; +import com.jero.modules.system.mapper.SysRoleMapper; +import com.jero.modules.system.mapper.SysUserMapper; +import com.jero.modules.system.service.IProjectUserDutyTerritoryService; +import com.jero.modules.system.service.ISysAnnouncementService; +import com.jero.modules.system.service.ISysDictService; +import com.jero.modules.system.service.ISysUserService; +import com.jero.modules.system.service.impl.SysCategoryServiceImpl; +import com.jero.modules.system.service.impl.SysDictItemServiceImpl; +import com.jero.modules.system.util.PDFUtils; +import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; +import com.jero.modules.todoCenter.entity.ProcessInfoEO; +import com.jero.modules.todoCenter.enums.DesignComplianceFlowNodeKeyEnum; +import com.jero.modules.todoCenter.enums.TodoCenterStatusEnum; +import com.jero.modules.todoCenter.enums.VerifyComplianceFlowNodeKeyEnum; +import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService; +import com.jero.modules.todoCenter.service.IProcessInfoEOService; +import com.jero.modules.wkflow.entity.ProcessHistoryEO; +import com.jero.modules.wkflow.enums.DesignComplianceNodeEnum; +import com.jero.modules.wkflow.enums.FlowTypeEnum; +import com.jero.modules.wkflow.feginClient.impl.WorkFlowFeignClientImpl; +import com.jero.modules.wkflow.service.IProcessHistoryEOService; +import com.jero.modules.wkflow.service.impl.ProcessHistoryEOServiceImpl; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; +import org.apache.poi.hssf.usermodel.HSSFRichTextString; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.apache.shiro.SecurityUtils; +import org.aspectj.util.FileUtil; +import org.docx4j.Docx4J; +import org.docx4j.TraversalUtil; +import org.docx4j.XmlUtils; +import org.docx4j.finders.ClassFinder; +import org.docx4j.openpackaging.exceptions.Docx4JException; +import org.docx4j.openpackaging.packages.WordprocessingMLPackage; +import org.docx4j.wml.Tbl; +import org.docx4j.wml.Tr; +import org.jeecgframework.poi.excel.ExcelExportUtil; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.enmus.ExcelType; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.text.Collator; +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +import static com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl.copyFile; + +//import com.jero.modules.project.util.WordUtil; + +/** + * @Description: 项目库-法规清单表 + * @Author: jero-boot + * @Date: 2022-04-14 + * @Version: V1.0 + */ +@Slf4j +@Service +@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class) +public class PlatformProjectLawsInventoryEOServiceImpl extends ServiceImpl implements IPlatformProjectLawsInventoryEOService { + + private static DecimalFormat df = new DecimalFormat("#.00"); + private static String percentSign = "%"; + @Autowired + private PlatformProjectLibraryBaseMapper platformProjectLibraryBaseMapper; + + @Autowired + private SysUserMapper sysUserMapper; + + @Autowired + private IBussDocumentLibraryEOService iBussDocumentLibraryEOService; + + @Autowired + private IOSSFileService iOSSFileService; + + @Autowired + private IFeishuService iFeishuService; + + @Autowired + private ISysAnnouncementService sysAnnouncementService; + + @Autowired + private ISysUserService sysUserService; + + @Autowired + private WebSocket webSocket; + + @Autowired + private ProjectRelatedPersonnelMapper projectRelatedPersonnelMapper; + + @Autowired + private PlatformProjectNameInfoEOMapper platformProjectNameInfoEOMapper; + + @Autowired + private ProjectYearNameInfoEOMapper projectYearNameInfoEOMapper; + + @Autowired + private IProjectTaskInventoryEOService projectTaskInventoryEOService; + + @Autowired + private IProjectTaskInventoryDetailEOService projectTaskInventoryDetailEOService; + + @Autowired + private IDummyInventoryInfoEOService dummyInventoryInfoEOService; + @Value(value = "${jero.path.upload}") + private String uploadpath; + @Value("${jero.path.exportPdfTempPath}") + private String exportPdfTempPath; + @Value("${jero.path.simfangFontFilePath}") + private String simfangFontFilePath; + @Value(value = "${jero.backUrl}") + private String backUrl; + @Value(value = "${jero.backUrlPhone}") + private String backUrlPhone; + + @Autowired + private SysCategoryServiceImpl sysCategoryService; + @Autowired + private SysDictItemServiceImpl sysDictItemServiceImpl; + @Autowired + private IProjectRelatedPersonnelService iProjectRelatedPersonnelService; + + @Autowired + private ProjectLawsInventoryLogEOServiceImpl projectLawsInventoryLogEOService; + + @Autowired + private DummyInventoryBaseEOServiceImpl dummyInventoryBaseEOService; + + @Autowired + private IProcessHistoryEOService processHistoryEOService; + + @Autowired + private IConditionAssessmentEOService conditionAssessmentEOService; + + @Autowired + private WorkFlowFeignClientImpl workFlowFeignClient; + @Autowired + SysCategoryMapper sysCategoryMapper; + + @Autowired + SysRoleMapper sysRoleMapper; + @Autowired + private PlatformProjectLibraryBaseServiceImpl platformProjectLibraryBaseService; + @Autowired + private ProjectLibraryBaseServiceImpl projectLibraryBaseService; + @Autowired + private ProjectRelatedPersonnelServiceImpl projectRelatedPersonnelService; + + @Autowired + private IProjectLawsInventoryRejectCauseEOService projectLawsInventoryRejectCauseEOService; + @Autowired + private IProcessInfoEOService processInfoEOService; + @Autowired + private IProcessInfoDetailEOService processInfoDetailEOService; + + @Autowired + private IFeishuService feishuService; + + @Autowired + private IBussDocumentLibraryEOService bussDocumentLibraryEOService; + + @Autowired + private IProjectUserPermissionService projectUserPermissionService; + + @Autowired + private IProjectUserDutyTerritoryService projectUserDutyTerritoryService; + + @Autowired + private ProjectLawsInventoryEOEditServiceImpl editService; + @Autowired + private ProblemManagementEOServiceImpl problemManagementEOService; + @Autowired + private ProblemManagementEOMapper problemManagementEOMapper; + @Autowired + private ISysDictService sysDictService; + @Autowired + private BussDocumentLibraryEOServiceImpl documentLibraryEOService; + @Autowired + private ProcessHistoryEOServiceImpl processHistoryEOServiceImpl; + + /** + * 保存 + * + * @param projectLawsInventoryEO + * @return + */ + @Override + public void add(ProjectLawsInventoryEO projectLawsInventoryEO) { + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + Date now = new Date(); + List projectTaskInventoryEOList = new ArrayList<>(); + //法规清单所有的数据 + LambdaQueryWrapper wrapperTemp = new LambdaQueryWrapper<>(); + wrapperTemp.in(ProjectLawsInventoryEO::getProjectLibraryId, projectLawsInventoryEO.getProjectLibraryId()); + List projectLawsInventoryEOList = this.list(wrapperTemp); + //调取 + String dummyInventoryBaseId = projectLawsInventoryEO.getDummyInventoryBaseId(); + if (StringUtils.isNotBlank(projectLawsInventoryEO.getDummyids())) { + //查询虚拟清单对应清单维护中的数据 + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.in(DummyInventoryInfoEO::getId, Arrays.asList(projectLawsInventoryEO.getDummyids().split(","))); + List dummyInventoryInfoEOList = dummyInventoryInfoEOService.list(lambdaQueryWrapper); + List dummyInventoryInfoEOListNew = new ArrayList<>(); + if (dummyInventoryInfoEOList.size() != 0) { + List projectLawsInventoryEOS = new ArrayList<>(); + //责任领域如果有多个,则需要拆分成多条 + for (DummyInventoryInfoEO dummyInventoryInfoEO : dummyInventoryInfoEOList) { + String dutyTerritory = dummyInventoryInfoEO.getDutyTerritory(); + if (StringUtils.isNotBlank(dutyTerritory)) { + for (String dutyTerritoryOne : dutyTerritory.split(",")) { + DummyInventoryInfoEO dummyInventoryInfoEONew = new DummyInventoryInfoEO(); + BeanUtils.copyProperties(dummyInventoryInfoEO, dummyInventoryInfoEONew); + dummyInventoryInfoEONew.setDutyTerritory(dutyTerritoryOne); + dummyInventoryInfoEOListNew.add(dummyInventoryInfoEONew); + } + } else { + dummyInventoryInfoEOListNew.add(dummyInventoryInfoEO); + } + } + if (projectLawsInventoryEOList.size() == 0) { + //此时法规清单中没有数据,直接将维护清单中的数据添加即可 + for (DummyInventoryInfoEO dummyInventoryInfoEO : dummyInventoryInfoEOListNew) { + ProjectLawsInventoryEO projectLawsInventoryEOTemp = new ProjectLawsInventoryEO(); + projectLawsInventoryEOTemp.setProjectLibraryId(projectLawsInventoryEO.getProjectLibraryId()); + BeanUtils.copyProperties(dummyInventoryInfoEO, projectLawsInventoryEOTemp); + projectLawsInventoryEOTemp.setId(UUID.randomUUID().toString().replace("-", "")); + projectLawsInventoryEOTemp.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryEOTemp.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryEOTemp.setStandId(dummyInventoryInfoEO.getBussDocumentLibraryId()); + projectLawsInventoryEOTemp.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + projectLawsInventoryEOTemp.setVerifyFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + projectLawsInventoryEOTemp.setCreateTime(new Date()); + projectLawsInventoryEOTemp.setUpdateTime(new Date()); + projectLawsInventoryEOS.add(projectLawsInventoryEOTemp); + } + } else { + //此时法规清单中有数据,再添加虚拟清单数据时,如果法规清单中已有要填加的虚拟清单数据,则数据以法规清单为准 + List projectLawsInventoryEOListTemp = new ArrayList<>(); + for (DummyInventoryInfoEO dummyInventoryInfoEO : dummyInventoryInfoEOListNew) { + List collect = projectLawsInventoryEOList.stream() + .filter(e -> e.getSerialNumber().equals(dummyInventoryInfoEO.getSerialNumber())).collect(Collectors.toList()); + if (collect.size() != 0) { + for (ProjectLawsInventoryEO lawsInventoryEO : collect) { + //数据对比 + ProjectLawsInventoryEO projectLawsInventoryEOTemp = dataCompare(lawsInventoryEO, dummyInventoryInfoEO); + projectLawsInventoryEOListTemp.add(projectLawsInventoryEOTemp); + } + } else { + ProjectLawsInventoryEO projectLawsInventoryEOTemp = new ProjectLawsInventoryEO(); + projectLawsInventoryEOTemp.setProjectLibraryId(projectLawsInventoryEO.getProjectLibraryId()); + BeanUtils.copyProperties(dummyInventoryInfoEO, projectLawsInventoryEOTemp); + projectLawsInventoryEOTemp.setId(UUID.randomUUID().toString().replace("-", "")); + projectLawsInventoryEOTemp.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryEOTemp.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryEOTemp.setStandId(dummyInventoryInfoEO.getBussDocumentLibraryId()); + projectLawsInventoryEOTemp.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + projectLawsInventoryEOTemp.setVerifyFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + projectLawsInventoryEOTemp.setCreateTime(new Date()); + projectLawsInventoryEOTemp.setUpdateTime(new Date()); + projectLawsInventoryEOS.add(projectLawsInventoryEOTemp); + } + } + if (projectLawsInventoryEOListTemp.size() != 0) { + this.updateBatchById(projectLawsInventoryEOListTemp); + } + } + if (projectLawsInventoryEOS.size() != 0) { + this.saveBatch(projectLawsInventoryEOS); + //设置权限 + for (ProjectLawsInventoryEO lawsInventoryEO : projectLawsInventoryEOS) { + ProjectUserPermission permission = new ProjectUserPermission(); + permission.setProjectId(projectLawsInventoryEO.getProjectLibraryId()); + permission.setUserId(sysUser.getId()); + permission.setBelong(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_CREATE_BY.getValue()); + permission.setDescription(PermissionDescriptionEnum.PROJECT_LAWS_INVENTORY.getValue() + lawsInventoryEO.getId()); + permission.setCreateTime(now); + permission.setUpdateTime(now); + projectUserPermissionService.add(permission); + } + projectLawsInventoryEOS.forEach(lawsInventory -> { + ProjectTaskInventoryEO projectTaskInventoryEO = new ProjectTaskInventoryEO(); + String projectTaskInventoryId = UUID.randomUUID().toString().replace("-", ""); + projectTaskInventoryEO.setId(projectTaskInventoryId); + projectTaskInventoryEO.setProjectLawsInventoryId(lawsInventory.getId()); + projectTaskInventoryEO.setStandId(lawsInventory.getStandId()); + projectTaskInventoryEO.setCertificationProgress(CertificationProgressEnum.NOT_START.getValue()); + projectTaskInventoryEOList.add(projectTaskInventoryEO); + }); + + //更新log + String projectLibraryId = projectLawsInventoryEOS.stream().map(e -> e.getProjectLibraryId()).collect(Collectors.toList()).get(0); + String username = sysUser.getUsername(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + String dummyInventoryBaseName = dummyInventoryBaseEOService.list(queryWrapper.eq("id", dummyInventoryBaseId)).get(0).getName();//name + String contentLog = username + "调取了" + dummyInventoryBaseName + "虚拟清单的标准内容"; + String enContentLog = username + " called the standard content of" + dummyInventoryBaseName + "virtual inventory."; + projectLawsInventoryLogEOService.updateLog(contentLog, projectLibraryId, CutEnum.CN.getValue()); + projectLawsInventoryLogEOService.updateLog(enContentLog, projectLibraryId, CutEnum.EN.getValue()); + } + } else if (dummyInventoryInfoEOList.size() == 0 && StringUtils.isBlank(projectLawsInventoryEO.getFlag())) { + //flag为二次确认标识,flag为空时进行验证 + throw new JeroBootException("该虚拟清单的维护清单中没有数据,是否需要添加"); + } + } + + //新增 + String ids = projectLawsInventoryEO.getIds(); + if (StringUtils.isNotBlank(ids)) { + //验重,对于每条法规清单添加文档库数据(之前添加过的就不能再次添加) + //1.已经添加过的文档库数据 + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.in(ProjectLawsInventoryEO::getProjectLibraryId, Arrays.asList(projectLawsInventoryEO.getProjectLibraryId().split(","))); + List projectLawsInventoryEOS = this.list(lambdaQueryWrapper); + List serialNumberList = new ArrayList<>(); + if (projectLawsInventoryEOS.size() != 0) { + List collect = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getSerialNumber).collect(Collectors.toList()); + serialNumberList.addAll(collect); + } + //2.文档库数据 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(BussDocumentLibraryEO::getId, Arrays.asList(ids.split(","))); + List bussDocumentLibraryEOList = iBussDocumentLibraryEOService.list(wrapper); + if (bussDocumentLibraryEOList.size() != 0) { + List serialNumberBussList = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList()); + if (serialNumberList.size() != 0) { + List collect = serialNumberList.stream().filter(e -> serialNumberBussList.contains(e)).collect(Collectors.toList()); + if (collect.size() != 0) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + throw new JeroBootException(StringUtils.join(collect, ",") + "已存在不能重复添加,请重新选择"); + } else { + throw new JeroBootException(StringUtils.join(collect, ",") + "Already exists and cannot be added again"); + } + } + } + } + + List list = new ArrayList<>(); + List addPermission = new ArrayList<>(); + for (BussDocumentLibraryEO bussDocumentLibraryEO : bussDocumentLibraryEOList) { + String standId = bussDocumentLibraryEO.getId(); + + ProjectLawsInventoryEO projectLawsInventoryTemp = new ProjectLawsInventoryEO(); + BeanUtils.copyProperties(bussDocumentLibraryEO, projectLawsInventoryTemp); + String projectLawsInventoryId = UUID.randomUUID().toString().replace("-", ""); + projectLawsInventoryTemp.setId(projectLawsInventoryId); + projectLawsInventoryTemp.setProjectLibraryId(projectLawsInventoryEO.getProjectLibraryId()); + projectLawsInventoryTemp.setCreateTime(new Date()); + projectLawsInventoryTemp.setUpdateTime(new Date()); + projectLawsInventoryTemp.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryTemp.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryTemp.setStandId(standId); + projectLawsInventoryTemp.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + projectLawsInventoryTemp.setVerifyFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + list.add(projectLawsInventoryTemp); + + ProjectTaskInventoryEO projectTaskInventoryEO = new ProjectTaskInventoryEO(); + String projectTaskInventoryId = UUID.randomUUID().toString().replace("-", ""); + projectTaskInventoryEO.setId(projectTaskInventoryId); + projectTaskInventoryEO.setProjectLawsInventoryId(projectLawsInventoryId); + projectTaskInventoryEO.setStandId(standId); + projectTaskInventoryEO.setCertificationProgress(CertificationProgressEnum.NOT_START.getValue()); + projectTaskInventoryEOList.add(projectTaskInventoryEO); + + //添加权限 + ProjectUserPermission permission = new ProjectUserPermission(); + permission.setProjectId(projectLawsInventoryEO.getProjectLibraryId()); + permission.setUserId(sysUser.getId()); + permission.setBelong(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_CREATE_BY.getValue()); + permission.setDescription(PermissionDescriptionEnum.PROJECT_LAWS_INVENTORY.getValue() + projectLawsInventoryId); + permission.setCreateTime(now); + permission.setUpdateTime(now); + addPermission.add(permission); + } + super.saveBatch(list); + if (ObjectUtils.isNotEmpty(addPermission)) { + projectUserPermissionService.saveBatch(addPermission); + } + + //更新log + String username = sysUser.getUsername(); + String serialNumber = list.stream().map(e -> e.getSerialNumber()).collect(Collectors.joining(",")); + String contentLog = username + "向清单中添加了“" + serialNumber + "”"; + String enContentLog = username + " added “" + serialNumber + "” to the list."; + + projectLawsInventoryLogEOService.updateLog(contentLog, projectLawsInventoryEO.getProjectLibraryId(), CutEnum.CN.getValue()); + projectLawsInventoryLogEOService.updateLog(enContentLog, projectLawsInventoryEO.getProjectLibraryId(), CutEnum.EN.getValue()); + } + + if (CollectionUtils.isNotEmpty(projectTaskInventoryEOList)) { + //项目任务清单数据初始化。 + this.projectTaskInventoryEOService.saveBatch(projectTaskInventoryEOList); + projectTaskInventoryEOList.forEach(taskInventory -> { + this.initConditionAssessmentEO(taskInventory.getProjectLawsInventoryId()); + }); + } + } + + @Override + public void editById(ProjectLawsInventoryEO projectLawsInventoryEO) { + this.editService.editByIdPlatform(projectLawsInventoryEO); + } + + /** + * 更新流程信息 + * + * @param projectLawsInventoryEO + */ + @Override + public void updateFlowInfo(ProjectLawsInventoryEO projectLawsInventoryEO) { + //只有法规的 任务确认状态为接受,才能启动 设计、验证、prehomo三个流程。 + if (StringUtils.equals(projectLawsInventoryEO.getTaskAffirmStatus(), TaskAffirmStatusEnum.ACCEPTED.getValue())) { + QueryWrapper taskInventoryQueryWrapper = new QueryWrapper<>(); + taskInventoryQueryWrapper.lambda().eq(ProjectTaskInventoryEO::getProjectLawsInventoryId, projectLawsInventoryEO.getId()); + ProjectTaskInventoryEO projectTaskInventoryEO = projectTaskInventoryEOService.getBaseMapper().selectOne(taskInventoryQueryWrapper); + if (projectTaskInventoryEO != null) { + String designPId = projectTaskInventoryEO.getDesignPId(); + if (StringUtils.isNotEmpty(designPId)) { + updateFlowAssignee(projectLawsInventoryEO, projectTaskInventoryEO, designPId, FlowTypeEnum.SJFHXSHLC.getValue()); + } + + String verifyPId = projectTaskInventoryEO.getVerifyPId(); + if (StringUtils.isNotEmpty(verifyPId)) { + updateFlowAssignee(projectLawsInventoryEO, projectTaskInventoryEO, verifyPId, FlowTypeEnum.YZFHXSCLC.getValue()); + } + + String prehomoPId = projectTaskInventoryEO.getPrehomoPId(); + if (StringUtils.isNotEmpty(prehomoPId)) { + updateFlowAssignee(projectLawsInventoryEO, projectTaskInventoryEO, prehomoPId, FlowTypeEnum.PREHOMOQRLC.getValue()); + } + } + } + } + + /** + * 更新流程办理人 + * + * @param projectLawsInventoryEO 法规清单数据 + * @param projectTaskInventoryEO 任务清单数据 + * @param pId 流程实例id + * @param flowType 流程类型 + */ + public void updateFlowAssignee(ProjectLawsInventoryEO projectLawsInventoryEO, ProjectTaskInventoryEO projectTaskInventoryEO, String pId, String flowType) { + QueryWrapper taskInventoryDetailWrapper = new QueryWrapper<>(); + taskInventoryDetailWrapper.lambda().eq(ProjectTaskInventoryDetailEO::getProjectTaskInventoryId, projectTaskInventoryEO.getProjectLawsInventoryId()); + taskInventoryDetailWrapper.lambda().eq(ProjectTaskInventoryDetailEO::getActiProcInstId, pId); + taskInventoryDetailWrapper.lambda().eq(ProjectTaskInventoryDetailEO::getFlowType, flowType); + List taskInventoryDetailList = projectTaskInventoryDetailEOService.getBaseMapper().selectList(taskInventoryDetailWrapper); + + if (CollectionUtils.isNotEmpty(taskInventoryDetailList)) { + if (StringUtils.equals(flowType, FlowTypeEnum.SJFHXSHLC.getValue())) { + for (ProjectTaskInventoryDetailEO projectTaskInventoryDetailEO : taskInventoryDetailList) { + if (StringUtils.equals(projectTaskInventoryDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey())) { + //更新责任人的任务 + projectTaskInventoryDetailEO.setUserId(projectLawsInventoryEO.getDesignDutyId()); + } + if (StringUtils.equals(projectTaskInventoryDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.SPONSOR_REVIEW.getKey())) { + //更新发起人的任务 + projectTaskInventoryDetailEO.setUserId(projectLawsInventoryEO.getDesignInitiatorId()); + } + this.projectTaskInventoryDetailEOService.updateById(projectTaskInventoryDetailEO); + } + } else if (StringUtils.equals(flowType, FlowTypeEnum.PREHOMOQRLC.getValue())) { + for (ProjectTaskInventoryDetailEO projectTaskInventoryDetailEO : taskInventoryDetailList) { + if (StringUtils.equals(projectTaskInventoryDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey())) { + //更新责任人的任务 + projectTaskInventoryDetailEO.setUserId(projectLawsInventoryEO.getPrehomoDutyId()); + } + if (StringUtils.equals(projectTaskInventoryDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.SPONSOR_REVIEW.getKey())) { + //更新发起人的任务 + projectTaskInventoryDetailEO.setUserId(projectLawsInventoryEO.getPrehomoInitiatorId()); + } + this.projectTaskInventoryDetailEOService.updateById(projectTaskInventoryDetailEO); + } + } else if (StringUtils.equals(flowType, FlowTypeEnum.YZFHXSCLC.getValue())) { + for (ProjectTaskInventoryDetailEO projectTaskInventoryDetailEO : taskInventoryDetailList) { + if (StringUtils.equals(projectTaskInventoryDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey())) { + //更新责任人的任务 + projectTaskInventoryDetailEO.setUserId(projectLawsInventoryEO.getVerifyDutyId()); + } + if (StringUtils.equals(projectTaskInventoryDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.SPONSOR_REVIEW.getKey())) { + //更新发起人的任务 + projectTaskInventoryDetailEO.setUserId(projectLawsInventoryEO.getVerifyInitiatorId()); + } + this.projectTaskInventoryDetailEOService.updateById(projectTaskInventoryDetailEO); + } + } + //更新待办中心流程信息明细表,处理人 + this.updateProcessInfoDetailAssignee(projectLawsInventoryEO, pId, flowType); + } + } + + /** + * 更新待办中心流程信息明细表,处理人 + * + * @param projectLawsInventoryEO + * @param pId + * @param flowType + */ + public void updateProcessInfoDetailAssignee(ProjectLawsInventoryEO projectLawsInventoryEO, String pId, String flowType) { + this.processInfoDetailEOService.updateProcessInfoDetailUserId(projectLawsInventoryEO, pId, flowType); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @Override + public void deleteById(String id, String projectLibraryId, String cut) { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + int isProjectRole = this.checkUserRole(projectLibraryId, currentUser.getId(), ""); +// if (!ProjectRoleEnum.STUDIO_ENGINEER.getValue().equals(String.valueOf(isProjectRole))) { +// if (CutEnum.CN.getValue().equals(cut)) { +// throw new JeroBootException("该用户没有删除权限"); +// } else { +// throw new JeroBootException("The user has no deletion permission"); +// } +// } + + //引用流程重置的逻辑 + String operateType= "lawsInventoryAllResetFlow"; + resetFlow(id,projectLibraryId,operateType); + + //更新log + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String username = sysUser.getUsername(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + String serialNumber = list(queryWrapper.eq("id", id)).get(0).getSerialNumber(); + String contentLog = username + "删除了清单中的“" + serialNumber + "”"; + String enContentLog = username + " deleted “" + serialNumber + "” from the list"; + projectLawsInventoryLogEOService.updateLog(contentLog, projectLibraryId, CutEnum.CN.getValue()); + projectLawsInventoryLogEOService.updateLog(enContentLog, projectLibraryId, CutEnum.EN.getValue()); + + removeById(id); + this.projectTaskInventoryEOService.deleteByProjectLawsInventoryIds(Arrays.asList(id.split(","))); + + //删除该条法规清单数据的 项目当前状态数据 + QueryWrapper conditionAssessmentRemoveWrapper = new QueryWrapper<>(); + conditionAssessmentRemoveWrapper.lambda().eq(ConditionAssessmentEO::getProjectLawsInventoryId, id); + this.conditionAssessmentEOService.remove(conditionAssessmentRemoveWrapper); + //删除该条法规清单数据的拒绝原因。 + QueryWrapper rejectCauseRemoveWrapper = new QueryWrapper<>(); + rejectCauseRemoveWrapper.lambda().eq(ProjectLawsInventoryRejectCauseEO::getProjectLawsInventoryId, id); + this.projectLawsInventoryRejectCauseEOService.remove(rejectCauseRemoveWrapper); + //删除相关人员权限 + QueryWrapper delPermission = new QueryWrapper<>(); + delPermission.eq("description", PermissionDescriptionEnum.PROJECT_LAWS_INVENTORY.getValue() + id); + projectUserPermissionService.remove(delPermission); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @Override + public void deleteByIds(List ids, String projectLibraryId, String cut) { + if (ObjectUtils.isEmpty(ids)) { + if (CutEnum.CN.getValue().equals(cut)) { + throw new JeroBootException("请选择数据"); + } else { + throw new JeroBootException("Please select data"); + } + } + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + int isProjectRole = this.checkUserRole(projectLibraryId, currentUser.getId(), ""); +// if (!ProjectRoleEnum.STUDIO_ENGINEER.getValue().equals(String.valueOf(isProjectRole))) { +// if (CutEnum.CN.getValue().equals(cut)) { +// throw new JeroBootException("该用户没有删除权限"); +// } else { +// throw new JeroBootException("The user has no deletion permission"); +// } +// } + + //引用流程重置的逻辑 + String operateType= "lawsInventoryAllResetFlow"; + resetFlow(StringUtils.join(ids,","),projectLibraryId,operateType); + + //更新log + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String username = sysUser.getUsername(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + List lawsList = list(queryWrapper.in("id", ids)); + String serialNumber = lawsList.stream().map(e -> e.getSerialNumber()).collect(Collectors.joining(",")); + + String contentLog = username + "删除了清单中的“" + serialNumber + "”"; + String enContentLog = username + " deleted “" + serialNumber + "” from the list"; + projectLawsInventoryLogEOService.updateLog(contentLog, projectLibraryId, CutEnum.CN.getValue()); + projectLawsInventoryLogEOService.updateLog(enContentLog, projectLibraryId, CutEnum.EN.getValue()); + removeByIds(ids); + this.projectTaskInventoryEOService.deleteByProjectLawsInventoryIds(ids); + + //删除该条法规清单数据的 项目当前状态数据 + QueryWrapper conditionAssessmentRemoveWrapper = new QueryWrapper<>(); + conditionAssessmentRemoveWrapper.lambda().in(ConditionAssessmentEO::getProjectLawsInventoryId, ids); + this.conditionAssessmentEOService.remove(conditionAssessmentRemoveWrapper); + + //删除该条法规清单数据的拒绝原因。 + QueryWrapper rejectCauseRemoveWrapper = new QueryWrapper<>(); + rejectCauseRemoveWrapper.lambda().in(ProjectLawsInventoryRejectCauseEO::getProjectLawsInventoryId, ids); + this.projectLawsInventoryRejectCauseEOService.remove(rejectCauseRemoveWrapper); + + //删除相关人员权限 + List description = new ArrayList<>(); + QueryWrapper delPermission = new QueryWrapper<>(); + for (String id : ids) { + description.add(PermissionDescriptionEnum.PROJECT_LAWS_INVENTORY.getValue() + id); + } + delPermission.in("description", description); + projectUserPermissionService.remove(delPermission); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @Override + public ProjectLawsInventoryEO queryById(String id) { + return getById(id); + } + + /** + * 列表查询 + * + * @return + */ + @Override + public List queryList(ProjectLawsInventoryEO projectLawsInventoryEO, HttpServletRequest req) { + + long startTime = System.currentTimeMillis(); + String dutyTerritoryStr = ""; + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getDutyTerritory())) { + dutyTerritoryStr = projectLawsInventoryEO.getDutyTerritory(); + projectLawsInventoryEO.setDutyTerritory(null); + } + + QueryWrapper projectLawsInventoryEOQueryWrapper = QueryGenerator.initQueryWrapper(projectLawsInventoryEO, req.getParameterMap()); + projectLawsInventoryEOQueryWrapper.orderByDesc("create_time", "serial_number"); + String projectLibraryId = projectLawsInventoryEO.getProjectLibraryId(); + + if (StringUtils.isNotEmpty(dutyTerritoryStr)) { + String finalDutyTerritoryStr = dutyTerritoryStr.replaceAll("\\*", ""); + projectLawsInventoryEOQueryWrapper.and(query -> { + query.lambda().like(ProjectLawsInventoryEO::getDutyTerritory, finalDutyTerritoryStr); + if (StringUtils.contains(finalDutyTerritoryStr, ",")) { + String[] dutyTerritoryArr = finalDutyTerritoryStr.split(","); + for (String duty : dutyTerritoryArr) { + query.or(q -> { + q.like("duty_territory", duty); + }); + } + } + }); + } + + + if (StringUtils.isEmpty(projectLibraryId)) { + throw new JeroBootException("项目库id不能为空!"); + } + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + //projectLawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); + + //验证当前用户在该项目中是什么角色 + //int isProjectRole = checkUserRole(projectLibraryId, currentUser.getId(), ""); + //if(isProjectRole != Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue())){ + int isProjectRole = Integer.parseInt(projectLawsInventoryEO.getRoleCode()); + + log.info("一阶段消耗时间:" + (System.currentTimeMillis() - startTime)); + + if (isProjectRole != Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue()) + && isProjectRole != Integer.parseInt(ProjectRoleEnum.MANAGER.getValue()) + && isProjectRole != Integer.parseInt(ProjectRoleEnum.ADMIN.getValue()) + && isProjectRole != Integer.parseInt(ProjectRoleEnum.VIEWER.getValue())) { + /*projectLawsInventoryEOQueryWrapper.and(queryWrapper ->{ + queryWrapper.eq("regulation_owner_id",currentUser.getId()). + or().eq("engineering_interface_person",currentUser.getId()). + or().eq("design_duty_id",currentUser.getId()). + or().eq("verify_duty_id",currentUser.getId()); + });*/ + + // 创建查询权限 + this.createQueryPermission(isProjectRole, currentUser, projectLawsInventoryEOQueryWrapper); + } + List result = super.baseMapper.selectList(projectLawsInventoryEOQueryWrapper); + log.info("二阶段消耗时间:" + (System.currentTimeMillis() - startTime)); + if (isProjectRole == Integer.parseInt(ProjectRoleEnum.VIEWER.getValue())) { + //查当前用户Viewer对应责任领域 + List dutyTerritoryList = projectUserDutyTerritoryService.queryDutyTerritoryByUserId(currentUser.getId()); + if (ObjectUtils.isNotEmpty(dutyTerritoryList)) { +// result = result.stream().filter(e -> dutyTerritoryList.contains(e.getDutyTerritory())).collect(Collectors.toList()); + result = result.stream().filter(data -> { + boolean flag = false; + if (StringUtils.isNotEmpty(data.getDutyTerritory())) { + for (String dutyTerritory : dutyTerritoryList) { + if (StringUtils.contains(data.getDutyTerritory(), dutyTerritory)) { + flag = true; + break; + } + } + } + return flag; + }).collect(Collectors.toList()); + } else { + result = new ArrayList<>(); + } + } + dataDispose(result, currentUser, isProjectRole, projectLawsInventoryEO.getCut()); + log.info("三阶段消耗时间:" + (System.currentTimeMillis() - startTime)); + dataDictDispose(result, projectLawsInventoryEO.getCut()); + log.debug("处理数据字典消耗时间:" + (System.currentTimeMillis() - startTime)); + //表头排序 + result = hearSort(projectLawsInventoryEO, result); + return result; + } + + private List hearSort(ProjectLawsInventoryEO projectLawsInventoryEO, List result) { +// String orderBy = "1"; +// String orderByField = "serialNumber"; + String orderBy = projectLawsInventoryEO.getOrderBy(); + String orderByField = projectLawsInventoryEO.getOrderByField(); + if (ObjectUtils.isNotEmpty(orderByField)) { + Collator comparator = Collator.getInstance(Locale.CHINESE); + //编号 serialNumber + if ("serialNumber".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e1.getSerialNumber(), e2.getSerialNumber()); + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e2.getSerialNumber(), e1.getSerialNumber()); + }); + } + } + // 认证类型 attestationType + if("attestationType".equals(orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(result,(e1, e2)->{ + String e1AttestationType = StringUtils.isNotBlank(e1.getAttestationType()) ? e1.getAttestationType() : ""; + String e2AttestationType = StringUtils.isNotBlank(e2.getAttestationType()) ? e2.getAttestationType() : ""; + return comparator.compare(e1AttestationType,e2AttestationType); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(result,(e1,e2)->{ + String e1AttestationType = StringUtils.isNotBlank(e1.getAttestationType()) ? e1.getAttestationType() : ""; + String e2AttestationType = StringUtils.isNotBlank(e2.getAttestationType()) ? e2.getAttestationType() : ""; + return comparator.compare(e2AttestationType,e1AttestationType); + }); + } + } + // 认证级别 attestationRank + if("attestationRank".equals(orderByField)){ + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + Collections.sort(result,(e1, e2)->{ + String e1AttestationRank = StringUtils.isNotBlank(e1.getAttestationRank()) ? e1.getAttestationRank() : ""; + String e2AttestationRank = StringUtils.isNotBlank(e2.getAttestationRank()) ? e2.getAttestationRank() : ""; + return comparator.compare(e1AttestationRank,e2AttestationRank); + }); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + Collections.sort(result,(e1,e2)->{ + String e1AttestationRank = StringUtils.isNotBlank(e1.getAttestationRank()) ? e1.getAttestationRank() : ""; + String e2AttestationRank = StringUtils.isNotBlank(e2.getAttestationRank()) ? e2.getAttestationRank() : ""; + return comparator.compare(e2AttestationRank,e1AttestationRank); + }); + } + } + // WVTA ID wvtaId + if ("wvtaId".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e1.getWvtaId(), e2.getWvtaId()); + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e2.getWvtaId(), e1.getWvtaId()); + }); + } + } + // 责任领域 dutyTerritory_dictText + if ("dutyTerritory".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e1.getDutyTerritory_dictText(), e2.getDutyTerritory_dictText()); + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e2.getDutyTerritory_dictText(), e1.getDutyTerritory_dictText()); + }); + } + } + // 法规工程师 regulationOwnerName + if ("regulationOwnerName".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e1.getRegulationOwnerName(), e2.getRegulationOwnerName()); + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e2.getRegulationOwnerName(), e1.getRegulationOwnerName()); + }); + } + } + // 认证工程师 homologationEngineerName + if ("homologationEngineerName".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e1.getHomologationEngineerName(), e2.getHomologationEngineerName()); + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e2.getHomologationEngineerName(), e1.getHomologationEngineerName()); + }); + } + } + // 工程接口人 engineeringInterfacePersonName + if ("engineeringInterfacePersonName".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e1.getEngineeringInterfacePersonName(), e2.getEngineeringInterfacePersonName()); + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e2.getEngineeringInterfacePersonName(), e1.getEngineeringInterfacePersonName()); + }); + } + } + List list = new LinkedList<>(); + // 清单确认状态(未发起,法规待确认,认证待确认,接受,法规拒绝,认证拒绝) inventoryAffirmStatusName + //InventoryAffirmStatusEnum + if ("inventoryAffirmStatusName".equals(orderByField)) { + result = inventorySort(orderBy, orderByField, result, list); + } + // 任务确认状态(未发起,待确认,接受,拒绝) taskAffirmStatusName + //TaskAffirmStatusEnum + if ("taskAffirmStatusName".equals(orderByField)) { + result = taskSort(orderBy, orderByField, result, list); + } + // 认证级别(WVTA,Com.-VTA,Cert.-Market,Reg.-Market) attestationRank_dictText + if ("attestationRank".equals(orderByField)) { + result = attestationRankSort(orderBy, orderByField, result, list); + } + + // 设计符合性排序 + // 设计符合性-责任人 designDutyId + if ("designDutyId".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e1.getDesignDutyIdName(), e2.getDesignDutyIdName()); + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e2.getDesignDutyIdName(), e1.getDesignDutyIdName()); + }); + } + } + // 设计符合性-截止时间 designDueDate + if ("designDueDate".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + if (e1.getDesignDueDate() != null && e2.getDesignDueDate() != null) { + String e1DesignDueDate = DateUtils.formatDate(e1.getDesignDueDate()); + String e2DesignDueDate = DateUtils.formatDate(e2.getDesignDueDate()); + return comparator.compare(e1DesignDueDate, e2DesignDueDate); + } + return -1; + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + if (e1.getDesignDueDate() != null && e2.getDesignDueDate() != null) { + String e1DesignDueDate = DateUtils.formatDate(e1.getDesignDueDate()); + String e2DesignDueDate = DateUtils.formatDate(e2.getDesignDueDate()); + return comparator.compare(e2DesignDueDate, e1DesignDueDate); + } + return -1; + }); + } + } + // 设计符合性-交付物类型 designDeliverableType + if ("designDeliverableType".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + if (e1.getDesignDeliverableTypeName() != null && e2.getDesignDeliverableTypeName() != null) { + return comparator.compare(e1.getDesignDeliverableTypeName(), e2.getDesignDeliverableTypeName()); + } + return -1; + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + if (e1.getDesignDeliverableTypeName() != null && e2.getDesignDeliverableTypeName() != null) { + return comparator.compare(e2.getDesignDeliverableTypeName(), e1.getDesignDeliverableTypeName()); + } + return -1; + }); + } + } + // 设计符合性-流程状态 designFlowStatusName + if ("designFlowStatusName".equals(orderByField)) { +// if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ +// Collections.sort(result,(e1, e2)->{ +// if(e1.getDesignDeliverableTypeName() != null && e2.getDesignDeliverableTypeName() != null){ +// return comparator.compare(e1.getDesignDeliverableTypeName(),e2.getDesignDeliverableTypeName()); +// } +// return -1; +// }); +// }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ +// Collections.sort(result,(e1,e2)->{ +// if(e1.getDesignDeliverableTypeName() != null && e2.getDesignDeliverableTypeName() != null){ +// return comparator.compare(e2.getDesignDeliverableTypeName(),e1.getDesignDeliverableTypeName()); +// } +// return -1; +// }); +// } + } + + // 验证符合性排序 + // 验证符合性-责任人 verifyDutyId + if ("verifyDutyId".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e1.getVerifyDutyIdName(), e2.getVerifyDutyIdName()); + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + return comparator.compare(e2.getVerifyDutyIdName(), e1.getVerifyDutyIdName()); + }); + } + } + // 验证符合性-截止时间 verifyDueDate + if ("verifyDueDate".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + if (e1.getVerifyDueDate() != null && e2.getVerifyDueDate() != null) { + String e1VerifyDueDate = DateUtils.formatDate(e1.getVerifyDueDate()); + String e2VerifyDueDate = DateUtils.formatDate(e2.getVerifyDueDate()); + return comparator.compare(e1VerifyDueDate, e2VerifyDueDate); + } + return -1; + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + if (e1.getVerifyDueDate() != null && e2.getVerifyDueDate() != null) { + String e1VerifyDueDate = DateUtils.formatDate(e1.getVerifyDueDate()); + String e2VerifyDueDate = DateUtils.formatDate(e2.getVerifyDueDate()); + return comparator.compare(e2VerifyDueDate, e1VerifyDueDate); + } + return -1; + }); + } + } + // 验证符合性-交付物类型 verifyDeliverableType + if ("verifyDeliverableType".equals(orderByField)) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + if (e1.getVerifyDeliverableTypeName() != null && e2.getVerifyDeliverableTypeName() != null) { + return comparator.compare(e1.getVerifyDeliverableTypeName(), e2.getVerifyDeliverableTypeName()); + } + return -1; + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(result, (e1, e2) -> { + if (e1.getVerifyDeliverableTypeName() != null && e2.getVerifyDeliverableTypeName() != null) { + return comparator.compare(e2.getVerifyDeliverableTypeName(), e1.getVerifyDeliverableTypeName()); + } + return -1; + }); + } + } + // 验证符合性-流程状态 designFlowStatusName + if ("verifyFlowStatusName".equals(orderByField)) { +// if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ +// Collections.sort(result,(e1, e2)->{ +// if(e1.getDesignDeliverableTypeName() != null && e2.getDesignDeliverableTypeName() != null){ +// return comparator.compare(e1.getDesignDeliverableTypeName(),e2.getDesignDeliverableTypeName()); +// } +// return -1; +// }); +// }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ +// Collections.sort(result,(e1,e2)->{ +// if(e1.getDesignDeliverableTypeName() != null && e2.getDesignDeliverableTypeName() != null){ +// return comparator.compare(e2.getDesignDeliverableTypeName(),e1.getDesignDeliverableTypeName()); +// } +// return -1; +// }); +// } + } + } + return result; + } + + //清单确认状态排序 + private List inventorySort(String orderBy, String orderByField, + List dummyInventoryInfoEOList, + List list) { + if (ObjectUtils.isNotEmpty(orderByField) && "inventoryAffirmStatusName".equals(orderByField)) { + List notStarted = dummyInventoryInfoEOList.stream() + .filter(e -> e.getInventoryAffirmStatusName().equals(InventoryAffirmStatusEnum.NOT_STARTED.getName())).collect(Collectors.toList()); + List regEngToConfirm = dummyInventoryInfoEOList.stream() + .filter(e -> e.getInventoryAffirmStatusName().equals(InventoryAffirmStatusEnum.REG_ENG_TO_CONFIRM.getName())).collect(Collectors.toList()); + List homoEngToConfirm = dummyInventoryInfoEOList.stream() + .filter(e -> e.getInventoryAffirmStatusName().equals(InventoryAffirmStatusEnum.HOMO_ENG_TO_CONFIRM.getName())).collect(Collectors.toList()); + List accepted = dummyInventoryInfoEOList.stream() + .filter(e -> e.getInventoryAffirmStatusName().equals(InventoryAffirmStatusEnum.ACCEPTED.getName())).collect(Collectors.toList()); + List regEngRejected = dummyInventoryInfoEOList.stream() + .filter(e -> e.getInventoryAffirmStatusName().equals(InventoryAffirmStatusEnum.REG_ENG_REJECTED.getName())).collect(Collectors.toList()); + List homoEngRejected = dummyInventoryInfoEOList.stream() + .filter(e -> e.getInventoryAffirmStatusName().equals(InventoryAffirmStatusEnum.HOMO_ENG_REJECTED.getName())).collect(Collectors.toList()); + List listToConfirm = dummyInventoryInfoEOList.stream() + .filter(e -> e.getInventoryAffirmStatusName().equals(InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getName())).collect(Collectors.toList()); + List rejected = dummyInventoryInfoEOList.stream() + .filter(e -> e.getInventoryAffirmStatusName().equals(InventoryAffirmStatusEnum.REJECTED.getName())).collect(Collectors.toList()); + + + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + //正序 + list.addAll(notStarted); + list.addAll(listToConfirm); + list.addAll(regEngToConfirm); + list.addAll(homoEngToConfirm); + list.addAll(accepted); + list.addAll(rejected); + list.addAll(regEngRejected); + list.addAll(homoEngRejected); + + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + //倒序 + list.addAll(homoEngRejected); + list.addAll(regEngRejected); + list.addAll(rejected); + list.addAll(accepted); + list.addAll(homoEngToConfirm); + list.addAll(regEngToConfirm); + list.addAll(listToConfirm); + list.addAll(notStarted); + } + } + if (ObjectUtils.isNotEmpty(list)) { + return list; + } else { + return dummyInventoryInfoEOList; + } + } + + // 任务确认状态排序 + private List taskSort(String orderBy, String orderByField, + List dummyInventoryInfoEOList, + List list) { + if (ObjectUtils.isNotEmpty(orderByField) && "taskAffirmStatusName".equals(orderByField)) { + List notStarted = dummyInventoryInfoEOList.stream() + .filter(e -> e.getTaskAffirmStatusName().equals(TaskAffirmStatusEnum.NOT_STARTED.getName())).collect(Collectors.toList()); + List listToConfirm = dummyInventoryInfoEOList.stream() + .filter(e -> e.getTaskAffirmStatusName().equals(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getName())).collect(Collectors.toList()); + List accepted = dummyInventoryInfoEOList.stream() + .filter(e -> e.getTaskAffirmStatusName().equals(TaskAffirmStatusEnum.ACCEPTED.getName())).collect(Collectors.toList()); + List rejected = dummyInventoryInfoEOList.stream() + .filter(e -> e.getTaskAffirmStatusName().equals(TaskAffirmStatusEnum.REJECTED.getName())).collect(Collectors.toList()); + + + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + //正序 + list.addAll(notStarted); + list.addAll(listToConfirm); + list.addAll(accepted); + list.addAll(rejected); + + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + //倒序 + list.addAll(rejected); + list.addAll(accepted); + list.addAll(listToConfirm); + list.addAll(notStarted); + } + } + if (ObjectUtils.isNotEmpty(list)) { + return list; + } else { + return dummyInventoryInfoEOList; + } + } + + //认证级别 + private List attestationRankSort(String orderBy, String orderByField, + List dummyInventoryInfoEOList, + List list) { + if (ObjectUtils.isNotEmpty(orderByField) && "attestationRank".equals(orderByField)) { + List wvta = dummyInventoryInfoEOList.stream() + .filter(e -> e.getAttestationRank_dictText().startsWith(AttestationRankEnum.WVTA.getValue())).collect(Collectors.toList()); + List vta = dummyInventoryInfoEOList.stream() + .filter(e -> e.getAttestationRank_dictText().startsWith(AttestationRankEnum.VTA.getValue())).collect(Collectors.toList()); + List market = dummyInventoryInfoEOList.stream() + .filter(e -> e.getAttestationRank_dictText().startsWith(AttestationRankEnum.MARKET.getValue())).collect(Collectors.toList()); + List regu = dummyInventoryInfoEOList.stream() + .filter(e -> e.getAttestationRank_dictText().startsWith(AttestationRankEnum.REGU.getValue())).collect(Collectors.toList()); + List na = dummyInventoryInfoEOList.stream() + .filter(e -> e.getAttestationRank_dictText().startsWith(AttestationRankEnum.NA.getValue())).collect(Collectors.toList()); + + Collator comparator = Collator.getInstance(Locale.CHINESE); + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + attestationRankPositive(orderBy, wvta, comparator); + attestationRankPositive(orderBy, vta, comparator); + attestationRankPositive(orderBy, market, comparator); + attestationRankPositive(orderBy, regu, comparator); + attestationRankPositive(orderBy, na, comparator); + //正序 + List collect = dummyInventoryInfoEOList.stream().filter(e -> StringUtils.isBlank(e.getAttestationRank_dictText())).collect(Collectors.toList()); + list.addAll(collect); + list.addAll(wvta); + list.addAll(vta); + list.addAll(market); + list.addAll(regu); + list.addAll(na); + + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + attestationRankReverse(orderBy, wvta, comparator); + attestationRankReverse(orderBy, vta, comparator); + attestationRankReverse(orderBy, market, comparator); + attestationRankReverse(orderBy, regu, comparator); + attestationRankReverse(orderBy, na, comparator); + //倒序 + list.addAll(na); + list.addAll(regu); + list.addAll(market); + list.addAll(vta); + list.addAll(wvta); + List collect = dummyInventoryInfoEOList.stream().filter(e -> StringUtils.isBlank(e.getAttestationRank_dictText())).collect(Collectors.toList()); + list.addAll(collect); + } + } + if (ObjectUtils.isNotEmpty(list)) { + return list; + } else { + return dummyInventoryInfoEOList; + } + } + + //正序 + private void attestationRankPositive(String orderBy, List list, Collator comparator) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(list, (e1, e2) -> { + return comparator.compare(e1.getAttestationRank_dictText(), e2.getAttestationRank_dictText()); + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(list, (e1, e2) -> { + return comparator.compare(e2.getAttestationRank_dictText(), e1.getAttestationRank_dictText()); + }); + } + } + + //倒序 + private void attestationRankReverse(String orderBy, List list, Collator comparator) { + if (OrderEnum.POSITIVE.getValue().equals(orderBy)) { + Collections.sort(list, (e1, e2) -> { + return comparator.compare(e1.getAttestationRank_dictText(), e2.getAttestationRank_dictText()); + }); + } else if (OrderEnum.REVERSE.getValue().equals(orderBy)) { + Collections.sort(list, (e1, e2) -> { + return comparator.compare(e2.getAttestationRank_dictText(), e1.getAttestationRank_dictText()); + }); + } + } + + /** + * 数据字典数据处理方法 + * + * @param result 返回值 + * @param cut 中英文切换 + */ + public void dataDictDispose(List result, String cut) { + if (CollectionUtils.isNotEmpty(result)) { + List sysDictItems = sysDictItemServiceImpl.getBaseMapper().selectItemsAll(); + for (ProjectLawsInventoryEO projectLawsInventoryEO : result) { + if (StringUtils.isBlank(projectLawsInventoryEO.getWvtaId())) { + projectLawsInventoryEO.setWvtaId(""); + } + if (StringUtils.isBlank(projectLawsInventoryEO.getDutyTerritory_dictText())) { + projectLawsInventoryEO.setDutyTerritory_dictText(""); + } + //处理适用地区 + String region = projectLawsInventoryEO.getRegion(); + if (StringUtils.isNotEmpty(region)) { + String region_dictText = disposeShowDictItemValue(sysDictItems, region, cut, ProjectInventoryFieldEnum.REGION.getValue()); + projectLawsInventoryEO.setRegion_dictText(region_dictText); + } + + //处理实施类别 + String implementType = projectLawsInventoryEO.getImplementType(); + if (StringUtils.isNotEmpty(implementType)) { + String implementType_dictText = disposeShowDictItemValue(sysDictItems, implementType, cut, ProjectInventoryFieldEnum.IMPLEMENT_TYPE.getValue()); + projectLawsInventoryEO.setImplementType_dictText(implementType_dictText); + } + + //处理认证类型 + String attestationType = projectLawsInventoryEO.getAttestationType(); + if (StringUtils.isNotEmpty(attestationType)) { + String attestationType_dictText = disposeShowDictItemValue(sysDictItems, attestationType, cut, ProjectInventoryFieldEnum.ATTESTATION_TYPE.getValue()); + projectLawsInventoryEO.setAttestationType_dictText(attestationType_dictText); + } + + //处理认证级别 + String attestationRank = projectLawsInventoryEO.getAttestationRank(); + if (StringUtils.isNotEmpty(attestationRank)) { + String attestationRank_dictText = disposeShowDictItemValue(sysDictItems, attestationRank, cut, ProjectInventoryFieldEnum.ATTESTATION_RANK.getValue()); + projectLawsInventoryEO.setAttestationRank_dictText(attestationRank_dictText); + } else { + projectLawsInventoryEO.setAttestationRank_dictText(""); + } + + //处理责任领域 + String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); + if (StringUtils.isNotEmpty(dutyTerritory)) { + String dutyTerritory_dictText = disposeShowDictItemValue(sysDictItems, dutyTerritory, cut, ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()); + projectLawsInventoryEO.setDutyTerritory_dictText(dutyTerritory_dictText); + } + + //处理设计符合性确认-交付物类型 + String designDeliverableType = projectLawsInventoryEO.getDesignDeliverableType(); + if (StringUtils.isNotEmpty(designDeliverableType)) { + String designDeliverableType_dictText = disposeShowDictItemValue(sysDictItems, designDeliverableType, cut, ProjectInventoryFieldEnum.DESIGN_DELIVERABLE_TYPE.getValue()); + projectLawsInventoryEO.setDesignDeliverableType_dictText(designDeliverableType_dictText); + } + + //处理设计符合性确认-发起人角色 + String designInitiator = projectLawsInventoryEO.getDesignInitiator(); + if (StringUtils.isNotEmpty(designInitiator)) { + String designInitiator_dictText = disposeShowDictItemValue(sysDictItems, designInitiator, cut, ProjectInventoryFieldEnum.DESIGN_INITIATOR.getValue()); + projectLawsInventoryEO.setDesignInitiator_dictText(designInitiator_dictText); + } + + //处理设计符合性确认-责任人角色 + String designDuty = projectLawsInventoryEO.getDesignDuty(); + if (StringUtils.isNotEmpty(designDuty)) { + String designDuty_dictText = disposeShowDictItemValue(sysDictItems, designDuty, cut, ProjectInventoryFieldEnum.DESIGN_DUTY.getValue()); + projectLawsInventoryEO.setDesignDuty_dictText(designDuty_dictText); + } + + //处理prehomo确认-交付物类型 + String prehomoDeliverableType = projectLawsInventoryEO.getPrehomoDeliverableType(); + if (StringUtils.isNotEmpty(prehomoDeliverableType)) { + String prehomoDeliverableType_dictText = disposeShowDictItemValue(sysDictItems, prehomoDeliverableType, cut, ProjectInventoryFieldEnum.PREHOMO_DELIVERABLE_TYPE.getValue()); + projectLawsInventoryEO.setPrehomoDeliverableType_dictText(prehomoDeliverableType_dictText); + } + + //处理prehomo确认-发起人角色 + String prehomoInitiator = projectLawsInventoryEO.getPrehomoInitiator(); + if (StringUtils.isNotEmpty(prehomoInitiator)) { + String prehomoInitiator_dictText = disposeShowDictItemValue(sysDictItems, prehomoInitiator, cut, ProjectInventoryFieldEnum.PREHOMO_INITIATOR.getValue()); + projectLawsInventoryEO.setPrehomoInitiator_dictText(prehomoInitiator_dictText); + } + + //处理prehomo确认-责任人角色 + String prehomoDuty = projectLawsInventoryEO.getPrehomoDuty(); + if (StringUtils.isNotEmpty(prehomoDuty)) { + String prehomoDuty_dictText = disposeShowDictItemValue(sysDictItems, prehomoDuty, cut, ProjectInventoryFieldEnum.PREHOMO_DUTY.getValue()); + projectLawsInventoryEO.setPrehomoDuty_dictText(prehomoDuty_dictText); + } + + //处理验证符合性确认-交付物类型 + String verifyDeliverableType = projectLawsInventoryEO.getVerifyDeliverableType(); + if (StringUtils.isNotEmpty(verifyDeliverableType)) { + String verifyDeliverableType_dictText = disposeShowDictItemValue(sysDictItems, verifyDeliverableType, cut, ProjectInventoryFieldEnum.VERIFY_DELIVERABLE_TYPE.getValue()); + projectLawsInventoryEO.setVerifyDeliverableType_dictText(verifyDeliverableType_dictText); + } + + //处理验证符合性确认-发起人角色 + String verifyInitiator = projectLawsInventoryEO.getVerifyInitiator(); + if (StringUtils.isNotEmpty(verifyInitiator)) { + String verifyInitiator_dictText = disposeShowDictItemValue(sysDictItems, verifyInitiator, cut, ProjectInventoryFieldEnum.VERIFY_INITIATOR.getValue()); + projectLawsInventoryEO.setVerifyInitiator_dictText(verifyInitiator_dictText); + } + + //处理验证符合性确认-责任人角色 + String verifyDuty = projectLawsInventoryEO.getVerifyDuty(); + if (StringUtils.isNotEmpty(verifyDuty)) { + String verifyDuty_dictText = disposeShowDictItemValue(sysDictItems, verifyDuty, cut, ProjectInventoryFieldEnum.VERIFY_DUTY.getValue()); + projectLawsInventoryEO.setVerifyDuty_dictText(verifyDuty_dictText); + } + } + } + } + + /** + * 处理展示数据字典值 + * + * @param sysDictItems 所有的数据字典项 + * @param fieldValues 字段值 + * @param cut 中英文切换标识 + * @param dicCode 数据字典code码 + * @return + */ + public String disposeShowDictItemValue(List sysDictItems, String fieldValues, String cut, String dicCode) { + String result = ""; + List sysDictItemList = sysDictItems.stream().filter(e -> { + boolean flag = false; + if (StringUtils.equals(e.getDictCode(), dicCode)) { + flag = true; + } + return flag; + }).distinct().collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sysDictItemList)) { + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + result = sysDictItemList.stream().filter(e -> { + boolean flag = false; + List fieldValueStrList = Arrays.asList(fieldValues.split(",")); + for (String fieldValueStr : fieldValueStrList) { + if (StringUtils.equals(fieldValueStr, e.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).map(SysDictItem::getItemText).collect(Collectors.joining(",")); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + result = sysDictItemList.stream().filter(e -> { + boolean flag = false; + List fieldValueStrList = Arrays.asList(fieldValues.split(",")); + for (String fieldValueStr : fieldValueStrList) { + if (StringUtils.equals(fieldValueStr, e.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).map(SysDictItem::getEnName).collect(Collectors.joining(",")); + } + } + return result; + } + + /** + * 数据处理 + * + * @param list + */ + @Override + public void dataDispose(List list, LoginUser currentUser, int isProjectRole, String cut) { + if (CollectionUtils.isNotEmpty(list)) { + //树形结构数据字典(技术领域) + List categoryList = sysCategoryService.list(); + List userIdList = new ArrayList<>(); + List deliverableList = new ArrayList<>(); + List correspondingStandardList = new ArrayList<>(); + for (ProjectLawsInventoryEO projectLawsInventoryEO : list) { + if (StringUtils.isNotBlank(projectLawsInventoryEO.getCorrespondingStandard())) { + correspondingStandardList.addAll(Arrays.asList(projectLawsInventoryEO.getCorrespondingStandard().split(","))); + } + } + List bussDocumentLibraryEOS = new ArrayList<>(); + if (correspondingStandardList.size() != 0) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.in(BussDocumentLibraryEO::getId, correspondingStandardList); + bussDocumentLibraryEOS = iBussDocumentLibraryEOService.list(lambdaQueryWrapper); + } + + for (ProjectLawsInventoryEO projectLawsInventoryEO : list) { + //处理交付物类型 + String designDeliverableType = projectLawsInventoryEO.getDesignDeliverableType(); + String prehomoDeliverableType = projectLawsInventoryEO.getPrehomoDeliverableType(); + String verifyDeliverableType = projectLawsInventoryEO.getVerifyDeliverableType(); + //设计交付物类型 + if (StringUtils.isNotBlank(designDeliverableType)) { + List designDeliverableTypeList = Arrays.asList(designDeliverableType.split(",")); + String name = getTreeName(cut, categoryList, designDeliverableTypeList); + projectLawsInventoryEO.setDesignDeliverableTypeName(name); + } + //pre交付物类型 + if (StringUtils.isNotBlank(prehomoDeliverableType)) { + List prehomoDeliverableTypeList = Arrays.asList(prehomoDeliverableType.split(",")); + String name = getTreeName(cut, categoryList, prehomoDeliverableTypeList); + projectLawsInventoryEO.setPrehomoDeliverableTypeName(name); + } + //验证交付物类型 + if (StringUtils.isNotBlank(verifyDeliverableType)) { + List verifyDeliverableTypeList = Arrays.asList(verifyDeliverableType.split(",")); + String name = getTreeName(cut, categoryList, verifyDeliverableTypeList); + projectLawsInventoryEO.setVerifyDeliverableTypeName(name); + } + StringBuilder sb = new StringBuilder(); + if (StringUtils.isNotBlank(projectLawsInventoryEO.getCorrespondingStandard()) && bussDocumentLibraryEOS.size() != 0) { + for (String correspondingStandard : projectLawsInventoryEO.getCorrespondingStandard().split(",")) { + List collect = bussDocumentLibraryEOS.stream().filter(e -> e.getId().equals(correspondingStandard)).collect(Collectors.toList()); + if (collect.size() != 0) { + sb.append(collect.get(0).getSerialNumber() + ","); + } else { + sb.append(correspondingStandard + ","); + } + } + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + projectLawsInventoryEO.setCorrespondingStandard(substring); + } + } + //认证工程师id + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId())) { + userIdList.add(projectLawsInventoryEO.getHomologationEngineerId()); + } else { + projectLawsInventoryEO.setHomologationEngineerName(""); + } + //法规工程师id + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId())) { + userIdList.add(projectLawsInventoryEO.getRegulationOwnerId()); + } else { + projectLawsInventoryEO.setRegulationOwnerName(""); + } + //工程接口人id + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) { + userIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson()); + } else { + projectLawsInventoryEO.setEngineeringInterfacePersonName(""); + } + + //设计符合性确认 + //发起人 + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignInitiatorId())) { + userIdList.add(projectLawsInventoryEO.getDesignInitiatorId()); + } + //责任人 + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())) { + userIdList.add(projectLawsInventoryEO.getDesignDutyId()); + } + + //prehomo确认 + //发起人 + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())) { + userIdList.add(projectLawsInventoryEO.getPrehomoInitiatorId()); + } + //责任人 + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())) { + userIdList.add(projectLawsInventoryEO.getPrehomoDutyId()); + } + + //验证符合性确认 + //发起人 + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())) { + userIdList.add(projectLawsInventoryEO.getVerifyInitiatorId()); + } + //责任人 + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())) { + userIdList.add(projectLawsInventoryEO.getVerifyDutyId()); + } + + //设计符合性确认交付物模板 + if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignDeliverableTemplate())) { + deliverableList.addAll(Arrays.asList(projectLawsInventoryEO.getDesignDeliverableTemplate().split(","))); + } + // Prehomo确认交付物模板 + if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDeliverableTemplate())) { + deliverableList.addAll(Arrays.asList(projectLawsInventoryEO.getPrehomoDeliverableTemplate().split(","))); + } + // 验证符合性确认交付物模板 + if (StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyDeliverableTemplate())) { + deliverableList.addAll(Arrays.asList(projectLawsInventoryEO.getVerifyDeliverableTemplate().split(","))); + } + } + + List sysUsers = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(userIdList)) { + userIdList = userIdList.stream().distinct().collect(Collectors.toList()); + QueryWrapper sysUserQueryWrapper = new QueryWrapper<>(); + sysUserQueryWrapper.lambda().in(SysUser::getId, userIdList); + sysUsers = sysUserMapper.selectList(sysUserQueryWrapper); + } + + //文件 + List fileInfos = new ArrayList<>(); + if (deliverableList.size() != 0) { + fileInfos = iOSSFileService.getFileInfos(StringUtils.join(deliverableList, ",")); + } + + for (ProjectLawsInventoryEO projectLawsInventoryEO : list) { + //处理人员展示名称 + if (CollectionUtils.isNotEmpty(sysUsers)) { + String homologationEngineerId = projectLawsInventoryEO.getHomologationEngineerId(); + if (StringUtils.isNotEmpty(homologationEngineerId)) { + String homologationEngineerName = sysUsers.stream().filter(e -> homologationEngineerId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + projectLawsInventoryEO.setHomologationEngineerName(homologationEngineerName); + } + String regulationOwnerId = projectLawsInventoryEO.getRegulationOwnerId(); + if (StringUtils.isNotEmpty(regulationOwnerId)) { + String regulationOwnerName = sysUsers.stream().filter(e -> regulationOwnerId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + projectLawsInventoryEO.setRegulationOwnerName(regulationOwnerName); + projectLawsInventoryEO.setRegulationOwnerIdName(regulationOwnerName); + } + String engineeringInterfacePerson = projectLawsInventoryEO.getEngineeringInterfacePerson(); + if (StringUtils.isNotEmpty(engineeringInterfacePerson)) { + String engineeringInterfacePersonName = sysUsers.stream().filter(e -> engineeringInterfacePerson.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + projectLawsInventoryEO.setEngineeringInterfacePersonName(engineeringInterfacePersonName); + } + + //设计符合性确认 + //发起人 + String designInitiatorId = projectLawsInventoryEO.getDesignInitiatorId(); + if (StringUtils.isNotEmpty(designInitiatorId)) { + String designInitiatorName = sysUsers.stream().filter(e -> designInitiatorId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + projectLawsInventoryEO.setDesignInitiatorName(designInitiatorName); + } + //责任人 + String designDutyId = projectLawsInventoryEO.getDesignDutyId(); + if (StringUtils.isNotEmpty(designDutyId)) { + String designDutyName = sysUsers.stream().filter(e -> designDutyId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + projectLawsInventoryEO.setDesignDutyIdName(designDutyName); + } else { + projectLawsInventoryEO.setDesignDutyIdName(""); + } + + //prehomo确认 + //发起人 + String prehomoInitiatorId = projectLawsInventoryEO.getPrehomoInitiatorId(); + if (StringUtils.isNotEmpty(prehomoInitiatorId)) { + String prehomoInitiatorName = sysUsers.stream().filter(e -> prehomoInitiatorId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + projectLawsInventoryEO.setPrehomoInitiatorName(prehomoInitiatorName); + } + //责任人 + String prehomoDutyId = projectLawsInventoryEO.getPrehomoDutyId(); + if (StringUtils.isNotEmpty(prehomoDutyId)) { + String prehomoDutyName = sysUsers.stream().filter(e -> prehomoDutyId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + projectLawsInventoryEO.setPrehomoDutyName(prehomoDutyName); + } + + //验证符合性确认 + //发起人 + String verifyInitiatorId = projectLawsInventoryEO.getVerifyInitiatorId(); + if (StringUtils.isNotEmpty(verifyInitiatorId)) { + String verifyInitiatorName = sysUsers.stream().filter(e -> verifyInitiatorId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + projectLawsInventoryEO.setVerifyInitiatorName(verifyInitiatorName); + } + //责任人 + String verifyDutyId = projectLawsInventoryEO.getVerifyDutyId(); + if (StringUtils.isNotEmpty(verifyDutyId)) { + String verifyDutyName = sysUsers.stream().filter(e -> verifyDutyId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + projectLawsInventoryEO.setVerifyDutyIdName(verifyDutyName); + } else { + projectLawsInventoryEO.setVerifyDutyIdName(""); + } + } + + //清单确认状态 + /*String inventoryAffirmStatus = projectLawsInventoryEO.getInventoryAffirmStatus(); + if(StringUtils.isNotEmpty(inventoryAffirmStatus)){ + if(StringUtils.equals(cut, CutEnum.CN.getValue())){ + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.getTextByValue(inventoryAffirmStatus)); + }else { + projectLawsInventoryEO.setInventoryAffirmStatusName(inventoryAffirmStatus); + } + }*/ + /** + * 清单确认状态展示: + * 待确认:展示 法规工程师待确认 或 认证工程师待确认 + * 拒绝:展示 法规工程师拒绝 或 认证工程师拒绝 + * + */ + String inventoryAffirmStatus = projectLawsInventoryEO.getInventoryAffirmStatus(); + if (StringUtils.isNotEmpty(inventoryAffirmStatus)) { + //如果是待确认 + if (StringUtils.equals(inventoryAffirmStatus, InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue())) { + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus()) + && StringUtils.equals(projectLawsInventoryEO.getHomologationEngineerSubmitStatus(), OperatorResultEnum.ACCEPTED.getValue())) { + + //如果 认证工程师提交状态 不为空,则证明认证工程师已经提交过了,展示状态应该展示 法规工程师待确认 + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.REG_ENG_TO_CONFIRM.getName()); + } else { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.REG_ENG_TO_CONFIRM.getValue()); + } + } else if (StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus()) + && StringUtils.equals(projectLawsInventoryEO.getRegulationOwnerSubmitStatus(), OperatorResultEnum.ACCEPTED.getValue())) { + + //如果 法规工程师提交状态 不为空,则证明法规工程师已经提交过了,展示状态应该展示 认证工程师待确认 + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.HOMO_ENG_TO_CONFIRM.getName()); + } else { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.HOMO_ENG_TO_CONFIRM.getValue()); + } + } else { + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.getTextByValue(inventoryAffirmStatus)); + } else { + projectLawsInventoryEO.setInventoryAffirmStatusName(inventoryAffirmStatus); + } + } + //如果是拒绝 + } else if (StringUtils.equals(inventoryAffirmStatus, InventoryAffirmStatusEnum.REJECTED.getValue())) { + if ((StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus()) && StringUtils.equals(projectLawsInventoryEO.getHomologationEngineerSubmitStatus(), OperatorResultEnum.REJECTED.getValue())) + && (StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus()) && StringUtils.equals(projectLawsInventoryEO.getRegulationOwnerSubmitStatus(), OperatorResultEnum.REJECTED.getValue()))) { + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.REJECTED.getName()); + } else { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.REJECTED.getValue()); + } + } else if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus()) + && StringUtils.equals(projectLawsInventoryEO.getHomologationEngineerSubmitStatus(), OperatorResultEnum.REJECTED.getValue())) { + //如果认证工程师提交状态不为空,并且认证工程师提交状态为拒绝 + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.HOMO_ENG_REJECTED.getName()); + } else { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.HOMO_ENG_REJECTED.getValue()); + } + } else if (StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus()) + && StringUtils.equals(projectLawsInventoryEO.getRegulationOwnerSubmitStatus(), OperatorResultEnum.REJECTED.getValue())) { + + //如果 法规工程师提交状态 不为空,则证明法规工程师已经提交过了,展示状态应该展示 认证工程师待确认 + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.REG_ENG_REJECTED.getName()); + } else { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.REG_ENG_REJECTED.getValue()); + } + } + } else { + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.getTextByValue(inventoryAffirmStatus)); + } else { + projectLawsInventoryEO.setInventoryAffirmStatusName(inventoryAffirmStatus); + } + } + } + + //任务确认状态 + String taskAffirmStatus = projectLawsInventoryEO.getTaskAffirmStatus(); + if (StringUtils.isNotEmpty(taskAffirmStatus)) { + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + projectLawsInventoryEO.setTaskAffirmStatusName(InventoryAffirmStatusEnum.getTextByValue(taskAffirmStatus)); + } else { + projectLawsInventoryEO.setTaskAffirmStatusName(taskAffirmStatus); + } + } + + String roleCode = ""; + String roleName = ""; + //设置当前用户在该项目中的角色 + if (isProjectRole == Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue())) { + roleCode = ProjectRoleEnum.STUDIO_ENGINEER.getValue(); + roleName = ProjectRoleEnum.STUDIO_ENGINEER.getName(); + } else { + if (StringUtils.equals(currentUser.getId(), projectLawsInventoryEO.getRegulationOwnerId()) + && StringUtils.equals(currentUser.getId(), projectLawsInventoryEO.getHomologationEngineerId())) { + roleCode = ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue(); + roleName = ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getName(); + } else if (StringUtils.equals(currentUser.getId(), projectLawsInventoryEO.getRegulationOwnerId())) { + roleCode = ProjectRoleEnum.REGULATI_ENGINEER.getValue(); + roleName = ProjectRoleEnum.REGULATI_ENGINEER.getName(); + } else if (StringUtils.equals(currentUser.getId(), projectLawsInventoryEO.getHomologationEngineerId())) { + roleCode = ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue(); + roleName = ProjectRoleEnum.HOMOLOGATION_ENGINEER.getName(); + } + } + projectLawsInventoryEO.setRoleCode(roleCode); + projectLawsInventoryEO.setRoleName(roleName); + + //交付物类型模板 + if (fileInfos.size() != 0) { + if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignDeliverableTemplate())) { + String fileName = this.editService.getFileName(projectLawsInventoryEO, fileInfos, projectLawsInventoryEO.getDesignDeliverableTemplate()); + if (StringUtils.isNotBlank(fileName)) { + projectLawsInventoryEO.setDesignDeliverableTemplateName(fileName); + } + } + if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDeliverableTemplate())) { + String fileName = this.editService.getFileName(projectLawsInventoryEO, fileInfos, projectLawsInventoryEO.getPrehomoDeliverableTemplate()); + if (StringUtils.isNotBlank(fileName)) { + projectLawsInventoryEO.setPrehomoDeliverableTemplateName(fileName); + } + } + if (StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyDeliverableTemplate())) { + String fileName = this.editService.getFileName(projectLawsInventoryEO, fileInfos, projectLawsInventoryEO.getVerifyDeliverableTemplate()); + if (StringUtils.isNotBlank(fileName)) { + projectLawsInventoryEO.setVerifyDeliverableTemplateName(fileName); + + } + } + } + + // 处理符合性流程状态。 + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignFlowStatus())) { + String designFlowStatusName = ComplianceFlowStatusEnum.getTextByValue(projectLawsInventoryEO.getDesignFlowStatus(), cut); + projectLawsInventoryEO.setDesignFlowStatusName(designFlowStatusName); + } + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyFlowStatus())) { + String verifyFlowStatusName = ComplianceFlowStatusEnum.getTextByValue(projectLawsInventoryEO.getVerifyFlowStatus(), cut); + projectLawsInventoryEO.setVerifyFlowStatusName(verifyFlowStatusName); + } + + // 返回符合性流程的流程实例id + if (!StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || !StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())) { + QueryWrapper processInfoDetailEOQueryWrapper = new QueryWrapper<>(); + processInfoDetailEOQueryWrapper.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId, projectLawsInventoryEO.getId()); + processInfoDetailEOQueryWrapper.lambda().eq(ProcessInfoDetailEO::getFlowType, FlowTypeEnum.YZFHXSCLC.getValue()); + List processInfoDetailEOS = this.processInfoDetailEOService.list(processInfoDetailEOQueryWrapper); + if (CollectionUtils.isNotEmpty(processInfoDetailEOS)) { + projectLawsInventoryEO.setVerifyPId(processInfoDetailEOS.get(0).getActiProcInstId()); + } + } + if (!StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || !StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())) { + QueryWrapper processInfoDetailEOQueryWrapper = new QueryWrapper<>(); + processInfoDetailEOQueryWrapper.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId, projectLawsInventoryEO.getId()); + processInfoDetailEOQueryWrapper.lambda().eq(ProcessInfoDetailEO::getFlowType, FlowTypeEnum.SJFHXSHLC.getValue()); + List processInfoDetailEOS = this.processInfoDetailEOService.list(processInfoDetailEOQueryWrapper); + if (CollectionUtils.isNotEmpty(processInfoDetailEOS)) { + projectLawsInventoryEO.setDesignPId(processInfoDetailEOS.get(0).getActiProcInstId()); + } + } + } + } + } + + private String getTreeName(String cut, List categoryList, List technologyTerritoryList) { + StringBuilder sb = new StringBuilder(); + for (String technologyTerritory : technologyTerritoryList) { + List collect = categoryList.stream().filter(e -> technologyTerritory.equals(e.getId())).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() + ","); + } + } + } + String technologyTerritoryName = ""; + if (StringUtils.isNotBlank(sb)) { + technologyTerritoryName = sb.substring(0, sb.length() - 1); + } + return technologyTerritoryName; + } + + /** + * 批量更新状态 + * + * @param json + * @return + */ + @Override + public Result updateStatusBatch(JSONObject json) { + String result = ""; + //operatorType: 0:studio工程师发起清单确认 1:法规工程师/认证工程师 (提交或拒绝) + String operatorType = json.getString("operatorType"); + String projectLibraryId = json.getString("projectLibraryId");//项目id + String cut = json.getString("cut");//中英文切换标识 + if (StringUtils.isEmpty(operatorType)) { + throw new JeroBootException("操作类型不能为空!"); + } + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + try { + ProjectLibraryBase projectLibraryBase = platformProjectLibraryBaseMapper.selectOne(new QueryWrapper() + .lambda().eq(ProjectLibraryBase::getId, projectLibraryId)); + + // studio信息 + SysUser studioUserInfo = this.sysUserMapper.selectOne( + new QueryWrapper().lambda().eq(SysUser::getId, projectLibraryBase.getStudioEngineer()) + ); + + QueryWrapper projectNameInfoEOQueryWrapper = new QueryWrapper<>(); + projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId, projectLibraryBase.getProjectNameId()); + ProjectNameInfoEO projectNameInfoEO = platformProjectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper); + + QueryWrapper projectYearInfoEOQueryWrapper = new QueryWrapper<>(); + projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId, projectLibraryBase.getYearNameId()); + ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper); + + //项目名称 + String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion(); + String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion; + //TODO 切换成枚举,不要在代码里出现魔数 + if (StringUtils.equals(operatorType, OperatorTypeEnum.INVENTORY_AFFIRM.getValue())) { + String ids = json.getString("ids"); + + //验证用户是否是该项目的studio + isStudio(projectLibraryId, cut); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + //清单确认截止时间 + String inventoryAffirmDueDate = json.getString("inventoryAffirmDueDate"); + Date endTime = new Date(); + try { + endTime = sdf.parse(inventoryAffirmDueDate); + } catch (ParseException e) { + e.printStackTrace(); + } + + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (StringUtils.isNotEmpty(ids)) { + queryWrapper.lambda().in(ProjectLawsInventoryEO::getId, Arrays.asList(ids.split(","))); + } + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + List projectLawsInventoryEOS = this.baseMapper.selectList(queryWrapper); + + List userIdList = new ArrayList<>(); + List processInfoDetailEOList = new ArrayList<>(); + for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOS) { + //未发起或拒绝 可以发起清单确认 + boolean checkStatus = (StringUtils.equals(projectLawsInventoryEO.getInventoryAffirmStatus(), InventoryAffirmStatusEnum.NOT_STARTED.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getInventoryAffirmStatus(), InventoryAffirmStatusEnum.REJECTED.getValue())); + //如果该数据的法规工程师、认证工程师都不为空 + boolean checkUser = (StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) + && StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId())); + + if (checkStatus && checkUser) { + projectLawsInventoryEO.setInventoryAffirmStatus(InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + projectLawsInventoryEO.setInventoryAffirmDueDate(sdf.parse(inventoryAffirmDueDate)); + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(ProjectLawsInventoryEO::getId, projectLawsInventoryEO.getId()); + //认证工程师标识 如果认证工程师提交状态为空, 或认证工程师拒绝过,给认证工程师任务,让他处理 + boolean homologationEngineerFlag = ( + StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus()) + || StringUtils.equals(projectLawsInventoryEO.getHomologationEngineerSubmitStatus(), "1") + ); + //法规工程师标识 如果法规工程师提交状态为空, 或法规工程师拒绝过,给法规工程师任务,让他处理 + boolean regulationOwnerFlag = ( + StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus()) + || StringUtils.equals(projectLawsInventoryEO.getRegulationOwnerSubmitStatus(), "1") + ); + if (homologationEngineerFlag) { + updateWrapper.set(ProjectLawsInventoryEO::getHomologationEngineerSubmitStatus, null); + userIdList.add(projectLawsInventoryEO.getHomologationEngineerId()); + + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId()); + processInfoDetailEO.setUserId(projectLawsInventoryEO.getHomologationEngineerId()); + processInfoDetailEO.setTaskDefinitionKey(InventoryAffirmNodeEnum.HOMOLOGATION_ENGINEER_AUDIT.getKey()); + processInfoDetailEO.setEndTime(endTime); + processInfoDetailEO.setCreateTime(new Date()); + processInfoDetailEO.setCreateBy(currentUser.getId()); + processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); + + processInfoDetailEOList.add(processInfoDetailEO); + } + if (regulationOwnerFlag) { + updateWrapper.set(ProjectLawsInventoryEO::getRegulationOwnerSubmitStatus, null); + userIdList.add(projectLawsInventoryEO.getRegulationOwnerId()); + + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId()); + processInfoDetailEO.setUserId(projectLawsInventoryEO.getRegulationOwnerId()); + processInfoDetailEO.setTaskDefinitionKey(InventoryAffirmNodeEnum.REGULATION_OWNER_AUDIT.getKey()); + processInfoDetailEO.setEndTime(endTime); + processInfoDetailEO.setCreateTime(new Date()); + processInfoDetailEO.setCreateBy(currentUser.getId()); + processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); + + processInfoDetailEOList.add(processInfoDetailEO); + } + + if (homologationEngineerFlag || regulationOwnerFlag) { + //创建一条当前发起清单确认的studio的已办任务。 + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId()); + processInfoDetailEO.setUserId(currentUser.getId()); + processInfoDetailEO.setTaskDefinitionKey(InventoryAffirmNodeEnum.INITIATED_BY_STUDIO_ENGINEERS.getKey()); + processInfoDetailEO.setEndTime(endTime); + processInfoDetailEO.setCreateTime(new Date()); + processInfoDetailEO.setCreateBy(currentUser.getId()); + processInfoDetailEO.setStatus(TaskStatusEnum.HAVE_DONE.getValue()); + + processInfoDetailEO.setSubmitTime(new Date()); + processInfoDetailEOList.add(processInfoDetailEO); + + super.update(projectLawsInventoryEO, updateWrapper); + } + } + } + + if (CollectionUtils.isNotEmpty(userIdList)) { + userIdList = userIdList.stream().distinct().collect(Collectors.toList()); + List sysUsers = sysUserService.listByIds(userIdList); + List thirdIdList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(sysUsers)) { + thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList()); + } + //消息内容 + //String msgContentEN = currentUser.getUsername() + " initiated the regulation list confirmation for " + // + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ". The due date is " + inventoryAffirmDueDate+ ". Please check and address it in a timely manner."; + //String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a regulation list confirmation task to complete"; + + // 飞书消息封装 + //FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); + //feishuMsgVo.setContent("Hello! Please check and address this task in a timely manner."); + //feishuMsgVo.setTaskType("Regulation List Confirmation"); + //feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); + //feishuMsgVo.setInitiator(studioUserInfo.getUsername()); + //feishuMsgVo.setDueDate(inventoryAffirmDueDate); + + //飞书跳转链接 + String hrefFeishu = backUrl + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType() + + "&projectName=" + projectNameInfoEO.getProjectName() + "-" + + projectYearNameInfoEO.getYearName() + + "&targetMarket=" + projectLibraryBase.getTargetMarket(); + + try { + FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); + feishuMsgVo.setTitle(MessageType2Enum.REGULATION_LIST_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_LIST_CONFIRMATION.getEn()); + feishuMsgVo.setCnContentUpper("您好,请及时查看处理此项任务,谢谢!"); + feishuMsgVo.setCnContentLower("项目: " + projectName + + "\n发起人: " + currentUser.getUsername() + + "\n截止时间: " + inventoryAffirmDueDate); + feishuMsgVo.setEnContentUpper("Please check and address the task in a timely manner. Thank you!"); + feishuMsgVo.setEnContentLower("Project: " + projectName + + "\nInitiator: " + currentUser.getUsername() + + "\nDue Date: " + inventoryAffirmDueDate); + feishuMsgVo.setUrl(hrefFeishu); + feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 + feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo); + } catch (IOException e) { + log.error("飞书消息推送失败"); + } + + //系统内部跳转链接 + //String href = "" + " View details" + ""; + //String contentInfo = msgContentEN + " " + href; + //Map sendMessageMap = new HashMap<>(); + //sendMessageMap.put("hrefFeishu",hrefFeishu); + //sendMessageMap.put("contentInfo",contentInfo); + + //发送消息 + //sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,currentUser.getUsername()); + + //往待办中心添加数据。 + ProcessInfoEO processInfoEO = new ProcessInfoEO(); + this.addProcessInfo(processInfoEO, projectLibraryId, endTime); + this.addProcessInfoDetail(processInfoEO.getId(), processInfoDetailEOList, endTime); + } + + result = "发起清单确认"; + } else if (StringUtils.equals(operatorType, OperatorTypeEnum.SUBMIT_OR_REJECTED.getValue())) { + //提交结果 0通过 1拒绝 + String operatorResult = json.getString("operatorResult"); + if (StringUtils.equals(operatorResult, OperatorResultEnum.ACCEPTED.getValue())) { + result = "提交"; + } else if (StringUtils.equals(operatorResult, OperatorResultEnum.REJECTED.getValue())) { + result = "拒绝"; + } + + /*List idList = Arrays.asList(ids.split(",")); + + for (String id : idList) { + int isProjectRole = checkUserRole(projectLibraryId, currentUser.getId(), id); + + ProjectLawsInventoryEO projectLawsInventoryEO = getById(id); + + if(isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue())){ + projectLawsInventoryEO.setRegulationOwnerSubmitStatus(operatorResult); + projectLawsInventoryEO.setHomologationEngineerSubmitStatus(operatorResult); + }else if(isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_ENGINEER.getValue())){ + projectLawsInventoryEO.setRegulationOwnerSubmitStatus(operatorResult); + }else if(isProjectRole == Integer.parseInt(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())){ + projectLawsInventoryEO.setHomologationEngineerSubmitStatus(operatorResult); + } + + //如果不是studio + if(isProjectRole != -1 && isProjectRole != Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue())){ + + String inventoryAffirmStatus = ""; + + //如果法规工程师与认证工程师都是提交通过 把清单确认状态设置为 接受 + if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus()) && StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){ + if(projectLawsInventoryEO.getRegulationOwnerSubmitStatus().equals("0") && projectLawsInventoryEO.getHomologationEngineerSubmitStatus().equals("0")){ + inventoryAffirmStatus = InventoryAffirmStatusEnum.ACCEPTED.getValue(); + } + + //如果法规工程师与认证工程师 其中一个人是拒绝 把清单确认状态设置为 拒绝 + if(projectLawsInventoryEO.getRegulationOwnerSubmitStatus().equals("1") || projectLawsInventoryEO.getHomologationEngineerSubmitStatus().equals("1")){ + inventoryAffirmStatus = InventoryAffirmStatusEnum.REJECTED.getValue(); + } + } + + if(StringUtils.isNotEmpty(inventoryAffirmStatus)){ + projectLawsInventoryEO.setInventoryAffirmStatus(inventoryAffirmStatus); + } + super.baseMapper.updateById(projectLawsInventoryEO); + } + }*/ + + JSONArray lawsInventoryList = json.getJSONArray("lawsInventoryList"); + if (CollectionUtils.isNotEmpty(lawsInventoryList)) { + Map lawsInventoryMap = null; + for (Object lawsInventory : lawsInventoryList) { + lawsInventoryMap = JSONObject.parseObject(JSONObject.toJSONString(lawsInventory), Map.class); + int isProjectRole = (int) lawsInventoryMap.get("roleCode"); + String id = (String) lawsInventoryMap.get("id"); + + ProjectLawsInventoryEO projectLawsInventoryEO = getById(id); + + //法规中英文 + BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId()); + String LAW_EN = ""; + if (ObjectUtils.isNotEmpty(bussDocumentLibraryEO)) { + if (ObjectUtils.isNotEmpty(bussDocumentLibraryEO.getTitleEn())) { + LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn(); + } else { + LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle(); + } + } else { + LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle(); + } + + if (isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue())) { + projectLawsInventoryEO.setRegulationOwnerSubmitStatus(operatorResult); + projectLawsInventoryEO.setHomologationEngineerSubmitStatus(operatorResult); + } else if (isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_ENGINEER.getValue())) { + projectLawsInventoryEO.setRegulationOwnerSubmitStatus(operatorResult); + } else if (isProjectRole == Integer.parseInt(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())) { + projectLawsInventoryEO.setHomologationEngineerSubmitStatus(operatorResult); + } + + //如果不是studio + if (isProjectRole != -1 && isProjectRole != Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue())) { + + String inventoryAffirmStatus = ""; + + //如果法规工程师与认证工程师都是提交通过 把清单确认状态设置为 接受 + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus()) && StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())) { + if (projectLawsInventoryEO.getRegulationOwnerSubmitStatus().equals("0") && projectLawsInventoryEO.getHomologationEngineerSubmitStatus().equals("0")) { + inventoryAffirmStatus = InventoryAffirmStatusEnum.ACCEPTED.getValue(); + } + + /*//如果法规工程师与认证工程师 其中一个人是拒绝 把清单确认状态设置为 拒绝 + if(projectLawsInventoryEO.getRegulationOwnerSubmitStatus().equals("1") || projectLawsInventoryEO.getHomologationEngineerSubmitStatus().equals("1")){ + inventoryAffirmStatus = InventoryAffirmStatusEnum.REJECTED.getValue(); + }*/ + } + + //只要有一个人拒绝,就改为拒绝。 + if (StringUtils.equals(operatorResult, OperatorResultEnum.REJECTED.getValue())) { + inventoryAffirmStatus = InventoryAffirmStatusEnum.REJECTED.getValue(); + //如果拒绝,给studio发消息 + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + //消息内容 + //String msgContentEN = ""; + //String msgTitle = ""; + + if (isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_ENGINEER.getValue()) || isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue())) { + //msgContentEN = "The regulation list confirmation" +" of "+projectLawsInventoryEO.getSerialNumber() +" for " + // + projectNameInfoEO.getProjectName() +" is rejected by " +currentUser.getUsername() +". Please check and address it in a timely manner."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + + // ": You have a regulation list confirmation task to complete"; + + + // 飞书消息封装 + //FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); + //feishuMsgVo.setContent("Hello! This task is rejected by " +currentUser.getUsername()+ ". Please check and address it in a timely manner."); + //feishuMsgVo.setTaskType("Regulation List Confirmation"); + //feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber()); + //feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); + //feishuMsgVo.setInitiator(studioUserInfo.getUsername()); + //feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate())); + + //飞书跳转链接 + String hrefFeishu = backUrl + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType() + + "&projectName=" + projectNameInfoEO.getProjectName() + "-" + + projectYearNameInfoEO.getYearName() + + "&targetMarket=" + projectLibraryBase.getTargetMarket(); + //系统内部跳转链接 + //String href = "" + " View details" + ""; + //String contentInfo = msgContentEN + " " + href; + //Map sendMessageMap = new HashMap<>(); + //sendMessageMap.put("hrefFeishu",hrefFeishu); + //sendMessageMap.put("contentInfo",contentInfo); + + //发送消息 + List userIdList = new ArrayList<>(); + userIdList.add(projectLibraryBase.getStudioEngineer()); + List sysUsers = sysUserService.listByIds(userIdList); + List thirdIdList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(sysUsers)) { + thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList()); + } + //sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,studioUserInfo.getUsername()); + String dueDate = sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()); + try { + FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); + feishuMsgVo.setTitle(MessageType2Enum.REGULATION_LIST_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_LIST_CONFIRMATION.getEn()); + feishuMsgVo.setCnContentUpper("您好,该任务被" + currentUser.getUsername() + "拒绝,请及时查看处理"); + feishuMsgVo.setCnContentLower("项目: " + projectName + + "\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() + + "\n发起人: " + currentUser.getUsername() + + "\n截止时间: " + dueDate); + feishuMsgVo.setEnContentUpper("Hello! This task is rejected by " + currentUser.getUsername() + ". Please check and address it in a timely manner"); + feishuMsgVo.setEnContentLower("Project: " + projectName + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + currentUser.getUsername() + + "\nDue Date: " + dueDate); + feishuMsgVo.setUrl(hrefFeishu); + feishuMsgVo.setColor(MsgColorEnum.RED.getValue()); // 颜色 + feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo); + } catch (IOException e) { + log.error("飞书消息推送失败"); + } + } + + if (isProjectRole == Integer.parseInt(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue()) || isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue())) { + //msgContentEN = "The regulation list confirmation of "+projectLawsInventoryEO.getSerialNumber() + " for " + // + projectNameInfoEO.getProjectName() +" is rejected by " + currentUser.getUsername() +". Please check and address it in a timely manner."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + + // ": You have a regulation list confirmation task to complete"; + + // 飞书消息封装 + //FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); + //feishuMsgVo.setContent("Hello! This task is rejected by "+currentUser.getUsername()+". Please check and address it in a timely manner."); + //feishuMsgVo.setTaskType("Regulation List Confirmation"); + //feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber()); + //feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); + //feishuMsgVo.setInitiator(studioUserInfo.getUsername()); + //feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate())); + + //飞书跳转链接 + String hrefFeishu = backUrl + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType() + + "&projectName=" + projectNameInfoEO.getProjectName() + "-" + + projectYearNameInfoEO.getYearName() + + "&targetMarket=" + projectLibraryBase.getTargetMarket(); + //系统内部跳转链接 + //String href = "" + " View details" + ""; + //String contentInfo = msgContentEN + " " + href; + //Map sendMessageMap = new HashMap<>(); + //sendMessageMap.put("hrefFeishu",hrefFeishu); + //sendMessageMap.put("contentInfo",contentInfo); + + //发送消息 + List userIdList = new ArrayList<>(); + userIdList.add(projectLibraryBase.getStudioEngineer()); + List sysUsers = sysUserService.listByIds(userIdList); + List thirdIdList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(sysUsers)) { + thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList()); + } + //sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,studioUserInfo.getUsername()); + String dueDate = sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()); + try { + FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); + feishuMsgVo.setTitle(MessageType2Enum.REGULATION_LIST_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_LIST_CONFIRMATION.getEn()); + feishuMsgVo.setCnContentUpper("您好,该任务被" + currentUser.getUsername() + "拒绝,请及时查看处理"); + feishuMsgVo.setCnContentLower("项目: " + projectName + + "\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() + + "\n发起人: " + currentUser.getUsername() + + "\n截止时间: " + dueDate); + feishuMsgVo.setEnContentUpper("Hello! This task is rejected by " + currentUser.getUsername() + ". Please check and address it in a timely manner"); + feishuMsgVo.setEnContentLower("Project: " + projectName + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + currentUser.getUsername() + + "\nDue Date: " + dueDate); + feishuMsgVo.setUrl(hrefFeishu); + feishuMsgVo.setColor(MsgColorEnum.RED.getValue()); // 颜色 + feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo); + } catch (IOException e) { + log.error("飞书消息推送失败"); + } + } + } + + if (StringUtils.isNotEmpty(inventoryAffirmStatus)) { + projectLawsInventoryEO.setInventoryAffirmStatus(inventoryAffirmStatus); + } + super.baseMapper.updateById(projectLawsInventoryEO); + this.updateProcessInfoDetail(projectLawsInventoryEO.getId()); + + //如果法规、认证工程师都提交通过,法规清单 清单确认状态为:接受, 并且给当前项目的studio发送消息 + /*if(StringUtils.equals(inventoryAffirmStatus,InventoryAffirmStatusEnum.ACCEPTED.getValue())){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + //消息内容 + String msgContentEN = "The regulation list confirmation of " + +projectLawsInventoryEO.getSerialNumber()+" for " + + projectNameInfoEO.getProjectName() +" is completed. Please check."; + String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + + ": You have a regulation list confirmation notification to check"; + + // 飞书消息封装 + FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); + feishuMsgVo.setContent("Hello! This task is completed. Please check."); + feishuMsgVo.setTaskType("Regulation List Confirmation"); + feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber()); + feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); + feishuMsgVo.setInitiator(studioUserInfo.getUsername()); + feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate())); + + //飞书跳转链接 + String hrefFeishu = backUrl + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType() + + "&projectName=" + projectNameInfoEO.getProjectName() + "-" + + projectYearNameInfoEO.getYearName() + + "&targetMarket=" + projectLibraryBase.getTargetMarket(); + //系统内部跳转链接 + String href = "" + " View details" + ""; + String contentInfo = msgContentEN + " " + href; + Map sendMessageMap = new HashMap<>(); + sendMessageMap.put("hrefFeishu",hrefFeishu); + sendMessageMap.put("contentInfo",contentInfo); + + //发送消息 + List userIdList = new ArrayList<>(); + userIdList.add(projectLibraryBase.getStudioEngineer()); + sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,studioUserInfo.getUsername()); + }*/ + } + } + } else { + throw new JeroBootException("请至少勾选一条法规清单进行" + result); + } + + } + } catch (Exception ex) { + log.error("批量" + result + " 更新状态失败:" + ex.getMessage()); + throw new JeroBootException("批量" + result + "失败!"); + } + return new Result<>().success(result + "成功!"); + } + + /** + * 发送消息 + * + * @param msgContent + * @param userIdList + * @param projectLibraryId + */ + @Override + public void sendMessage(String msgTitle, String msgContent, List userIdList, String projectLibraryId, Map sendMessageMap, FeishuMsgVo feishuMsgVo, MessageTypeEnum messageType, String initiator) { + String idTemp = projectLibraryId; + + List sysUsers = sysUserService.listByIds(userIdList); + List thirdIdList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(sysUsers)) { + thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList()); + } +// //飞书跳转链接 + String hrefFeishu = (String) sendMessageMap.get("hrefFeishu"); + //消息内容 + String contentInfo = (String) sendMessageMap.get("contentInfo"); + + //系统消息 + SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, msgTitle, msgContent, contentInfo, messageType, initiator); + sysAnnouncementService.saveAnnouncement(sysAnnouncement); + sendWebsocket(idTemp, idTemp); + +// //飞书消息 + try { + if (feishuMsgVo != null) { + // 补充飞书跳转链接 + feishuMsgVo.setUrl(hrefFeishu); + feishuMsgVo.setTitle(messageType.getName()); + iFeishuService.sendCardMsg(thirdIdList.toArray(new String[]{}), feishuMsgVo); + } else { + iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), msgContent, messageType.getName(), hrefFeishu); + } + } catch (IOException e) { + log.error("飞书消息推送失败"); + } + } + + @NotNull + private SysAnnouncement getSysAnnouncement(List userIdList, String title, String content, String contentInfo, MessageTypeEnum messageType, String initiator) { + SysAnnouncement sysAnnouncement = new SysAnnouncement(); + sysAnnouncement.setInitiator(initiator); + sysAnnouncement.setDelFlag("0"); + sysAnnouncement.setSendStatus("0"); + sysAnnouncement.setSendTime(new Date()); + sysAnnouncement.setMsgCategory(messageType.getValue());//消息类型 + sysAnnouncement.setMsgType(CommonConstant.MSG_TYPE_UESR);//指定用户 + sysAnnouncement.setTitile(title); + sysAnnouncement.setMsgContent(content); + sysAnnouncement.setMsgContentInfo(contentInfo); + sysAnnouncement.setUserIds(StringUtils.join(userIdList, ",")); + return sysAnnouncement; + } + + private void sendWebsocket(String msgId, String msgTet) { + JSONObject obj = new JSONObject(); + obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC); + obj.put(WebsocketConst.MSG_ID, msgId); + obj.put(WebsocketConst.MSG_TXT, msgTet); + webSocket.sendMessage(obj.toJSONString()); + } + + /** + * 匹配相关人员 + * + * @param params + * @return + */ + @Override + public Result matchRelevantPeople(Map params) { + String projectLibraryId = (String) params.get("projectLibraryId");//项目id + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + int isProjectRole = this.checkUserRole(projectLibraryId, currentUser.getId(), ""); + //验证用户是否是该项目的studio工程师,只有studio工程师才能匹配相关人员 + if (isProjectRole == Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue())) { + //获取当前项目中的相关人员信息 + QueryWrapper queryProjectPerson = new QueryWrapper<>(); + queryProjectPerson.lambda().eq(ProjectRelatedPersonnel::getProjectId, projectLibraryId); + List projectRelatedPersonnels = this.projectRelatedPersonnelMapper.selectList(queryProjectPerson); + + if (CollectionUtils.isNotEmpty(projectRelatedPersonnels)) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + /*List inventoryAffirmStatusList = new ArrayList<>(); + inventoryAffirmStatusList.add(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); + inventoryAffirmStatusList.add(InventoryAffirmStatusEnum.REJECTED.getValue()); + queryWrapper.lambda().in(ProjectLawsInventoryEO::getInventoryAffirmStatus,inventoryAffirmStatusList);*/ + + String ids = (String) params.get("ids"); + if (StringUtils.isNotEmpty(ids)) { + List projectLawsInventoryIdList = Arrays.asList(ids.split(",")); + queryWrapper.lambda().in(ProjectLawsInventoryEO::getId, projectLawsInventoryIdList); + } + + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + //查询当前项目下,清单状态为 未发起、拒绝状态的法规清单。 + List projectLawsInventoryEOS = this.baseMapper.selectList(queryWrapper); + //项目库信息(获取studio) + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(ProjectLibraryBase::getId, projectLibraryId); + List projectLibraryBases = platformProjectLibraryBaseMapper.selectList(wrapper); + String studioEngineer = ""; + if (projectLibraryBases.size() != 0) { + studioEngineer = projectLibraryBases.get(0).getStudioEngineer(); + } + + for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOS) { + //法规清单的责任领域 + /*String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); + if(StringUtils.isNotBlank(dutyTerritory)){ + List projectRelatedPersonnelList = new ArrayList<>(); + for (String s : dutyTerritory.split(",")) { + List projectRelatedPersonnelListTemp = projectRelatedPersonnels.stream() + .filter(e -> s.equals(e.getDutyTerritory())).collect(Collectors.toList()); + if(projectRelatedPersonnelListTemp.size() != 0){ + projectRelatedPersonnelList.addAll(projectRelatedPersonnelListTemp); + } + } +// List projectRelatedPersonnelList = projectRelatedPersonnels.stream() +// .filter(e -> dutyTerritory.contains(e.getDutyTerritory())).collect(Collectors.toList()); + + List lawEngineerList = projectRelatedPersonnelList.stream().map(ProjectRelatedPersonnel::getLawEngineer).distinct().collect(Collectors.toList()).stream().filter(e->StringUtils.isNotBlank(e)).collect(Collectors.toList()); + List engineeringInterfacePersonList = projectRelatedPersonnelList.stream().map(ProjectRelatedPersonnel::getEngineeringInterfacePerson).distinct().collect(Collectors.toList()).stream().filter(e->StringUtils.isNotBlank(e)).collect(Collectors.toList()); + List certificationEngineerList = projectRelatedPersonnelList.stream().map(ProjectRelatedPersonnel::getCertificationEngineer).distinct().collect(Collectors.toList()).stream().filter(e->StringUtils.isNotBlank(e)).collect(Collectors.toList()); + List lawEngineerListTemp = new ArrayList<>(); + List engineeringInterfacePersonListTemp = new ArrayList<>(); + List certificationEngineerListTemp = new ArrayList<>(); + + if(lawEngineerList.size() != 0){ + for (String s : lawEngineerList) { + lawEngineerListTemp.addAll(Arrays.asList(s.split(","))); + } + lawEngineerListTemp = lawEngineerListTemp.stream().distinct().collect(Collectors.toList()); + } + if(engineeringInterfacePersonList.size() != 0){ + for (String s : engineeringInterfacePersonList) { + engineeringInterfacePersonListTemp.addAll(Arrays.asList(s.split(","))); + } + engineeringInterfacePersonListTemp = engineeringInterfacePersonListTemp.stream().distinct().collect(Collectors.toList()); + } + if(certificationEngineerList.size() != 0){ + for (String s : certificationEngineerList) { + certificationEngineerListTemp.addAll(Arrays.asList(s.split(","))); + } + certificationEngineerListTemp = certificationEngineerListTemp.stream().distinct().collect(Collectors.toList()); + } + + //法规工程师 + if (StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && lawEngineerListTemp.size() == 1) { + List finalLawEngineerList = lawEngineerListTemp; + List collect = projectRelatedPersonnels.stream() + .filter(e -> finalLawEngineerList.contains(e.getLawEngineer())).collect(Collectors.toList()); + if(collect.size() != 0){ + String userId = ToGetAUserId(ProjectRoleEnum.REGULATI_ENGINEER.getValue(), collect.get(0),studioEngineer); + if(StringUtils.isNotEmpty(userId)){ + projectLawsInventoryEO.setRegulationOwnerId(userId); + } + } + } + + //认证工程师 + if (StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && certificationEngineerListTemp.size() == 1) { + List finalCertificationEngineerList = certificationEngineerListTemp; + List collect = projectRelatedPersonnels.stream() + .filter(e -> finalCertificationEngineerList.contains(e.getCertificationEngineer())).collect(Collectors.toList()); + if(collect.size() != 0){ + String userId = ToGetAUserId(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue(), collect.get(0),studioEngineer); + if(StringUtils.isNotEmpty(userId)){ + projectLawsInventoryEO.setHomologationEngineerId(userId); + } + } + } + + //项目接口人 + if (StringUtils.isEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson()) && engineeringInterfacePersonListTemp.size() == 1) { + List finalEngineeringInterfacePersonList = engineeringInterfacePersonListTemp; + List collect = projectRelatedPersonnels.stream() + .filter(e -> finalEngineeringInterfacePersonList.contains(e.getEngineeringInterfacePerson())).collect(Collectors.toList()); + if(collect.size() != 0){ + String userId = ToGetAUserId(ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue(), collect.get(0),studioEngineer); + if(StringUtils.isNotEmpty(userId)){ + projectLawsInventoryEO.setEngineeringInterfacePerson(userId); + } + } + } + }*/ + + String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); + if (StringUtils.isNotEmpty(dutyTerritory)) { + List projectRelatedPersonnelTempList = projectRelatedPersonnels.stream().filter(relatedPersonnel -> { + boolean flag = false; + for (String duty : dutyTerritory.split(",")) { + if (StringUtils.equals(duty, relatedPersonnel.getDutyTerritory())) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(projectRelatedPersonnelTempList)) { + + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + + //法规工程师 + if (StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerId())) { + String userId = ToGetAUserId(ProjectRoleEnum.REGULATI_ENGINEER.getValue(), projectRelatedPersonnelTempList, studioEngineer); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setRegulationOwnerId(userId); + } + } else { + String userId = ToGetAUserId(ProjectRoleEnum.REGULATI_ENGINEER.getValue(), projectRelatedPersonnelTempList, studioEngineer, projectLawsInventoryEO.getRegulationOwnerId()); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setRegulationOwnerId(userId); + } else { + updateWrapper.set(ProjectLawsInventoryEO::getRegulationOwnerId, null); + } + } + + //认证工程师 + if (StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerId())) { + String userId = ToGetAUserId(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue(), projectRelatedPersonnelTempList, studioEngineer); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setHomologationEngineerId(userId); + } + } else { + String userId = ToGetAUserId(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue(), projectRelatedPersonnelTempList, studioEngineer, projectLawsInventoryEO.getHomologationEngineerId()); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setHomologationEngineerId(userId); + } else { + updateWrapper.set(ProjectLawsInventoryEO::getHomologationEngineerId, null); + } + } + + //项目接口人 + if (StringUtils.isEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) { + String userId = ToGetAUserId(ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue(), projectRelatedPersonnelTempList, studioEngineer); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setEngineeringInterfacePerson(userId); + } + } else { + String userId = ToGetAUserId(ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue(), projectRelatedPersonnelTempList, studioEngineer, projectLawsInventoryEO.getEngineeringInterfacePerson()); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setEngineeringInterfacePerson(userId); + } else { + updateWrapper.set(ProjectLawsInventoryEO::getEngineeringInterfacePerson, null); + } + } + + //设计符合性确认 + //发起人角色 + String designInitiator = projectLawsInventoryEO.getDesignInitiator(); + if (StringUtils.isNotEmpty(designInitiator)) { + if (StringUtils.isEmpty(projectLawsInventoryEO.getDesignInitiatorId())) { + String userId = ToGetAUserId(designInitiator, projectRelatedPersonnelTempList, studioEngineer); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setDesignInitiatorId(userId); + } + } else { + String userId = ToGetAUserId(designInitiator, projectRelatedPersonnelTempList, studioEngineer, projectLawsInventoryEO.getDesignInitiatorId()); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setDesignInitiatorId(userId); + } else { + updateWrapper.set(ProjectLawsInventoryEO::getDesignInitiatorId, null); + } + } + } + + //责任人角色 + String designDuty = projectLawsInventoryEO.getDesignDuty(); + if (StringUtils.isNotEmpty(designDuty)) { + if (StringUtils.isEmpty(projectLawsInventoryEO.getDesignDutyId())) { + String userId = ToGetAUserId(designDuty, projectRelatedPersonnelTempList, studioEngineer); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setDesignDutyId(userId); + } + } else { + String userId = ToGetAUserId(designDuty, projectRelatedPersonnelTempList, studioEngineer, projectLawsInventoryEO.getDesignDutyId()); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setDesignDutyId(userId); + } else { + updateWrapper.set(ProjectLawsInventoryEO::getDesignDutyId, null); + } + } + } + + + //prehomo确认 + //发起人角色 + String prehomoInitiator = projectLawsInventoryEO.getPrehomoInitiator(); + if (StringUtils.isNotEmpty(prehomoInitiator)) { + if (StringUtils.isEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())) { + String userId = ToGetAUserId(prehomoInitiator, projectRelatedPersonnelTempList, studioEngineer); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setPrehomoInitiatorId(userId); + } + } else { + String userId = ToGetAUserId(prehomoInitiator, projectRelatedPersonnelTempList, studioEngineer, projectLawsInventoryEO.getPrehomoInitiatorId()); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setPrehomoInitiatorId(userId); + } else { + updateWrapper.set(ProjectLawsInventoryEO::getPrehomoInitiatorId, null); + } + } + } + + //责任人角色 + String prehomoDuty = projectLawsInventoryEO.getPrehomoDuty(); + if (StringUtils.isNotEmpty(prehomoDuty)) { + if (StringUtils.isEmpty(projectLawsInventoryEO.getPrehomoDutyId())) { + String userId = ToGetAUserId(prehomoDuty, projectRelatedPersonnelTempList, studioEngineer); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setPrehomoDutyId(userId); + } + } else { + String userId = ToGetAUserId(prehomoDuty, projectRelatedPersonnelTempList, studioEngineer, projectLawsInventoryEO.getPrehomoDutyId()); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setPrehomoDutyId(userId); + } else { + updateWrapper.set(ProjectLawsInventoryEO::getPrehomoDutyId, null); + } + } + } + + //验证符合性确认 + //发起人角色 + String verifyInitiator = projectLawsInventoryEO.getVerifyInitiator(); + if (StringUtils.isNotEmpty(verifyInitiator)) { + if (StringUtils.isEmpty(projectLawsInventoryEO.getVerifyInitiatorId())) { + String userId = ToGetAUserId(verifyInitiator, projectRelatedPersonnelTempList, studioEngineer); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setVerifyInitiatorId(userId); + } + } else { + String userId = ToGetAUserId(verifyInitiator, projectRelatedPersonnelTempList, studioEngineer, projectLawsInventoryEO.getVerifyInitiatorId()); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setVerifyInitiatorId(userId); + } else { + updateWrapper.set(ProjectLawsInventoryEO::getVerifyInitiatorId, null); + } + } + } + + //责任人角色 + String verifyDuty = projectLawsInventoryEO.getVerifyDuty(); + if (StringUtils.isNotEmpty(verifyDuty)) { + if (StringUtils.isEmpty(projectLawsInventoryEO.getVerifyDutyId())) { + String userId = ToGetAUserId(verifyDuty, projectRelatedPersonnelTempList, studioEngineer); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setVerifyDutyId(userId); + } + } else { + String userId = ToGetAUserId(verifyDuty, projectRelatedPersonnelTempList, studioEngineer, projectLawsInventoryEO.getVerifyDutyId()); + if (StringUtils.isNotEmpty(userId)) { + projectLawsInventoryEO.setVerifyDutyId(userId); + } else { + updateWrapper.set(ProjectLawsInventoryEO::getVerifyDutyId, null); + } + } + } + updateWrapper.eq(ProjectLawsInventoryEO::getId, projectLawsInventoryEO.getId()); + super.update(projectLawsInventoryEO, updateWrapper); + } + } + //this.baseMapper.updateById(projectLawsInventoryEO); + } + } else { + throw new JeroBootException("当前项目中,未找到相关维护人员信息"); + } + } else { + throw new JeroBootException("当前操作用户不是该项目的studio工程师,没有权限操作!"); + } + + //更新log + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String username = sysUser.getUsername(); + String contentLog = username + "带入了相关人员名单信息"; + String enContentLog = username + " brought in the list information of relevant personnel."; + projectLawsInventoryLogEOService.updateLog(contentLog, projectLibraryId, CutEnum.CN.getValue()); + projectLawsInventoryLogEOService.updateLog(enContentLog, projectLibraryId, CutEnum.EN.getValue()); + + return new Result<>().success("带入成功!"); + } + + /** + * 获取一个用户的id + * + * @param roleCode + * @param projectRelatedPersonnelList + * @return + */ + public String ToGetAUserId(String roleCode, List projectRelatedPersonnelList, String studioEngineer) { + String resultUserId = ""; + //法规工程师 + if (StringUtils.equals(roleCode, ProjectRoleEnum.REGULATI_ENGINEER.getValue())) { + String lawEngineer = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> { + boolean flag = false; + if (StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())) { + flag = true; + } + return flag; + }).map(ProjectRelatedPersonnel::getLawEngineer).distinct().collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(lawEngineer)) { + String[] lawEngineerArr = lawEngineer.split(","); + if (lawEngineerArr.length == 1) { + resultUserId = lawEngineer; + } + } + } + //认证工程师 + if (StringUtils.equals(roleCode, ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())) { + String certificationEngineer = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> { + boolean flag = false; + if (StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())) { + flag = true; + } + return flag; + }).map(ProjectRelatedPersonnel::getCertificationEngineer).distinct().collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(certificationEngineer)) { + String[] certificationEngineerArr = certificationEngineer.split(","); + if (certificationEngineerArr.length == 1) { + resultUserId = certificationEngineer; + } + } + } + //工程接口人 + if (StringUtils.equals(roleCode, ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue())) { + String engineeringInterfacePerson = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> { + boolean flag = false; + if (StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())) { + flag = true; + } + return flag; + }).map(ProjectRelatedPersonnel::getEngineeringInterfacePerson).distinct().collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(engineeringInterfacePerson)) { + String[] engineeringInterfacePersonArr = engineeringInterfacePerson.split(","); + if (engineeringInterfacePersonArr.length == 1) { + resultUserId = engineeringInterfacePerson; + } + } + } + //studio + if (StringUtils.equals(roleCode, ProjectRoleEnum.STUDIO_ENGINEER.getValue())) { + resultUserId = studioEngineer; + } + return resultUserId; + } + + /** + * 流程调用 + * + * @param jsonObject + * @return + */ + @Override + public Result processCall(JSONObject jsonObject) { + String requestSource = jsonObject.getString("requestSource"); + if (StringUtils.isEmpty(requestSource)) { + throw new JeroBootException("请求来源不能为空!"); + } + if (!StringUtils.equals(requestSource, RequestSourceEnum.WORK_FLOW.getValue())) { + throw new JeroBootException("来源有误,没有权限调用该接口!"); + } + + String operatorType = jsonObject.getString("operatorType"); + if (StringUtils.isEmpty(operatorType)) { + throw new JeroBootException("操作类型不能为空!"); + } + + if (StringUtils.equals(operatorType, OperatorTypeEnum.UPDATE_STATUS.getValue())) { + ProjectLawsInventoryEO projectLawsInventoryEO = JSONObject.parseObject(jsonObject.toString(), ProjectLawsInventoryEO.class); + this.baseMapper.updateById(projectLawsInventoryEO); + } + if (StringUtils.equals(operatorType, OperatorTypeEnum.ADD.getValue())) { + + } + if (StringUtils.equals(operatorType, OperatorTypeEnum.DELETE.getValue())) { + + } + if (StringUtils.equals(operatorType, OperatorTypeEnum.QUERY.getValue())) { + Result objectResult = new Result<>(); + try { + String projectLawsInventoryId = jsonObject.getString("projectLawsInventoryId"); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getId, projectLawsInventoryId); + ProjectLawsInventoryEO projectLawsInventoryEO = this.baseMapper.selectOne(queryWrapper); + objectResult.setResult(projectLawsInventoryEO); + objectResult.setSuccess(true); + } catch (Exception ex) { + objectResult.setSuccess(false); + ex.printStackTrace(); + log.error("工作流后端查询法规清单失败:" + ex.getMessage()); + } + return objectResult; + } + if (StringUtils.equals(operatorType, OperatorTypeEnum.SEND_MSG.getValue())) { + // workFlowSendMsg(jsonObject); + Map prarams = (Map) jsonObject.get("params"); + String templateId = jsonObject.getString("templateId"); + + String projectLibraryId = (String) prarams.get("projectLibraryId"); + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取待办中心 - 飞书跳转链接 + Map todoCenterParams = new HashMap<>(); + todoCenterParams.put("projectNameCn", PRN_CN); + todoCenterParams.put("projectNameEn", PRN_EN); + Map hrefFeishuMap = this.getToDoCenterLinkHrefFeishu(projectLibraryBase.getId(), todoCenterParams); + prarams.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + prarams.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + + String projectLawsInventoryId = (String) prarams.get("id"); + ProjectLawsInventoryEO projectLawsInventoryEO = this.baseMapper.selectById(projectLawsInventoryId); + + //处理手机端飞书消息跳转 + String flowType = jsonObject.getString("flowType"); + String actiProcInstId = jsonObject.getString("actiProcInstId"); + String taskDefinitionKey = jsonObject.getString("taskDefinitionKey"); + if(StringUtils.isNotEmpty(flowType)){ + if("Design".equals(flowType)){ + String hrefFeishu_CN_P = this.editService.handlePhoneDesignLink(projectLawsInventoryEO,actiProcInstId,taskDefinitionKey); + prarams.put("hrefFeishu_CN_P", hrefFeishu_CN_P); + }else if("Verify".equals(flowType)){ + String hrefFeishu_CN_P = this.editService.handlePhoneVerifyLink(projectLawsInventoryEO,actiProcInstId,taskDefinitionKey); + prarams.put("hrefFeishu_CN_P", hrefFeishu_CN_P); + } + } + String regulationOwnerId = projectLawsInventoryEO.getRegulationOwnerId(); + List regulationOwnerUserList = this.sysUserService.querySysUserListByIdList(Arrays.asList(regulationOwnerId.split(","))); + String regulationOwnerUserName = this.sysUserService.getUsernameByUserId(regulationOwnerUserList, regulationOwnerId); + prarams.put("Initiator", regulationOwnerUserName); + + this.sendMessageByTemplateId(templateId, prarams); + } + } + + // 将法规工程师的 法规清单确认待办中心任务转为已办 + if (StringUtils.equals(operatorType, OperatorTypeEnum.TO_DO_CENTER_FG_CONVERT_TO_HAVE_DONE.getValue())) { + String projectLawsInventoryId = jsonObject.getString("id"); + ProjectLawsInventoryEO projectLawsInventoryEO = this.baseMapper.selectById(projectLawsInventoryId); + if (StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + // 如果该条法规清单的设计、验证符合性流程都发起了,将法规工程师在待办中心的待办任务转为已办 + LambdaUpdateWrapper pidUpdateWrap = new LambdaUpdateWrapper<>(); + pidUpdateWrap.eq(ProcessInfoDetailEO::getFlowType, FlowTypeEnum.QDQR.getValue()); + pidUpdateWrap.eq(ProcessInfoDetailEO::getProjectLawsInventoryId, projectLawsInventoryId); + pidUpdateWrap.set(ProcessInfoDetailEO::getStatus, TaskStatusEnum.HAVE_DONE.getValue()); + this.processInfoDetailEOService.update(pidUpdateWrap); + } + } + + return new Result<>().success("调用成功!"); + } + + @Override + public List queryProjectLawsInventoryInfoById(Map params) { + + String id = (String) params.get("id"); + if (StringUtils.isEmpty(id)) { + throw new JeroBootException("id不能为空"); + } + String cut = (String) params.get("cut"); + //String operatorType = (String) params.get("operatorType"); + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List projectLawsInventoryEOList = new ArrayList<>(); + ProjectLawsInventoryEO byId = getById(id); + projectLawsInventoryEOList.add(byId); + if (CollectionUtils.isNotEmpty(projectLawsInventoryEOList)) { + int isProjectRole = this.checkUserRole(byId.getProjectLibraryId(), currentUser.getId(), id); + dataDispose(projectLawsInventoryEOList, currentUser, isProjectRole, cut); + dataDictDispose(projectLawsInventoryEOList, cut); + + //result.put("projectLawsInventory",projectLawsInventoryEOList.get(0)); + /*if (StringUtils.equals(operatorType, OperatorTypeEnum.TASK_AFFIRM_QUERY.getValue())) { + //设计符合性 + Map designMap = new HashMap<>(); + designMap.put("designDeliverableType",projectLawsInventoryEOList.get(0).getDesignDeliverableType()); + designMap.put("designDeliverableTemplateName",projectLawsInventoryEOList.get(0).getDesignDeliverableType()); + designMap.put("designInitiatorName",projectLawsInventoryEOList.get(0).getDesignInitiatorName()); + designMap.put("designDutyName",projectLawsInventoryEOList.get(0).getDesignDutyName()); + designMap.put("designDueDate",projectLawsInventoryEOList.get(0).getDesignDueDate()); + result.put("design",designMap); + //prehomo + Map prehomoMap = new HashMap<>(); + prehomoMap.put("prehomoDeliverableType",projectLawsInventoryEOList.get(0).getPrehomoDeliverableType()); + prehomoMap.put("prehomoDeliverableTemplateName",projectLawsInventoryEOList.get(0).getPrehomoDeliverableTemplateName()); + prehomoMap.put("prehomoInitiatorName",projectLawsInventoryEOList.get(0).getPrehomoInitiatorName()); + prehomoMap.put("prehomoDutyName",projectLawsInventoryEOList.get(0).getPrehomoDutyName()); + prehomoMap.put("prehomoDueDate",projectLawsInventoryEOList.get(0).getPrehomoDueDate()); + result.put("prehomo",prehomoMap); + //验证符合性 + Map verifyMap = new HashMap<>(); + verifyMap.put("verifyDeliverableType",projectLawsInventoryEOList.get(0).getVerifyDeliverableType()); + verifyMap.put("verifyDeliverableTemplateName",projectLawsInventoryEOList.get(0).getVerifyDeliverableTemplateName()); + verifyMap.put("verifyInitiatorName",projectLawsInventoryEOList.get(0).getVerifyInitiatorName()); + verifyMap.put("verifyDutyName",projectLawsInventoryEOList.get(0).getVerifyDutyName()); + verifyMap.put("verifyDueDate",projectLawsInventoryEOList.get(0).getVerifyDueDate()); + result.put("verify",verifyMap); + }*/ + } else { + throw new JeroBootException("未找到该法规清单信息!"); + } + return projectLawsInventoryEOList; + } + + /** + * 工作流发送消息 + * + * @param jsonObject + */ + public void workFlowSendMsg(JSONObject jsonObject) { + String msgType = jsonObject.getString("msgType"); //发送消息类型 + if (StringUtils.isEmpty(msgType)) { + throw new JeroBootException("发送消息类型不能为空,请检查!"); + } + String id = jsonObject.getString("id"); //法规清单id + String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id + String taskAffirmDueDate = jsonObject.getString("taskAffirmDueDate"); //截止日期 + //String serialNumber = jsonObject.getString("serialNumber"); //编号 + String projectLibraryId = jsonObject.getString("projectLibraryId"); //项目库id + String engineeringInterfacePerson = jsonObject.getString("engineeringInterfacePerson"); //工程接口人id + + ProjectLibraryBase projectLibraryBase = platformProjectLibraryBaseMapper.selectOne(new QueryWrapper() + .lambda().eq(ProjectLibraryBase::getId, projectLibraryId)); + + ProjectLawsInventoryEO projectLawsInventoryEO = this.baseMapper.selectOne( + new QueryWrapper().lambda().eq(ProjectLawsInventoryEO::getId, id) + ); + + SysUser studioUserInfo = this.sysUserMapper.selectOne( + new QueryWrapper().lambda().eq(SysUser::getId, projectLibraryBase.getStudioEngineer()) + ); + + QueryWrapper projectNameInfoEOQueryWrapper = new QueryWrapper<>(); + projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId, projectLibraryBase.getProjectNameId()); + ProjectNameInfoEO projectNameInfoEO = platformProjectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper); + + QueryWrapper projectYearInfoEOQueryWrapper = new QueryWrapper<>(); + projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId, projectLibraryBase.getYearNameId()); + ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper); + + SysUser sysUser = sysUserMapper.selectOne(new QueryWrapper().lambda().eq(SysUser::getId, currentUserId)); + + //String msgContentEN = ""; + String msgTitle = ""; + List userIdList = new ArrayList<>(); + + //FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); + + //MessageTypeEnum messageTypeEnum = null; + //String taskType = ""; + String initiator = ""; + String initiatorLark = ""; + String cnContentUpper = "";//中文上部分 + String cnContentLower = "";//中文下部分 + String enContentUpper = "";//英文上部分 + String enContentLower = "";//英文下部分 + String color = "";//颜色 + + ProjectLibraryBase LibraryBase = platformProjectLibraryBaseService.queryById(projectLibraryId, CutEnum.EN.getValue()).get(0); + String PRN = LibraryBase.getProjectName();//项目名称 + String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规 + BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId()); + String LAW_EN = ""; + if (ObjectUtils.isEmpty(bussDocumentLibraryEO)) { + LAW_EN = LAW_CN; + } else { + if (ObjectUtils.isEmpty(bussDocumentLibraryEO.getTitleEn())) { + LAW_EN = LAW_CN; + } else { + LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规 + } + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_START_MSG.getValue())) { + userIdList.add(engineeringInterfacePerson); + //msgContentEN = sysUser.getUsername() + " initiated the regulation task confirmation of " + projectNameInfoEO.getProjectName() + // + ". The due date is " + taskAffirmDueDate + ". Please check and address it in a timely manner."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a regulation task confirmation to complete"; + + //feishuMsgVo.setContent("Hello! Please check and address this task in a timely manner."); + + //messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION; + //taskType = "Regulation Task Confirmation"; + + //initiator = studioUserInfo.getUsername(); + //initiatorLark = studioUserInfo.getUsername(); + + msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn(); + cnContentUpper = "您好,请及时查看处理此项任务,谢谢!"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + + } else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ISSUE_DRE_MSG.getValue())) { + String dreUserId = jsonObject.getString("dreUserId"); //dre用户id + userIdList.add(dreUserId); + //msgContentEN = sysUser.getUsername() + " has assigned the regulation task confirmation of " + serialNumber + " in "+ projectNameInfoEO.getProjectName() + // + " to you. The due date is " +taskAffirmDueDate+ ". Please check and handle it in time."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a regulation task confirmation to complete"; + + //feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has assigned the task. Please check and and handle it in time."); + + //messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION; + //taskType = "Regulation Task Confirmation"; + + //initiator = studioUserInfo.getUsername(); + //initiatorLark = studioUserInfo.getUsername(); + + + msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn(); + cnContentUpper = "您好," + sysUser.getUsername() + "向您询问意见,请及时查看处理"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + enContentUpper = "Hello! " + sysUser.getUsername() + " asked you for opinion. Please check and address it in a timely manner"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + } else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_DRE_REJECTED.getValue())) { + userIdList.add(engineeringInterfacePerson); + //msgContentEN = sysUser.getUsername() + " has rejected the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + ". The due date is " +taskAffirmDueDate+ ". Please check and handle it in time."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a regulation task confirmation to complete"; + + //feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has rejected the task. Please check and and handle it in time."); + + //messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION; + //taskType = "Regulation Task Confirmation"; + + //initiator = studioUserInfo.getUsername(); + //initiatorLark = studioUserInfo.getUsername(); + + msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn(); + cnContentUpper = "您好,该任务被" + sysUser.getUsername() + "退回,请及时查看处理"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + enContentUpper = "Hello! This task is rejected by " + sysUser.getUsername() + ". Please check and address it in a timely manner"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + } else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_DRE_ACCEPTED.getValue())) { + userIdList.add(engineeringInterfacePerson); + //msgContentEN = sysUser.getUsername() + " has submitted the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + ". The due date is " +taskAffirmDueDate+ ". Please check and handle it in time."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a regulation task confirmation to complete"; + + //feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has submitted the task. Please check and and handle it in time."); + + //messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION; + //taskType = "Regulation Task Confirmation"; + + //initiator = studioUserInfo.getUsername(); + //initiatorLark = studioUserInfo.getUsername(); + + msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn(); + cnContentUpper = "您好," + sysUser.getUsername() + "已向您提交回复,请及时查看处理"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + enContentUpper = "Hello! " + sysUser.getUsername() + " has replied to you. Please check and address it in a timely manner"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + + } else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_REJECTED_MSG.getValue())) { + userIdList.add(projectLibraryBase.getStudioEngineer()); + //msgContentEN = sysUser.getUsername() + " has rejected the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + ". Please check and handle it in time."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a regulation task confirmation to complete"; + + //feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has rejected the task. Please check and and handle it in time."); + + //messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION; + //taskType = "Regulation Task Confirmation"; + + //initiator = studioUserInfo.getUsername(); + //initiatorLark = studioUserInfo.getUsername(); + + msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn(); + cnContentUpper = "您好,该任务被" + sysUser.getUsername() + "拒绝,请及时查看处理"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + enContentUpper = "Hello! This task is rejected by " + sysUser.getUsername() + ". Please check and address it in a timely manner"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + color = MsgColorEnum.RED.getValue(); + + + } /*else if(StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ACCEPTED_MSG.getValue())){ + userIdList.add(projectLibraryBase.getStudioEngineer()); + //msgContentEN = sysUser.getUsername() + " has accepted the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + ". Please check and handle it in time."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a regulation task confirmation notification to check"; + + //feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has accepted the task. Please check and and handle it in time."); + + //messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION; + //taskType = "Regulation Task Confirmation"; + + initiator = studioUserInfo.getUsername(); + initiatorLark = studioUserInfo.getUsername(); + } */ else if (StringUtils.equals(msgType, MsgTypeEnum.DESIGN_START_MSG.getValue())) { + String designDutyId = jsonObject.getString("designDutyId"); //设计符合性责任人id + userIdList.add(designDutyId); + //msgContentEN = "You recieved the design compliance task of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + ". The due date is " + sdf.format(projectLawsInventoryEO.getDesignDueDate()) + ". Please check and address it in a timely manner."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a design compliance task to complete"; + + //feishuMsgVo.setContent("Hello! Please address the task in a timely manner."); + + //messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION; + //taskType = "Design Compliance Confirmation"; + + //initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); + //SysUser initiatorLarkInfo = this.sysUserMapper.selectOne( + // new QueryWrapper().lambda().eq(SysUser::getId, projectLawsInventoryEO.getDesignInitiatorId()) + //); + //initiatorLark = initiatorLarkInfo.getUsername(); + + msgTitle = MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getEn(); + cnContentUpper = "您好,请及时查看处理此项任务,谢谢!"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getDesignDueDate()); + enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getDesignDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + } else if (StringUtils.equals(msgType, MsgTypeEnum.PREHOMO_START_MSG.getValue())) { + String prehomoDutyId = jsonObject.getString("prehomoDutyId"); //pre-Home责任人id + userIdList.add(prehomoDutyId); + //msgContentEN = "You recieved the Pre-Homo task of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + ". The due date is " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate()) + ". Please check and address it in a timely manner."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a Pre-Homo task to complete"; + + //feishuMsgVo.setContent("Hello! Please address the task in a timely manner."); + + //messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION; + //taskType = "Pre-Homo Confirmation"; + + //initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); + + //SysUser initiatorLarkInfo = this.sysUserMapper.selectOne( + // new QueryWrapper().lambda().eq(SysUser::getId, projectLawsInventoryEO.getPrehomoInitiatorId()) + //); + //initiatorLark = initiatorLarkInfo.getUsername(); + msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn(); + cnContentUpper = "您好,请及时查看处理此项任务,谢谢!"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate()); + enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + } else if (StringUtils.equals(msgType, MsgTypeEnum.VERIFY_START_MSG.getValue())) { + String verifyDutyId = jsonObject.getString("verifyDutyId"); //验证符合性责任人id + userIdList.add(verifyDutyId); + //msgContentEN = "You recieved the validation compliance task of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + ". The due date is " + sdf.format(projectLawsInventoryEO.getVerifyDueDate()) + ". Please check and address it in a timely manner."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a validation compliance task to complete"; + + //feishuMsgVo.setContent("Hello! Please address the task in a timely manner."); + + //messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION; + //taskType = "Validation Compliance Confirmation"; + + //initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); + //SysUser initiatorLarkInfo = this.sysUserMapper.selectOne( + // new QueryWrapper().lambda().eq(SysUser::getId, projectLawsInventoryEO.getVerifyInitiatorId()) + //); + //initiatorLark = initiatorLarkInfo.getUsername(); + + msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn(); + cnContentUpper = "您好,请及时查看处理此项任务,谢谢!"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate()); + enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + } else if (StringUtils.equals(msgType, MsgTypeEnum.DESIGN_CHARGE_PERSON_SUBMIT_MSG.getValue())) { + String designInitiatorId = jsonObject.getString("designInitiatorId"); //设计符合性发起人id + userIdList.add(designInitiatorId); + //msgContentEN = sysUser.getUsername() + " has submitted the design compliance confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + ". Please check and review it in time."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a design compliance task to complete"; + + //feishuMsgVo.setContent("Hello! The compliance confirmation has been submitted. Please check and review it in a timely manner."); + + //messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION; + //taskType = "Design Compliance Confirmation"; + + //initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); + + msgTitle = MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getEn(); + cnContentUpper = "您好," + sysUser.getUsername() + "已完成任务,请审查"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getDesignDueDate()); + enContentUpper = "Hello! " + sysUser.getUsername() + " has completed the task. Please check and review it"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getDesignDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + //feishuMsgVo.setAssignee(sysUser.getUsername()); +// SysUser initiatorLarkInfo = this.sysUserMapper.selectOne( +// new QueryWrapper().lambda().eq(SysUser::getId, projectLawsInventoryEO.getDesignInitiatorId()) +// ); +// initiatorLark = initiatorLarkInfo.getUsername(); + } else if (StringUtils.equals(msgType, MsgTypeEnum.PREHOMO_CHARGE_PERSON_SUBMIT_MSG.getValue())) { + String prehomoInitiatorId = jsonObject.getString("prehomoInitiatorId"); //pre-Home发起人id + userIdList.add(prehomoInitiatorId); + //msgContentEN = sysUser.getUsername() + " has submitted the Pre-Homo confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + ". Please check and review it in time."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a Pre-Homo task to complete"; + + //feishuMsgVo.setContent("Hello! The compliance confirmation has been submitted. Please check and review it in a timely manner."); + + //messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION; + //taskType = "Pre-Homo Confirmation"; + + //initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); + + msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn(); + cnContentUpper = "您好," + sysUser.getUsername() + "已完成任务,请审查"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate()); + enContentUpper = "Hello! " + sysUser.getUsername() + " has completed the task. Please check and review it"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + //feishuMsgVo.setAssignee(sysUser.getUsername()); +// SysUser initiatorLarkInfo = this.sysUserMapper.selectOne( +// new QueryWrapper().lambda().eq(SysUser::getId, projectLawsInventoryEO.getPrehomoInitiatorId()) +// ); +// initiatorLark = initiatorLarkInfo.getUsername(); + } else if (StringUtils.equals(msgType, MsgTypeEnum.VERIFY_CHARGE_PERSON_SUBMIT_MSG.getValue())) { + String verifyInitiatorId = jsonObject.getString("verifyInitiatorId"); //验证符合性发起人id + userIdList.add(verifyInitiatorId); + //msgContentEN = sysUser.getUsername() + " has submitted the validation compliance confirmation " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + ". Please check and review it in time."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a validation compliance task to complete"; + + //feishuMsgVo.setContent("Hello! The compliance confirmation has been submitted. Please check and review it in a timely manner."); + + //messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION; + //taskType = "Validation Compliance Confirmation"; + + //initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); + + msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn(); + cnContentUpper = "您好," + sysUser.getUsername() + "已完成任务,请审查"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate()); + enContentUpper = "Hello! " + sysUser.getUsername() + " has completed the task. Please check and review it"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + //feishuMsgVo.setAssignee(sysUser.getUsername()); +// SysUser initiatorLarkInfo = this.sysUserMapper.selectOne( +// new QueryWrapper().lambda().eq(SysUser::getId, projectLawsInventoryEO.getVerifyInitiatorId()) +// ); +// initiatorLark = initiatorLarkInfo.getUsername(); + } else if (StringUtils.equals(msgType, MsgTypeEnum.DESIGN_INITIATOR_ACCEPTED_MSG.getValue())) { + String designDutyId = jsonObject.getString("designDutyId"); //设计符合性责任人id + userIdList.add(designDutyId); + //msgContentEN = "The design compliance information of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + " you submitted has been approved."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a design compliance task to complete"; + + //feishuMsgVo.setContent("Hello! The compliance information you submitted has been approved."); + + //messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION; + //taskType = "Design Compliance Confirmation"; + + //initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); + //SysUser initiatorLarkInfo = this.sysUserMapper.selectOne( + // new QueryWrapper().lambda().eq(SysUser::getId, projectLawsInventoryEO.getDesignInitiatorId()) + //); + //initiatorLark = initiatorLarkInfo.getUsername(); + + msgTitle = MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getEn(); + cnContentUpper = "您好,该任务被发起人审查通过"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + enContentUpper = "Hello! The task has been approved by initiator"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + } else if (StringUtils.equals(msgType, MsgTypeEnum.PREHOMO_INITIATOR_ACCEPTED_MSG.getValue())) { + String prehomoDutyId = jsonObject.getString("prehomoDutyId"); //pre-Home责任人id + userIdList.add(prehomoDutyId); + //msgContentEN = "The Pre-Homo confirmation information of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + " you submitted has been approved."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a Pre-Homo task to complete"; + + //feishuMsgVo.setContent("Hello! The compliance information you submitted has been approved."); + + //messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION; + //taskType = "Pre-Homo Confirmation"; + + //initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); + //SysUser initiatorLarkInfo = this.sysUserMapper.selectOne( + // new QueryWrapper().lambda().eq(SysUser::getId, projectLawsInventoryEO.getPrehomoInitiatorId()) + //); + //initiatorLark = initiatorLarkInfo.getUsername(); + msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn(); + cnContentUpper = "您好,该任务被发起人审查通过"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + enContentUpper = "Hello! The task has been approved by initiator"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + color = MsgColorEnum.GREEN.getValue(); + + } else if (StringUtils.equals(msgType, MsgTypeEnum.VERIFY_INITIATOR_ACCEPTED_MSG.getValue())) { + String verifyDutyId = jsonObject.getString("verifyDutyId"); //验证符合性责任人id + userIdList.add(verifyDutyId); + //msgContentEN = "The validation compliance information of " + serialNumber +" in "+ projectNameInfoEO.getProjectName() + // + " you submitted has been approved."; + //msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a validation compliance task to complete"; + + //feishuMsgVo.setContent("Hello! The compliance information you submitted has been approved."); + + //messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION; + //taskType = "Validation Compliance Confirmation"; + + //initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); + //SysUser initiatorLarkInfo = this.sysUserMapper.selectOne( + // new QueryWrapper().lambda().eq(SysUser::getId, projectLawsInventoryEO.getVerifyInitiatorId()) + //); + //initiatorLark = initiatorLarkInfo.getUsername(); + + msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn(); + cnContentUpper = "您好,该任务被发起人审查通过"; + cnContentLower = "项目: " + PRN + + "\n法规: " + LAW_CN + + "\n发起人: " + sysUser.getUsername() + + "\n截止时间: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + enContentUpper = "Hello! The task has been approved by initiator"; + enContentLower = "Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + sysUser.getUsername() + + "\nDue Date: " + sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()); + color = MsgColorEnum.GREEN.getValue(); + } + + if (CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgTitle)) { + + //feishuMsgVo.setTaskType(taskType); + //feishuMsgVo.setRegulationNo(serialNumber); + //feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); + //feishuMsgVo.setInitiator(initiatorLark); + //feishuMsgVo.setDueDate(taskAffirmDueDate); + + //飞书跳转链接 + String hrefFeishu = ""; + //系统内部跳转链接 + //String href = ""; + if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_START_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ISSUE_DRE_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_DRE_REJECTED.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_DRE_ACCEPTED.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_REJECTED_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ACCEPTED_MSG.getValue())) { + hrefFeishu = backUrl + + JumpLinkEnum.TASK_AFFIRM_LINK.getLink(); + //href = "" + " View details" + ""; + } else if (StringUtils.equals(msgType, MsgTypeEnum.DESIGN_START_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.PREHOMO_START_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.VERIFY_START_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.DESIGN_CHARGE_PERSON_SUBMIT_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.PREHOMO_CHARGE_PERSON_SUBMIT_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.VERIFY_CHARGE_PERSON_SUBMIT_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.DESIGN_INITIATOR_ACCEPTED_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.PREHOMO_INITIATOR_ACCEPTED_MSG.getValue()) + || StringUtils.equals(msgType, MsgTypeEnum.VERIFY_INITIATOR_ACCEPTED_MSG.getValue())) { + hrefFeishu = backUrl + + JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + + projectLibraryBase.getId() + + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType() + + "&projectName=" + PRN; + //href = "" + " View details" + ""; + } + + //String contentInfo = msgContentEN + " " + href; + //Map sendMessageMap = new HashMap<>(); + //sendMessageMap.put("hrefFeishu",hrefFeishu); + //sendMessageMap.put("contentInfo",contentInfo); + + //发送消息 + //sendMessage(msgTitle, msgContentEN,userIdList,id,sendMessageMap, feishuMsgVo, messageTypeEnum,initiator); + + List sysUsers = sysUserService.listByIds(userIdList); + List thirdIdList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(sysUsers)) { + thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList()); + } + try { + FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); + feishuMsgVo.setTitle(msgTitle); + feishuMsgVo.setCnContentUpper(cnContentUpper); + feishuMsgVo.setCnContentLower(cnContentLower); + feishuMsgVo.setEnContentUpper(enContentUpper); + feishuMsgVo.setEnContentLower(enContentLower); + feishuMsgVo.setUrl(hrefFeishu); + feishuMsgVo.setColor(color); // 颜色 + feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo); + } catch (IOException e) { + log.error("飞书消息推送失败"); + } + } + } + + @Override + public void copyInfoByIds(String ids, String operateType) { + if (StringUtils.isNotBlank(ids)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(ProjectLawsInventoryEO::getId, Arrays.asList(ids.split(","))); + List projectLawsInventoryEOList = this.list(wrapper); + List projectTaskInventoryEOList = new ArrayList<>(); + for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOList) { + String projectLawsInventoryId = UUID.randomUUID().toString().replace("-", ""); + projectLawsInventoryEO.setId(projectLawsInventoryId); + + projectLawsInventoryEO.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryEO.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryEO.setRegulationOwnerSubmitStatus(null); + projectLawsInventoryEO.setHomologationEngineerSubmitStatus(null); + projectLawsInventoryEO.setSendMsgFlag(null); + projectLawsInventoryEO.setSendMsgCurrentFlag(null); + // 2023-03-27 修改禅道67149问题,复制的时候将符合性流程的截至时间复制上。 + /*projectLawsInventoryEO.setDesignDueDate(null); + projectLawsInventoryEO.setPrehomoDueDate(null); + projectLawsInventoryEO.setVerifyDueDate(null);*/ + projectLawsInventoryEO.setInventoryAffirmDueDate(null); + projectLawsInventoryEO.setTaskAffirmDueDate(null); + + // 修改UAT问题清单,122条,法规工程师复制,将流程状态设置为 待校核 -> 对应现在的 任务待发起 + if (StringUtils.equals(operateType, OperatorTypeEnum.LAWS_INVENTORY_STUDIO_COPY.getValue())) { + projectLawsInventoryEO.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); + projectLawsInventoryEO.setVerifyFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); + } else if (StringUtils.equals(operateType, OperatorTypeEnum.LAWS_INVENTORY_REGULATION_OWNER_COPY.getValue())) { + projectLawsInventoryEO.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + projectLawsInventoryEO.setVerifyFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + } + + + ProjectTaskInventoryEO projectTaskInventoryEO = new ProjectTaskInventoryEO(); + String projectTaskInventoryId = UUID.randomUUID().toString().replace("-", ""); + projectTaskInventoryEO.setId(projectTaskInventoryId); + projectTaskInventoryEO.setProjectLawsInventoryId(projectLawsInventoryId); + projectTaskInventoryEO.setStandId(projectLawsInventoryEO.getStandId()); + projectTaskInventoryEO.setCertificationProgress(CertificationProgressEnum.NOT_START.getValue()); + projectTaskInventoryEOList.add(projectTaskInventoryEO); + } + this.saveBatch(projectLawsInventoryEOList); + + //更新log + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String username = sysUser.getUsername(); + String projectLibraryId = projectLawsInventoryEOList.get(0).getProjectLibraryId(); + String serialNumber = projectLawsInventoryEOList.stream().map(e -> e.getSerialNumber()).collect(Collectors.joining(",")); + String contentLog = username + "复制了“" + serialNumber + "”"; + String enContentLog = username + " copied “" + serialNumber + "”"; + projectLawsInventoryLogEOService.updateLog(contentLog, projectLibraryId, CutEnum.CN.getValue()); + projectLawsInventoryLogEOService.updateLog(enContentLog, projectLibraryId, CutEnum.EN.getValue()); + this.projectTaskInventoryEOService.saveBatch(projectTaskInventoryEOList); + projectTaskInventoryEOList.forEach(taskInventory -> { + this.initConditionAssessmentEO(taskInventory.getProjectLawsInventoryId()); + }); + } + + } + + @Override + public void setBatch(ProjectLawsInventoryEO projectLawsInventoryEO) { + this.editService.setBatch(projectLawsInventoryEO); + } + + + private ProjectLawsInventoryEO dataCompare(ProjectLawsInventoryEO projectLawsInventoryEO, DummyInventoryInfoEO dummyInventoryInfoEO) { + //编号 + if (StringUtils.isBlank(projectLawsInventoryEO.getSerialNumber())) { + projectLawsInventoryEO.setSendMsgFlag(dummyInventoryInfoEO.getSerialNumber()); + } + //标题 + if (StringUtils.isBlank(projectLawsInventoryEO.getTitle())) { + projectLawsInventoryEO.setTitle(dummyInventoryInfoEO.getTitle()); + } + //子标题 + if (StringUtils.isBlank(projectLawsInventoryEO.getSubtitle())) { + projectLawsInventoryEO.setSubtitle(dummyInventoryInfoEO.getSubtitle()); + } + //WVTA ID + if (StringUtils.isBlank(projectLawsInventoryEO.getWvtaId())) { + projectLawsInventoryEO.setWvtaId(dummyInventoryInfoEO.getWvtaId()); + } + //对应标准 + if (StringUtils.isBlank(projectLawsInventoryEO.getCorrespondingStandard())) { + projectLawsInventoryEO.setCorrespondingStandard(dummyInventoryInfoEO.getCorrespondingStandard()); + } + //实施类别 + if (StringUtils.isBlank(projectLawsInventoryEO.getImplementType())) { + projectLawsInventoryEO.setImplementType(dummyInventoryInfoEO.getImplementType()); + } + //适用地区 + if (StringUtils.isBlank(projectLawsInventoryEO.getRegion())) { + projectLawsInventoryEO.setRegion(dummyInventoryInfoEO.getRegion()); + } + //在产车实施日期 + if (ObjectUtils.isEmpty(projectLawsInventoryEO.getImplementTime())) { + projectLawsInventoryEO.setImplementTime(dummyInventoryInfoEO.getImplementTime()); + } + //新车型实施日期 + if (ObjectUtils.isEmpty(projectLawsInventoryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1())) { + projectLawsInventoryEO.setXin1Che1Xing2Shi2Shi1Ri4Qi1(dummyInventoryInfoEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1()); + } + //认证类型 + if (StringUtils.isBlank(projectLawsInventoryEO.getAttestationType())) { + projectLawsInventoryEO.setAttestationType(dummyInventoryInfoEO.getAttestationType()); + + } + //认证级别 + if (StringUtils.isBlank(projectLawsInventoryEO.getAttestationRank())) { + projectLawsInventoryEO.setAttestationRank(dummyInventoryInfoEO.getAttestationRank()); + } + //责任领域 + if (StringUtils.isBlank(projectLawsInventoryEO.getDutyTerritory())) { + projectLawsInventoryEO.setDutyTerritory(dummyInventoryInfoEO.getDutyTerritory()); + } + //备注 + if (StringUtils.isBlank(projectLawsInventoryEO.getRemark())) { + projectLawsInventoryEO.setRemark(dummyInventoryInfoEO.getRemark()); + } + //设计--交付物类型 + if (StringUtils.isBlank(projectLawsInventoryEO.getDesignDeliverableType())) { + projectLawsInventoryEO.setDesignDeliverableType(dummyInventoryInfoEO.getDesignDeliverableType()); + + } + //设计--交付物模板 + if (StringUtils.isBlank(projectLawsInventoryEO.getDesignDeliverableTemplate())) { + projectLawsInventoryEO.setDesignDeliverableTemplate(dummyInventoryInfoEO.getDesignDeliverableTemplate()); + } + //设计--发起人 + if (StringUtils.isBlank(projectLawsInventoryEO.getDesignInitiator())) { + projectLawsInventoryEO.setDesignInitiator(dummyInventoryInfoEO.getDesignInitiator()); + } + //设计--发起人责任人 + if (StringUtils.isBlank(projectLawsInventoryEO.getDesignDuty())) { + projectLawsInventoryEO.setDesignDuty(dummyInventoryInfoEO.getDesignDuty()); + } + //Pre--交付物类型 + if (StringUtils.isBlank(projectLawsInventoryEO.getPrehomoDeliverableType())) { + projectLawsInventoryEO.setPrehomoDeliverableType(dummyInventoryInfoEO.getPrehomoDeliverableType()); + } + //Pre--交付物模板 + if (StringUtils.isBlank(projectLawsInventoryEO.getPrehomoDeliverableTemplate())) { + projectLawsInventoryEO.setPrehomoDeliverableTemplate(dummyInventoryInfoEO.getPrehomoDeliverableTemplate()); + } + //Pre--发起人 + if (StringUtils.isBlank(projectLawsInventoryEO.getPrehomoInitiator())) { + projectLawsInventoryEO.setPrehomoInitiator(dummyInventoryInfoEO.getPrehomoInitiator()); + } + //Pre--发起人责任人 + if (StringUtils.isBlank(projectLawsInventoryEO.getPrehomoDuty())) { + projectLawsInventoryEO.setPrehomoDuty(dummyInventoryInfoEO.getPrehomoDuty()); + } + //验证--交付物类型 + if (StringUtils.isBlank(projectLawsInventoryEO.getVerifyDeliverableType())) { + projectLawsInventoryEO.setVerifyDeliverableType(dummyInventoryInfoEO.getVerifyDeliverableType()); + } + //验证--交付物模板 + if (StringUtils.isBlank(projectLawsInventoryEO.getVerifyDeliverableTemplate())) { + projectLawsInventoryEO.setVerifyDeliverableTemplate(dummyInventoryInfoEO.getVerifyDeliverableTemplate()); + } + //验证--发起人 + if (StringUtils.isBlank(projectLawsInventoryEO.getVerifyInitiator())) { + projectLawsInventoryEO.setVerifyInitiator(dummyInventoryInfoEO.getVerifyInitiator()); + } + //验证--发起人责任人 + if (StringUtils.isBlank(projectLawsInventoryEO.getVerifyDuty())) { + projectLawsInventoryEO.setVerifyDuty(dummyInventoryInfoEO.getVerifyDuty()); + } + return projectLawsInventoryEO; + } + + + @Override + public void exportTemplate(ProjectLawsInventoryEO projectLawsInventoryEO, HttpServletResponse response, HttpServletRequest request) { + OutputStream os = null; + HSSFWorkbook workbook = new HSSFWorkbook(); + String fileOriName = ""; + String sheetName = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + fileOriName = "法规清单导入模板.xls"; + sheetName = "法规清单导入模板"; + } else if (StringUtils.equals(projectLawsInventoryEO.getCut(), CutEnum.EN.getValue())) { + fileOriName = "Regulatory List Import Template.xls"; + sheetName = "Regulatory List Import Template"; + } + String filePath = uploadpath + File.separator + fileOriName; + try { + String titleOne = ""; + String titleTwo = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + titleOne = "*编号,标题,子标题," + + "认证类型,*认证级别,适用增补件," + + "*责任领域,法规工程师,工程接口人," + + "备注," + + "设计符合性确认,验证符合性确认"; + titleTwo = "交付物类型,交付物模板,责任人,截止时间,交付物说明," + + "交付物类型,交付物模板,责任人,截止时间,交付物说明"; + } else { + titleOne = "*Number,Title,Sub-Title," + + "Certification Type,*Certification Level,Applicable Supplement," + + "*Responsible Field,Regulation Engineer,Engineering Interface," + + "Comments," + + "Design Compliance Check,Validation Compliance Check"; + titleTwo = "Deliverable Type,Deliverable Template,Assignee,Due Date,Deliverable Description," + + "Deliverable Type,Deliverable Template,Assignee,Due Date,Deliverable Description"; + } + + List list = Arrays.asList(titleOne.split(",")); + int index = 0; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + index = list.indexOf("备注") + 1; + } else { + index = list.indexOf("Comments") + 1; + } + + //创建临时文件夹 + File nowFile = new File(filePath); + if (nowFile.exists()) { + nowFile.delete(); + } + nowFile.mkdirs(); + HSSFSheet sheet = workbook.createSheet(sheetName); + sheet.setDefaultColumnWidth(16);//列宽 + HSSFCellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setWrapText(true);//自动换行 + cellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中 + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中 + + HSSFCellStyle cellStyleTemp = workbook.createCellStyle(); + cellStyleTemp.setWrapText(true);//自动换行 + + + int count = 1; + int startLine = 0; + int endLine = 0; + int line = 4; + for (int i = 0; i < index; i++) { + //合并单元格 + CellRangeAddress region1 = + new CellRangeAddress(0, 1, i, i); + sheet.addMergedRegion(region1); + } + for (int i = index; i < 16; i++) { + if (count > 1) { + startLine = startLine + line + 1; + endLine = startLine + line; + } else { + startLine = i; + endLine = i + line; + } + //合并单元格 + CellRangeAddress region1 = + new CellRangeAddress(0, 0, startLine, endLine); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列 + sheet.addMergedRegion(region1); + count++; + } + CellRangeAddress region = + new CellRangeAddress(2, 2, 0, 29); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列 + sheet.addMergedRegion(region); + String explain = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + explain = "填写说明\n" + + "1.导入数据从第四行开始\n" + + "2.所有带*号的字段必须填写\n" + + "3.实施类别,交付物类型,责任人,字段是单选属性,必须和系统中的对应字段选项相匹配\n" + + "4.认证类型,认证级别,责任领域,字段是多选属性,必须和系统中的对应字段选项相匹配,填写多个时采用英文或中文逗号分割\n" + + "5.编号,子标题,WVTA ID,备注,填写文本内容\n" + + "6.交付物模板字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件,假设在AAA标准号下放置了B.docx,则应填写AAA/B.docx"; + } else { + explain = "Filling explanation\n" + + "1.Import data starts at the fourth line\n" + + "2.All fields marked with * must be filled in\n" + + "3.Usage,Deliverable Type,Assignee,Fields are radio attributes that must match the corresponding field option in the system\n" + + "4.Certification type,Certification Level,Responsible Field, field is a multi-select attribute and must match the corresponding field in the system. If multiple fields are filled in, separate them by commas (,)\n" + + "5.Number,Sub-Title,WVTA ID,Comments,Fill in the text\n" + + "6.Deliverable Template,When filling in the field, you need to create a folder in the directory of the same level as the file with the name of the standard number and place the file in the folder. If b. diocx is stored under the AAA standard number, enter AAA/B.docx"; + } + + + for (int i = 0; i < 3; i++) { + //表头 + Row row = sheet.createRow(i);//开始创建标题行 + String[] headerArr = titleOne.split(","); + int lineTemp = index; + if (i == 0) { + for (int m = 0; m < headerArr.length; m++) { + if (m < index) { + row.createCell(m).setCellValue(headerArr[m]); + } else { + row.createCell(lineTemp).setCellValue(headerArr[m]); + Cell cell = row.getCell(lineTemp); + cell.setCellStyle(cellStyle); + lineTemp = lineTemp + 5; + } + } + + } else if (i == 1) { + //titleTwo + String[] headerArrTwo = titleTwo.split(","); + for (int j = 0; j < headerArrTwo.length; j++) { + row.createCell(10 + j).setCellValue(headerArrTwo[j]); + } + } else { + short height = (short) (7 * 252); + row.setHeight((short) height); + Cell cell = row.createCell(0); + cell.setCellStyle(cellStyleTemp); + cell.setCellValue(new HSSFRichTextString(explain)); + } + } + response.setHeader("Content-Disposition", + "attachment; filename=\"" + fileOriName + ".xls"); + response.setContentType("application/force-download"); + response.flushBuffer(); + os = response.getOutputStream(); + workbook.write(os); + } catch (Exception e) { + e.printStackTrace(); + throw new JeroBootException("下载文件失败,请重试"); + } finally { + IOUtils.closeQuietly(os); + } + + } + + @Override + public void exportData(HttpServletResponse response, HttpServletRequest request, ProjectLawsInventoryEO projectLawsInventoryEO) { + List dataList = new ArrayList<>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(projectLawsInventoryEO, request.getParameterMap()); + queryWrapper.in("project_library_id", projectLawsInventoryEO.getProjectLibraryId()); + if (StringUtils.isNotBlank(projectLawsInventoryEO.getIds())) { + queryWrapper.in("id", Arrays.asList(projectLawsInventoryEO.getIds().split(","))); + } + queryWrapper.orderByDesc("create_time", "serial_number"); + +// int isProjectRole = Integer.parseInt(projectLawsInventoryEO.getRoleCode()); +// if (isProjectRole != Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue()) +// && isProjectRole != Integer.parseInt(ProjectRoleEnum.MANAGER.getValue()) +// && isProjectRole != Integer.parseInt(ProjectRoleEnum.ADMIN.getValue())) { +// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// queryWrapper.and(q -> { +// q.eq("regulation_owner_id", currentUser.getId()). +// or().eq("homologation_engineer_id", currentUser.getId()); +// }); +// } + //导出的数据 + dataList = this.list(queryWrapper); + + //文件 + List fileInfos = getOssFiles(dataList); + + //用户 + List userIdList = new ArrayList<>(); + for (ProjectLawsInventoryEO lawsInventoryEO : dataList) { + getUserIdList(userIdList, lawsInventoryEO); + } + List sysUserList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(userIdList)) { + userIdList = userIdList.stream().distinct().collect(Collectors.toList()); + QueryWrapper sysUserQueryWrapper = new QueryWrapper<>(); + sysUserQueryWrapper.select("id,username"); + sysUserQueryWrapper.lambda().in(SysUser::getId, userIdList); + sysUserList = sysUserMapper.selectList(sysUserQueryWrapper); + } + + //所有用户 +// List sysUserList = sysUserService.list(); + //数据转换(文件名称,对应标准) + dataTransition(dataList, fileInfos, sysUserList, projectLawsInventoryEO); + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + this.dataDispose(dataList, currentUser, Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue()), projectLawsInventoryEO.getCut()); + OutputStream os = null; + try { + response.setContentType("application/force-download"); + Workbook workbook = new XSSFWorkbook(); + String path = uploadpath + "/tempZip"; + File fileTemp = new File(path); + if (fileTemp.exists()) { + fileTemp.delete(); + } + fileTemp.mkdirs(); + //文件 + exportFile(dataList, fileInfos); + String excelName = projectLawsInventoryEO.getExcelName() + ".xlsx"; +// String excelName = ""; +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// excelName = "法规清单.xlsx"; +// }else{ +// excelName = "Regulation List.xlsx"; +// } + //excel + OutputStream excelOS = new FileOutputStream(path + File.separator + excelName); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + workbook = ExcelExportUtil.exportExcel(exportParams, ProjectLawsInventoryEO.class, dataList); + } else { + List dataListEn = new ArrayList<>(); + for (ProjectLawsInventoryEO projectLawsInventoryEOTemp : dataList) { + ProjectLawsInventoryEOEn ProjectLawsInventoryEOEn = new ProjectLawsInventoryEOEn(); + BeanUtils.copyProperties(projectLawsInventoryEOTemp, ProjectLawsInventoryEOEn); + dataListEn.add(ProjectLawsInventoryEOEn); + } + //下拉选中英文转换 + transition(dataListEn, projectLawsInventoryEO); + workbook = ExcelExportUtil.exportExcel(exportParams, ProjectLawsInventoryEOEn.class, dataListEn); + } + + workbook.write(excelOS); + excelOS.flush(); + + ZipUtil.zip(path, path + ".zip"); + //文件 + FileInputStream fis = new FileInputStream(path + ".zip"); + os = response.getOutputStream(); + + int len = 0; + while ((len = fis.read()) != -1) { + os.write(len); + } + os.flush(); + fis.close(); + } catch (IOException e) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + throw new JeroBootException("下载文件失败"); + } else { + throw new JeroBootException("Failed to download file"); + } + } finally { + IOUtils.closeQuietly(os); + File file = new File(uploadpath + "/tempZip"); + FileUtil.deleteContents(file); + } + + } + + private void getUserIdList(List userIdList, ProjectLawsInventoryEO lawsInventoryEO) { + //认证工程师id + if (StringUtils.isNotEmpty(lawsInventoryEO.getHomologationEngineerId())) { + userIdList.add(lawsInventoryEO.getHomologationEngineerId()); + } + //法规工程师id + if (StringUtils.isNotEmpty(lawsInventoryEO.getRegulationOwnerId())) { + userIdList.add(lawsInventoryEO.getRegulationOwnerId()); + } + //工程接口人id + if (StringUtils.isNotEmpty(lawsInventoryEO.getEngineeringInterfacePerson())) { + userIdList.add(lawsInventoryEO.getEngineeringInterfacePerson()); + } + + //设计符合性确认 + //发起人 + if (StringUtils.isNotEmpty(lawsInventoryEO.getDesignInitiatorId())) { + userIdList.add(lawsInventoryEO.getDesignInitiatorId()); + } + //责任人 + if (StringUtils.isNotEmpty(lawsInventoryEO.getDesignDutyId())) { + userIdList.add(lawsInventoryEO.getDesignDutyId()); + } + + //prehomo确认 + //发起人 + if (StringUtils.isNotEmpty(lawsInventoryEO.getPrehomoInitiatorId())) { + userIdList.add(lawsInventoryEO.getPrehomoInitiatorId()); + } + //责任人 + if (StringUtils.isNotEmpty(lawsInventoryEO.getPrehomoDutyId())) { + userIdList.add(lawsInventoryEO.getPrehomoDutyId()); + } + + //验证符合性确认 + //发起人 + if (StringUtils.isNotEmpty(lawsInventoryEO.getVerifyInitiatorId())) { + userIdList.add(lawsInventoryEO.getVerifyInitiatorId()); + } + //责任人 + if (StringUtils.isNotEmpty(lawsInventoryEO.getVerifyDutyId())) { + userIdList.add(lawsInventoryEO.getVerifyDutyId()); + } + } + + + private void transition(List dataListEn, ProjectLawsInventoryEO projectLawsInventoryEOTemp) { + //下拉选数据字典 + List sysCategoryList = sysCategoryService.list(); + + //技术领域数据字典 + List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); + for (ProjectLawsInventoryEOEn projectLawsInventoryEOEn : dataListEn) { + + //设计交付物类型 inventoryInfoEO + if (StringUtils.isNotBlank(projectLawsInventoryEOEn.getDesignDeliverableType())) { + StringBuilder sb = getStringBuilder(projectLawsInventoryEOTemp, sysCategoryList, projectLawsInventoryEOEn.getDesignDeliverableType()); + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + projectLawsInventoryEOEn.setDesignDeliverableType(substring); + } + } + //pre交付物类型 + if (StringUtils.isNotBlank(projectLawsInventoryEOEn.getPrehomoDeliverableType())) { + StringBuilder sb = getStringBuilder(projectLawsInventoryEOTemp, sysCategoryList, projectLawsInventoryEOEn.getPrehomoDeliverableType()); + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + projectLawsInventoryEOEn.setPrehomoDeliverableType(substring); + } + } + //验证交付物类型 + if (StringUtils.isNotBlank(projectLawsInventoryEOEn.getVerifyDeliverableType())) { + StringBuilder sb = getStringBuilder(projectLawsInventoryEOTemp, sysCategoryList, projectLawsInventoryEOEn.getVerifyDeliverableType()); + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + projectLawsInventoryEOEn.setVerifyDeliverableType(substring); + } + } + + + //适用地区 + String region = projectLawsInventoryEOEn.getRegion(); + String pullRegion = pull(sysDictItems, region, "region"); + if (StringUtils.isNotBlank(pullRegion)) { + projectLawsInventoryEOEn.setRegion(pullRegion); + } + //适用范围shi4Yong4Fan4Wei2 +// St + + //状态state +// String state = projectLawsInventoryEOEn.getState(); +// String pullState = pull(sysDictItems, state,"state"); +// if(StringUtils.isNotBlank(pullState)){ +// projectLawsInventoryEOEn.setState(pullState); +// } + ///认证类型attestationType + String attestationType = projectLawsInventoryEOEn.getAttestationType(); + String pullAttestationType = pull(sysDictItems, attestationType, "attestation_type"); + if (StringUtils.isNotBlank(pullAttestationType)) { + projectLawsInventoryEOEn.setAttestationType(pullAttestationType); + } + //责任领域dutyTerritory + String dutyTerritory = projectLawsInventoryEOEn.getDutyTerritory(); + String pullDutyTerritory = pull(sysDictItems, dutyTerritory, "duty_territory"); + if (StringUtils.isNotBlank(pullDutyTerritory)) { + projectLawsInventoryEOEn.setDutyTerritory(pullDutyTerritory); + } + //认证级别attestationRank + String attestationRank = projectLawsInventoryEOEn.getAttestationRank(); + String pullAttestationRank = pull(sysDictItems, attestationRank, "attestation_rank"); + if (StringUtils.isNotBlank(pullAttestationRank)) { + projectLawsInventoryEOEn.setAttestationRank(pullAttestationRank); + } + //实施类别implementType + String implementType = projectLawsInventoryEOEn.getImplementType(); + String pullImplementType = pull(sysDictItems, implementType, "implement_type"); + if (StringUtils.isNotBlank(pullImplementType)) { + projectLawsInventoryEOEn.setImplementType(pullImplementType); + } + //设计交付物类型designDeliverableType + String designDeliverableType = projectLawsInventoryEOEn.getDesignDeliverableType(); + String pullDesignDeliverableType = pull(sysDictItems, designDeliverableType, "deliverable_template"); + if (StringUtils.isNotBlank(pullDesignDeliverableType)) { + projectLawsInventoryEOEn.setDesignDeliverableType(pullDesignDeliverableType); + } + + //pre交付物类型prehomoDeliverableType + String prehomoDeliverableType = projectLawsInventoryEOEn.getPrehomoDeliverableType(); + String pullPrehomoDeliverableType = pull(sysDictItems, prehomoDeliverableType, "deliverable_template"); + if (StringUtils.isNotBlank(pullPrehomoDeliverableType)) { + projectLawsInventoryEOEn.setPrehomoDeliverableType(pullPrehomoDeliverableType); + } + + //验证交付物类型verifyDeliverableType + String verifyDeliverableType = projectLawsInventoryEOEn.getVerifyDeliverableType(); + String pullVerifyDeliverableType = pull(sysDictItems, verifyDeliverableType, "deliverable_template"); + if (StringUtils.isNotBlank(pullVerifyDeliverableType)) { + projectLawsInventoryEOEn.setVerifyDeliverableType(pullVerifyDeliverableType); + } + //清单确认状态 + String inventoryAffirmStatus = projectLawsInventoryEOEn.getInventoryAffirmStatus(); + if (StringUtils.isNotBlank(inventoryAffirmStatus)) { + projectLawsInventoryEOEn.setInventoryAffirmStatusName(inventoryAffirmStatus); + } + + //任务确认状态 + String taskAffirmStatus = projectLawsInventoryEOEn.getTaskAffirmStatus(); + if (StringUtils.isNotBlank(taskAffirmStatus)) { + projectLawsInventoryEOEn.setTaskAffirmStatusName(taskAffirmStatus); + } + } + } + + private String pull(List sysDictItems, String field, String dictCode) { + if (StringUtils.isBlank(field)) { + return null; + } + StringBuilder sb = new StringBuilder(); + for (String s : field.split(",")) { + List collect = sysDictItems.stream().filter(e -> dictCode.equals(e.getDictCode()) && s.equals(e.getItemValue())).collect(Collectors.toList()); + if (collect.size() != 0) { + sb.append(collect.get(0).getEnName() + ","); + } + } + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + return substring; + } + return null; + } + + @SneakyThrows + @Override + public void importData(MultipartFile file, ProjectLawsInventoryEO projectLawsInventoryEO) { +// String title = ""; +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// title = "*编号,子标题,WVTA ID," + +// "实施类别,认证类型,*认证级别,适用增补件," + +// "*责任领域,法规工程师,认证工程师,工程接口人," + +// "备注," + +// "设计交付物类型,设计交付物模板,设计发起人,设计责任人,设计截止时间,设计交付物说明," + +// "pre交付物类型,pre交付物模板,pre发起人,pre责任人,pre截止时间,pre交付物说明," + +// "验证交付物类型,验证交付物模板,验证发起人,验证责任人,验证截止时间,验证交付物说明"; +// }else{ +// title = "*Number,Sub-Title,WVTA ID," + +// "Usage,Certification Type,*Certification Level,Applicable Supplement," + +// "*Responsible Field,Regulation Engineer,Homologation Engineer,Engineering Interface," + +// "Comments," + +// "design Deliverable Type,design Deliverable Template,design initiator,design Assignee,design Due Date,design Deliverable Description," + +// "pre Deliverable Type,pre Deliverable Template,pre initiator,pre Assignee,pre Due Date,pre Deliverable Description," + +// "verify Deliverable Type,verify Deliverable Template,verify initiator,verify Assignee,verify Due Date,verify Deliverable Description"; +// } + + int pos = file.getOriginalFilename().lastIndexOf("."); + String str = file.getOriginalFilename().substring(pos + 1).toLowerCase(); + String filenameorg = file.getOriginalFilename().substring(0, pos); + //判断上传文件必须是zip + if (!str.equals("zip")) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + throw new JeroBootException("请上传zip格式的文件或rar格式的文件"); + } else { + throw new JeroBootException("Please upload a zip file or rar file"); + } + + } + String path = uploadpath + File.separator + "modal" + File.separator + filenameorg + System.currentTimeMillis(); + File saveDirectory = new File(path); + if (!saveDirectory.isDirectory()) { + saveDirectory.mkdir(); + } + FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + File.separator + file.getOriginalFilename())); + //解压缩 + String zipEntryName = ""; + if (str.equals("zip")) { + zipEntryName = FileUnZip.unZipFiles(path + File.separator + file.getOriginalFilename(), path); + } + + + //判断压缩包下是否只有一个文件夹 + File fileTemp = new File(path); + int length = fileTemp.listFiles().length; + if (length > 2) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + throw new JeroBootException("压缩包中必须有且仅有一个文件夹,请重新上传"); + } else { + throw new JeroBootException("There must be only one folder in the compressed package Please upload it again"); + } + + } + File fileNew = new File(zipEntryName); + List fileList = new ArrayList<>(); + for (File file1 : fileNew.listFiles()) { + if (file1.getName().contains(".xls") || file1.getName().contains(".xlsx")) { + fileList.add(file1); + } + } + if (fileList.size() == 0) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + throw new JeroBootException("压缩包根目录下没有excel作为导入数据,请重新上传"); + } else { + throw new JeroBootException("Excel does not exist in the root directory of the compressed package Please upload it again"); + } + + } else if (fileList.size() > 1) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + throw new JeroBootException("压缩包根目录下仅能存在一个excel为导入数据,请重新上传"); + } else { + throw new JeroBootException("Only one Excel file can be imported in the compressed package root directory. Please upload data again"); + } + + } + + // 数据相关处理, + // 1.获取其中的Excel, + List excelfilelist = FileUnZip.readImpExcelFile(zipEntryName); + System.gc(); + if (excelfilelist.size() < 1) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + throw new JeroBootException("压缩包内没有上传Excel数据"); + } else { + throw new JeroBootException("No Excel data is uploaded in the compressed package"); + } + + } else if (excelfilelist.size() > 1) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + throw new JeroBootException("压缩包内有多个Excel数据源"); + } else { + throw new JeroBootException("There are multiple Excel data sources in the zip package"); + } + + } + String title = ""; + String dataSource = ""; + List datas = new ArrayList<>(); + File excelFile = excelfilelist.get(0); + Workbook workbook = WorkbookFactory.create(excelFile); + List> dataList = new ArrayList<>(); + if (workbook != null) { + DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + Sheet sheet = workbook.getSheetAt(0); + if (sheet != null) { + StringBuilder headerSb = new StringBuilder(); + int rowNos = sheet.getLastRowNum();// 得到excel的总记录条数 + //以sheet页第一行的列数为标记,判断用的是导入模板还是用的列表导出的数据 + short lastCellNum = sheet.getRow(0).getLastCellNum(); + if (lastCellNum == 32) { + dataSource = DataSourceEnum.LIST_DATA.getValue(); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + title = "*编号,标题,子标题," + + "清单确认状态,任务确认状态,适用地区,对应标准," + + "实施类别,新车型实施日期,在产车实施日期,认证类型,*认证级别," + + "适用增补件,WVTA ID,*责任领域,法规工程师,认证工程师,工程接口人,备注," + + "设计交付物类型,设计交付物模板,设计发起人,设计责任人,设计截止时间,设计交付物说明," + + "pre交付物类型,pre交付物模板,pre发起人,pre责任人,pre截止时间,pre交付物说明," + + "验证交付物类型,验证交付物模板,验证发起人,验证责任人,验证截止时间,验证交付物说明"; + } else { + title = "*Number,Title,Sub-Title," + + "List Confirmation Status,Task Confirmation Status,Area,Compare EU/CN," + + "Usage,New Type Execution Date,New Vehicle Execution Date,Certification Type," + + "*Certification Level,Applicable Supplement,WVTA ID,*Responsible Field," + + "Regulation Engineer,Homologation Engineer,Engineering Interface,Comments," + + "design Deliverable Type,design Deliverable Template,design Reviewer,design Assignee,design Due Date,design Deliverable Description," + + "pre Deliverable Type,pre Deliverable Template,pre Reviewer,pre Assignee,pre Due Date,pre Deliverable Description," + + "verify Deliverable Type,verify Deliverable Template,verify Reviewer,verify Assignee,verify Due Date,verify Deliverable Description"; + } + //导入的数据为列表导出的数据 + for (int i = 0; i <= rowNos; i++) { + Row row = sheet.getRow(i); + Row headerRow = sheet.getRow(i); + boolean isBlank = isRowEmpty(row); + String key = ""; + if (row != null && !isBlank) { + int columNos = headerRow.getLastCellNum();// 表头总共的列数 + Map rowList = new LinkedHashMap<>(); + for (int j = 0; j < columNos; j++) { + Cell cell = row.getCell(j); + Cell headerCell = headerRow.getCell(j); + if (cell != null) { + if (i == 0) { + cell.setCellType(HSSFCell.CELL_TYPE_STRING); + headerSb.append(cell.getStringCellValue() + ","); + if (j == 18) { + break; + } + } else if (i == 1) { + if (j > 18) { + String flag = ""; + if (18 < j && j < 25) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + flag = "设计"; + } else { + flag = "design "; + } + key = flag + headerCell.getStringCellValue(); + } + if (24 < j && j < 31) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + flag = "pre"; + } else { + flag = "pre "; + } + key = flag + headerCell.getStringCellValue(); + } + if (30 < j && j < 37) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + flag = "验证"; + } else { + flag = "verify "; + } + key = flag + headerCell.getStringCellValue(); + } + headerSb.append(key + ","); + } + } else if (i > 1) { + List headList = Arrays.asList(headerSb.toString().split(",")); + String field = ""; + if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) { + Date d = cell.getDateCellValue(); + field = fieldConvert(headList.get(j)); + rowList.put(field, df.format(d)); + } else { + field = fieldConvert(headList.get(j)); + cell.setCellType(HSSFCell.CELL_TYPE_STRING); + String stringCellValue = cell.getStringCellValue(); + if (StringUtils.isNotBlank(stringCellValue)) { + String replace = stringCellValue.replace(",", ","); + rowList.put(field, replace); + } else { + rowList.put(field, ""); + } + } + } + } + } + if (i > 1) { + dataList.add(rowList); + } + } + } + } else { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + title = "*编号,标题,子标题," + + "认证类型,*认证级别,适用增补件," + + "*责任领域,法规工程师,工程接口人," + + "备注," + + "设计交付物类型,设计交付物模板,设计责任人,设计截止时间,设计交付物说明," + + "验证交付物类型,验证交付物模板,验证责任人,验证截止时间,验证交付物说明"; + } else { + title = "*Number,Title,Sub-Title," + + "Certification Type,*Certification Level,Applicable Supplement," + + "*Responsible Field,Regulation Engineer,Engineering Interface," + + "Comments," + + "design Deliverable Type,design Deliverable Template,design Assignee,design Due Date,design Deliverable Description," + + "verify Deliverable Type,verify Deliverable Template,verify Assignee,verify Due Date,verify Deliverable Description"; + } + //导入的数据为填写模板的数据 + for (int i = 0; i <= rowNos; i++) { + Row row = sheet.getRow(i); + Row headerRow = sheet.getRow(i); + boolean isBlank = isRowEmpty(row); + String key = ""; + if (row != null && !isBlank) { + int columNos = headerRow.getLastCellNum();// 表头总共的列数 + Map rowList = new LinkedHashMap<>(); + for (int j = 0; j < columNos; j++) { + Cell cell = row.getCell(j); + Cell headerCell = headerRow.getCell(j); + if (cell != null) { + if (i == 0) { + cell.setCellType(HSSFCell.CELL_TYPE_STRING); + headerSb.append(cell.getStringCellValue() + ","); + if (j == 9) { + break; + } + } else if (i == 1) { + if (j > 9) { + String flag = ""; + if (9 < j && j < 15) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + flag = "设计"; + } else { + flag = "design "; + } + key = flag + headerCell.getStringCellValue(); + } + /*if(17 < j && j < 24){ + if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ + flag ="pre"; + }else{ + flag ="pre "; + } + key = flag + headerCell.getStringCellValue(); + }*/ + if (14 < j && j < 20) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + flag = "验证"; + } else { + flag = "verify "; + } + key = flag + headerCell.getStringCellValue(); + } + headerSb.append(key + ","); + } + } else if (i > 2) { + List headList = Arrays.asList(headerSb.toString().split(",")); + String field = ""; + if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) { + Date d = cell.getDateCellValue(); + field = fieldConvert(headList.get(j)); + rowList.put(field, df.format(d)); + } else { + field = fieldConvert(headList.get(j)); + cell.setCellType(HSSFCell.CELL_TYPE_STRING); + String stringCellValue = cell.getStringCellValue(); + if (StringUtils.isNotBlank(stringCellValue)) { + String replace = stringCellValue.replace(",", ","); + rowList.put(field, replace); + } else { + rowList.put(field, ""); + } + } + } + } + } + if (i > 2) { + dataList.add(rowList); + } + } + } + } + + + if (dataList.size() == 0) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + throw new JeroBootException("请填写必填字段内容,带*的为必填"); + } else { + throw new JeroBootException("Please fill in the required fields marked with *"); + } + + } else { + //数据转换 JSON.parseObject(JSON.toJSONString(map), MyUser.class) + for (Map stringStringMap : dataList) { + ProjectLawsInventoryEO projectLawsInventoryEOTemp = JSON.parseObject(JSON.toJSONString(stringStringMap), ProjectLawsInventoryEO.class); + projectLawsInventoryEOTemp.setCut(projectLawsInventoryEO.getCut()); + projectLawsInventoryEOTemp.setProjectLibraryId(projectLawsInventoryEO.getProjectLibraryId()); + projectLawsInventoryEOTemp.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryEOTemp.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryEOTemp.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + projectLawsInventoryEOTemp.setVerifyFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + datas.add(projectLawsInventoryEOTemp); + } + } + // 校验头部是否符合模板 + String substring = headerSb.toString(); + if (substring.endsWith(",") || substring.endsWith(",")) { + substring = headerSb.substring(0, headerSb.length() - 1); + } + + String excelHeader = substring.toString(); + if (!title.equals(excelHeader)) { + workbook.close(); + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + throw new JeroBootException("读取失败,请严格按照模板文件导入数据"); + } else { + throw new JeroBootException("The data fails to be read. Import data strictly according to the template file"); + } + + } + } + } + workbook.close(); + List categoryList = sysCategoryService.list(); + //普通数据字典 + List dictItemList = sysDictItemServiceImpl.selectItemsAll(); + importDatas(datas, dictItemList, zipEntryName, saveDirectory, projectLawsInventoryEO, categoryList, dataSource); + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + + } +// @SneakyThrows +// @Override +// public void importData(MultipartFile file, ProjectLawsInventoryEO projectLawsInventoryEO) { +// String title = ""; +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// title = "*编号,子标题,WVTA ID," + +// "实施类别,认证类型,*认证级别,适用增补件," + +// "*责任领域,法规工程师,认证工程师,工程接口人," + +// "备注," + +// "设计交付物类型,设计交付物模板,设计发起人,设计责任人,设计截止时间,设计交付物说明," + +// "pre交付物类型,pre交付物模板,pre发起人,pre责任人,pre截止时间,pre交付物说明," + +// "验证交付物类型,验证交付物模板,验证发起人,验证责任人,验证截止时间,验证交付物说明"; +// }else{ +// title = "*Number,Sub-Title,WVTA ID," + +// "Usage,Certification Type,*Certification Level,Applicable Supplement," + +// "*Responsible Field,Regulation Engineer,Homologation Engineer,Engineering Interface," + +// "Comments," + +// "design Deliverable Type,design Deliverable Template,design initiator,design Assignee,design Due Date,design Deliverable Description," + +// "pre Deliverable Type,pre Deliverable Template,pre initiator,pre Assignee,pre Due Date,pre Deliverable Description," + +// "verify Deliverable Type,verify Deliverable Template,verify initiator,verify Assignee,verify Due Date,verify Deliverable Description"; +// } +// +// int pos = file.getOriginalFilename().lastIndexOf("."); +// String str = file.getOriginalFilename().substring(pos + 1).toLowerCase(); +// String filenameorg = file.getOriginalFilename().substring(0, pos); +// //判断上传文件必须是zip +// if (!str.equals("zip")) { +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// throw new JeroBootException("请上传zip格式的文件或rar格式的文件"); +// }else{ +// throw new JeroBootException("Please upload a zip file or rar file"); +// } +// +// } +// String path = uploadpath + File.separator + "modal" + File.separator + filenameorg + System.currentTimeMillis(); +// File saveDirectory = new File(path); +// if (!saveDirectory.isDirectory()) { +// saveDirectory.mkdir(); +// } +// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + File.separator + file.getOriginalFilename())); +// //解压缩 +// String zipEntryName = ""; +// if (str.equals("zip")) { +// zipEntryName = FileUnZip.unZipFiles(path + File.separator + file.getOriginalFilename(), path); +// } +// +// +// //判断压缩包下是否只有一个文件夹 +// File fileTemp = new File(path); +// int length = fileTemp.listFiles().length; +// if (length > 2) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// throw new JeroBootException("压缩包中必须有且仅有一个文件夹,请重新上传"); +// }else{ +// throw new JeroBootException("There must be only one folder in the compressed package Please upload it again"); +// } +// +// } +// File fileNew = new File(zipEntryName); +// List fileList = new ArrayList<>(); +// for (File file1 : fileNew.listFiles()) { +// if (file1.getName().contains(".xls") || file1.getName().contains(".xlsx")) { +// fileList.add(file1); +// } +// } +// if (fileList.size() == 0) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// throw new JeroBootException("压缩包根目录下没有excel作为导入数据,请重新上传"); +// }else{ +// throw new JeroBootException("Excel does not exist in the root directory of the compressed package Please upload it again"); +// } +// +// } else if (fileList.size() > 1) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// throw new JeroBootException("压缩包根目录下仅能存在一个excel为导入数据,请重新上传"); +// }else{ +// throw new JeroBootException("Only one Excel file can be imported in the compressed package root directory. Please upload data again"); +// } +// +// } +// +// // 数据相关处理, +// // 1.获取其中的Excel, +// List excelfilelist = FileUnZip.readImpExcelFile(zipEntryName); +// System.gc(); +// if (excelfilelist.size() < 1) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// throw new JeroBootException("压缩包内没有上传Excel数据"); +// }else{ +// throw new JeroBootException("No Excel data is uploaded in the compressed package"); +// } +// +// } else if (excelfilelist.size() > 1) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// throw new JeroBootException("压缩包内有多个Excel数据源"); +// }else{ +// throw new JeroBootException("There are multiple Excel data sources in the zip package"); +// } +// +// } +// List datas = new ArrayList<>(); +// File excelFile = excelfilelist.get(0); +// Workbook workbook = WorkbookFactory.create(excelFile); +// List> dataList = new ArrayList<>(); +// if (workbook != null) { +// DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); +// Sheet sheet = workbook.getSheetAt(0); +// if (sheet != null) { +// StringBuilder headerSb = new StringBuilder(); +// int rowNos = sheet.getLastRowNum();// 得到excel的总记录条数 +// for (int i = 0; i <= rowNos; i++) { +// Row row = sheet.getRow(i); +// Row headerRow = sheet.getRow(i); +// boolean isBlank = isRowEmpty(row); +// String key = ""; +// if (row != null && !isBlank) { +// int columNos = headerRow.getLastCellNum();// 表头总共的列数 +// Map rowList = new LinkedHashMap<>(); +// for (int j = 0; j < columNos; j++) { +// Cell cell = row.getCell(j); +// Cell headerCell = headerRow.getCell(j); +// if (cell != null) { +// if (i == 0) { +// cell.setCellType(HSSFCell.CELL_TYPE_STRING); +// headerSb.append(cell.getStringCellValue() + ","); +// if(j == 11){ +// break; +// } +// }else if(i == 1){ +// if(j > 11){ +// String flag = ""; +// if(11 < j && j < 18){ +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// flag ="设计"; +// }else{ +// flag ="design "; +// } +// key = flag + headerCell.getStringCellValue(); +// } +// if(17 < j && j < 24){ +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// flag ="pre"; +// }else{ +// flag ="pre "; +// } +// key = flag + headerCell.getStringCellValue(); +// } +// if(23 < j && j < 30){ +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// flag ="验证"; +// }else{ +// flag ="verify "; +// } +// key = flag + headerCell.getStringCellValue(); +// } +// headerSb.append(key + ","); +// } +// } else if(i > 2){ +// List headList = Arrays.asList(headerSb.toString().split(",")); +// String field =""; +// if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) { +// Date d = cell.getDateCellValue(); +// field = fieldConvert(headList.get(j)); +// rowList.put(field, df.format(d)); +// } else { +// field = fieldConvert(headList.get(j)); +// cell.setCellType(HSSFCell.CELL_TYPE_STRING); +// String stringCellValue = cell.getStringCellValue(); +// if (StringUtils.isNotBlank(stringCellValue)) { +// String replace = stringCellValue.replace(",", ","); +// rowList.put(field, replace); +// } else { +// rowList.put(field, ""); +// } +// } +// } +// } +// } +// if (i > 2) { +// dataList.add(rowList); +// } +// } +// } +// +// if (dataList.size() == 0) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// throw new JeroBootException("请填写必填字段内容,带*的为必填"); +// }else{ +// throw new JeroBootException("Please fill in the required fields marked with *"); +// } +// +// }else{ +// //数据转换 JSON.parseObject(JSON.toJSONString(map), MyUser.class) +// for (Map stringStringMap : dataList) { +// ProjectLawsInventoryEO projectLawsInventoryEOTemp = JSON.parseObject(JSON.toJSONString(stringStringMap), ProjectLawsInventoryEO.class); +// projectLawsInventoryEOTemp.setCut(projectLawsInventoryEO.getCut()); +// projectLawsInventoryEOTemp.setProjectLibraryId(projectLawsInventoryEO.getProjectLibraryId()); +// projectLawsInventoryEOTemp.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue()); +// projectLawsInventoryEOTemp.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); +// datas.add(projectLawsInventoryEOTemp); +// } +// } +// // 校验头部是否符合模板 +// String substring = headerSb.toString(); +// if (substring.endsWith(",") || substring.endsWith(",")){ +// substring = headerSb.substring(0, headerSb.length() - 1); +// } +// +// String excelHeader = substring.toString(); +// if (!title.equals(excelHeader)) { +// workbook.close(); +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// throw new JeroBootException("读取失败,请严格按照模板文件导入数据"); +// }else{ +// throw new JeroBootException("The data fails to be read. Import data strictly according to the template file"); +// } +// +// } +// } +// } +// workbook.close(); +// List categoryList = sysCategoryService.list(); +// //普通数据字典 +// List dictItemList = sysDictItemServiceImpl.selectItemsAll(); +// importDatas(datas, dictItemList, zipEntryName,saveDirectory,projectLawsInventoryEO,categoryList); +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// +// } + + @Override + @Transactional + public Result change(JSONObject parmas) { + String ids = parmas.getString("ids"); + String projectLibraryId = parmas.getString("projectLibraryId"); + String operateType = parmas.getString("operateType"); + resetFlow(ids, projectLibraryId, operateType); + return Result.OK("变更成功!"); + } + + private void resetFlow(String ids, String projectLibraryId, String operateType) { + if (StringUtils.isNotEmpty(ids)) { + + List piFlowTypeList = new ArrayList<>(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectLawsInventoryEO::getId, Arrays.asList(ids.split(","))); + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + List projectLawsInventoryEOS = this.list(queryWrapper); + + List idList = Arrays.asList(ids.split(",")); + String projectLawsInventoryIds = ids; + String pIds = ""; + + ProjectLawsInventoryEO projectLawsInventoryEO = new ProjectLawsInventoryEO(); + projectLawsInventoryEO.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryEO.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + //清单、任务确认初始化。 + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.in(ProjectLawsInventoryEO::getId, idList); + updateWrapper.set(ProjectLawsInventoryEO::getRegulationOwnerSubmitStatus, null); + updateWrapper.set(ProjectLawsInventoryEO::getHomologationEngineerSubmitStatus, null); + updateWrapper.set(ProjectLawsInventoryEO::getSendMsgFlag, null); + updateWrapper.set(ProjectLawsInventoryEO::getSendMsgCurrentFlag, null); + //updateWrapper.set(ProjectLawsInventoryEO::getDesignDueDate,null); + //updateWrapper.set(ProjectLawsInventoryEO::getPrehomoDueDate,null); + //updateWrapper.set(ProjectLawsInventoryEO::getVerifyDueDate,null); + updateWrapper.set(ProjectLawsInventoryEO::getInventoryAffirmDueDate, null); + updateWrapper.set(ProjectLawsInventoryEO::getTaskAffirmDueDate, null); + + // 区分重置设计、验证、全部流程 + if(StringUtils.equals(operateType, OperatorTypeEnum.LAWS_INVENTORY_ALL_RESET_FLOW.getValue())){ + updateWrapper.set(ProjectLawsInventoryEO::getDesignFlowStatus, ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + updateWrapper.set(ProjectLawsInventoryEO::getVerifyFlowStatus, ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + piFlowTypeList.add(FlowTypeEnum.SJFHXSHLC.getValue()); + piFlowTypeList.add(FlowTypeEnum.YZFHXSCLC.getValue()); + piFlowTypeList.add(FlowTypeEnum.SJ_XGJFWLC.getValue()); + piFlowTypeList.add(FlowTypeEnum.YZ_XGJFWLC.getValue()); + }else if(StringUtils.equals(operateType,OperatorTypeEnum.LAWS_INVENTORY_DESIGN_RESET_FLOW.getValue())){ + updateWrapper.set(ProjectLawsInventoryEO::getDesignFlowStatus, ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + piFlowTypeList.add(FlowTypeEnum.SJFHXSHLC.getValue()); + piFlowTypeList.add(FlowTypeEnum.SJ_XGJFWLC.getValue()); + }else if(StringUtils.equals(operateType,OperatorTypeEnum.LAWS_INVENTORY_VERIFY_RESET_FLOW.getValue())){ + updateWrapper.set(ProjectLawsInventoryEO::getVerifyFlowStatus, ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + piFlowTypeList.add(FlowTypeEnum.YZFHXSCLC.getValue()); + piFlowTypeList.add(FlowTypeEnum.YZ_XGJFWLC.getValue()); + } + + super.update(projectLawsInventoryEO, updateWrapper); + + QueryWrapper processInfoQueryWrap = new QueryWrapper<>(); + processInfoQueryWrap.lambda().in(ProcessInfoEO::getProjectLawsInventoryId, idList); + processInfoQueryWrap.lambda().in(ProcessInfoEO::getFlowType,piFlowTypeList); + List processInfoEOList = this.processInfoEOService.list(processInfoQueryWrap); + List actiProcInstIdList = processInfoEOList.stream().map(ProcessInfoEO::getActiProcInstId).distinct().collect(Collectors.toList()); + + pIds = actiProcInstIdList.stream().map(String::valueOf).collect(Collectors.joining(",")); + + + JSONObject params = new JSONObject(); + params.put("projectLawsInventoryIds", projectLawsInventoryIds); + params.put("pIds", pIds); + //根据流程实例id 、 法规清单id 删除相关流程。 +// workFlowFeignClient.deleteProcessInstanceByProjectLawsInventoryIds(params); + + //清除流程中心对应的数据 + params.put("ids", ids); + params.put("operateType", operateType); + this.processInfoEOService.change(params); + + // 删除流程历史数据 + this.processHistoryEOService.deleteBiActiProcInstIdList(actiProcInstIdList); + + this.lawsInventoryEOListSortByInventoryAffirmDueDate(projectLawsInventoryEOS); + Date inventoryAffirmDueDate = projectLawsInventoryEOS.get(0).getInventoryAffirmDueDate(); + String endTime = ""; + if (inventoryAffirmDueDate != null) { + endTime = DateUtils.formatDate(inventoryAffirmDueDate); + } + + // 给法规工程师发消息 + List userIdList = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getRegulationOwnerId).distinct().collect(Collectors.toList()); + String serialNumbers = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + Map paramsMsg = new HashMap<>(); + paramsMsg.put("contentCn", "您好,该法规已被发起人撤回。"); + paramsMsg.put("contentEn", "Hello! This regulation has been withdrawn by the initiator."); + paramsMsg.put("projectLibraryId", projectLibraryId); + paramsMsg.put("endTime", endTime); + paramsMsg.put("userIdList", userIdList); + paramsMsg.put("serialNumbers", serialNumbers); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取法规清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getProjectLawsInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN, com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + paramsMsg.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + paramsMsg.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + paramsMsg.put("hrefFeishu_CN_P", (String) hrefFeishuMap.get("hrefFeishu_CN_P")); + paramsMsg.put("Initiator", projectLibraryBase.getStudioEngineerName()); + + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE2.getValue(), paramsMsg); + } + } + } + + private void importDatas(List dataList, + List dictItemList, + String zipEntryName, + File saveDirectory, + ProjectLawsInventoryEO projectLawsInventoryEOTemp, + List categoryList, + String dataSource) { + List msgList = new ArrayList<>(); + if (DataSourceEnum.LIST_DATA.getValue().equals(dataSource)) { + //列表数据验证 + msgList = dataListVerify(dataList, dictItemList, zipEntryName, projectLawsInventoryEOTemp, categoryList, dataSource); + } else { + //模板数据验证 + msgList = dataTemplateVerify(dataList, dictItemList, zipEntryName, projectLawsInventoryEOTemp, categoryList, dataSource); + } + if (msgList.size() > 0) { + //返回报错信息 + String html = ""; + for (String s : msgList) { + html += s + "
"; + } + FileUnZip.deleteDir(saveDirectory); + if (StringUtils.isNotBlank(html)) { + html = html.substring(0, html.length() - 7); + } + throw new JeroBootException(html); + } else { + if (dataList.size() != 0) { + this.saveBatch(dataList); + //项目任务清单数据初始化。 + List projectTaskInventoryEOList = new ArrayList<>(); + //权限添加 + List adds = new ArrayList<>(); + Date now = new Date(); + for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { + ProjectTaskInventoryEO projectTaskInventoryEO = new ProjectTaskInventoryEO(); + String projectTaskInventoryId = UUID.randomUUID().toString().replace("-", ""); + projectTaskInventoryEO.setId(projectTaskInventoryId); + projectTaskInventoryEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId()); + projectLawsInventoryEO.setStandId(projectLawsInventoryEO.getStandId()); + projectTaskInventoryEO.setCertificationProgress(CertificationProgressEnum.NOT_START.getValue()); + projectTaskInventoryEOList.add(projectTaskInventoryEO); + //设置权限 + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId())) { + this.editService.setProjectLawsInventoryPermission(projectLawsInventoryEO.getRegulationOwnerId(), projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_REGULATION.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId())) { + this.editService.setProjectLawsInventoryPermission(projectLawsInventoryEO.getHomologationEngineerId(), projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_HOMOLOGATION.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) { + this.editService.setProjectLawsInventoryPermission(projectLawsInventoryEO.getEngineeringInterfacePerson(), projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_INTERFACE.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getDesignInitiatorId())) { + this.editService.setProjectLawsInventoryPermission(projectLawsInventoryEO.getDesignInitiatorId(), projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_INITIATOR.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())) { + this.editService.setProjectLawsInventoryPermission(projectLawsInventoryEO.getDesignDutyId(), projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_DUTY.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())) { + this.editService.setProjectLawsInventoryPermission(projectLawsInventoryEO.getPrehomoInitiatorId(), projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_INITIATOR.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())) { + this.editService.setProjectLawsInventoryPermission(projectLawsInventoryEO.getPrehomoDutyId(), projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_DUTY.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())) { + this.editService.setProjectLawsInventoryPermission(projectLawsInventoryEO.getVerifyInitiatorId(), projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_INITIATOR.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())) { + this.editService.setProjectLawsInventoryPermission(projectLawsInventoryEO.getVerifyDutyId(), projectLawsInventoryEOTemp.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_DUTY.getValue()); + } + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + this.projectTaskInventoryEOService.saveBatch(projectTaskInventoryEOList); + //初始化项目状态评估 + projectTaskInventoryEOList.forEach(taskInventory -> { + this.initConditionAssessmentEO(taskInventory.getProjectLawsInventoryId()); + }); + + //更新log + String serialNumber = dataList.stream().map(e -> e.getSerialNumber()).collect(Collectors.joining(",")); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String username = sysUser.getUsername(); + String contentLog = username + "向清单中导入了“" + serialNumber + "”"; + String enContentLog = username + " imported “" + serialNumber + "” into the list."; + projectLawsInventoryLogEOService.updateLog(contentLog, dataList.get(0).getProjectLibraryId(), CutEnum.CN.getValue()); + projectLawsInventoryLogEOService.updateLog(enContentLog, dataList.get(0).getProjectLibraryId(), CutEnum.EN.getValue()); + } + } + } + + /** + * 列表数据验证 + * + * @param dataList + * @param dictItemList + * @param zipEntryName + * @param projectLawsInventoryEOTemp + * @param categoryList + * @param dataSource + * @return + */ + @NotNull + private List dataListVerify(List dataList, + List dictItemList, + String zipEntryName, + ProjectLawsInventoryEO projectLawsInventoryEOTemp, + List categoryList, + String dataSource) { + String dictId = sysCategoryMapper.getDictId("deliverable_template"); + List collect = categoryList.stream().filter(e -> e.getSysDictId().equals(dictId)).collect(Collectors.toList()); + List treeNameList = new ArrayList<>(); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + treeNameList = collect.stream().map(SysCategory::getName).collect(Collectors.toList()); + } else { + treeNameList = collect.stream().map(SysCategory::getEnName).collect(Collectors.toList()); + } + int i = 2; + List msgList = new ArrayList<>(); + String value = ""; + boolean flag = true; + + //编号验证 + verifySerialNumber(dataList, projectLawsInventoryEOTemp, dataSource); + for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { + i++; + String errorMsg = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + errorMsg = "第" + i + "行:"; + } else { + errorMsg = i + " line:"; + } + //编号 + String serialNumber = projectLawsInventoryEO.getSerialNumber(); + //子标题subtitle + String subtitle = projectLawsInventoryEO.getSubtitle(); + //WVTA ID + String wvtaId = projectLawsInventoryEO.getWvtaId(); + //备注 remark + String remark = projectLawsInventoryEO.getRemark(); + //认证级别 + String attestationRank = projectLawsInventoryEO.getAttestationRank(); + //责任领域 + String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); + //认证类型 + String attestationType = projectLawsInventoryEO.getAttestationType(); + //实施类别 + String implementType = projectLawsInventoryEO.getImplementType(); + //法规工程师regulationOwnerId + String regulationOwnerId = projectLawsInventoryEO.getRegulationOwnerId(); + + //认证工程师homologationEngineerId + String homologationEngineerId = projectLawsInventoryEO.getHomologationEngineerId(); + + //工程接口人engineeringInterfacePerson + String engineeringInterfacePerson = projectLawsInventoryEO.getEngineeringInterfacePerson(); + + //设计交付物类型 + String designDeliverableType = projectLawsInventoryEO.getDesignDeliverableType(); + //设计发起人 + String designInitiator = projectLawsInventoryEO.getDesignInitiatorId(); + //设计责任人 + String designDuty = projectLawsInventoryEO.getDesignDutyId(); + //设计截止时间designDueDate + Date designDueDate = projectLawsInventoryEO.getDesignDueDate(); + + //pre交付物类型 + String prehomoDeliverableType = projectLawsInventoryEO.getPrehomoDeliverableType(); + //pre发起人 + String prehomoInitiator = projectLawsInventoryEO.getPrehomoInitiatorId(); + //pre责任人 + String prehomoDuty = projectLawsInventoryEO.getPrehomoDutyId(); + //pre截止时间prehomoDueDate + Date prehomoDueDate = projectLawsInventoryEO.getPrehomoDueDate(); + + //确认交付物类型 + String verifyDeliverableType = projectLawsInventoryEO.getVerifyDeliverableType(); + //确认发起人 + String verifyInitiator = projectLawsInventoryEO.getVerifyInitiatorId(); + //确认责任人 + String verifyDuty = projectLawsInventoryEO.getVerifyDutyId(); + //确认截止时间verifyDueDate + Date verifyDueDate = projectLawsInventoryEO.getVerifyDueDate(); + String applicableSupplement = projectLawsInventoryEO.getApplicableSupplement(); + + //文件 + String designDeliverableTemplate = projectLawsInventoryEO.getDesignDeliverableTemplate(); + String prehomoDeliverableTemplate = projectLawsInventoryEO.getPrehomoDeliverableTemplate(); + String verifyDeliverableTemplate = projectLawsInventoryEO.getVerifyDeliverableTemplate(); + //标题 + String title = projectLawsInventoryEO.getTitle(); + //清单确认状态 + String inventoryAffirmStatus = projectLawsInventoryEO.getInventoryAffirmStatus(); + //任务确认状态 + String taskAffirmStatus = projectLawsInventoryEO.getTaskAffirmStatus(); + //适用地区 + String region = projectLawsInventoryEO.getRegion(); + //对应标准 + String correspondingStandard = projectLawsInventoryEO.getCorrespondingStandard(); + //新车型实施日期 + Date xin1Che1Xing2Shi2Shi1Ri4Qi1 = projectLawsInventoryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1(); + //在产出实施日期 + Date implementTime = projectLawsInventoryEO.getImplementTime(); + + //清单确认状态,任务确认状态默认为未发起 +// //清单确认状态数据转换 +// if(StringUtils.isNotBlank(inventoryAffirmStatus)){ +// String textByName = InventoryAffirmStatusEnum.getTextByName(inventoryAffirmStatus); +// projectLawsInventoryEO.setInventoryAffirmStatus(textByName); +// } +// //任务确认状态数据转换 +// if(StringUtils.isNotBlank(taskAffirmStatus)){ +// String textByName = TaskAffirmStatusEnum.getTextByName(taskAffirmStatus); +// projectLawsInventoryEO.setTaskAffirmStatus(textByName); +// } + //适用地区数据转换 + if (StringUtils.isNotBlank(region)) { + String regionTemp = pullMore(dictItemList, projectLawsInventoryEO, errorMsg, region, msgList, "适用地区", "Region", "region"); + projectLawsInventoryEO.setRegion(regionTemp); + } + //新车型实施日期验证 + flag = dateVerify(projectLawsInventoryEO, errorMsg, xin1Che1Xing2Shi2Shi1Ri4Qi1, msgList, "新车型实施日", "New Type Execution Date"); + //在产车实施日期验证 + flag = dateVerify(projectLawsInventoryEO, errorMsg, implementTime, msgList, "在产车实施日期", "New Vehicle Execution Date"); + + + //编号(输入框必填) + flag = must(projectLawsInventoryEO, errorMsg, msgList, serialNumber, "编号", "Number"); + + //子标题 + if (StringUtils.isNotBlank(subtitle)) { + if (subtitle.length() > 300) { + String message = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + message = errorMsg + "子标题不能超过300个字符, "; + } else { + message = errorMsg + " Subheadings cannot be checked more than 300 characters, "; + } + msgList.add(message); + } + } + //WVTA ID + if (StringUtils.isNotBlank(wvtaId)) { + if (wvtaId.length() > 100) { + String message = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + message = errorMsg + "WVTA ID不能超过100个字符, "; + } else { + message = errorMsg + " The WVTA ID cannot contain more than 100 characters, "; + } + msgList.add(message); + } + } + //备注 remark + if (StringUtils.isNotBlank(remark)) { + if (remark.length() > 1000) { + String message = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + message = errorMsg + "备注不能超过1000个字符, "; + } else { + message = errorMsg + " Note The value cannot exceed 1000 characters, "; + } + msgList.add(message); + } + } + + //实施类别(单选不必填) + value = pullSingle(dictItemList, projectLawsInventoryEO, errorMsg, implementType, msgList, "实施类别", "Usage", "implement_type"); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setImplementType(value); + } + //认证类型(多选不必填) + value = pullMore(dictItemList, projectLawsInventoryEO, errorMsg, attestationType, msgList, "认证类型", "Certification Type", "attestation_type"); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setAttestationType(value); + } + + //认证级别(多选必填) +// flag = must(projectLawsInventoryEO, errorMsg, msgList, attestationRank,"认证级别","Certification Level"); + if (StringUtils.isNotBlank(projectLawsInventoryEO.getAttestationRank())) { + value = pullMore(dictItemList, projectLawsInventoryEO, errorMsg, attestationRank, msgList, "认证级别", "Certification Level", "attestation_rank"); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setAttestationRank(value); + } + } + + //责任领域(多选必填) +// flag = must(projectLawsInventoryEO, errorMsg, msgList, dutyTerritory,"责任领域","Responsible Field"); + if (StringUtils.isNotBlank(projectLawsInventoryEO.getDutyTerritory())) { + value = pullMore(dictItemList, projectLawsInventoryEO, errorMsg, dutyTerritory, msgList, "责任领域", "Responsible Field", "duty_territory"); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setDutyTerritory(value); + } + } + //工程接口人(责任领域下的工程接口人) + Map objectMap = iProjectRelatedPersonnelService.queryPersonByProjectId(projectLawsInventoryEOTemp.getProjectLibraryId(), value); + + //法规工程师 + List> mapLawList = (List>) objectMap.get("lawEngineerList"); + //认证工程师 + List> mapCertificationList = (List>) objectMap.get("certificationEngineerList"); + //工程接口人 + List> mapPersonList = (List>) objectMap.get("engineeringInterfacePersonList"); + //所有人 + List> allPersonList = (List>) objectMap.get("allPersonList"); + + String nameCn = ""; + String nameEn = ""; + //法规工程师 + if (StringUtils.isNotBlank(regulationOwnerId)) { + nameCn = "法规工程师"; + nameEn = "regulatory engineer"; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, regulationOwnerId, mapLawList, nameCn, nameEn, ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + } + + //认证工程师 + if (StringUtils.isNotBlank(homologationEngineerId)) { + nameCn = "认证工程师"; + nameEn = "certification engineer "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, homologationEngineerId, mapCertificationList, nameCn, nameEn, ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue()); + } + + //工程接口人 + if (StringUtils.isNotBlank(engineeringInterfacePerson)) { + nameCn = "工程接口人"; + nameEn = "Engineering Interface "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, engineeringInterfacePerson, mapPersonList, nameCn, nameEn, ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue()); + } + + + //设计 + //交付物类型 + value = tree(categoryList, treeNameList, projectLawsInventoryEO, errorMsg, designDeliverableType, msgList, "交付物类型", "Deliverable Type", "deliverable_template"); + if (StringUtils.isNotBlank(value)) { + String treeId = getTreeId(categoryList, projectLawsInventoryEOTemp, treeNameList, value); + projectLawsInventoryEO.setDesignDeliverableType(treeId); + } + + //交付物模板 + value = templateTransition(zipEntryName, projectLawsInventoryEO, errorMsg, designDeliverableTemplate, msgList, "交付物模板", "Deliverable Template", dataSource); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setDesignDeliverableTemplate(value); + } + + //发起人 + if (StringUtils.isNotBlank(designInitiator)) { + nameCn = "设计符合性确认发起人"; + nameEn = "confirm design conformance initiator "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, designInitiator, allPersonList, nameCn, nameEn, ProjectRoleEnum.DESIGNINITIATOR.getValue()); + } + + //责任人 + if (StringUtils.isNotBlank(designDuty)) { + nameCn = "设计符合性确认责任人"; + nameEn = "confirm design conformance responsible"; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, designDuty, allPersonList, nameCn, nameEn, ProjectRoleEnum.DESIGNDUTY.getValue()); + } + + //截止时间 + flag = dateVerify(projectLawsInventoryEO, errorMsg, designDueDate, msgList, "截止时间", "due date"); + if (flag) { + projectLawsInventoryEO.setDesignDueDate(designDueDate); + } + + + //pre + //交付物类型 + value = tree(categoryList, treeNameList, projectLawsInventoryEO, errorMsg, prehomoDeliverableType, msgList, "交付物类型", "Deliverable Type", "deliverable_template"); + if (StringUtils.isNotBlank(value)) { + String treeId = getTreeId(categoryList, projectLawsInventoryEOTemp, treeNameList, value); + projectLawsInventoryEO.setPrehomoDeliverableType(treeId); + } + + //交付物模板 + value = templateTransition(zipEntryName, projectLawsInventoryEO, errorMsg, prehomoDeliverableTemplate, msgList, "交付物模板", "Deliverable Template", dataSource); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setPrehomoDeliverableTemplate(value); + } + + //发起人 + if (StringUtils.isNotBlank(prehomoInitiator)) { + nameCn = "Pre-homo确认发起人"; + nameEn = "Pre-homo identifies the initiator "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, prehomoInitiator, allPersonList, nameCn, nameEn, ProjectRoleEnum.PREHOMOINITIATOR.getValue()); + } + + //责任人 + if (StringUtils.isNotBlank(prehomoDuty)) { + nameCn = "Pre-homo确认责任人"; + nameEn = "Pre-homo identifies the person responsible "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, prehomoDuty, allPersonList, nameCn, nameEn, ProjectRoleEnum.PREHOMODUTY.getValue()); + } + + //截止时间 + flag = dateVerify(projectLawsInventoryEO, errorMsg, prehomoDueDate, msgList, "截止时间", "due date"); + if (flag) { + projectLawsInventoryEO.setPrehomoDueDate(prehomoDueDate); + } + + //确认 + //交付物类型 + value = tree(categoryList, treeNameList, projectLawsInventoryEO, errorMsg, verifyDeliverableType, msgList, "交付物类型", "Deliverable Type", "deliverable_template"); + if (StringUtils.isNotBlank(value)) { + String treeId = getTreeId(categoryList, projectLawsInventoryEOTemp, treeNameList, value); + projectLawsInventoryEO.setVerifyDeliverableType(treeId); + } + + //交付物模板 + value = templateTransition(zipEntryName, projectLawsInventoryEO, errorMsg, verifyDeliverableTemplate, msgList, "交付物模板", "Deliverable Template", dataSource); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setVerifyDeliverableTemplate(value); + } + + + //发起人 + if (StringUtils.isNotBlank(verifyInitiator)) { + nameCn = "验证符合性确认发起人"; + nameEn = "verify conformance validates the originator "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, verifyInitiator, allPersonList, nameCn, nameEn, ProjectRoleEnum.VERIFYINITIATOR.getValue()); + } + + //责任人 + if (StringUtils.isNotBlank(verifyDuty)) { + nameCn = "验证符合性确认责任人"; + nameEn = "verify conformance to confirm the responsible person "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, verifyDuty, allPersonList, nameCn, nameEn, ProjectRoleEnum.VERIFYDUTY.getValue()); + } + + + //截止时间 + flag = dateVerify(projectLawsInventoryEO, errorMsg, verifyDueDate, msgList, "截止时间", "due date"); + if (flag) { + projectLawsInventoryEO.setVerifyDueDate(verifyDueDate); + } + } + return msgList; + } + + /** + * 模板数据验证 + * + * @param dataList + * @param dictItemList + * @param zipEntryName + * @param projectLawsInventoryEOTemp + * @param categoryList + * @param dataSource + * @return + */ + @NotNull + private List dataTemplateVerify(List dataList, + List dictItemList, + String zipEntryName, + ProjectLawsInventoryEO projectLawsInventoryEOTemp, + List categoryList, + String dataSource) { + String dictId = sysCategoryMapper.getDictId("deliverable_template"); + List collect = categoryList.stream().filter(e -> e.getSysDictId().equals(dictId)).collect(Collectors.toList()); + List treeNameList = new ArrayList<>(); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + treeNameList = collect.stream().map(SysCategory::getName).collect(Collectors.toList()); + } else { + treeNameList = collect.stream().map(SysCategory::getEnName).collect(Collectors.toList()); + } + int i = 3; + List msgList = new ArrayList<>(); + String value = ""; + boolean flag = true; + + // List dutyTerritoryDictItemList = this.sysDictItemService.selectItemsByDictCode(DicCodeEnum.DUTY_TERRITORY.getCode()); + + List userNameList = new ArrayList<>(); + String designDutyIds = dataList.stream().map(ProjectLawsInventoryEO::getDesignDutyId).collect(Collectors.joining(",")); + String verifyDutyIds = dataList.stream().map(ProjectLawsInventoryEO::getVerifyDutyId).collect(Collectors.joining(",")); + userNameList.addAll(Arrays.asList(designDutyIds.split(","))); + userNameList.addAll(Arrays.asList(verifyDutyIds.split(","))); + List sysUserList = this.sysUserService.querySysUserByUserNameList(userNameList); + + List userIdList = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(dataList)){ + //regulationOwnerId engineeringInterfacePerson + List collect1 = dataList.stream().filter(e -> StringUtils.isNotBlank(e.getRegulationOwnerId())) + .map(ProjectLawsInventoryEO::getRegulationOwnerId).distinct().collect(Collectors.toList()); + List collect2 = dataList.stream().filter(e -> StringUtils.isNotBlank(e.getEngineeringInterfacePerson())) + .map(ProjectLawsInventoryEO::getEngineeringInterfacePerson).distinct().collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect1)){ + userIdList.addAll(collect1); + } + if(ObjectUtils.isNotEmpty(collect2)){ + userIdList.addAll(collect2); + } + } + List userList = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(userIdList)){ + userList = sysUserService.queryUserIdListByNameList(userIdList); + } + //编号验证 + verifySerialNumber(dataList, projectLawsInventoryEOTemp, dataSource); + for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { + i++; + String errorMsg = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + errorMsg = "第" + i + "行:"; + } else { + errorMsg = i + " line:"; + } + //编号 + String serialNumber = projectLawsInventoryEO.getSerialNumber(); + //子标题subtitle + String subtitle = projectLawsInventoryEO.getSubtitle(); + //WVTA ID + String wvtaId = projectLawsInventoryEO.getWvtaId(); + //备注 remark + String remark = projectLawsInventoryEO.getRemark(); + //认证级别 + String attestationRank = projectLawsInventoryEO.getAttestationRank(); + //责任领域 + String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); + //认证类型 + String attestationType = projectLawsInventoryEO.getAttestationType(); + //实施类别 + String implementType = projectLawsInventoryEO.getImplementType(); + //法规工程师regulationOwnerId + String regulationOwnerId = projectLawsInventoryEO.getRegulationOwnerId(); + + //认证工程师homologationEngineerId + String homologationEngineerId = projectLawsInventoryEO.getHomologationEngineerId(); + + //工程接口人engineeringInterfacePerson + String engineeringInterfacePerson = projectLawsInventoryEO.getEngineeringInterfacePerson(); + + //设计交付物类型 + String designDeliverableType = projectLawsInventoryEO.getDesignDeliverableType(); + //设计发起人 + String designInitiator = projectLawsInventoryEO.getDesignInitiatorId(); + //设计责任人 + String designDuty = projectLawsInventoryEO.getDesignDutyId(); + //设计截止时间designDueDate + Date designDueDate = projectLawsInventoryEO.getDesignDueDate(); + + //pre交付物类型 + String prehomoDeliverableType = projectLawsInventoryEO.getPrehomoDeliverableType(); + //pre发起人 + String prehomoInitiator = projectLawsInventoryEO.getPrehomoInitiatorId(); + //pre责任人 + String prehomoDuty = projectLawsInventoryEO.getPrehomoDutyId(); + //pre截止时间prehomoDueDate + Date prehomoDueDate = projectLawsInventoryEO.getPrehomoDueDate(); + + //确认交付物类型 + String verifyDeliverableType = projectLawsInventoryEO.getVerifyDeliverableType(); + //确认发起人 + String verifyInitiator = projectLawsInventoryEO.getVerifyInitiatorId(); + //确认责任人 + String verifyDuty = projectLawsInventoryEO.getVerifyDutyId(); + //确认截止时间verifyDueDate + Date verifyDueDate = projectLawsInventoryEO.getVerifyDueDate(); + + //文件 + String designDeliverableTemplate = projectLawsInventoryEO.getDesignDeliverableTemplate(); + String prehomoDeliverableTemplate = projectLawsInventoryEO.getPrehomoDeliverableTemplate(); + String verifyDeliverableTemplate = projectLawsInventoryEO.getVerifyDeliverableTemplate(); + + //编号(输入框必填) + flag = must(projectLawsInventoryEO, errorMsg, msgList, serialNumber, "编号", "Number"); + + //子标题 + if (StringUtils.isNotBlank(subtitle)) { + if (subtitle.length() > 300) { + String message = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + message = errorMsg + "子标题不能超过300个字符, "; + } else { + message = errorMsg + " Subheadings cannot be checked more than 300 characters, "; + } + msgList.add(message); + } + } + //WVTA ID + if (StringUtils.isNotBlank(wvtaId)) { + if (wvtaId.length() > 100) { + String message = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + message = errorMsg + "WVTA ID不能超过100个字符, "; + } else { + message = errorMsg + " The WVTA ID cannot contain more than 100 characters, "; + } + msgList.add(message); + } + } + //备注 remark + if (StringUtils.isNotBlank(remark)) { + if (remark.length() > 1000) { + String message = ""; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + message = errorMsg + "备注不能超过1000个字符, "; + } else { + message = errorMsg + " Note The value cannot exceed 1000 characters, "; + } + msgList.add(message); + } + } + + //实施类别(单选不必填) + value = pullSingle(dictItemList, projectLawsInventoryEO, errorMsg, implementType, msgList, "实施类别", "Usage", "implement_type"); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setImplementType(value); + } + //认证类型(单选不必填) + value = pullMore(dictItemList, projectLawsInventoryEO, errorMsg, attestationType, msgList, "认证类型", "Certification Type", "attestation_type"); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setAttestationType(value); + } + + //认证级别(多选必填) + flag = must(projectLawsInventoryEO, errorMsg, msgList, attestationRank, "认证级别", "Certification Level"); + if (flag) { + value = pullMore(dictItemList, projectLawsInventoryEO, errorMsg, attestationRank, msgList, "认证级别", "Certification Level", "attestation_rank"); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setAttestationRank(value); + } + } + + String nameCn = ""; + String nameEn = ""; + + //责任领域(多选必填) + flag = must(projectLawsInventoryEO, errorMsg, msgList, dutyTerritory, "责任领域", "Responsible Field"); + if (flag) { + value = pullMore(dictItemList, projectLawsInventoryEO, errorMsg, dutyTerritory, msgList, "责任领域", "Responsible Field", DicCodeEnum.DUTY_TERRITORY.getCode()); + + if(StringUtils.isNotBlank(value)){ + projectLawsInventoryEO.setDutyTerritory(value); + List list = Arrays.asList(value.split(",")); + List ddList = dictItemList.stream().filter(e -> "duty_territory".equals(e.getDictCode()) && list.contains(e.getItemValue())).collect(Collectors.toList()); + List valueList = ddList.stream().map(SysDictItem::getStatNode).collect(Collectors.toList()); + projectLawsInventoryEO.setDutyDepart(StringUtils.join(valueList,",")); + } + + if (StringUtils.isNotBlank(value)) { + //工程接口人(责任领域下的工程接口人) + Map objectMap = iProjectRelatedPersonnelService.queryPersonByProjectId(projectLawsInventoryEOTemp.getProjectLibraryId(), value); + + //法规工程师 + List> mapLawList = (List>) objectMap.get("lawEngineerList"); + //认证工程师 + List> mapCertificationList = (List>) objectMap.get("certificationEngineerList"); + //工程接口人 + List> mapPersonList = (List>) objectMap.get("engineeringInterfacePersonList"); + //所有人 + List> allPersonList = (List>) objectMap.get("allPersonList"); + + projectLawsInventoryEO.setDutyTerritory(value); + + // 如果责任领域存在,再匹配这些人员 + //法规工程师 + if (StringUtils.isNotBlank(regulationOwnerId)) { + nameCn = "法规工程师"; + nameEn = "regulatory engineer"; + List sysUsers = userList.stream().filter(e -> regulationOwnerId.equals(e.getUsername())).collect(Collectors.toList()); + //验证人员是否存在 + personnelVerifyTemp(projectLawsInventoryEO, errorMsg, msgList, regulationOwnerId, sysUsers, nameCn, nameEn, ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + } + + //认证工程师 + if (StringUtils.isNotBlank(homologationEngineerId)) { + nameCn = "认证工程师"; + nameEn = "certification engineer "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, homologationEngineerId, mapCertificationList, nameCn, nameEn, ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue()); + } + + //工程接口人 + if (StringUtils.isNotBlank(engineeringInterfacePerson)) { + nameCn = "工程接口人"; + nameEn = "Engineering Interface "; + //验证人员是否存在 + List sysUsers = userList.stream().filter(e -> engineeringInterfacePerson.equals(e.getUsername())).collect(Collectors.toList()); + //验证人员是否存在 + personnelVerifyTemp(projectLawsInventoryEO, errorMsg, msgList, engineeringInterfacePerson, sysUsers, nameCn, nameEn, ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue()); +// personnelVerify(projectLawsInventoryEO, errorMsg, msgList, engineeringInterfacePerson, mapPersonList, nameCn, nameEn, ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue()); + } + } + } + + //设计 + //交付物类型 + value = tree(categoryList, treeNameList, projectLawsInventoryEO, errorMsg, designDeliverableType, msgList, "交付物类型", "Deliverable Type", "deliverable_template"); + if (StringUtils.isNotBlank(value)) { + String treeId = getTreeId(categoryList, projectLawsInventoryEOTemp, treeNameList, value); + projectLawsInventoryEO.setDesignDeliverableType(treeId); + } + + //交付物模板 + value = templateTransition(zipEntryName, projectLawsInventoryEO, errorMsg, designDeliverableTemplate, msgList, "交付物模板", "Deliverable Template", dataSource); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setDesignDeliverableTemplate(value); + } + + //发起人 + /*if(StringUtils.isNotBlank(designInitiator)){ + nameCn = "设计符合性确认发起人"; + nameEn = "confirm design conformance initiator "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, designInitiator, allPersonList,nameCn,nameEn,ProjectRoleEnum.DESIGNINITIATOR.getValue()); + }*/ + + //责任人 + if (StringUtils.isNotBlank(designDuty)) { + nameCn = "设计符合性确认责任人"; + nameEn = "confirm design conformance responsible"; + //验证人员是否存在 + sysUserVerify(projectLawsInventoryEO, errorMsg, msgList, designDuty, sysUserList, nameCn, nameEn, ProjectRoleEnum.DESIGNDUTY.getValue()); + } + + //截止时间 + flag = dateVerify(projectLawsInventoryEO, errorMsg, designDueDate, msgList, "截止时间", "due date"); + if (flag) { + projectLawsInventoryEO.setDesignDueDate(designDueDate); + } + + + //pre + //交付物类型 + value = tree(categoryList, treeNameList, projectLawsInventoryEO, errorMsg, prehomoDeliverableType, msgList, "交付物类型", "Deliverable Type", "deliverable_template"); + if (StringUtils.isNotBlank(value)) { + String treeId = getTreeId(categoryList, projectLawsInventoryEOTemp, treeNameList, value); + projectLawsInventoryEO.setPrehomoDeliverableType(treeId); + } + + //交付物模板 + value = templateTransition(zipEntryName, projectLawsInventoryEO, errorMsg, prehomoDeliverableTemplate, msgList, "交付物模板", "Deliverable Template", dataSource); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setPrehomoDeliverableTemplate(value); + } + + //发起人 + /*if(StringUtils.isNotBlank(prehomoInitiator)){ + nameCn = "Pre-homo确认发起人"; + nameEn = "Pre-homo identifies the initiator "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList, prehomoInitiator, allPersonList,nameCn,nameEn,ProjectRoleEnum.PREHOMOINITIATOR.getValue()); + } + + //责任人 + if(StringUtils.isNotBlank(prehomoDuty)){ + nameCn = "Pre-homo确认责任人"; + nameEn = "Pre-homo identifies the person responsible "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList,prehomoDuty, allPersonList,nameCn,nameEn,ProjectRoleEnum.PREHOMODUTY.getValue()); + }*/ + + //截止时间 + flag = dateVerify(projectLawsInventoryEO, errorMsg, prehomoDueDate, msgList, "截止时间", "due date"); + if (flag) { + projectLawsInventoryEO.setPrehomoDueDate(prehomoDueDate); + } + + //确认 + //交付物类型 + value = tree(categoryList, treeNameList, projectLawsInventoryEO, errorMsg, verifyDeliverableType, msgList, "交付物类型", "Deliverable Type", "deliverable_template"); + if (StringUtils.isNotBlank(value)) { + String treeId = getTreeId(categoryList, projectLawsInventoryEOTemp, treeNameList, value); + projectLawsInventoryEO.setVerifyDeliverableType(treeId); + } + + //交付物模板 + value = templateTransition(zipEntryName, projectLawsInventoryEO, errorMsg, verifyDeliverableTemplate, msgList, "交付物模板", "Deliverable Template", dataSource); + if (StringUtils.isNotBlank(value)) { + projectLawsInventoryEO.setVerifyDeliverableTemplate(value); + } + + + //发起人 + /*if(StringUtils.isNotBlank(verifyInitiator)){ + nameCn = "验证符合性确认发起人"; + nameEn = "verify conformance validates the originator "; + //验证人员是否存在 + personnelVerify(projectLawsInventoryEO, errorMsg, msgList,verifyInitiator, allPersonList,nameCn,nameEn,ProjectRoleEnum.VERIFYINITIATOR.getValue()); + }*/ + + //责任人 + if (StringUtils.isNotBlank(verifyDuty)) { + nameCn = "验证符合性确认责任人"; + nameEn = "verify conformance to confirm the responsible person "; + //验证人员是否存在 + sysUserVerify(projectLawsInventoryEO, errorMsg, msgList, verifyDuty, sysUserList, nameCn, nameEn, ProjectRoleEnum.VERIFYDUTY.getValue()); + } + + + //截止时间 + flag = dateVerify(projectLawsInventoryEO, errorMsg, verifyDueDate, msgList, "截止时间", "due date"); + if (flag) { + projectLawsInventoryEO.setVerifyDueDate(verifyDueDate); + } + } + return msgList; + } +// private void importDatas(List dataList, +// List dictItemList, +// String zipEntryName, +// File saveDirectory, +// ProjectLawsInventoryEO projectLawsInventoryEOTemp, +// List categoryList, +// String dataSource) { +// String dictId = sysCategoryMapper.getDictId("deliverable_template"); +// List collect = categoryList.stream().filter(e -> e.getSysDictId().equals(dictId)).collect(Collectors.toList()); +// List treeNameList = new ArrayList<>(); +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())){ +// treeNameList = collect.stream().map(SysCategory::getName).collect(Collectors.toList()); +// }else{ +// treeNameList = collect.stream().map(SysCategory::getEnName).collect(Collectors.toList()); +// } +// int i = 3; +// List msgList = new ArrayList<>(); +// String value = ""; +// boolean flag = true; +// +// //编号验证 +// verifySerialNumber(dataList,projectLawsInventoryEOTemp,dataSource); +// for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { +// i++; +// String errorMsg = ""; +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())){ +// errorMsg = "第" + i + "行:"; +// }else{ +// errorMsg = i + " line:"; +// } +// //编号 +// String serialNumber = projectLawsInventoryEO.getSerialNumber(); +// //子标题subtitle +// String subtitle = projectLawsInventoryEO.getSubtitle(); +// //WVTA ID +// String wvtaId = projectLawsInventoryEO.getWvtaId(); +// //备注 remark +// String remark = projectLawsInventoryEO.getRemark(); +// //认证级别 +// String attestationRank = projectLawsInventoryEO.getAttestationRank(); +// //责任领域 +// String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); +// //认证类型 +// String attestationType = projectLawsInventoryEO.getAttestationType(); +// //实施类别 +// String implementType = projectLawsInventoryEO.getImplementType(); +// //法规工程师regulationOwnerId +// String regulationOwnerId = projectLawsInventoryEO.getRegulationOwnerId(); +// +// //认证工程师homologationEngineerId +// String homologationEngineerId = projectLawsInventoryEO.getHomologationEngineerId(); +// +// //工程接口人engineeringInterfacePerson +// String engineeringInterfacePerson = projectLawsInventoryEO.getEngineeringInterfacePerson(); +// +// //设计交付物类型 +// String designDeliverableType = projectLawsInventoryEO.getDesignDeliverableType(); +// //设计发起人 +// String designInitiator = projectLawsInventoryEO.getDesignInitiatorId(); +// //设计责任人 +// String designDuty = projectLawsInventoryEO.getDesignDutyId(); +// //设计截止时间designDueDate +// Date designDueDate = projectLawsInventoryEO.getDesignDueDate(); +// +// //pre交付物类型 +// String prehomoDeliverableType = projectLawsInventoryEO.getPrehomoDeliverableType(); +// //pre发起人 +// String prehomoInitiator = projectLawsInventoryEO.getPrehomoInitiatorId(); +// //pre责任人 +// String prehomoDuty = projectLawsInventoryEO.getPrehomoDutyId(); +// //pre截止时间prehomoDueDate +// Date prehomoDueDate = projectLawsInventoryEO.getPrehomoDueDate(); +// +// //确认交付物类型 +// String verifyDeliverableType = projectLawsInventoryEO.getVerifyDeliverableType(); +// //确认发起人 +// String verifyInitiator = projectLawsInventoryEO.getVerifyInitiatorId(); +// //确认责任人 +// String verifyDuty = projectLawsInventoryEO.getVerifyDutyId(); +// //确认截止时间verifyDueDate +// Date verifyDueDate = projectLawsInventoryEO.getVerifyDueDate(); +// +// //文件 +// String designDeliverableTemplate = projectLawsInventoryEO.getDesignDeliverableTemplate(); +// String prehomoDeliverableTemplate = projectLawsInventoryEO.getPrehomoDeliverableTemplate(); +// String verifyDeliverableTemplate = projectLawsInventoryEO.getVerifyDeliverableTemplate(); +// +// //编号(输入框必填) +// flag = must(projectLawsInventoryEO, errorMsg, msgList, serialNumber, "编号", "Number"); +// +// //子标题 +// if(StringUtils.isNotBlank(subtitle)){ +// if(subtitle.length() > 300){ +// String message = ""; +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())){ +// message = errorMsg + "子标题不能超过300个字符, "; +// }else{ +// message = errorMsg + " Subheadings cannot be checked more than 300 characters, "; +// } +// msgList.add(message); +// } +// } +// //WVTA ID +// if(StringUtils.isNotBlank(wvtaId)){ +// if(wvtaId.length() > 100){ +// String message = ""; +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())){ +// message = errorMsg + "WVTA ID不能超过100个字符, "; +// }else{ +// message = errorMsg + " The WVTA ID cannot contain more than 100 characters, "; +// } +// msgList.add(message); +// } +// } +// //备注 remark +// if(StringUtils.isNotBlank(remark)){ +// if(remark.length() > 1000){ +// String message = ""; +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())){ +// message = errorMsg + "备注不能超过1000个字符, "; +// }else{ +// message = errorMsg + " Note The value cannot exceed 1000 characters, "; +// } +// msgList.add(message); +// } +// } +// +// //实施类别(单选不必填) +// value = pullSingle(dictItemList, projectLawsInventoryEO, errorMsg, implementType,msgList,"实施类别","Usage","implement_type"); +// if(StringUtils.isNotBlank(value)){ +// projectLawsInventoryEO.setImplementType(value); +// } +// //认证类型(单选不必填) +// value = pullMore(dictItemList, projectLawsInventoryEO, errorMsg, attestationType,msgList,"认证类型","Certification Type","attestation_type"); +// if(StringUtils.isNotBlank(value)){ +// projectLawsInventoryEO.setAttestationType(value); +// } +// +// //认证级别(多选必填) +// flag = must(projectLawsInventoryEO, errorMsg, msgList, attestationRank,"认证级别","Certification Level"); +// if(flag){ +// value = pullMore(dictItemList, projectLawsInventoryEO, errorMsg, attestationRank,msgList,"认证级别","Certification Level","attestation_rank"); +// if(StringUtils.isNotBlank(value)){ +// projectLawsInventoryEO.setAttestationRank(value); +// } +// } +// +// //责任领域(多选必填) +// flag = must(projectLawsInventoryEO, errorMsg, msgList, dutyTerritory,"责任领域","Responsible Field"); +// if(flag){ +// value = pullMore(dictItemList, projectLawsInventoryEO, errorMsg, dutyTerritory,msgList,"责任领域","Responsible Field","duty_territory"); +// if(StringUtils.isNotBlank(value)){ +// projectLawsInventoryEO.setDutyTerritory(value); +// } +// } +// //工程接口人(责任领域下的工程接口人) +// Map objectMap = iProjectRelatedPersonnelService.queryPersonByProjectId(projectLawsInventoryEOTemp.getProjectLibraryId(), value); +// +// //法规工程师 +// List> mapLawList = (List>) objectMap.get("lawEngineerList"); +// //认证工程师 +// List> mapCertificationList = (List>) objectMap.get("certificationEngineerList"); +// //工程接口人 +// List> mapPersonList = (List>) objectMap.get("engineeringInterfacePersonList"); +// //所有人 +// List> allPersonList = (List>) objectMap.get("allPersonList"); +// +// String nameCn = ""; +// String nameEn = ""; +// //法规工程师 +// if(StringUtils.isNotBlank(regulationOwnerId)){ +// nameCn = "法规工程师"; +// nameEn = "regulatory engineer"; +// //验证人员是否存在 +// personnelVerify(projectLawsInventoryEO, errorMsg, msgList, regulationOwnerId, mapLawList,nameCn,nameEn,ProjectRoleEnum.REGULATI_ENGINEER.getValue()); +// } +// +// //认证工程师 +// if(StringUtils.isNotBlank(homologationEngineerId)){ +// nameCn = "认证工程师"; +// nameEn = "certification engineer "; +// //验证人员是否存在 +// personnelVerify(projectLawsInventoryEO, errorMsg, msgList, homologationEngineerId, mapCertificationList,nameCn,nameEn,ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue()); +// } +// +// //工程接口人 +// if(StringUtils.isNotBlank(engineeringInterfacePerson)){ +// nameCn = "工程接口人"; +// nameEn = "Engineering Interface "; +// //验证人员是否存在 +// personnelVerify(projectLawsInventoryEO, errorMsg, msgList, engineeringInterfacePerson, mapPersonList,nameCn,nameEn,ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue()); +// } +// +// +// //设计 +// //交付物类型 +// value = tree(categoryList,treeNameList, projectLawsInventoryEO, errorMsg, designDeliverableType,msgList,"交付物类型","Deliverable Type","deliverable_template"); +// if(StringUtils.isNotBlank(value)){ +// String treeId = getTreeId(categoryList, projectLawsInventoryEOTemp, treeNameList, value); +// projectLawsInventoryEO.setDesignDeliverableType(treeId); +// } +// +// //交付物模板 +// value = templateTransition(zipEntryName, projectLawsInventoryEO, errorMsg, designDeliverableTemplate,msgList,"交付物模板","Deliverable Template",dataSource); +// if(StringUtils.isNotBlank(value)){ +// projectLawsInventoryEO.setDesignDeliverableTemplate(value); +// } +// +// //发起人 +// if(StringUtils.isNotBlank(designInitiator)){ +// nameCn = "设计符合性确认发起人"; +// nameEn = "confirm design conformance initiator "; +// //验证人员是否存在 +// personnelVerify(projectLawsInventoryEO, errorMsg, msgList, designInitiator, allPersonList,nameCn,nameEn,ProjectRoleEnum.DESIGNINITIATOR.getValue()); +// } +// +// //责任人 +// if(StringUtils.isNotBlank(designDuty)){ +// nameCn = "设计符合性确认责任人"; +// nameEn = "confirm design conformance responsible"; +// //验证人员是否存在 +// personnelVerify(projectLawsInventoryEO, errorMsg, msgList, designDuty, allPersonList,nameCn,nameEn,ProjectRoleEnum.DESIGNDUTY.getValue()); +// } +// +// //截止时间 +// flag = dateVerify(projectLawsInventoryEO, errorMsg, designDueDate,msgList,"在产车实施日期","on the production vehicle implementation date"); +// if(flag){ +// projectLawsInventoryEO.setImplementTime(designDueDate); +// } +// +// +// //pre +// //交付物类型 +// value = tree(categoryList, treeNameList,projectLawsInventoryEO, errorMsg, prehomoDeliverableType,msgList,"交付物类型","Deliverable Type","deliverable_template"); +// if(StringUtils.isNotBlank(value)){ +// String treeId = getTreeId(categoryList, projectLawsInventoryEOTemp, treeNameList, value); +// projectLawsInventoryEO.setPrehomoDeliverableType(treeId); +// } +// +// //交付物模板 +// value = templateTransition(zipEntryName, projectLawsInventoryEO, errorMsg, prehomoDeliverableTemplate,msgList,"交付物模板","Deliverable Template",dataSource); +// if(StringUtils.isNotBlank(value)){ +// projectLawsInventoryEO.setPrehomoDeliverableTemplate(value); +// } +// +// //发起人 +// if(StringUtils.isNotBlank(prehomoInitiator)){ +// nameCn = "Pre-homo确认发起人"; +// nameEn = "Pre-homo identifies the initiator "; +// //验证人员是否存在 +// personnelVerify(projectLawsInventoryEO, errorMsg, msgList, prehomoInitiator, allPersonList,nameCn,nameEn,ProjectRoleEnum.PREHOMOINITIATOR.getValue()); +// } +// +// //责任人 +// if(StringUtils.isNotBlank(prehomoDuty)){ +// nameCn = "Pre-homo确认责任人"; +// nameEn = "Pre-homo identifies the person responsible "; +// //验证人员是否存在 +// personnelVerify(projectLawsInventoryEO, errorMsg, msgList,prehomoDuty, allPersonList,nameCn,nameEn,ProjectRoleEnum.PREHOMODUTY.getValue()); +// } +// +// //截止时间 +// flag = dateVerify(projectLawsInventoryEO, errorMsg, prehomoDueDate,msgList,"在产车实施日期","on the production vehicle implementation date"); +// if(flag){ +// projectLawsInventoryEO.setPrehomoDueDate(prehomoDueDate); +// } +// +// //确认 +// //交付物类型 +// value = tree(categoryList,treeNameList,projectLawsInventoryEO, errorMsg, verifyDeliverableType,msgList,"交付物类型","Deliverable Type","deliverable_template"); +// if(StringUtils.isNotBlank(value)){ +// String treeId = getTreeId(categoryList, projectLawsInventoryEOTemp, treeNameList, value); +// projectLawsInventoryEO.setVerifyDeliverableType(treeId); +// } +// +// //交付物模板 +// value = templateTransition(zipEntryName, projectLawsInventoryEO, errorMsg, verifyDeliverableTemplate,msgList,"交付物模板","Deliverable Template",dataSource); +// if(StringUtils.isNotBlank(value)){ +// projectLawsInventoryEO.setVerifyDeliverableTemplate(value); +// } +// +// +// //发起人 +// if(StringUtils.isNotBlank(verifyInitiator)){ +// nameCn = "验证符合性确认发起人"; +// nameEn = "verify conformance validates the originator "; +// //验证人员是否存在 +// personnelVerify(projectLawsInventoryEO, errorMsg, msgList,verifyInitiator, allPersonList,nameCn,nameEn,ProjectRoleEnum.VERIFYINITIATOR.getValue()); +// } +// +// //责任人 +// if(StringUtils.isNotBlank(verifyDuty)){ +// nameCn = "验证符合性确认责任人"; +// nameEn = "verify conformance to confirm the responsible person "; +// //验证人员是否存在 +// personnelVerify(projectLawsInventoryEO, errorMsg, msgList,verifyDuty, allPersonList,nameCn,nameEn,ProjectRoleEnum.VERIFYDUTY.getValue()); +// } +// +// +// //截止时间 +// flag = dateVerify(projectLawsInventoryEO, errorMsg, verifyDueDate,msgList,"在产车实施日期","on the production vehicle implementation date"); +// if(flag){ +// projectLawsInventoryEO.setVerifyDueDate(verifyDueDate); +// } +// } +// +// if (msgList.size() > 0) { +// //返回报错信息 +// String html = ""; +// for (String s : msgList) { +// html += s + "
"; +// } +// FileUnZip.deleteDir(saveDirectory); +// throw new JeroBootException(html); +// } else { +// if (dataList.size() != 0) { +// this.saveBatch(dataList); +// //项目任务清单数据初始化。 +// List projectTaskInventoryEOList = new ArrayList<>(); +// for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { +// ProjectTaskInventoryEO projectTaskInventoryEO = new ProjectTaskInventoryEO(); +// String projectTaskInventoryId = UUID.randomUUID().toString().replace("-", ""); +// projectTaskInventoryEO.setId(projectTaskInventoryId); +// projectTaskInventoryEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId()); +// projectLawsInventoryEO.setStandId(projectLawsInventoryEO.getStandId()); +// projectTaskInventoryEOList.add(projectTaskInventoryEO); +// } +// this.projectTaskInventoryEOService.saveBatch(projectTaskInventoryEOList); +// //初始化项目状态评估 +// projectTaskInventoryEOList.forEach(taskInventory -> { +// this.initConditionAssessmentEO(taskInventory.getProjectLawsInventoryId()); +// }); +// +// //更新log +// String serialNumber = dataList.stream().map(e->e.getSerialNumber()).collect(Collectors.joining(",")); +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// String username = sysUser.getUsername(); +// String contentLog = username+"向清单中导入了“"+serialNumber+"”"; +// String enContentLog = username+" imported “"+serialNumber+"” into the list."; +// projectLawsInventoryLogEOService.updateLog(contentLog, dataList.get(0).getProjectLibraryId(),CutEnum.CN.getValue()); +// projectLawsInventoryLogEOService.updateLog(enContentLog, dataList.get(0).getProjectLibraryId(),CutEnum.EN.getValue()); +// } +// } +// } + + private String tree(List categoryList, List nameList, ProjectLawsInventoryEO projectLawsInventoryEO, + String errorMsg, String value, List msgList, + String nameCn, String nameEn, String dictCode) { + if (StringUtils.isNotBlank(value)) { + StringBuilder sb = new StringBuilder(); + for (String s : value.split(",")) { + if (!nameList.contains(s)) { + sb.append(s + ","); + } + } + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + "中的" + substring + "与数据字典不匹配, "; + } else { + errorMsg += nameEn + " " + substring + " does not match the data dictionary, "; + } + msgList.add(errorMsg); + } else { + StringBuilder sbTemp = new StringBuilder(); + for (String s : value.split(",")) { + List collect = new ArrayList<>(); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + collect = categoryList.stream().filter(e -> s.equals(e.getName())).collect(Collectors.toList()); + if (collect.size() != 0) { + sbTemp.append(collect.get(0).getName() + ","); + } + } else { + collect = categoryList.stream().filter(e -> s.equals(e.getEnName())).collect(Collectors.toList()); + if (collect.size() != 0) { + sbTemp.append(collect.get(0).getEnName() + ","); + } + } + } + if (StringUtils.isNotBlank(sbTemp)) { + String substring = sbTemp.substring(0, sbTemp.length() - 1); + return substring; + } + } + } + return null; + } + + private String getTreeId(List categoryList, + ProjectLawsInventoryEO projectLawsInventoryEOTemp, List treeNameList, String value) { + StringBuilder sb = new StringBuilder(); + for (String valueTemp : value.split(",")) { + if (treeNameList.contains(valueTemp)) { + List sysCategoryList = new ArrayList<>(); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEOTemp.getCut())) { + sysCategoryList = categoryList.stream().filter(e -> e.getName().equals(valueTemp)).collect(Collectors.toList()); + } else { + sysCategoryList = categoryList.stream().filter(e -> e.getEnName().equals(valueTemp)).collect(Collectors.toList()); + } + if (sysCategoryList.size() != 0) { + sb.append(sysCategoryList.get(0).getId() + ","); + } + } + } + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + return substring; + } + return null; + } + + private void verifySerialNumber(List dataList, + ProjectLawsInventoryEO projectLawsInventoryEOTemp, + String dataSource) { + //1. 验证标准号在文档库中是否存在 + List serialNumberList = dataList.stream().map(ProjectLawsInventoryEO::getSerialNumber).collect(Collectors.toList()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(BussDocumentLibraryEO::getSerialNumber, serialNumberList); + List bussDocumentLibraryEOList = iBussDocumentLibraryEOService.list(wrapper); + //文档库中可能存在重复的标准号 + List serialNumberListTemp = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).distinct().collect(Collectors.toList()); + if (serialNumberList.size() != serialNumberListTemp.size()) { + //存在文档库没有的数据 + List collect = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList()); + List serialNumbers = serialNumberList.stream().filter(e -> !collect.contains(e)).collect(Collectors.toList()); + if (serialNumbers.size() > 0) { + if (CutEnum.CN.getValue().equals(dataList.get(0).getCut())) { + throw new JeroBootException(StringUtils.join(serialNumbers, ",") + "文档库中不存在,不能添加"); + } else { + throw new JeroBootException(StringUtils.join(serialNumbers, ",") + " does not exist in the document library and cannot be added"); + } + } + } + //导入数据为列表导出的数据时,不需要一下验证 + if (!DataSourceEnum.LIST_DATA.getValue().equals(dataSource)) { + //2. 验证标准号在法规清单中是否添加过 + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.in(ProjectLawsInventoryEO::getSerialNumber, serialNumberList).in(ProjectLawsInventoryEO::getProjectLibraryId, projectLawsInventoryEOTemp.getProjectLibraryId()); + List projectLawsInventoryEOList = this.list(lambdaQueryWrapper); + List serialNumberTempList = projectLawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).collect(Collectors.toList()); + if (projectLawsInventoryEOList.size() > 0) { + if (CutEnum.CN.getValue().equals(dataList.get(0).getCut())) { + throw new JeroBootException(StringUtils.join(serialNumberTempList, ",") + "已存在,不能重复添加"); + } else { + throw new JeroBootException(StringUtils.join(serialNumberTempList, ",") + " already exists and cannot be added again"); + } + } + //3. 通过编号将导入的数据与文档库进行关联 + for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { + List collect = bussDocumentLibraryEOList.stream() + .filter(e -> e.getSerialNumber().equals(projectLawsInventoryEO.getSerialNumber())).collect(Collectors.toList()); + projectLawsInventoryEO.setTitle(collect.get(0).getTitle());//标题 + projectLawsInventoryEO.setCorrespondingStandard(collect.get(0).getCorrespondingStandard());//对应标准 + projectLawsInventoryEO.setRegion(collect.get(0).getRegion());//适用地区 + projectLawsInventoryEO.setImplementTime(collect.get(0).getImplementTime());//在产车实施日期 + projectLawsInventoryEO.setXin1Che1Xing2Shi2Shi1Ri4Qi1(collect.get(0).getXin1Che1Xing2Shi2Shi1Ri4Qi1());//新车实施日期 + projectLawsInventoryEO.setStandId(collect.get(0).getId()); + } + } else { + //导入列表数据处理standId(用于点击标准号跳转) + for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { + List collect = bussDocumentLibraryEOList.stream() + .filter(e -> e.getSerialNumber().equals(projectLawsInventoryEO.getSerialNumber())).collect(Collectors.toList()); + projectLawsInventoryEO.setStandId(collect.get(0).getId()); + } + } + } + + private void personnelVerify(ProjectLawsInventoryEO projectLawsInventoryEO, + String errorMsg, List msgList, + String regulationOwnerId, + List> mapList, + String nameCn, String nameEn, + String fieldNumber) { + //单选 + if (regulationOwnerId.contains(",")) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + "导入只能填写一个用户名, "; + } else { + errorMsg += "Only one user name can be entered for" + nameEn + "import, "; + } + msgList.add(errorMsg); + } + + if (mapList.size() != 0) { + int count = 0; + for (Map stringStringMap : mapList) { + String name = stringStringMap.get("name"); + if (regulationOwnerId.equals(name)) { + count++; + if (ProjectRoleEnum.REGULATI_ENGINEER.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setRegulationOwnerId(stringStringMap.get("value")); + } else if (ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setHomologationEngineerId(stringStringMap.get("value")); + } else if (ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setEngineeringInterfacePerson(stringStringMap.get("value")); + } else if (ProjectRoleEnum.DESIGNINITIATOR.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setDesignInitiatorId(stringStringMap.get("value")); + } else if (ProjectRoleEnum.DESIGNDUTY.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setDesignDutyId(stringStringMap.get("value")); + } else if (ProjectRoleEnum.PREHOMOINITIATOR.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setPrehomoInitiatorId(stringStringMap.get("value")); + } else if (ProjectRoleEnum.PREHOMODUTY.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setPrehomoDutyId(stringStringMap.get("value")); + } else if (ProjectRoleEnum.VERIFYINITIATOR.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setVerifyInitiatorId(stringStringMap.get("value")); + } else if (ProjectRoleEnum.VERIFYDUTY.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setVerifyDutyId(stringStringMap.get("value")); + } + break; + } + } + if (count == 0) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + regulationOwnerId + "与相关人员名单中责任领域下的人员不匹配, "; + } else { + errorMsg += nameEn + regulationOwnerId + "does not match a person under the Responsible Field in the relevant person list, "; + } + msgList.add(errorMsg); + } + } else { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + regulationOwnerId + "与相关人员名单中责任领域下的人员不匹配, "; + } else { + errorMsg += nameEn + regulationOwnerId + "does not match a person under the Responsible Field in the relevant person list, "; + } + msgList.add(errorMsg); + } + } + private void personnelVerifyTemp(ProjectLawsInventoryEO projectLawsInventoryEO, + String errorMsg, List msgList, + String regulationOwnerId, + List sysUserList, + String nameCn, String nameEn, + String fieldNumber) { + //单选 + if (regulationOwnerId.contains(",")) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + "导入只能填写一个用户名, "; + } else { + errorMsg += "Only one user name can be entered for" + nameEn + "import, "; + } + msgList.add(errorMsg); + } + + if (ObjectUtils.isNotEmpty(sysUserList)) { + if (ProjectRoleEnum.REGULATI_ENGINEER.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setRegulationOwnerId(sysUserList.get(0).getId()); + } else if (ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setHomologationEngineerId(sysUserList.get(0).getId()); + } else if (ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setEngineeringInterfacePerson(sysUserList.get(0).getId()); + } else if (ProjectRoleEnum.DESIGNINITIATOR.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setDesignInitiatorId(sysUserList.get(0).getId()); + } else if (ProjectRoleEnum.DESIGNDUTY.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setDesignDutyId(sysUserList.get(0).getId()); + } else if (ProjectRoleEnum.PREHOMOINITIATOR.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setPrehomoInitiatorId(sysUserList.get(0).getId()); + } else if (ProjectRoleEnum.PREHOMODUTY.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setPrehomoDutyId(sysUserList.get(0).getId()); + } else if (ProjectRoleEnum.VERIFYINITIATOR.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setVerifyInitiatorId(sysUserList.get(0).getId()); + } else if (ProjectRoleEnum.VERIFYDUTY.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setVerifyDutyId(sysUserList.get(0).getId()); + } + }else{ + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + regulationOwnerId + "不存在, "; + } else { + errorMsg += nameEn + regulationOwnerId + "absent, "; + } + msgList.add(errorMsg); + } + } + + private boolean dateVerify(ProjectLawsInventoryEO projectLawsInventoryEO, String errorMsg, + Date field, List msgList, + String nameCn, String nameEn) { + //判断格式是否正确 + boolean flag = true; + if (ObjectUtils.isNotEmpty(field)) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String format = sdf.format(field); + if (!DateUtils.isValidDate(format)) { + flag = false; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日"; + } else { + errorMsg += nameEn + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日"; + } + msgList.add(errorMsg); + } + } + return flag; + } + + private boolean must(ProjectLawsInventoryEO projectLawsInventoryEO, String errorMsg, + List msgList, String serialNumber, String nameCn, String nameEn) { + int errorCount = 0; + if (StringUtils.isBlank(serialNumber)) { + errorCount++; + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + "为必填项,不能为空, "; + } else { + errorMsg += nameEn + "This parameter is mandatory and cannot be empty, "; + } + msgList.add(errorMsg); + } + if (errorCount == 0) { + return true; + } else { + return false; + } + } + + private String pullMore(List dictItemList, ProjectLawsInventoryEO projectLawsInventoryEO, + String errorMsg, String value, List msgList, + String nameCn, String nameEn, String dictCode) { + List valueList = new ArrayList<>(); + if (StringUtils.isNotBlank(value)) { + List list = Arrays.asList(value.split(",")); + List sysDictItemList = new ArrayList<>(); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + sysDictItemList = dictItemList.stream().filter(e -> dictCode.equals(e.getDictCode()) && list.contains(e.getItemText())).collect(Collectors.toList()); + } else { + sysDictItemList = dictItemList.stream().filter(e -> dictCode.equals(e.getDictCode()) && list.contains(e.getEnName())).collect(Collectors.toList()); + } + + if (list.size() == sysDictItemList.size()) { + valueList = sysDictItemList.stream().map(SysDictItem::getItemValue).collect(Collectors.toList()); + + } else { + //数据中有与数据字典不匹配的值 + List finalValueList = valueList; + List diffList = list.stream().filter(e -> !finalValueList.contains(e)).collect(Collectors.toList()); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + "中的" + StringUtils.join(diffList, ",") + "与数据字典不匹配, "; + } else { + errorMsg += nameEn + " " + StringUtils.join(diffList, ",") + " does not match the data dictionary, "; + } + msgList.add(errorMsg); + } + } + return StringUtils.join(valueList, ","); + } + + private String pullSingle(List dictItemList, ProjectLawsInventoryEO projectLawsInventoryEO, + String errorMsg, String value, List msgList, + String nameCn, String nameEn, String dictCode) { + if (StringUtils.isNotBlank(value)) { + if (value.contains(",")) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + " 为单选项, "; + } else { + errorMsg += nameEn + " Is multiple choice, "; + } + msgList.add(errorMsg); + } else { + List sysDictItemList = new ArrayList<>(); + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + sysDictItemList = dictItemList.stream().filter(e -> dictCode.equals(e.getDictCode()) && value.equals(e.getItemText())).collect(Collectors.toList()); + } else { + sysDictItemList = dictItemList.stream().filter(e -> dictCode.equals(e.getDictCode()) && value.equals(e.getEnName())).collect(Collectors.toList()); + } + + if (sysDictItemList.size() == 0) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + "中的" + value + "与数据字典不匹配, "; + } else { + errorMsg += nameEn + " " + value + " does not match the data dictionary, "; + } + msgList.add(errorMsg); + } else { + return sysDictItemList.get(0).getItemValue(); + } + } + } + return null; + } + + private String templateTransition(String zipEntryName, ProjectLawsInventoryEO projectLawsInventoryEO, + String errorMsg, String designDeliverableTemplate, List msgList, + String nameCn, String nameEn, String dataSource) { + String value = ""; + if (StringUtils.isNotBlank(designDeliverableTemplate)) { + StringBuilder sb = new StringBuilder(); + for (String fileName : designDeliverableTemplate.split(",")) { + List nowFileList = new ArrayList<>(); + if (DataSourceEnum.LIST_DATA.getValue().equals(dataSource)) { + nowFileList = FileUnZip.readFileByFilenameDataList(zipEntryName, fileName, projectLawsInventoryEO.getCut(), errorMsg, msgList, nameCn, nameEn, projectLawsInventoryEO); + } else { + nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName, projectLawsInventoryEO.getCut(), errorMsg, msgList, nameCn, nameEn); + } + if (nowFileList.size() == 0) { +// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){ +// errorMsg += "压缩包中没有" + fileName + "文件; "; +// }else{ +// errorMsg += " Not in the zip package" + fileName + "file; "; +// } +// msgList.add(errorMsg); + } else { + try { + FileInputStream input = new FileInputStream(nowFileList.get(0)); + MultipartFile multipartFile = + new MockMultipartFile(nowFileList.get(0).getName(), nowFileList.get(0).getName(), "text/plain", input); + //文件存入文件表 + OSSFile ossFile = iOSSFileService.uploadLocalOfCos(multipartFile, "", null, null); + if (ObjectUtils.isNotEmpty(ossFile)) { + sb.append(ossFile.getId() + ","); + } + } catch (IOException e) { + log.error("虚拟清单导入" + e.getMessage()); + } + } + } + if (StringUtils.isNotBlank(sb)) { + value = sb.substring(0, sb.length() - 1); + } + } + return value; + } + + private String fieldConvert(String field) { + if (field == null) return null; + switch (field) { + case "*编号": + return "serialNumber"; + case "*Number": + return "serialNumber"; +// case "标题": return "title"; + case "子标题": + return "subtitle"; + case "Sub-Title": + return "subtitle"; + case "适用范围": + return "shi4Yong4Fan4Wei2"; + case "状态": + return "state"; +// case "对应标准": return "correspondingStandard"; + case "实施类别": + return "implementType"; + case "Usage": + return "implementType"; + case "新车实施日期": + return "xin1Che1Xing2Shi2Shi1Ri4Qi1"; +// case "在产车实施日期": return "implementTime"; + case "WVTA ID": + return "wvtaId"; + case "认证类型": + return "attestationType"; + case "Certification Type": + return "attestationType"; + case "*认证级别": + return "attestationRank"; + case "*Certification Level": + return "attestationRank"; + case "适用增补件": + return "applicableSupplement"; + case "Applicable Supplement": + return "applicableSupplement"; + case "技术领域": + return "technologyTerritory"; + case "*责任领域": + return "dutyTerritory"; + case "*Responsible Field": + return "dutyTerritory"; +// case "适用地区": return "region"; + case "备注": + return "remark"; + case "Comments": + return "remark"; + case "法规工程师": + return "regulationOwnerId"; + case "Regulation Engineer": + return "regulationOwnerId"; + case "认证工程师": + return "homologationEngineerId"; + case "Homologation Engineer": + return "homologationEngineerId"; + case "工程接口人": + return "engineeringInterfacePerson"; + case "Engineering Interface": + return "engineeringInterfacePerson"; + case "设计交付物类型": + return "designDeliverableType"; + case "design Deliverable Type": + return "designDeliverableType"; + case "设计交付物模板": + return "designDeliverableTemplate"; + case "design Deliverable Template": + return "designDeliverableTemplate"; + case "设计发起人": + return "designInitiatorId"; + case "design Reviewer": + return "designInitiatorId"; + case "设计责任人": + return "designDutyId"; + case "design Assignee": + return "designDutyId"; + case "设计截止时间": + return "designDueDate"; + case "design Due Date": + return "designDueDate"; + + case "设计交付物说明": + return "designRemark"; + case "design Deliverable Description": + return "designRemark"; + + case "pre交付物类型": + return "prehomoDeliverableType"; + case "pre Deliverable Type": + return "prehomoDeliverableType"; + case "pre交付物模板": + return "prehomoDeliverableTemplate"; + case "pre Deliverable Template": + return "prehomoDeliverableTemplate"; + case "pre发起人": + return "prehomoInitiatorId"; + case "pre Reviewer": + return "prehomoInitiatorId"; + case "pre责任人": + return "prehomoDutyId"; + case "pre Assignee": + return "prehomoDutyId"; + case "pre截止时间": + return "prehomoDueDate"; + case "pre Due Date": + return "prehomoDueDate"; + + case "pre交付物说明": + return "prehomoRemark"; + case "pre Deliverable Description": + return "prehomoRemark"; + + case "验证交付物类型": + return "verifyDeliverableType"; + case "verify Deliverable Type": + return "verifyDeliverableType"; + case "验证交付物模板": + return "verifyDeliverableTemplate"; + case "verify Deliverable Template": + return "verifyDeliverableTemplate"; + case "验证发起人": + return "verifyInitiatorId"; + case "verify Reviewer": + return "verifyInitiatorId"; + case "验证责任人": + return "verifyDutyId"; + case "verify Assignee": + return "verifyDutyId"; + case "验证截止时间": + return "verifyDueDate"; + case "verify Due Date": + return "verifyDueDate"; + + case "验证交付物说明": + return "verifyRemark"; + case "verify Deliverable Description": + return "verifyRemark"; + + case "标题": + return "title"; + case "Title": + return "title"; + + case "清单确认状态": + return "inventoryAffirmStatus"; + case "List Confirmation Status": + return "inventoryAffirmStatus"; + + case "任务确认状态": + return "taskAffirmStatus"; + case "Task Confirmation Status": + return "taskAffirmStatus"; + + case "适用地区": + return "region"; + case "Area": + return "region"; + + case "对应标准": + return "correspondingStandard"; + case "Compare EU/CN": + return "correspondingStandard"; + + case "新车型实施日期": + return "xin1Che1Xing2Shi2Shi1Ri4Qi1"; + case "New Type Execution Date": + return "xin1Che1Xing2Shi2Shi1Ri4Qi1"; + + case "在产车实施日期": + return "implementTime"; + case "New Vehicle Execution Date": + return "implementTime"; + + default: + return null; + //"Deliverable Type,Deliverable Template,initiator,Assignee,Due Date," + + } + } + + + //判断row是否为空 空返回true + public boolean isRowEmpty(Row row) { + if (null == row) { + return true; + } + int firstCellNum = row.getFirstCellNum(); //第一个列位置 + int lastCellNum = row.getLastCellNum(); //最后一列位置 + int nullCellNum = 0; //空列数量 + for (int c = firstCellNum; c < lastCellNum; c++) { + Cell cell = row.getCell(c); + if (null == cell) { + nullCellNum++; + continue; + } + String value = ""; + switch (cell.getCellType()) { + case HSSFCell.CELL_TYPE_NUMERIC: // 数字 + //如果为时间格式的内容 + value = String.valueOf(cell.getNumericCellValue()); + break; + case HSSFCell.CELL_TYPE_STRING: // 字符串 + value = cell.getStringCellValue(); + break; + case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean + value = cell.getBooleanCellValue() + ""; + break; + case HSSFCell.CELL_TYPE_FORMULA: // 公式 + value = cell.getCellFormula() + ""; + break; + default: + break; + } + if (org.apache.commons.lang.StringUtils.isEmpty(value)) { + nullCellNum++; + } + } + //所有列都为空 + if (nullCellNum == (lastCellNum - firstCellNum)) { + return true; + } + return false; + } + + /** + * 获取文件 + * + * @param dataList + * @return + */ + private List getOssFiles(List dataList) { + List fileIdList = new ArrayList<>(); + List design = new ArrayList<>(); + List prehomo = new ArrayList<>(); + List verify = new ArrayList<>(); + for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { + if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignDeliverableTemplate())) { + design.add(projectLawsInventoryEO.getDesignDeliverableTemplate()); + } + if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDeliverableTemplate())) { + prehomo.add(projectLawsInventoryEO.getPrehomoDeliverableTemplate()); + } + if (StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyDeliverableTemplate())) { + verify.add(projectLawsInventoryEO.getVerifyDeliverableTemplate()); + } + } + if (design.size() != 0) { + fileIdList.addAll(design); + } + if (prehomo.size() != 0) { + fileIdList.addAll(prehomo); + } + if (verify.size() != 0) { + fileIdList.addAll(verify); + } + //查询所有的文件 + List fileInfos = new ArrayList<>(); + if (fileIdList.size() != 0) { + fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ",")); + } + return fileInfos; + } + + @NotNull + private StringBuilder getStringBuilder(ProjectLawsInventoryEO projectLawsInventoryEO, List sysCategoryList, String technologyTerritory) { + StringBuilder sb = new StringBuilder(); + for (String s : technologyTerritory.split(",")) { + List collect = sysCategoryList.stream() + .filter(e -> s.equals(e.getId())).collect(Collectors.toList()); + if (collect.size() != 0) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + sb.append(collect.get(0).getName() + ","); + } else { + sb.append(collect.get(0).getEnName() + ","); + } + } + } + return sb; + } + + /** + * 数据转换(文件名称,技术领域,对应标准) + * + * @param dataList + * @param fileInfos + */ + private void dataTransition(List dataList, + List fileInfos, + List sysUserList, + ProjectLawsInventoryEO projectLawsInventoryEOTemp) { + List sysCategoryList = sysCategoryService.list(); + + for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { + //设计交付物类型 inventoryInfoEO + if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignDeliverableType())) { + StringBuilder sb = getStringBuilder(projectLawsInventoryEOTemp, sysCategoryList, projectLawsInventoryEO.getDesignDeliverableType()); + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + projectLawsInventoryEO.setDesignDeliverableType(substring); + } + } + //pre交付物类型 + if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDeliverableType())) { + StringBuilder sb = getStringBuilder(projectLawsInventoryEOTemp, sysCategoryList, projectLawsInventoryEO.getPrehomoDeliverableType()); + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + projectLawsInventoryEO.setPrehomoDeliverableType(substring); + } + } + //验证交付物类型 + if (StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyDeliverableType())) { + StringBuilder sb = getStringBuilder(projectLawsInventoryEOTemp, sysCategoryList, projectLawsInventoryEO.getVerifyDeliverableType()); + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + projectLawsInventoryEO.setVerifyDeliverableType(substring); + } + } + + + //清单确认状态 inventoryAffirmStatus + if (StringUtils.isNotBlank(projectLawsInventoryEO.getInventoryAffirmStatus())) { + String stateName = stateTransition(projectLawsInventoryEO.getInventoryAffirmStatus()); + projectLawsInventoryEO.setInventoryAffirmStatusName(stateName); + } + //任务确认状态 taskAffirmStatus + if (StringUtils.isNotBlank(projectLawsInventoryEO.getTaskAffirmStatus())) { + String stateName = stateTransition(projectLawsInventoryEO.getTaskAffirmStatus()); + projectLawsInventoryEO.setTaskAffirmStatusName(stateName); + } + //法规工程师 regulationOwnerId + if (StringUtils.isNotBlank(projectLawsInventoryEO.getRegulationOwnerId())) { + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLawsInventoryEO.getRegulationOwnerId())).collect(Collectors.toList()); + if (collect.size() != 0) { + projectLawsInventoryEO.setRegulationOwnerName(collect.get(0).getUsername()); + } + } + + //认证工程师 homologationEngineerId + if (StringUtils.isNotBlank(projectLawsInventoryEO.getHomologationEngineerId())) { + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLawsInventoryEO.getHomologationEngineerId())).collect(Collectors.toList()); + if (collect.size() != 0) { + projectLawsInventoryEO.setHomologationEngineerName(collect.get(0).getUsername()); + } + } + + //工程接口人 engineeringInterfacePerson + if (StringUtils.isNotBlank(projectLawsInventoryEO.getEngineeringInterfacePerson())) { + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLawsInventoryEO.getEngineeringInterfacePerson())).collect(Collectors.toList()); + if (collect.size() != 0) { + projectLawsInventoryEO.setEngineeringInterfacePersonName(collect.get(0).getUsername()); + } + } + + //设计符合性确认发起人designInitiatorId + if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignInitiatorId())) { + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignInitiatorId())).collect(Collectors.toList()); + if (collect.size() != 0) { + projectLawsInventoryEO.setDesignInitiatorName(collect.get(0).getUsername()); + } + } + + //设计符合性确认责任人designDutyId + if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignDutyId())) { + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignDutyId())).collect(Collectors.toList()); + if (collect.size() != 0) { + projectLawsInventoryEO.setDesignDutyIdName(collect.get(0).getUsername()); + } + } + + //PreHomo确认发起人prehomoInitiatorId + if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoInitiatorId())) { + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLawsInventoryEO.getPrehomoInitiatorId())).collect(Collectors.toList()); + if (collect.size() != 0) { + projectLawsInventoryEO.setPrehomoInitiatorName(collect.get(0).getUsername()); + } + } + + //PreHomo确认责任人prehomoDutyId + if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDutyId())) { + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLawsInventoryEO.getPrehomoDutyId())).collect(Collectors.toList()); + if (collect.size() != 0) { + projectLawsInventoryEO.setPrehomoDutyName(collect.get(0).getUsername()); + } + } + + //验证符合性确认发起人verifyInitiatorId + if (StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyInitiatorId())) { + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyInitiatorId())).collect(Collectors.toList()); + if (collect.size() != 0) { + projectLawsInventoryEO.setVerifyInitiatorName(collect.get(0).getUsername()); + } + } + + //验证符合性确认责任人verifyDutyId + if (StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyDutyId())) { + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyDutyId())).collect(Collectors.toList()); + if (collect.size() != 0) { + projectLawsInventoryEO.setVerifyDutyIdName(collect.get(0).getUsername()); + } + } + + String designDeliverableTemplate = projectLawsInventoryEO.getDesignDeliverableTemplate(); + String prehomoDeliverableTemplate = projectLawsInventoryEO.getPrehomoDeliverableTemplate(); + String verifyDeliverableTemplate = projectLawsInventoryEO.getVerifyDeliverableTemplate(); + //设计交付物模板 + if (StringUtils.isNotBlank(designDeliverableTemplate)) { + String designDeliverableTemplateName = template(fileInfos, designDeliverableTemplate); + projectLawsInventoryEO.setDesignDeliverableTemplateName(designDeliverableTemplateName); + } + //设计交付物模板 + if (StringUtils.isNotBlank(prehomoDeliverableTemplate)) { + String prehomoDeliverableTemplateName = template(fileInfos, prehomoDeliverableTemplate); + projectLawsInventoryEO.setPrehomoDeliverableTemplateName(prehomoDeliverableTemplateName); + + } + //设计交付物模板 + if (StringUtils.isNotBlank(verifyDeliverableTemplate)) { + String verifyDeliverableTemplateName = template(fileInfos, verifyDeliverableTemplate); + projectLawsInventoryEO.setVerifyDeliverableTemplateName(verifyDeliverableTemplateName); + } + } + } + + private String stateTransition(String state) { + String result = ""; + if (InventoryAffirmStatusEnum.NOT_STARTED.getValue().equals(state)) { + result = InventoryAffirmStatusEnum.NOT_STARTED.getName(); + + } else if (InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue().equals(state)) { + result = InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getName(); + + } else if (InventoryAffirmStatusEnum.ACCEPTED.getValue().equals(state)) { + result = InventoryAffirmStatusEnum.ACCEPTED.getName(); + + } else if (InventoryAffirmStatusEnum.REJECTED.getValue().equals(state)) { + result = InventoryAffirmStatusEnum.REJECTED.getName(); + } + return result; + } + + /** + * 模板名称转换 + * + * @param fileInfos + * @param value + * @return + */ + private String template(List fileInfos, String value) { + StringBuilder sb = new StringBuilder(); + for (String s : value.split(",")) { + List collect = fileInfos.stream().filter(e -> s.equals(e.getId())).collect(Collectors.toList()); + if (collect.size() != 0) { + sb.append(collect.get(0).getFileName() + ","); + } + } + String substring = ""; + if (StringUtils.isNotBlank(sb)) { + substring = sb.substring(0, sb.length() - 1); + } + return substring; + } + + private void exportFile(List dataList, List fileInfos) throws IOException { + if (fileInfos.size() != 0) { + for (ProjectLawsInventoryEO projectLawsInventoryEO : dataList) { + String designDeliverableTemplate = projectLawsInventoryEO.getDesignDeliverableTemplate(); + String prehomoDeliverableTemplate = projectLawsInventoryEO.getPrehomoDeliverableTemplate(); + String verifyDeliverableTemplate = projectLawsInventoryEO.getVerifyDeliverableTemplate(); + String serialNumber = projectLawsInventoryEO.getSerialNumber(); + if (StringUtils.isBlank(serialNumber)) { + continue; + } + List designFileList = new ArrayList<>(); + List prehomoFileList = new ArrayList<>(); + List verifyFileList = new ArrayList<>(); + List oSSFileList = new ArrayList<>(); + if (StringUtils.isNotBlank(designDeliverableTemplate)) { + designFileList = fileInfos.stream().filter(e -> designDeliverableTemplate.contains(e.getId())).collect(Collectors.toList()); + oSSFileList.addAll(designFileList); + } + if (StringUtils.isNotBlank(prehomoDeliverableTemplate)) { + prehomoFileList = fileInfos.stream().filter(e -> prehomoDeliverableTemplate.contains(e.getId())).collect(Collectors.toList()); + oSSFileList.addAll(prehomoFileList); + } + if (StringUtils.isNotBlank(verifyDeliverableTemplate)) { + verifyFileList = fileInfos.stream().filter(e -> verifyDeliverableTemplate.contains(e.getId())).collect(Collectors.toList()); + oSSFileList.addAll(verifyFileList); + } + + if (oSSFileList.size() != 0) { + if (serialNumber.contains("/")) { + serialNumber = serialNumber.replaceAll("/", "-"); + } + String fileNowPath = uploadpath + "/tempZip/" + serialNumber; + File file = new File(fileNowPath); + if (file.exists()) { + file.delete(); + } + file.mkdirs(); + for (OSSFile ossFile : oSSFileList) { + String url = ossFile.getUrl(); + if (StringUtils.isNotBlank(url)) { + //判断文件是否存在 + boolean b = CosBootUtil.doesObjectExist(url); + if (b) { + InputStream download = CosBootUtil.download(url); + copyFile(download, fileNowPath + File.separator + ossFile.getFileName()); + } + } + } + } + } + } + } + + /** + * 验证用户是否是该项目的studio工程师。 + * + * @param projectLibraryId + * @param cut + */ + public void isStudio(String projectLibraryId, String cut) { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + int roleCode = this.checkUserRole(projectLibraryId, currentUser.getId(), ""); + if (roleCode != Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue())) { + String errorMessage = ""; + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + errorMessage = "该用户不是这个项目的studio工程师,没有权限操作!"; + } else { + errorMessage = "This user is not a studio engineer for this project and does not have permission to operate!"; + } + throw new JeroBootException(errorMessage); + } + } + + //表格高度 + private static int high = 25; + //表格宽度 + private static int widthPercentage = 100; + + @Override + public void downloadReport(Map params, HttpServletRequest req, HttpServletResponse resp) throws DocumentException { + String filename = "法规清单报告"; + + File file = null; + InputStream fin = null; + ServletOutputStream out = null; + + String filePar = null; + // 文件夹路径 + filePar = exportPdfTempPath + new Date().getTime(); + File myPath = new File(filePar); + file = new File(filePar + "/" + filename + new Date().getTime() + ".pdf"); + if (!myPath.exists()) { + myPath.mkdirs(); + } + + /*******pdf文件内容生成开始*********/ + Document document = new Document(PageSize.A4, 25, 25, 25, 25); + + //设中文字体 + BaseFont bfChinese = null; + try { + //bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",BaseFont.NOT_EMBEDDED); // 该方式不好用。 + + //创建一个支持中文的字体,字体为本地下载的字体 + bfChinese = BaseFont.createFont(simfangFontFilePath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); + } catch (Exception e) { + e.printStackTrace(); + } + + //创建标题 //size:26 一号字体 + Font f26 = new Font(bfChinese, 18, Font.NORMAL); + //Font f10 = new Font(bfChinese, 10, Font.NORMAL); + //Font f12 = new Font(bfChinese, 12, Font.NORMAL); + Font f8 = new Font(bfChinese, 8, Font.NORMAL); + Paragraph title1 = new Paragraph("ComplianceReport-Template", f26); + title1.setAlignment(Element.ALIGN_CENTER); + title1.setAlignment(Element.ALIGN_CENTER); + Chapter chapter1 = new Chapter(title1, 1); + chapter1.setNumberDepth(0); + Section section1 = chapter1; + + try { + PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file)); + } catch (DocumentException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + document.open(); + + // 创建4列的表格 + int colNumber = 4; + PdfPTable tableBasic = new PdfPTable(colNumber); + //设置段落上下空白 + //tableBasic.setSpacingBefore(25); + //tableBasic.setSpacingAfter(25); + + section1.add(tableBasic); + document.add(chapter1); + + String cut = (String) params.get("cut"); + String id = (String) params.get("id");//法规id + + QueryWrapper lawsInventoryQueryWrapper = new QueryWrapper<>(); + lawsInventoryQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getId, id); + ProjectLawsInventoryEO projectLawsInventoryEO = this.baseMapper.selectOne(lawsInventoryQueryWrapper); + params.put("projectLawsInventoryEO", projectLawsInventoryEO); + + QueryWrapper taskInventoryQueryWrapper = new QueryWrapper<>(); + taskInventoryQueryWrapper.lambda().eq(ProjectTaskInventoryEO::getProjectLawsInventoryId, id); + ProjectTaskInventoryEO projectTaskInventoryEO = projectTaskInventoryEOService.getBaseMapper().selectOne(taskInventoryQueryWrapper); + params.put("projectTaskInventoryEO", projectTaskInventoryEO); + + QueryWrapper libraryBaseQueryWrapper = new QueryWrapper<>(); + libraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getId, projectLawsInventoryEO.getProjectLibraryId()); + ProjectLibraryBase projectLibraryBase = platformProjectLibraryBaseMapper.selectOne(libraryBaseQueryWrapper); + params.put("projectLibraryBase", projectLibraryBase); + + QueryWrapper projectNameQueryWrapper = new QueryWrapper<>(); + projectNameQueryWrapper.lambda().eq(ProjectNameInfoEO::getId, projectLibraryBase.getProjectNameId()); + ProjectNameInfoEO projectNameInfoEO = platformProjectNameInfoEOMapper.selectOne(projectNameQueryWrapper); + params.put("projectNameInfoEO", projectNameInfoEO); + + //设置ProgramInformation内容 + setProgramInformation(tableBasic, document, f8, params); + + //设置ComplianceAttachments 验证符合性流程里最后通过审批的 “ 工程确认 ” 中的附件 内容 + setComplianceAttachments(new PdfPTable(2), document, f8); + + //设置ComplianceResult 内容 + setComplianceResult(new PdfPTable(2), document, f8, params); + + //审核历史表头 + String[] auditHistoryHead = new String[]{"Result", "Opinion", "Node", "Operator", "Datetime"}; + + //设置DesignComplianceCheckApprovals (设计符合性确认的审批历史数据,没有就空着) 内容 + setDesignComplianceCheckApprovals(new PdfPTable(auditHistoryHead.length), document, f8, auditHistoryHead, params); + + //设置ValidationComplianceCheckApprovals (验证符合性确认的审批历史数据,没有就空着) 内容 + setValidationComplianceCheckApprovals(new PdfPTable(auditHistoryHead.length), document, f8, auditHistoryHead, params); + + document.close(); + + try { + fin = new FileInputStream(file); + resp.setCharacterEncoding("utf-8"); + resp.setContentType("application/pdf"); + + // 设置浏览器以下载的方式处理该文件 + if (req.getHeader("User-Agent").toUpperCase().indexOf("MSIE") > 0) { + filename = URLEncoder.encode(filename, "UTF-8"); + } else { + filename = new String(filename.getBytes("UTF-8"), "ISO8859-1"); + } + resp.setHeader("Content-Disposition", "attachment;filename=" + filename + ".pdf"); + out = resp.getOutputStream(); + + // 缓冲区 + byte[] buffer = new byte[512]; + int bytesToRead = -1; + + // 通过循环将读入的Word文件的内容输出到浏览器中 + while ((bytesToRead = fin.read(buffer)) != -1) { + out.write(buffer, 0, bytesToRead); + } + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + try { + if (fin != null) { + fin.close(); + } + if (out != null) { + out.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + if (file != null) { + // 删除临时文件 + file.delete(); + } + + if (myPath != null) { + // 删除临时文件夹 + myPath.delete(); + } + } + } + + private PdfPCell pdfTableStyle(String content, Font font, int high, boolean isAlignCenter, boolean isAlignMidde) { + PdfPCell pdfPCell = new PdfPCell(new Phrase(content, font)); + pdfPCell.setMinimumHeight(high); + pdfPCell.setUseAscender(true); // 设置可以居中 + if (isAlignCenter) { + pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); // 设置水平居中 + } + if (isAlignMidde) { + pdfPCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); // 设置垂直居中 + } + return pdfPCell; + } + + public void setProgramInformation(PdfPTable tableBase, Document document, Font fontSize, Map params) throws DocumentException { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + String cut = (String) params.get("cut"); + + ProjectLawsInventoryEO projectLawsInventoryEO = (ProjectLawsInventoryEO) params.get("projectLawsInventoryEO"); + ProjectTaskInventoryEO projectTaskInventoryEO = (ProjectTaskInventoryEO) params.get("projectTaskInventoryEO"); + ProjectLibraryBase projectLibraryBase = (ProjectLibraryBase) params.get("projectLibraryBase"); + ProjectNameInfoEO projectNameInfoEO = (ProjectNameInfoEO) params.get("projectNameInfoEO"); + + tableBase.setHorizontalAlignment(Element.ALIGN_CENTER);// 居左 + tableBase.setTotalWidth(500f);//表格的总宽度 + tableBase.setWidthPercentage(100);// 表格的宽度百分比 + + PdfPTable tableName = new PdfPTable(1); + //设置段落上空白 + tableName.setSpacingBefore(25); + //设置标题长度占纸张比例 + tableName.setWidthPercentage(widthPercentage); + //给表格赋值 + PdfPCell programInformation = pdfTableStyle("Program Information", fontSize, 10, false, false); + programInformation.disableBorderSide(15); + tableName.addCell(programInformation); + //将表格添加到文档对象中 + document.add(tableName); + + // cell 11 第一行 第一列 + PdfPCell cell11 = pdfTableStyle("CR No.", fontSize, 50, true, true); + tableBase.addCell(cell11); + PdfPCell cell12 = pdfTableStyle("Xxx(自动生成NIO-日期-序号)NIO-2022041301", fontSize, 50, true, true); + tableBase.addCell(cell12); + PdfPCell cell13 = pdfTableStyle("CR Status", fontSize, 50, true, true); + tableBase.addCell(cell13); + + String flowStatus = ""; + if (StringUtils.isNotEmpty(projectTaskInventoryEO.getVerifyStatus())) { + flowStatus = projectTaskInventoryEO.getVerifyStatus() + ","; + } + if (StringUtils.isNotEmpty(projectTaskInventoryEO.getPrehomoStatus())) { + flowStatus += projectTaskInventoryEO.getPrehomoStatus() + ","; + } + if (StringUtils.isNotEmpty(projectTaskInventoryEO.getVerifyStatus())) { + flowStatus += projectTaskInventoryEO.getVerifyStatus() + ","; + } + if (StringUtils.isNotEmpty(flowStatus)) { + flowStatus = flowStatus.substring(0, flowStatus.length() - 1); + } + PdfPCell cell14 = pdfTableStyle(flowStatus, fontSize, 50, true, true); + tableBase.addCell(cell14); + + // cell 21 第二行 第一列 + PdfPCell cell21 = pdfTableStyle("Regulation", fontSize, 50, true, true); + tableBase.addCell(cell21); + PdfPCell cell22 = pdfTableStyle(projectLawsInventoryEO.getSerialNumber(), fontSize, 50, true, true); + tableBase.addCell(cell22); + PdfPCell cell23 = pdfTableStyle("Subject", fontSize, 50, true, true); + tableBase.addCell(cell23); + PdfPCell cell24 = pdfTableStyle(projectLawsInventoryEO.getTitle(), fontSize, 50, true, true); + tableBase.addCell(cell24); + // cell 31 第三行 第一列 + PdfPCell cell31 = pdfTableStyle("Project", fontSize, 50, true, true); + tableBase.addCell(cell31); + PdfPCell cell32 = pdfTableStyle(projectNameInfoEO.getProjectName(), fontSize, 50, true, true); + tableBase.addCell(cell32); + PdfPCell cell33 = pdfTableStyle("Market", fontSize, 50, true, true); + tableBase.addCell(cell33); + + List regionDictList = sysDictItemServiceImpl.selectItemsByDictCode("region"); + List marketList = new ArrayList<>(); + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + marketList = regionDictList.stream().filter(e -> StringUtils.equals(e.getItemValue(), projectLibraryBase.getTargetMarket())).map(SysDictItem::getItemText).distinct().collect(Collectors.toList()); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + marketList = regionDictList.stream().filter(e -> StringUtils.equals(e.getItemValue(), projectLibraryBase.getTargetMarket())).map(SysDictItem::getEnName).distinct().collect(Collectors.toList()); + } + String market = ""; + if (CollectionUtils.isNotEmpty(marketList)) { + market = marketList.get(0); + } + + PdfPCell cell34 = pdfTableStyle(market, fontSize, 50, true, true); + tableBase.addCell(cell34); + // cell 41 第四行 第一列 + PdfPCell cell41 = pdfTableStyle("NT", fontSize, 50, true, true); + tableBase.addCell(cell41); + PdfPCell cell42 = pdfTableStyle("(取项目-数字平台)", fontSize, 50, true, true); + tableBase.addCell(cell42); + PdfPCell cell43 = pdfTableStyle("NP", fontSize, 50, true, true); + tableBase.addCell(cell43); + PdfPCell cell44 = pdfTableStyle("(取项目-车型平台)", fontSize, 50, true, true); + tableBase.addCell(cell44); + + // cell 51 第五行 第一列 + PdfPCell cell51 = pdfTableStyle("Completion Date", fontSize, 50, true, true); + tableBase.addCell(cell51); + String processEndTimeStr = ""; + if (projectTaskInventoryEO.getProcessEndTime() != null) { + processEndTimeStr = sdf.format(projectTaskInventoryEO.getProcessEndTime()); + } + PdfPCell cell52 = pdfTableStyle(processEndTimeStr, fontSize, 50, true, true); + tableBase.addCell(cell52); + PdfPCell cell53 = pdfTableStyle("Responsible Field", fontSize, 50, true, true); + tableBase.addCell(cell53); + + String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); + String finalDutyTerritory = dutyTerritory; + List dutyTerritoryDictItemList = sysDictItemServiceImpl.selectItemsByDictCode("duty_territory"); + String dutyTerritoryName = ""; + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + dutyTerritoryName = dutyTerritoryDictItemList.stream() + .filter(e -> finalDutyTerritory.contains(e.getItemValue())) + .map(SysDictItem::getItemText) + .collect(Collectors.joining(",")); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + dutyTerritoryName = dutyTerritoryDictItemList.stream() + .filter(e -> finalDutyTerritory.contains(e.getItemValue())) + .map(SysDictItem::getEnName) + .collect(Collectors.joining(",")); + } + PdfPCell cell54 = pdfTableStyle(dutyTerritoryName, fontSize, 50, true, true); + tableBase.addCell(cell54); + + // cell 61 第6行 第一列 + PdfPCell cell61 = pdfTableStyle("R&H Studio Engineer", fontSize, 50, true, true); + tableBase.addCell(cell61); + + String studioEngineer = projectLibraryBase.getStudioEngineer(); + QueryWrapper queryStudioUserWrapper = new QueryWrapper<>(); + queryStudioUserWrapper.lambda().eq(SysUser::getId, studioEngineer); + SysUser studioUserInfo = sysUserMapper.selectOne(queryStudioUserWrapper); + PdfPCell cell62 = pdfTableStyle(studioUserInfo.getUsername(), fontSize, 50, true, true); + tableBase.addCell(cell62); + PdfPCell cell63 = pdfTableStyle("Engineering Interface", fontSize, 50, true, true); + tableBase.addCell(cell63); + + String engineeringInterfacePerson = projectLawsInventoryEO.getEngineeringInterfacePerson(); + QueryWrapper queryEngineeringInterfaceUserWrapper = new QueryWrapper<>(); + queryEngineeringInterfaceUserWrapper.lambda().eq(SysUser::getId, engineeringInterfacePerson); + SysUser engineeringInterfaceInfo = sysUserMapper.selectOne(queryEngineeringInterfaceUserWrapper); + PdfPCell cell64 = pdfTableStyle(engineeringInterfaceInfo.getUsername(), fontSize, 50, true, true); + tableBase.addCell(cell64); + + // cell 71 第7行 第一列 + PdfPCell cell71 = pdfTableStyle("Homologation Engineer", fontSize, 50, true, true); + tableBase.addCell(cell71); + String homologationEngineerId = projectLawsInventoryEO.getHomologationEngineerId(); + QueryWrapper queryHomologationEngineerUserWrapper = new QueryWrapper<>(); + queryHomologationEngineerUserWrapper.lambda().eq(SysUser::getId, homologationEngineerId); + SysUser homologationEngineerInfo = sysUserMapper.selectOne(queryHomologationEngineerUserWrapper); + PdfPCell cell72 = pdfTableStyle(homologationEngineerInfo.getUsername(), fontSize, 50, true, true); + tableBase.addCell(cell72); + PdfPCell cell73 = pdfTableStyle("Regulation Engineer", fontSize, 50, true, true); + tableBase.addCell(cell73); + String regulationOwnerId = projectLawsInventoryEO.getRegulationOwnerId(); + QueryWrapper queryRegulationOwnerUserWrapper = new QueryWrapper<>(); + queryRegulationOwnerUserWrapper.lambda().eq(SysUser::getId, regulationOwnerId); + SysUser regulationOwnerInfo = sysUserMapper.selectOne(queryRegulationOwnerUserWrapper); + PdfPCell cell74 = pdfTableStyle(regulationOwnerInfo.getUsername(), fontSize, 50, true, true); + tableBase.addCell(cell74); + + // cell 81 第8行 第一列 + PdfPCell cell81 = pdfTableStyle(" ", fontSize, 20, true, true); + tableBase.addCell(cell81); + PdfPCell cell82 = pdfTableStyle(" ", fontSize, 20, true, true); + tableBase.addCell(cell82); + PdfPCell cell83 = pdfTableStyle(" ", fontSize, 20, true, true); + tableBase.addCell(cell83); + PdfPCell cell84 = pdfTableStyle(" ", fontSize, 20, true, true); + tableBase.addCell(cell84); + + document.add(tableBase); + + PdfPTable cell9 = new PdfPTable(2); + // 定义表格的宽度 占比 + float[] cell9Width = {0.25f, 0.75f}; + try { + cell9.setWidths(cell9Width); + } catch (DocumentException e) { + e.printStackTrace(); + } + cell9.setWidthPercentage(widthPercentage); //设置标题长度占纸张比例 + cell9.addCell(pdfTableStyle("Description", fontSize, 50, true, true)); + cell9.addCell(pdfTableStyle(" ", fontSize, 50, true, true)); //(导出后自己填写) + document.add(cell9); + } + + public void setComplianceAttachments(PdfPTable tableBase, Document document, Font fontSize) throws DocumentException { + // 定义表格的宽度 + float[] cellsWidth = {0.45f, 0.55f}; + try { + tableBase.setWidths(cellsWidth); + } catch (Exception ex) { + ex.printStackTrace(); + } + + tableBase.setTotalWidth(500f);//表格的总宽度 + tableBase.setWidthPercentage(100);// 表格的宽度百分比 + + // 单元格宽度 + PdfPTable tableName = new PdfPTable(1); + //设置段落上空白 + tableName.setSpacingBefore(25); + tableName.setWidthPercentage(widthPercentage); //设置标题长度占纸张比例 + //给表格赋值 + PdfPCell programInformation = pdfTableStyle("Compliance Attachments", fontSize, 10, false, false); + programInformation.disableBorderSide(15); + tableName.addCell(programInformation); + //将表格添加到文档对象中 + document.add(tableName); + + // cell 11 第一行 第一列 + PdfPCell cell11 = pdfTableStyle("File Name", fontSize, 20, true, true); + tableBase.addCell(cell11); + PdfPCell cell12 = pdfTableStyle("catalogue", fontSize, 20, true, true); + tableBase.addCell(cell12); + // cell 21 第二行 第一列 + PdfPCell cell21 = pdfTableStyle("Checklist.doc", fontSize, 20, true, true); + tableBase.addCell(cell21); + PdfPCell cell22 = pdfTableStyle("Xxx(显示文件所在的相对路径)", fontSize, 20, true, true); + tableBase.addCell(cell22); + // cell 31 第三行 第一列 + PdfPCell cell31 = pdfTableStyle("CADreport.pdf", fontSize, 20, true, true); + tableBase.addCell(cell31); + PdfPCell cell32 = pdfTableStyle("Xxx(显示文件所在的相对路径)", fontSize, 20, true, true); + tableBase.addCell(cell32); + + document.add(tableBase); + } + + public void setComplianceResult(PdfPTable tableBase, Document document, Font fontSize, Map params) throws DocumentException { + String cut = (String) params.get("cut"); + //法规id + String id = (String) params.get("id"); + QueryWrapper lawsInventoryQueryWrapper = new QueryWrapper<>(); + lawsInventoryQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getId, id); + ProjectLawsInventoryEO projectLawsInventoryEO = this.baseMapper.selectOne(lawsInventoryQueryWrapper); + + // 单元格宽度 + float[] cellsWidth = {0.45f, 0.55f}; + try { + tableBase.setWidths(cellsWidth); + } catch (Exception ex) { + ex.printStackTrace(); + } + + tableBase.setTotalWidth(500f);//表格的总宽度 + tableBase.setWidthPercentage(100);// 表格的宽度百分比 + + PdfPTable tableName = new PdfPTable(1); + //设置段落上空白 + tableName.setSpacingBefore(25); + tableName.setWidthPercentage(widthPercentage); //设置标题长度占纸张比例 + //给表格赋值 + PdfPCell programInformation = pdfTableStyle("Compliance Result", fontSize, 10, false, false); + programInformation.disableBorderSide(15); + tableName.addCell(programInformation); + //将表格添加到文档对象中 + document.add(tableName); + + // cell 11 第一行 第一列 + PdfPCell cell11 = pdfTableStyle("Subject", fontSize, 20, true, true); + tableBase.addCell(cell11); + PdfPCell cell12 = pdfTableStyle("Lamp " + projectLawsInventoryEO.getTitle(), fontSize, 20, true, true); + tableBase.addCell(cell12); + // cell 21 第二行 第一列 + PdfPCell cell21 = pdfTableStyle("Conclusion", fontSize, 20, true, true); + tableBase.addCell(cell21); + PdfPCell cell22 = pdfTableStyle("", fontSize, 20, true, true); //(导出后自己填写) + tableBase.addCell(cell22); + // cell 31 第三行 第一列 + PdfPCell cell31 = pdfTableStyle("DiscussionorComments", fontSize, 20, true, true); + tableBase.addCell(cell31); + PdfPCell cell32 = pdfTableStyle("", fontSize, 20, true, true); //(导出后自己填写) + tableBase.addCell(cell32); + + document.add(tableBase); + } + + public void setDesignComplianceCheckApprovals(PdfPTable tableBase, Document document, Font fontSize, String[] auditHistoryHead, Map params) throws DocumentException { + tableBase.setTotalWidth(500f);//表格的总宽度 + tableBase.setWidthPercentage(100);// 表格的宽度百分比 + + PdfPTable tableName = new PdfPTable(1); + //设置段落上空白 + tableName.setSpacingBefore(25); + tableName.setWidthPercentage(widthPercentage); //设置标题长度占纸张比例 + //给表格赋值 + PdfPCell programInformation = pdfTableStyle("designComplianceCheckApprovals", fontSize, 10, false, false); + programInformation.disableBorderSide(15); + tableName.addCell(programInformation); + //将表格添加到文档对象中 + document.add(tableName); + + + for (int i = 0; i < auditHistoryHead.length; i++) { + tableBase.addCell(new Paragraph(auditHistoryHead[i], fontSize)); + } + document.add(tableBase); + } + + public void setValidationComplianceCheckApprovals(PdfPTable tableBase, Document document, Font fontSize, String[] auditHistoryHead, Map params) throws DocumentException { + List> list = new ArrayList<>(); + + Map map1 = new HashMap<>(); + map1.put("Result", ""); + map1.put("Opinion", "Opinion 1"); + map1.put("Node", "Node 1"); + map1.put("Operator", "Operator 1"); + map1.put("Datetime", "Datetime 1"); + list.add(map1); + Map map2 = new HashMap<>(); + map2.put("Result", "Result 2 "); + map2.put("Opinion", "Opinion 2"); + map2.put("Node", ""); + map2.put("Operator", "Operator 2"); + map2.put("Datetime", "Datetime 2"); + list.add(map2); + Map map3 = new HashMap<>(); + map3.put("Result", "Result 3 "); + map3.put("Opinion", "Opinion 3"); + map3.put("Node", "Node 3"); + map3.put("Operator", "Operator 3"); + map3.put("Datetime", "Datetime 3"); + list.add(map3); + + tableBase.setTotalWidth(500f);//表格的总宽度 + tableBase.setWidthPercentage(100);// 表格的宽度百分比 + + PdfPTable tableName = new PdfPTable(1); + //设置段落上空白 + tableName.setSpacingBefore(25); + tableName.setWidthPercentage(widthPercentage); //设置标题长度占纸张比例 + //给表格赋值 + PdfPCell programInformation = pdfTableStyle("validationComplianceCheckApprovals", fontSize, 10, false, false); + programInformation.disableBorderSide(15); + tableName.addCell(programInformation); + //将表格添加到文档对象中 + document.add(tableName); + + for (int i = 0; i < auditHistoryHead.length; i++) { + tableBase.addCell(new Paragraph(auditHistoryHead[i], fontSize)); + } + + for (Map map : list) { + tableBase.addCell(new Paragraph(map.get("Result").toString(), fontSize)); + tableBase.addCell(new Paragraph(map.get("Opinion").toString(), fontSize)); + tableBase.addCell(new Paragraph(map.get("Node").toString(), fontSize)); + tableBase.addCell(new Paragraph(map.get("Operator").toString(), fontSize)); + tableBase.addCell(new Paragraph(map.get("Datetime").toString(), fontSize)); + } + document.add(tableBase); + } + + /** + * 下载docx报告 + * + * @param params + * @param req + * @param resp + */ + @Override + public void downloadDocxReport(Map params, HttpServletRequest req, HttpServletResponse resp) { + File exportFile = null; + InputStream fin = null; + ServletOutputStream out = null; + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + //导出只有英文,去除中英文切换。 + params.put("cut", CutEnum.EN.getValue()); + String id = (String) params.get("id"); + String cut = (String) params.get("cut"); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + log.debug("导出word报告,查询数据开始 ============================================================================="); + //查询数据 + QueryWrapper lawsInventoryQueryWrapper = new QueryWrapper<>(); + lawsInventoryQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getId, id); + ProjectLawsInventoryEO projectLawsInventory = this.baseMapper.selectOne(lawsInventoryQueryWrapper); + List projectLawsInventoryEOList = new ArrayList<>(); + projectLawsInventoryEOList.add(projectLawsInventory); + this.dataDispose( + projectLawsInventoryEOList, + currentUser, + Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue()), + CutEnum.EN.getValue() + ); + + ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOList.get(0); + params.put("projectLawsInventoryEO", projectLawsInventoryEO); + + /*QueryWrapper taskInventoryQueryWrapper = new QueryWrapper<>(); + taskInventoryQueryWrapper.lambda().eq(ProjectTaskInventoryEO::getProjectLawsInventoryId,id); + ProjectTaskInventoryEO projectTaskInventoryEO = projectTaskInventoryEOService.getBaseMapper().selectOne(taskInventoryQueryWrapper); + params.put("projectTaskInventoryEO",projectTaskInventoryEO);*/ + + QueryWrapper libraryBaseQueryWrapper = new QueryWrapper<>(); + libraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getId, projectLawsInventoryEO.getProjectLibraryId()); + ProjectLibraryBase projectLibraryBase = platformProjectLibraryBaseMapper.selectOne(libraryBaseQueryWrapper); + params.put("projectLibraryBase", projectLibraryBase); + + QueryWrapper projectNameQueryWrapper = new QueryWrapper<>(); + projectNameQueryWrapper.lambda().eq(ProjectNameInfoEO::getId, projectLibraryBase.getProjectNameId()); + ProjectNameInfoEO projectNameInfoEO = platformProjectNameInfoEOMapper.selectOne(projectNameQueryWrapper); + params.put("projectNameInfoEO", projectNameInfoEO); + + + final Map dataMap = new HashMap<>(); + //对应 CR No + dataMap.put("crNo", String.valueOf(new SimpleDateFormat("yyyyMMddHHmmssSSSS").format(new Date()))); + + String flowStatus = ""; + + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyFlowStatusName())) { + flowStatus += projectLawsInventoryEO.getVerifyFlowStatusName() + ","; + } + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignFlowStatusName())) { + flowStatus += projectLawsInventoryEO.getDesignFlowStatusName() + ","; + } + if (StringUtils.isNotEmpty(flowStatus)) { + flowStatus = flowStatus.substring(0, flowStatus.length() - 1); + } + + //对应 crStatus + dataMap.put("FLOW_STATUS", StringUtils.isNotEmpty(flowStatus) ? flowStatus : ""); + //对应 Regulation + dataMap.put("REGULATION", StringUtils.isNotEmpty(projectLawsInventoryEO.getSerialNumber()) ? projectLawsInventoryEO.getSerialNumber() : ""); + //对应 Subject + dataMap.put("SUBJECT", StringUtils.isNotEmpty(projectLawsInventoryEO.getTitle()) ? projectLawsInventoryEO.getTitle() : ""); + //对应 Project + dataMap.put("PROJECT_NAME", StringUtils.isNotEmpty(projectLibraryBase.getProjectNameId()) ? projectLibraryBase.getProjectNameId() : ""); +// dataMap.put("PROJECT_NAME", StringUtils.isNotEmpty(projectNameInfoEO.getProjectName()) ? projectNameInfoEO.getProjectName() : ""); + + List regionDictList = sysDictItemServiceImpl.selectItemsByDictCode("region"); + String market = ""; + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + if(StringUtils.isNotBlank(projectLibraryBase.getTargetMarket())){ + market = regionDictList.stream() + .filter(e -> projectLibraryBase.getTargetMarket().contains(e.getItemValue())) + .map(SysDictItem::getItemText) + .collect(Collectors.joining(",")); + } + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + if(StringUtils.isNotBlank(projectLibraryBase.getTargetMarket())){ + market = regionDictList.stream() + .filter(e -> projectLibraryBase.getTargetMarket().contains(e.getItemValue())) + .map(SysDictItem::getEnName) + .collect(Collectors.joining(",")); + } + } + //对应 Market + dataMap.put("MARKET", StringUtils.isNotEmpty(market) ? market : ""); + if(ObjectUtils.isNotEmpty(projectNameInfoEO)){ + //对应 nt 数字平台 + dataMap.put("NT", StringUtils.isNotEmpty(projectNameInfoEO.getDigitalPlatform()) ? projectNameInfoEO.getDigitalPlatform() : ""); + //对应 np 车型平台 + dataMap.put("NP", StringUtils.isNotEmpty(projectNameInfoEO.getVehiclePlatform()) ? projectNameInfoEO.getVehiclePlatform() : ""); + } + String processEndTimeStr = ""; + // 流程最后结束的时间 + if (projectLawsInventoryEO.getProcessEndTime() != null) { + processEndTimeStr = sdf.format(projectLawsInventoryEO.getProcessEndTime()); + } + dataMap.put("COMPLETION_DATE", StringUtils.isNotEmpty(processEndTimeStr) ? processEndTimeStr : ""); + + String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); + String finalDutyTerritory = dutyTerritory; + List dutyTerritoryDictItemList = sysDictItemServiceImpl.selectItemsByDictCode("duty_territory"); + String dutyTerritoryName = ""; + if (StringUtils.isNotEmpty(finalDutyTerritory)) { + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + dutyTerritoryName = dutyTerritoryDictItemList.stream() + .filter(e -> finalDutyTerritory.contains(e.getItemValue())) + .map(SysDictItem::getItemText) + .collect(Collectors.joining(",")); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + dutyTerritoryName = dutyTerritoryDictItemList.stream() + .filter(e -> finalDutyTerritory.contains(e.getItemValue())) + .map(SysDictItem::getEnName) + .collect(Collectors.joining(",")); + } + } + dataMap.put("RESPONSIBLE_FIELD", StringUtils.isNotEmpty(dutyTerritoryName) ? dutyTerritoryName : ""); + + String studioEngineer = projectLibraryBase.getStudioEngineer(); + QueryWrapper queryStudioUserWrapper = new QueryWrapper<>(); + queryStudioUserWrapper.lambda().eq(SysUser::getId, studioEngineer); + SysUser studioUserInfo = sysUserMapper.selectOne(queryStudioUserWrapper); + dataMap.put("STUDIO", StringUtils.isNotEmpty(studioUserInfo.getUsername()) ? studioUserInfo.getUsername() : ""); + + String engineeringInterfacePerson = projectLawsInventoryEO.getEngineeringInterfacePerson(); + String engineeringInterfaceName = ""; + if (StringUtils.isNotEmpty(engineeringInterfacePerson)) { + QueryWrapper queryEngineeringInterfaceUserWrapper = new QueryWrapper<>(); + queryEngineeringInterfaceUserWrapper.lambda().eq(SysUser::getId, engineeringInterfacePerson); + SysUser engineeringInterfaceInfo = sysUserMapper.selectOne(queryEngineeringInterfaceUserWrapper); + engineeringInterfaceName = engineeringInterfaceInfo.getUsername(); + } + + dataMap.put("ENGINEERING", StringUtils.isNotEmpty(engineeringInterfaceName) ? engineeringInterfaceName : ""); + + String homologationEngineerId = projectLawsInventoryEO.getHomologationEngineerId(); + String homologationEngineerName = ""; + if (StringUtils.isNotEmpty(homologationEngineerId)) { + QueryWrapper queryHomologationEngineerUserWrapper = new QueryWrapper<>(); + queryHomologationEngineerUserWrapper.lambda().eq(SysUser::getId, homologationEngineerId); + SysUser homologationEngineerInfo = sysUserMapper.selectOne(queryHomologationEngineerUserWrapper); + homologationEngineerName = homologationEngineerInfo.getUsername(); + } + dataMap.put("HOMOLOGATION", StringUtils.isNotEmpty(homologationEngineerName) ? homologationEngineerName : ""); + + String regulationOwnerId = projectLawsInventoryEO.getRegulationOwnerId(); + String regulationOwnerName = ""; + if (StringUtils.isNotEmpty(regulationOwnerId)) { + QueryWrapper queryRegulationOwnerUserWrapper = new QueryWrapper<>(); + queryRegulationOwnerUserWrapper.lambda().eq(SysUser::getId, regulationOwnerId); + SysUser regulationOwnerInfo = sysUserMapper.selectOne(queryRegulationOwnerUserWrapper); + regulationOwnerName = regulationOwnerInfo.getUsername(); + } + dataMap.put("REGULATION_ENG", StringUtils.isNotEmpty(regulationOwnerName) ? regulationOwnerName : ""); + log.debug("导出word报告,查询数据结束 ============================================================================="); + log.debug("导出word报告,获取模板开始 ============================================================================="); + //File templateFile = new File(exportPdfTempPath + "temp/ComplianceReportTemplate.docx"); + InputStream inputStream = PlatformProjectLawsInventoryEOServiceImpl.class.getClassLoader().getResourceAsStream("exportPdfTemp/ComplianceReportTemplate.docx"); + /*try { + FileUtils.copyInputStreamToFile(inputStream, templateFile); + } catch (IOException e) { + e.printStackTrace(); + }*/ + + + log.debug("导出word报告,获取模板结束 ============================================================================="); + //if(templateFile != null){ + if (inputStream != null) { + try { + String uuid = UUID.randomUUID().toString(); + //final String TEMP_FILE_PATH = System.getProperty("os.name").toLowerCase().contains("windows") ? System.getProperty("user.dir") + File.separator : "/home/admin/tempfile/"; + final String TEMP_FILE_PATH = exportPdfTempPath + "exportFile/"; + + File pathFile = new File(TEMP_FILE_PATH); + if (!pathFile.exists()) { + pathFile.mkdirs(); + } + String outFile = TEMP_FILE_PATH + uuid + ".docx"; + exportFile = new File(outFile); + FileOutputStream os = new FileOutputStream(outFile); + //WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new FileInputStream(templateFile)); + WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(inputStream); + + //验证符合性流程实例id + String verifyPId = projectLawsInventoryEO.getVerifyPId(); + //Compliance Attachments 验证符合性流程里最后通过审批的“工程确认”中的附件 + setTableContent(1, wordMLPackage, params, verifyPId); + //Validation Compliance Check Approvals(验证符合性确认的审批历史数据) + setTableContent(4, wordMLPackage, params, verifyPId); + + //设计符合性流程实例id + String designPId = projectLawsInventoryEO.getDesignPId(); + //Design Compliance Check Approvals (设计符合性确认的审批历史数据) + setTableContent(3, wordMLPackage, params, designPId); + + WordUtil.replaceVariable(wordMLPackage, dataMap); + Docx4J.save(wordMLPackage, os); + + //将替换后的文档输出出去。 + fin = new FileInputStream(outFile); + resp.setCharacterEncoding("utf-8"); + resp.setContentType("application/docx"); + + String filename = ""; + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + filename = "法规清单报告"; + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + filename = "Compliance List report"; + } + // 设置浏览器以下载的方式处理该文件 + if (req.getHeader("User-Agent").toUpperCase().indexOf("MSIE") > 0) { + filename = URLEncoder.encode(filename, "UTF-8"); + } else { + filename = new String(filename.getBytes("UTF-8"), "ISO8859-1"); + } + resp.setHeader("Content-Disposition", "attachment;filename=" + filename + ".docx"); + out = resp.getOutputStream(); + + // 缓冲区 + byte[] buffer = new byte[512]; + int bytesToRead = -1; + + // 通过循环将读入的Word文件的内容输出到浏览器中 + while ((bytesToRead = fin.read(buffer)) != -1) { + out.write(buffer, 0, bytesToRead); + } + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (fin != null) { + fin.close(); + } + if (out != null) { + out.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + if (exportFile != null) { + // 删除导出去的文件 + exportFile.delete(); + } + } + } else { + throw new JeroBootException("路径 :" + exportPdfTempPath + "temp/ComplianceReportTemplate.docx" + " 中没有找到文件"); + } + } + + /** + * 设置表内容 + * + * @param tableIndex 表的下标 + * @param wordMLPackage + * @param params + * @param pId 流程实例id + */ + public void setTableContent(int tableIndex, WordprocessingMLPackage wordMLPackage, Map params, String pId) { + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + List> dataList = new ArrayList<>(); + // 设置数据 + if (StringUtils.isNotEmpty(pId)) { + if (tableIndex == 1) { + /*QueryWrapper taskFeedbackQueryWrapper = new QueryWrapper<>(); + taskFeedbackQueryWrapper.lambda().eq(ProjectTaskInventoryFeedbackEO::getActiProcInstId,pId); + List projectTaskInventoryFeedbackEOList = projectTaskInventoryFeedbackEOService.getBaseMapper().selectList(taskFeedbackQueryWrapper); + if(CollectionUtils.isNotEmpty(projectTaskInventoryFeedbackEOList)){ + List fileIdList = projectTaskInventoryFeedbackEOList.stream().map(ProjectTaskInventoryFeedbackEO::getFileId).distinct().collect(Collectors.toList()); + String fileId = StringUtils.join(fileIdList,","); + List fileList = iOSSFileService.getFileInfos(fileId); + if(CollectionUtils.isNotEmpty(fileList)){ + fileList.forEach(file -> { + Map fileMap = new HashMap<>(); + fileMap.put("ITEM_FILENAME", StringUtils.isNotEmpty(file.getFileName()) ? file.getFileName() : ""); + fileMap.put("ITEM_FILEPATH", StringUtils.isNotEmpty(file.getUrl()) ? file.getUrl() : ""); + *//*fileMap.put("item.fileName", file.getFileName()); + fileMap.put("item.filePath", file.getUrl());*//* + dataList.add(fileMap); + }); + } + }*/ + params.put("actiProcInstId", pId); + List processHistoryEOList = processHistoryEOService.queryList(params); + if (CollectionUtils.isNotEmpty(processHistoryEOList)) { + List fileIdList = processHistoryEOList.stream().map(ProcessHistoryEO::getApprovalFile).distinct().collect(Collectors.toList()); + String fileId = StringUtils.join(fileIdList, ","); + List fileList = iOSSFileService.getFileInfos(fileId); + if (CollectionUtils.isNotEmpty(fileList)) { + fileList.forEach(file -> { + Map fileMap = new HashMap<>(); + fileMap.put("ITEM_FILENAME", StringUtils.isNotEmpty(file.getFileName()) ? file.getFileName() : ""); + fileMap.put("ITEM_FILEPATH", StringUtils.isNotEmpty(file.getUrl()) ? file.getUrl() : ""); + /*fileMap.put("item.fileName", file.getFileName()); + fileMap.put("item.filePath", file.getUrl());*/ + dataList.add(fileMap); + }); + } + } + } else if (tableIndex == 3) { + params.put("actiProcInstId", pId); + List processHistoryEOList = processHistoryEOService.queryList(params); + if (CollectionUtils.isNotEmpty(processHistoryEOList)) { + processHistoryEOList.forEach(processHistory -> { + String createTime = sdf.format(processHistory.getCreateTime()); + + Map designMap = new HashMap<>(); + designMap.put("DESIGN_RESULT", StringUtils.isNotEmpty(processHistory.getReviewResult()) ? processHistory.getReviewResult() : ""); + designMap.put("DESIGN_OPINION", StringUtils.isNotEmpty(processHistory.getApprovalOpinion()) ? processHistory.getApprovalOpinion() : ""); + designMap.put("DESIGN_NODE", StringUtils.isNotEmpty(processHistory.getName()) ? processHistory.getName() : ""); + designMap.put("DESIGN_OPERATOR", StringUtils.isNotEmpty(processHistory.getAssignee()) ? processHistory.getAssignee() : ""); + designMap.put("DESIGN_DATETIME", StringUtils.isNotEmpty(createTime) ? createTime : ""); + + /*designMap.put("design.result", processHistory.getReviewResult()); + designMap.put("design.opinion", processHistory.getApprovalOpinion()); + designMap.put("design.node", processHistory.getName()); + designMap.put("design.operator", processHistory.getAssignee()); + designMap.put("design.dateTime", createTime);*/ + dataList.add(designMap); + }); + } + } else if (tableIndex == 4) { + params.put("actiProcInstId", pId); + List processHistoryEOList = processHistoryEOService.queryList(params); + if (CollectionUtils.isNotEmpty(processHistoryEOList)) { + processHistoryEOList.forEach(processHistory -> { + String createTime = sdf.format(processHistory.getCreateTime()); + + Map verifyMap = new HashMap<>(); + verifyMap.put("VERIFY_RESULT", StringUtils.isNotEmpty(processHistory.getReviewResult()) ? processHistory.getReviewResult() : ""); + verifyMap.put("VERIFY_OPINION", StringUtils.isNotEmpty(processHistory.getApprovalOpinion()) ? processHistory.getApprovalOpinion() : ""); + verifyMap.put("VERIFY_NODE", StringUtils.isNotEmpty(processHistory.getName()) ? processHistory.getName() : ""); + verifyMap.put("VERIFY_OPERATOR", StringUtils.isNotEmpty(processHistory.getAssignee()) ? processHistory.getAssignee() : ""); + verifyMap.put("VERIFY_DATETIME", StringUtils.isNotEmpty(createTime) ? createTime : ""); + + /*verifyMap.put("verify.result", processHistory.getReviewResult()); + verifyMap.put("verify.opinion", processHistory.getApprovalOpinion()); + verifyMap.put("verify.node", processHistory.getName()); + verifyMap.put("verify.operator", processHistory.getAssignee()); + verifyMap.put("verify.dateTime", createTime);*/ + dataList.add(verifyMap); + }); + } + } + } + + //构造循环列表的数据 + ClassFinder find = new ClassFinder(Tbl.class); + new TraversalUtil(wordMLPackage.getMainDocumentPart().getContent(), find); + Tbl table = (Tbl) find.results.get(tableIndex); + //第二行约定为模板 + Tr dynamicTr = (Tr) table.getContent().get(1); + //获取模板行的xml数据 + String dynamicTrXml = XmlUtils.marshaltoString(dynamicTr); + + for (Map mapList : dataList) { + Tr newTr = (Tr) XmlUtils.unmarshallFromTemplate(dynamicTrXml, mapList);//填充模板行数据 + table.getContent().add(newTr); + } + //删除模板行的占位行 + table.getContent().remove(1); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + public static WordprocessingMLPackage getTemplate(String name) throws Docx4JException, FileNotFoundException { + WordprocessingMLPackage template = WordprocessingMLPackage.load(new FileInputStream(new File(name))); + return template; + } + + /** + * 催办 + * + * @param json + * @return + */ + @Override + public Result expediting(JSONObject json) { + String cut = json.getString("cut"); + String ids = json.getString("ids"); + String projectLibraryId = json.getString("projectLibraryId"); + String operateType = json.getString("operateType"); // 操作类型,判断是studio催办 还是法规工程师催办 + if (StringUtils.isEmpty(ids)) { + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + throw new JeroBootException("请至少选择一条数据!"); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + throw new JeroBootException("Please select at least one data!"); + } + } + + //法规清单id数组 + List projectLawsInventoryIdList = Arrays.asList(ids.split(",")); + + QueryWrapper lawsInventoryEOQueryWrapper = new QueryWrapper<>(); + lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + lawsInventoryEOQueryWrapper.lambda().in(ProjectLawsInventoryEO::getId, projectLawsInventoryIdList); + List projectLawsInventoryEOList = this.baseMapper.selectList(lawsInventoryEOQueryWrapper); + + // 催办类型 可以只催设计符合性 也可以只催验证符合性 + String expeditingType = json.getString("expeditingType"); + if (StringUtils.contains(expeditingType, OperatorTypeEnum.LAWS_INVENTORY_DESIGN_EXPEDITING.getValue())) { + // 只有studio催办的时候,才会给法规工程师发消息 + if (StringUtils.equals(operateType, OperatorTypeEnum.LAWS_INVENTORY_STUDIO_EXPEDITING.getValue())) { + // 设计符合性 清单待校核状态数据催办。 + this.designExpeditingToBeChecked(projectLibraryId, projectLawsInventoryEOList); + // 设计符合性 结果待审查状态数据催办。 + this.designExpeditingToBeReviewed(projectLibraryId, projectLawsInventoryEOList); + } + // 设计符合性 清单待确认状态数据催办 + this.designExpeditingToBeConfirmed(projectLibraryId, projectLawsInventoryEOList); + // 设计符合性 结果待提交状态数据催办 + this.designExpeditingToBeSubmitted(projectLibraryId, projectLawsInventoryEOList); + } + if (StringUtils.contains(expeditingType, OperatorTypeEnum.LAWS_INVENTORY_VERIFY_EXPEDITING.getValue())) { + // 只有studio催办的时候,才会给法规工程师发消息 + if (StringUtils.equals(operateType, OperatorTypeEnum.LAWS_INVENTORY_STUDIO_EXPEDITING.getValue())) { + // 验证符合性 清单待校核状态数据催办。 + this.verifyExpeditingToBeChecked(projectLibraryId, projectLawsInventoryEOList); + // 验证符合性 结果待审查状态数据催办。 + this.verifyExpeditingToBeReviewed(projectLibraryId, projectLawsInventoryEOList); + } + // 验证符合性 清单待确认状态数据催办 + this.verifyExpeditingToBeConfirmed(projectLibraryId, projectLawsInventoryEOList); + // 验证符合性 结果待提交状态数据催办 + this.verifyExpeditingToBeSubmitted(projectLibraryId, projectLawsInventoryEOList); + } + + /*//获取已经发起的 任务确认流程信息(当前处理人) + JSONObject queryFlowCurrentTaskJson = new JSONObject(); + queryFlowCurrentTaskJson.put("projectLawsInventoryIdList",projectLawsInventoryIdList); + queryFlowCurrentTaskJson.put("flowType",FlowTypeEnum.RWQRLC.getValue()); + String result = this.taskFeignClient.queryFlowCurrentTask(queryFlowCurrentTaskJson); + JSONObject jsonObject = JSONObject.parseObject(result); + + QueryWrapper libraryBaseQueryWrapper = new QueryWrapper<>(); + libraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getId,projectLibraryId); + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseMapper.selectOne(libraryBaseQueryWrapper); + + SysUser studioUserInfo = this.sysUserMapper.selectOne( + new QueryWrapper().lambda().eq(SysUser::getId, projectLibraryBase.getStudioEngineer()) + ); + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + projectLawsInventoryEOList.forEach(projectLawsInventoryEO -> { + + //如果清单确认状态为待确认的,进行催办 + if(StringUtils.equals(projectLawsInventoryEO.getInventoryAffirmStatus(),InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue())){ + List inventoryAffirmUserIdList = new ArrayList<>(); + + if(StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){ + //如果'认证工程师提交状态'为空,则代表认证工程师没提交过,给认证工程师发消息 + inventoryAffirmUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId()); + } + + if(StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){ + //如果'法规工程师提交状态'为空,则代表认证工程师没提交过,给认证工程师发消息 + inventoryAffirmUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId()); + } + + if(CollectionUtils.isNotEmpty(inventoryAffirmUserIdList)){ + //如果清单确认 没办理的用户不为空,给这些人发送消息,清单确认催办 + inventoryAffirmUserIdList = inventoryAffirmUserIdList.stream().distinct().collect(Collectors.toList()); + + log.debug("清单确认待办人员:" + inventoryAffirmUserIdList.toString()); + + QueryWrapper projectNameInfoEOQueryWrapper = new QueryWrapper<>(); + projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId()); + ProjectNameInfoEO projectNameInfoEO = platformProjectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper); + + QueryWrapper projectYearInfoEOQueryWrapper = new QueryWrapper<>(); + projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId()); + ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper); + + //消息内容 + //String msgContentEN = "Please address the regulation list confirmation process for "+ projectNameInfoEO.getProjectName() +" ASAP. "; + //String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a regulation task confirmation to complete"; + + //FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); + //feishuMsgVo.setContent("Hello! Please address the regulation list confirmation process ASAP. "); + //feishuMsgVo.setTaskType("Regulation List Confirmation"); + //feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); + + //飞书跳转链接 + String hrefFeishu = backUrl + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + + projectLibraryId + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType() + + "&projectName=" + projectNameInfoEO.getProjectName() + "-" + + projectYearNameInfoEO.getYearName() + + "&targetMarket=" + projectLibraryBase.getTargetMarket(); + //系统内部跳转链接 + //String href = "" + " View details" + ""; + //String contentInfo = msgContentEN + " " + href; + //Map sendMessageMap = new HashMap<>(); + //sendMessageMap.put("hrefFeishu",hrefFeishu); + //sendMessageMap.put("contentInfo",contentInfo); + + //发送消息 + //sendMessage(msgTitle, msgContentEN,inventoryAffirmUserIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,studioUserInfo.getUsername()); + + String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion(); + String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion; + + String dueDate = new SimpleDateFormat("yyyy-MM-dd").format(projectLawsInventoryEO.getInventoryAffirmDueDate()); + + List thirdIdList = new ArrayList<>(); + List sysUsers = sysUserService.listByIds(inventoryAffirmUserIdList); + if (ObjectUtils.isNotEmpty(sysUsers)) { + thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList()); + } + try { + FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); + feishuMsgVo.setTitle(MessageType2Enum.REGULATION_LIST_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_LIST_CONFIRMATION.getEn()); + feishuMsgVo.setCnContentUpper("您好,请尽快查看处理此项任务,谢谢!"); + feishuMsgVo.setCnContentLower("项目: " + PRN + + "\n发起人: " + currentUser.getUsername() + + "\n截止时间: " + dueDate); + feishuMsgVo.setEnContentUpper("Please check and address the task in a timely manner. Thank you!"); + feishuMsgVo.setEnContentLower("Project: " + PRN + + "\nInitiator: " + currentUser.getUsername() + + "\nDue Date: "+ dueDate); + feishuMsgVo.setUrl(hrefFeishu); + feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 + feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo); + } catch (IOException e) { + log.error("飞书消息推送失败"); + } + } + } + + //如果任务确认状态为待确认的,进行催办 + if(StringUtils.equals(projectLawsInventoryEO.getTaskAffirmStatus(),TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue())){ + List taskAffirmUserIdList = new ArrayList<>(); + + List> currentTaskList = (List>) jsonObject.get("currentTaskList"); + + List finalTaskAffirmUserIdList = new ArrayList<>(); + currentTaskList.forEach(currentTask -> { + String projectLawsInventoryId = (String) currentTask.get("projectLawsInventoryId"); + if(StringUtils.equals(projectLawsInventoryId,projectLawsInventoryEO.getId())){ + List> taskList = (List>) currentTask.get("taskList"); + taskList.forEach(task -> { + String assignee = (String) task.get("assignee"); + finalTaskAffirmUserIdList.add(assignee); + }); + } + }); + + if(CollectionUtils.isNotEmpty(finalTaskAffirmUserIdList)){ + //如果任务确认 没办理的用户不为空,给这些人发送消息,任务确认催办 + taskAffirmUserIdList = finalTaskAffirmUserIdList.stream().distinct().collect(Collectors.toList()); + log.debug("任务确认待办人员:" + taskAffirmUserIdList.toString()); + + QueryWrapper projectNameInfoEOQueryWrapper = new QueryWrapper<>(); + projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId()); + ProjectNameInfoEO projectNameInfoEO = platformProjectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper); + + QueryWrapper projectYearInfoEOQueryWrapper = new QueryWrapper<>(); + projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId()); + ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper); + + //消息内容 + //String msgContentEN = "Please address the regulation task confirmation process for "+ projectNameInfoEO.getProjectName() +" ASAP. "; + //String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + // + ": You have a regulation task confirmation to complete"; + + //FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); + //feishuMsgVo.setContent("Hello! Please address the task ASAP. "); + //feishuMsgVo.setTaskType("Regulation List Confirmation"); + //feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); + + //飞书跳转链接 + String hrefFeishu = backUrl + JumpLinkEnum.TASK_AFFIRM_LINK.getLink(); + //系统内部跳转链接 + //String href = "" + " View details" + ""; + + //String contentInfo = msgContentEN + " " + href; + //Map sendMessageMap = new HashMap<>(); + //sendMessageMap.put("hrefFeishu",hrefFeishu); + //sendMessageMap.put("contentInfo",contentInfo); + + //发送消息 + //sendMessage(msgTitle, msgContentEN,taskAffirmUserIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.TASK_CONFIRMATION,studioUserInfo.getUsername()); + + String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion(); + String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion; + + String dueDate = new SimpleDateFormat("yyyy-MM-dd").format(projectLawsInventoryEO.getTaskAffirmDueDate()); + //法规中英文 + BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId()); + String LAW_EN = ""; + if (ObjectUtils.isEmpty(bussDocumentLibraryEO)) { + LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle(); + } else { + if (ObjectUtils.isEmpty(bussDocumentLibraryEO.getTitleEn())) { + LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle(); + } else { + LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规 + } + } + + List thirdIdList = new ArrayList<>(); + List sysUsers = sysUserService.listByIds(taskAffirmUserIdList); + if (ObjectUtils.isNotEmpty(sysUsers)) { + thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList()); + } + try { + FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); + feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn()); + feishuMsgVo.setCnContentUpper("您好,请尽快查看处理此项任务,谢谢!"); + feishuMsgVo.setCnContentLower("项目: " + PRN + + "\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() + + "\n发起人: " + currentUser.getUsername() + + "\n截止时间: " + dueDate); + feishuMsgVo.setEnContentUpper("Hello! Please check and address the task ASAP. Thank you!"); + feishuMsgVo.setEnContentLower("Project: " + PRN + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + currentUser.getUsername() + + "\nDue Date: "+ dueDate); + feishuMsgVo.setUrl(hrefFeishu); + feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 + feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo); + } catch (IOException e) { + log.error("飞书消息推送失败"); + } + + } + } + });*/ + + return Result.OK(); + } + + /** + * 验证符合性 结果待提交状态数据催办 + * + * @param projectLibraryId + * @param projectLawsInventoryEOList + */ + private void verifyExpeditingToBeSubmitted(String projectLibraryId, List projectLawsInventoryEOList) { + // 催办验证符合性流程状态为 结果待提交的 责任人 + List toBeSubmitLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag = false; + if (StringUtils.equals(lawsInventory.getVerifyFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeSubmitLawsInventoryList)) { + Map> verifyDutyGroupMap = toBeSubmitLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getVerifyDutyId)); + for (Map.Entry> verifyDutyMap : verifyDutyGroupMap.entrySet()) { + String verifyDutyId = verifyDutyMap.getKey(); + List lawsInventoryEOList = verifyDutyMap.getValue(); + if (StringUtils.isEmpty(verifyDutyId) || CollectionUtils.isEmpty(lawsInventoryEOList)) { + continue; + } + this.lawsInventoryEOListSortByVerifyDueDate(lawsInventoryEOList); + + Date verifyDueDate = lawsInventoryEOList.get(0).getVerifyDueDate(); + String endTime = ""; + if (verifyDueDate != null) { + endTime = DateUtils.formatDate(verifyDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(verifyDutyId.split(",")); + // 给设计符合性流程责任人发消息 + Map params = new HashMap<>(); + params.put("contentCn", "您好,请尽快查看处理此项任务,谢谢!"); + params.put("contentEn", "Hello! Please check and address the task ASAP. Thank you!"); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("userIdList", userIdList); + params.put("serialNumbers", serialNumbers); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取待办中心 - 飞书跳转链接 + Map todoCenterParams = new HashMap<>(); + todoCenterParams.put("projectNameCn", PRN_CN); + todoCenterParams.put("projectNameEn", PRN_EN); + Map hrefFeishuMap = this.getToDoCenterLinkHrefFeishu(projectLibraryBase.getId(), todoCenterParams); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P",(String)hrefFeishuMap.get("hrefFeishu_CN_P")); + + String regulationOwnerId = lawsInventoryEOList.get(0).getRegulationOwnerId(); + List regulationOwnerUserList = this.sysUserService.querySysUserListByIdList(Arrays.asList(regulationOwnerId.split(","))); + String regulationOwnerUserName = this.sysUserService.getUsernameByUserId(regulationOwnerUserList, regulationOwnerId); + params.put("Initiator", regulationOwnerUserName); + + this.sendMessageByTemplateId(TemplateInfoEnum2.VALIDATION_COMPLIANCE_CONFIRMATION1.getValue(), params); + } + } + } + } + + /** + * 验证符合性 清单待确认状态数据催办 + * + * @param projectLibraryId + * @param projectLawsInventoryEOList + */ + private void verifyExpeditingToBeConfirmed(String projectLibraryId, List projectLawsInventoryEOList) { + // 催办验证符合性流程状态为 清单待确认的 责任人 + List toBeConfirmedLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag = false; + if (StringUtils.equals(lawsInventory.getVerifyFlowStatus(), ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeConfirmedLawsInventoryList)) { + Map> verifyDutyGroupMap = toBeConfirmedLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getVerifyDutyId)); + for (Map.Entry> verifyDutyMap : verifyDutyGroupMap.entrySet()) { + String verifyDutyId = verifyDutyMap.getKey(); + List lawsInventoryEOList = verifyDutyMap.getValue(); + if (StringUtils.isEmpty(verifyDutyId) || CollectionUtils.isEmpty(lawsInventoryEOList)) { + continue; + } + + this.lawsInventoryEOListSortByVerifyDueDate(lawsInventoryEOList); + Date verifyDueDate = lawsInventoryEOList.get(0).getVerifyDueDate(); + String endTime = ""; + if (verifyDueDate != null) { + endTime = DateUtils.formatDate(verifyDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(verifyDutyId.split(",")); + // 给验证符合性流程责任人发消息 + Map params = new HashMap<>(); + params.put("contentCn", "您好,请及时查看确认以下任务要求,谢谢!"); + params.put("contentEn", "Hello! Please check and confirm the following task requirement in a timely manner. Thank you!"); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("userIdList", userIdList); + params.put("serialNumbers", serialNumbers); + params.put("flowTypeCn","验证符合性流程"); + params.put("flowTypeEn","Validation Compliance Process"); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取待办中心 - 飞书跳转链接 + Map todoCenterParams = new HashMap<>(); + todoCenterParams.put("projectNameCn", PRN_CN); + todoCenterParams.put("projectNameEn", PRN_EN); + Map hrefFeishuMap = this.getToDoCenterLinkHrefFeishu(projectLibraryId, todoCenterParams); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P",(String)hrefFeishuMap.get("hrefFeishu_CN_P")); + + String regulationOwnerId = lawsInventoryEOList.get(0).getRegulationOwnerId(); + List regulationOwnerUserList = this.sysUserService.querySysUserListByIdList(Arrays.asList(regulationOwnerId.split(","))); + String regulationOwnerUserName = this.sysUserService.getUsernameByUserId(regulationOwnerUserList, regulationOwnerId); + params.put("Initiator", regulationOwnerUserName); + + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION4.getValue(), params); + } + } + } + } + + /** + * 验证符合性 结果待审查状态数据催办。 + * + * @param projectLibraryId + * @param projectLawsInventoryEOList + */ + private void verifyExpeditingToBeReviewed(String projectLibraryId, List projectLawsInventoryEOList) { + // 如果验证符合性流程状态为 结果待审查,催办时就需要给这一条数据的法规工程师发消息 + List toBeReviewedLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag = false; + if (StringUtils.equals(lawsInventory.getVerifyFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(toBeReviewedLawsInventoryList)) { + Map> regulationOwnerGroupMap = toBeReviewedLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getRegulationOwnerId)); + for (Map.Entry> regulationOwnerMap : regulationOwnerGroupMap.entrySet()) { + String regulationOwnerId = regulationOwnerMap.getKey(); + List lawsInventoryEOList = regulationOwnerMap.getValue(); + if (StringUtils.isEmpty(regulationOwnerId) || CollectionUtils.isEmpty(lawsInventoryEOList)) { + continue; + } + + this.lawsInventoryEOListSortByVerifyDueDate(lawsInventoryEOList); + Date verifyDueDate = lawsInventoryEOList.get(0).getVerifyDueDate(); + String endTime = ""; + if (verifyDueDate != null) { + endTime = DateUtils.formatDate(verifyDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(regulationOwnerId.split(",")); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn", "您好,请尽快查看处理此项任务,谢谢!"); + params.put("contentEn", "Hello! Please check and address the task ASAP. Thank you!"); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("userIdList", userIdList); + params.put("serialNumbers", serialNumbers); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取待办中心 - 飞书跳转链接 + Map todoCenterParams = new HashMap<>(); + todoCenterParams.put("projectNameCn", PRN_CN); + todoCenterParams.put("projectNameEn", PRN_EN); + Map hrefFeishuMap = this.getToDoCenterLinkHrefFeishu(projectLibraryBase.getId(), todoCenterParams); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P",(String)hrefFeishuMap.get("hrefFeishu_CN_P")); + + List regulationOwnerUserList = this.sysUserService.querySysUserListByIdList(Arrays.asList(regulationOwnerId.split(","))); + String regulationOwnerUserName = this.sysUserService.getUsernameByUserId(regulationOwnerUserList, regulationOwnerId); + params.put("Initiator", regulationOwnerUserName); + + this.sendMessageByTemplateId(TemplateInfoEnum2.VALIDATION_COMPLIANCE_CONFIRMATION1.getValue(), params); + } + } + } + } + + /** + * 验证符合性 清单待校核状态数据催办。 + * + * @param projectLibraryId + * @param projectLawsInventoryEOList + */ + private void verifyExpeditingToBeChecked(String projectLibraryId, List projectLawsInventoryEOList) { + // 如果验证符合性流程状态为 清单待校核,催办时就需要给这一条数据的法规工程师发消息 + List toBeCheckedLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag = false; + if (StringUtils.equals(lawsInventory.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(toBeCheckedLawsInventoryList)) { + Map> regulationOwnerGroupMap = toBeCheckedLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getRegulationOwnerId)); + for (Map.Entry> regulationOwnerMap : regulationOwnerGroupMap.entrySet()) { + String regulationOwnerId = regulationOwnerMap.getKey(); + List lawsInventoryEOList = regulationOwnerMap.getValue(); + if (StringUtils.isEmpty(regulationOwnerId) || CollectionUtils.isEmpty(lawsInventoryEOList)) { + continue; + } + + this.lawsInventoryEOListSortByInventoryAffirmDueDate(lawsInventoryEOList); + Date inventoryAffirmDueDate = lawsInventoryEOList.get(0).getInventoryAffirmDueDate(); + String endTime = ""; + if (inventoryAffirmDueDate != null) { + endTime = DateUtils.formatDate(inventoryAffirmDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(regulationOwnerId.split(",")); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn", "您好,请及时校核法规清单内容并发起符合性流程,谢谢!"); + params.put("contentEn", "Please check the content of the regulation list and initiate the compliance process in a timely manner. Thank you!"); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("userIdList", userIdList); + params.put("serialNumbers", serialNumbers); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取法规清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getProjectLawsInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN, com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P", (String) hrefFeishuMap.get("hrefFeishu_CN_P")); + params.put("Initiator", projectLibraryBase.getStudioEngineerName()); + + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE1.getValue(), params); + } + } + } + } + + /** + * 设计符合性 结果待提交状态数据催办 + * + * @param projectLibraryId + * @param projectLawsInventoryEOList + */ + private void designExpeditingToBeSubmitted(String projectLibraryId, List projectLawsInventoryEOList) { + // 催办设计符合性流程状态为 结果待提交的 责任人 + List toBeSubmitLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag = false; + if (StringUtils.equals(lawsInventory.getDesignFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeSubmitLawsInventoryList)) { + Map> designDutyGroupMap = toBeSubmitLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getVerifyDutyId)); + for (Map.Entry> designDutyMap : designDutyGroupMap.entrySet()) { + String designDutyId = designDutyMap.getKey(); + List lawsInventoryEOList = designDutyMap.getValue(); + if (StringUtils.isEmpty(designDutyId) || CollectionUtils.isEmpty(lawsInventoryEOList)) { + continue; + } + this.lawsInventoryEOListSortByVerifyDueDate(lawsInventoryEOList); + + Date designDueDate = lawsInventoryEOList.get(0).getDesignDueDate(); + String endTime = ""; + if (designDueDate != null) { + endTime = DateUtils.formatDate(designDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(designDutyId.split(",")); + // 给设计符合性流程责任人发消息 + Map params = new HashMap<>(); + params.put("contentCn", "您好,请尽快查看处理此项任务,谢谢!"); + params.put("contentEn", "Hello! Please check and address the task ASAP. Thank you!"); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("userIdList", userIdList); + params.put("serialNumbers", serialNumbers); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取待办中心 - 飞书跳转链接 + Map todoCenterParams = new HashMap<>(); + todoCenterParams.put("projectNameCn", PRN_CN); + todoCenterParams.put("projectNameEn", PRN_EN); + Map hrefFeishuMap = this.getToDoCenterLinkHrefFeishu(projectLibraryBase.getId(), todoCenterParams); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P",(String)hrefFeishuMap.get("hrefFeishu_CN_P")); + + String regulationOwnerId = lawsInventoryEOList.get(0).getRegulationOwnerId(); + List regulationOwnerUserList = this.sysUserService.querySysUserListByIdList(Arrays.asList(regulationOwnerId.split(","))); + String regulationOwnerUserName = this.sysUserService.getUsernameByUserId(regulationOwnerUserList, regulationOwnerId); + params.put("Initiator", regulationOwnerUserName); + + this.sendMessageByTemplateId(TemplateInfoEnum2.DESIGN_COMPLIANCE_CONFIRMATION1.getValue(), params); + } + } + } + } + + /** + * 设计符合性 清单待确认状态数据催办 + * + * @param projectLibraryId + * @param projectLawsInventoryEOList + */ + private void designExpeditingToBeConfirmed(String projectLibraryId, List projectLawsInventoryEOList) { + // 催办设计符合性流程状态为 清单待确认的 责任人 + List toBeConfirmedLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag = false; + if (StringUtils.equals(lawsInventory.getDesignFlowStatus(), ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeConfirmedLawsInventoryList)) { + Map> designDutyGroupMap = toBeConfirmedLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getDesignDutyId)); + for (Map.Entry> designDutyMap : designDutyGroupMap.entrySet()) { + String designDutyId = designDutyMap.getKey(); + List lawsInventoryEOList = designDutyMap.getValue(); + if (StringUtils.isEmpty(designDutyId) || CollectionUtils.isEmpty(lawsInventoryEOList)) { + continue; + } + + this.lawsInventoryEOListSortByDesignDueDate(lawsInventoryEOList); + Date designDueDate = lawsInventoryEOList.get(0).getDesignDueDate(); + String endTime = ""; + if (designDueDate != null) { + endTime = DateUtils.formatDate(designDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(designDutyId.split(",")); + // 给设计符合性流程责任人发消息 + Map params = new HashMap<>(); + params.put("contentCn", "您好,请及时查看确认以下任务要求,谢谢!"); + params.put("contentEn", "Hello! Please check and confirm the following task requirement in a timely manner. Thank you!"); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("userIdList", userIdList); + params.put("serialNumbers", serialNumbers); + params.put("flowTypeCn","设计符合性流程"); + params.put("flowTypeEn","Design Compliance Process"); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取待办中心 - 飞书跳转链接 + Map todoCenterParams = new HashMap<>(); + todoCenterParams.put("projectNameCn", PRN_CN); + todoCenterParams.put("projectNameEn", PRN_EN); + Map hrefFeishuMap = this.getToDoCenterLinkHrefFeishu(projectLibraryId, todoCenterParams); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P",(String)hrefFeishuMap.get("hrefFeishu_CN_P")); + + String regulationOwnerId = lawsInventoryEOList.get(0).getRegulationOwnerId(); + List regulationOwnerUserList = this.sysUserService.querySysUserListByIdList(Arrays.asList(regulationOwnerId.split(","))); + String regulationOwnerUserName = this.sysUserService.getUsernameByUserId(regulationOwnerUserList, regulationOwnerId); + params.put("Initiator", regulationOwnerUserName); + + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION4.getValue(), params); + } + } + } + } + + /** + * 设计符合性 结果待审查状态数据催办 + * + * @param projectLibraryId + * @param projectLawsInventoryEOList + */ + private void designExpeditingToBeReviewed(String projectLibraryId, List projectLawsInventoryEOList) { + // 如果设计符合性流程状态为 结果待审查,催办时就需要给这一条数据的法规工程师发消息 + List toBeReviewedLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag = false; + if (StringUtils.equals(lawsInventory.getDesignFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(toBeReviewedLawsInventoryList)) { + Map> regulationOwnerGroupMap = toBeReviewedLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getRegulationOwnerId)); + for (Map.Entry> regulationOwnerMap : regulationOwnerGroupMap.entrySet()) { + String regulationOwnerId = regulationOwnerMap.getKey(); + List lawsInventoryEOList = regulationOwnerMap.getValue(); + if (StringUtils.isEmpty(regulationOwnerId) || CollectionUtils.isEmpty(lawsInventoryEOList)) { + continue; + } + + this.lawsInventoryEOListSortByDesignDueDate(lawsInventoryEOList); + Date designDueDate = lawsInventoryEOList.get(0).getDesignDueDate(); + String endTime = ""; + if (designDueDate != null) { + endTime = DateUtils.formatDate(designDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(regulationOwnerId.split(",")); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn", "您好,请尽快查看处理此项任务,谢谢!"); + params.put("contentEn", "Hello! Please check and address the task ASAP. Thank you!"); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("userIdList", userIdList); + params.put("serialNumbers", serialNumbers); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取待办中心 - 飞书跳转链接 + Map todoCenterParams = new HashMap<>(); + todoCenterParams.put("projectNameCn", PRN_CN); + todoCenterParams.put("projectNameEn", PRN_EN); + Map hrefFeishuMap = this.getToDoCenterLinkHrefFeishu(projectLibraryBase.getId(), todoCenterParams); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P",(String)hrefFeishuMap.get("hrefFeishu_CN_P")); + + List regulationOwnerUserList = this.sysUserService.querySysUserListByIdList(Arrays.asList(regulationOwnerId.split(","))); + String regulationOwnerUserName = this.sysUserService.getUsernameByUserId(regulationOwnerUserList, regulationOwnerId); + params.put("Initiator", regulationOwnerUserName); + + this.sendMessageByTemplateId(TemplateInfoEnum2.DESIGN_COMPLIANCE_CONFIRMATION1.getValue(), params); + } + } + } + } + + /** + * 设计符合性 清单待校核状态数据催办 + * + * @param projectLibraryId + * @param projectLawsInventoryEOList + */ + private void designExpeditingToBeChecked(String projectLibraryId, List projectLawsInventoryEOList) { + // 如果设计符合性流程状态为 清单待校核,催办时就需要给这一条数据的法规工程师发消息 + List toBeCheckedLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag = false; + if (StringUtils.equals(lawsInventory.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(toBeCheckedLawsInventoryList)) { + Map> regulationOwnerGroupMap = toBeCheckedLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getRegulationOwnerId)); + for (Map.Entry> regulationOwnerMap : regulationOwnerGroupMap.entrySet()) { + String regulationOwnerId = regulationOwnerMap.getKey(); + List lawsInventoryEOList = regulationOwnerMap.getValue(); + if (StringUtils.isEmpty(regulationOwnerId) || CollectionUtils.isEmpty(lawsInventoryEOList)) { + continue; + } + + this.lawsInventoryEOListSortByInventoryAffirmDueDate(lawsInventoryEOList); + Date inventoryAffirmDueDate = lawsInventoryEOList.get(0).getInventoryAffirmDueDate(); + String endTime = ""; + if (inventoryAffirmDueDate != null) { + endTime = DateUtils.formatDate(inventoryAffirmDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(regulationOwnerId.split(",")); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn", "您好,请及时校核法规清单内容并发起符合性流程,谢谢!"); + params.put("contentEn", "Please check the content of the regulation list and initiate the compliance process in a timely manner. Thank you!"); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("userIdList", userIdList); + params.put("serialNumbers", serialNumbers); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取法规清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getProjectLawsInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN, com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P", (String) hrefFeishuMap.get("hrefFeishu_CN_P")); + params.put("Initiator", projectLibraryBase.getStudioEngineerName()); + + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE1.getValue(), params); + } + } + } + } + + + @Override + public List getRoleByUserId(String projectLibraryId, String cut) { + List sysRoles = new LinkedList<>(); + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List projectLibraryBases = platformProjectLibraryBaseService.queryById(projectLibraryId, null); + //1、判断当前登录用户是否为该平台件项目的的法规工程师 + if(!projectLibraryBases.isEmpty() && loginUser.getUsername().equals(projectLibraryBases.get(0).getCreateBy())){ + SysRole sysRole = new SysRole(); + sysRole.setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getName()); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getCode()); + } + sysRoles.add(sysRole); + } + + //遍历法规清单,判断是否为接口人或责任人 + + // 法规工程师 + QueryWrapper querylawEngineerCountWrap = new QueryWrapper<>(); + querylawEngineerCountWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + querylawEngineerCountWrap.lambda().eq(ProjectLawsInventoryEO::getRegulationOwnerId, loginUser.getId()); + Integer lawCount = this.baseMapper.selectCount(querylawEngineerCountWrap); + if (lawCount > 0) { + SysRole sysRole = new SysRole(); + sysRole.setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getName()); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getCode()); + } + sysRoles.add(sysRole); + } + + + // 工程接口人 + QueryWrapper queryEipCountWrap = new QueryWrapper<>(); + queryEipCountWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + queryEipCountWrap.lambda().eq(ProjectLawsInventoryEO::getEngineeringInterfacePerson, loginUser.getId()); + Integer eipCount = this.baseMapper.selectCount(queryEipCountWrap); + if (eipCount > 0) { + SysRole sysRole = new SysRole(); + sysRole.setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.INTERFACE_PERSON1.getValue()); + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.INTERFACE_PERSON1.getName()); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.INTERFACE_PERSON1.getCode()); + } + sysRoles.add(sysRole); + } + + // 责任人 + QueryWrapper queryDutyPersonCountWrap = new QueryWrapper<>(); + queryDutyPersonCountWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + queryDutyPersonCountWrap.and(query -> { + query.lambda().eq(ProjectLawsInventoryEO::getDesignDutyId, loginUser.getId()); + query.or().lambda().eq(ProjectLawsInventoryEO::getVerifyDutyId, loginUser.getId()); + }); + Integer dutyPersonCount = this.baseMapper.selectCount(queryDutyPersonCountWrap); + if (dutyPersonCount > 0) { + SysRole sysRole = new SysRole(); + sysRole.setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.PERSON_LIABLE1.getValue()); + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.PERSON_LIABLE1.getName()); + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + sysRole.setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.PERSON_LIABLE1.getCode()); + } + sysRoles.add(sysRole); + } + + + List roleList = sysRoleMapper.getRoleByUserId(loginUser.getId()); + //studio角色,法规工程师/认证工程师,领导角色,管理员角色,Viewer + if (roleList.size() != 0) { + List manager = roleList.stream().filter(e -> com.jero.modules.system.enums.ProjectRoleEnum.MANAGER.getCode().equals(e.getRoleCode())).collect(Collectors.toList()); + List admin = roleList.stream().filter(e -> com.jero.modules.system.enums.ProjectRoleEnum.ADMIN.getCode().equals(e.getRoleCode())).collect(Collectors.toList()); + List Viewer = roleList.stream().filter(e -> com.jero.modules.system.enums.ProjectRoleEnum.VIEWER.getCode().equals(e.getRoleCode())).collect(Collectors.toList()); + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + if (manager.size() != 0) { + manager.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.MANAGER.getValue()); + sysRoles.addAll(manager); + } + if (admin.size() != 0) { + admin.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.ADMIN.getValue()); + sysRoles.addAll(admin); + } + if (Viewer.size() != 0) { + Viewer.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.VIEWER.getValue()); + sysRoles.addAll(Viewer); + } + } else if (StringUtils.equals(cut, CutEnum.EN.getValue())) { + if (manager.size() != 0) { + manager.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.MANAGER.getValue()); + manager.get(0).setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.MANAGER.getCode()); + sysRoles.addAll(manager); + } + if (admin.size() != 0) { + admin.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.ADMIN.getValue()); + admin.get(0).setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.ADMIN.getCode()); + sysRoles.addAll(admin); + } + if (Viewer.size() != 0) { + Viewer.get(0).setRoleCode(com.jero.modules.system.enums.ProjectRoleEnum.VIEWER.getValue()); + Viewer.get(0).setRoleName(com.jero.modules.system.enums.ProjectRoleEnum.VIEWER.getCode()); + sysRoles.addAll(Viewer); + } + + } + + } + sysRoles = sysRoles.stream().distinct().collect(Collectors.toList()); + return sysRoles; + } + + /** + * 获取一个用户的id + * 例如:如果法规工程师不是空,判断当前这个法规工程师,是否在这个责任领域的数组里, + * 1、如果在的话,不用管他; + * 2、如果只有一个人,则把这个用户设置进来; + * 3、如果不在,判断这个责任领域下是否有多个法规工程师,如果是,则把这个法规工程师设置为空; + * + * @param roleCode 角色编码 + * @param projectRelatedPersonnelList 相关人员对象数组 + * @param studioEngineer studioCode + * @param engineersId 现有的工程师id + * @return + */ + public String ToGetAUserId(String roleCode, List projectRelatedPersonnelList, String studioEngineer, String engineersId) { + String resultUserId = ""; + //法规工程师 + if (StringUtils.equals(roleCode, ProjectRoleEnum.REGULATI_ENGINEER.getValue())) { + String lawEngineer = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> { + boolean flag = false; + if (StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())) { + flag = true; + } + return flag; + }).map(ProjectRelatedPersonnel::getLawEngineer).distinct().collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(lawEngineer)) { + if (!StringUtils.contains(lawEngineer, engineersId)) { + String[] lawEngineerArr = lawEngineer.split(","); + if (lawEngineerArr.length == 1) { + resultUserId = lawEngineer; + } + } else { + resultUserId = engineersId; + } + } + } + //认证工程师 + if (StringUtils.equals(roleCode, ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())) { + String certificationEngineer = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> { + boolean flag = false; + if (StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())) { + flag = true; + } + return flag; + }).map(ProjectRelatedPersonnel::getCertificationEngineer).distinct().collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(certificationEngineer)) { + if (!StringUtils.contains(certificationEngineer, engineersId)) { + String[] certificationEngineerArr = certificationEngineer.split(","); + if (certificationEngineerArr.length == 1) { + resultUserId = certificationEngineer; + } + } else { + resultUserId = engineersId; + } + } + } + //工程接口人 + if (StringUtils.equals(roleCode, ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue())) { + String engineeringInterfacePerson = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> { + boolean flag = false; + if (StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())) { + flag = true; + } + return flag; + }).map(ProjectRelatedPersonnel::getEngineeringInterfacePerson).distinct().collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(engineeringInterfacePerson)) { + if (!StringUtils.contains(engineeringInterfacePerson, engineersId)) { + String[] engineeringInterfacePersonArr = engineeringInterfacePerson.split(","); + if (engineeringInterfacePersonArr.length == 1) { + resultUserId = engineeringInterfacePerson; + } + } else { + resultUserId = engineersId; + } + } + } + //studio + if (StringUtils.equals(roleCode, ProjectRoleEnum.STUDIO_ENGINEER.getValue())) { + resultUserId = studioEngineer; + } + return resultUserId; + } + + /** + * 初始化 法规清单对应的 项目状态评估表 + * + * @param projectLawsInventoryId + */ + public void initConditionAssessmentEO(String projectLawsInventoryId) { + + QueryWrapper removeWrapper = new QueryWrapper<>(); + removeWrapper.lambda().eq(ConditionAssessmentEO::getProjectLawsInventoryId, projectLawsInventoryId); + this.conditionAssessmentEOService.remove(removeWrapper); + + ConditionAssessmentEO conditionAssessmentEO = new ConditionAssessmentEO(); + conditionAssessmentEO.setRoleCode(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue()); + conditionAssessmentEO.setProjectLawsInventoryId(projectLawsInventoryId); + conditionAssessmentEO.setConditionAssessment(CurrentProjectStatusEnum.BLUE.getValue()); + this.conditionAssessmentEOService.addOrUpdate(conditionAssessmentEO); + } + + /** + * 添加流程信息 + * + * @param processInfoEO + * @param projectLibraryId + * @param endTime + */ + @Override + public void addProcessInfo(ProcessInfoEO processInfoEO, String projectLibraryId, Date endTime) { + String id = null; + //查询当前项目之前有没有启动过清单确认 + QueryWrapper processInfoQueryWrap = new QueryWrapper<>(); + processInfoQueryWrap.lambda().eq(ProcessInfoEO::getProjectLibraryId, projectLibraryId); + processInfoQueryWrap.lambda().eq(ProcessInfoEO::getFlowType, FlowTypeEnum.QDQR.getValue()); + List processInfoEOList = this.processInfoEOService.list(processInfoQueryWrap); + if (CollectionUtils.isNotEmpty(processInfoEOList)) { + id = processInfoEOList.get(0).getId(); + //删除之前创建的数据 + this.processInfoEOService.remove(processInfoQueryWrap); + } else { + id = UUID.randomUUID().toString().replace("-", ""); + } + + processInfoEO.setId(id); + processInfoEO.setProjectLibraryId(projectLibraryId); + + processInfoEO.setEndTime(endTime); + processInfoEO.setStatus(TodoCenterStatusEnum.LIST_TO_CONFIRM.getValue()); + processInfoEO.setFlowType(FlowTypeEnum.QDQR.getValue()); + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + processInfoEO.setCreateBy(currentUser.getId()); + this.processInfoEOService.add(processInfoEO); + } + + /** + * 添加流程信息,用户的待办、已办信息。 + * + * @param processInfoId + * @param processInfoDetailEOList + * @param endTime + */ + @Override + public void addProcessInfoDetail(String processInfoId, List processInfoDetailEOList, Date endTime) { + processInfoDetailEOList.forEach(detail -> { + detail.setProcessInfoId(processInfoId); + detail.setFlowType(FlowTypeEnum.QDQR.getValue()); + + QueryWrapper deleteDetailWrap = new QueryWrapper<>(); + deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId, detail.getProjectLawsInventoryId()); + deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getUserId, detail.getUserId()); + this.processInfoDetailEOService.remove(deleteDetailWrap); + }); + + //删除studio在这个项目的清单确认已办任务。 + /*QueryWrapper deleteStudioDetailWrap = new QueryWrapper<>(); + deleteStudioDetailWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,InventoryAffirmNodeEnum.INITIATED_BY_STUDIO_ENGINEERS.getKey()); + deleteStudioDetailWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,processInfoId); + this.processInfoDetailEOService.remove(deleteStudioDetailWrap);*/ + + this.processInfoDetailEOService.saveBatch(processInfoDetailEOList); + } + + /** + * 更新流程信息,用户的待办、已办任务信息 + * + * @param projeceLawsInventoryId + */ + public void updateProcessInfoDetail(String projeceLawsInventoryId) { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + QueryWrapper detailQueryWrapper = new QueryWrapper<>(); + detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId, projeceLawsInventoryId); + detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getUserId, currentUser.getId()); + detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getFlowType, FlowTypeEnum.QDQR.getValue()); + List detailEOList = this.processInfoDetailEOService.list(detailQueryWrapper); + + if (CollectionUtils.isNotEmpty(detailEOList)) { + String processInfoId = detailEOList.get(0).getProcessInfoId(); + + detailEOList.forEach(detail -> { + detail.setSubmitTime(new Date()); + detail.setStatus(TaskStatusEnum.HAVE_DONE.getValue()); + }); + this.processInfoDetailEOService.updateBatchById(detailEOList); + + //查询当前项目下还有没有未完成的任务 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, processInfoId); + queryWrapper.lambda().eq(ProcessInfoDetailEO::getStatus, TaskStatusEnum.NOT_DONE.getValue()); + int count = this.processInfoDetailEOService.count(queryWrapper); + //如果没有待办任务 + if (count == 0) { + ProcessInfoEO processInfoEO = new ProcessInfoEO(); + processInfoEO.setStatus(TodoCenterStatusEnum.COMPLETED.getValue()); + processInfoEO.setId(processInfoId); + this.processInfoEOService.updateById(processInfoEO); + } + } + } + + /** + * 任务清单催办 + * + * @param projectTaskUrgVo + * @return + */ + @Override + public Result taskUrg(ProjectTaskUrgVo projectTaskUrgVo) { + if (ObjectUtils.isEmpty(projectTaskUrgVo.getProjectLawsInventoryIds())) { + if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { + throw new JeroBootException("请选择至少一条数据"); + } else { + throw new JeroBootException("Please select at least one piece of data"); + } + + } + if (ObjectUtils.isEmpty(projectTaskUrgVo.getType())) { + if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { + throw new JeroBootException("请选择催办类型"); + } else { + throw new JeroBootException("Please select the type of reminder"); + } + } + + String title = ""; + + if (FlowTypeEnum.SJFHXSHLC.getValue().equals(projectTaskUrgVo.getType())) { + title = MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getEn(); + } else if (FlowTypeEnum.PREHOMOQRLC.getValue().equals(projectTaskUrgVo.getType())) { + title = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn(); + } else if (FlowTypeEnum.YZFHXSCLC.getValue().equals(projectTaskUrgVo.getType())) { + title = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn(); + } else { + if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { + throw new JeroBootException("请选择正确的催办类型"); + } else { + throw new JeroBootException("Please select the correct type of reminder"); + } + } + String[] ProjectLawsInventoryIds = projectTaskUrgVo.getProjectLawsInventoryIds().split(","); + ProjectLawsInventoryEO projectLawsInventoryEO = baseMapper.selectById(ProjectLawsInventoryIds[0]); + if (ObjectUtils.isEmpty(projectLawsInventoryEO)) { + if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { + throw new JeroBootException("程序异常,请刷新页面并重新操作"); + } else { + throw new JeroBootException("The program is abnormal, please refresh the page and operate again"); + } + } + + ProjectLibraryBase projectLibraryBase = platformProjectLibraryBaseMapper.selectOne(new QueryWrapper() + .lambda().eq(ProjectLibraryBase::getId, projectLawsInventoryEO.getProjectLibraryId())); + + QueryWrapper projectNameInfoEOQueryWrapper = new QueryWrapper<>(); + projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId, projectLibraryBase.getProjectNameId()); + ProjectNameInfoEO projectNameInfoEO = platformProjectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper); + + QueryWrapper projectYearInfoEOQueryWrapper = new QueryWrapper<>(); + projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId, projectLibraryBase.getYearNameId()); + ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper); + + //项目名称 + String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion(); + String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion; + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + //飞书跳转链接 + String hrefFeishu = backUrl + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + + projectLibraryBase.getId() + + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType() + + "&projectName=" + projectNameInfoEO.getProjectName() + "-" + + projectYearNameInfoEO.getYearName() + + "&targetMarket=" + projectLibraryBase.getTargetMarket(); + + for (String projectLawsInventoryId : ProjectLawsInventoryIds) { + ProjectLawsInventoryEO lawsInventoryEO = baseMapper.selectById(projectLawsInventoryId); + if (ObjectUtils.isEmpty(lawsInventoryEO)) { + if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { + throw new JeroBootException("程序异常,请刷新页面并重新操作"); + } else { + throw new JeroBootException("The program is abnormal, please refresh the page and operate again"); + } + } + String LAW_CN = lawsInventoryEO.getSerialNumber() + " " + lawsInventoryEO.getTitle();//法规 + BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(lawsInventoryEO.getStandId()); + String LAW_EN = lawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规 + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + String userId = ""; + String dueDate = null; + + QueryWrapper queryProjectTaskInventoryWrapper = new QueryWrapper<>(); + queryProjectTaskInventoryWrapper.isNotNull("design_p_id").or().isNotNull("verify_p_id"); + queryProjectTaskInventoryWrapper.lambda().eq(ProjectTaskInventoryEO::getProjectLawsInventoryId, projectLawsInventoryId); + List list = projectTaskInventoryEOService.list(queryProjectTaskInventoryWrapper); + + if (FlowTypeEnum.SJFHXSHLC.getValue().equals(projectTaskUrgVo.getType())) { + dueDate = sdf.format(lawsInventoryEO.getDesignDueDate()); + if (DesignComplianceStatusEnum.TO_REVIEW.getValue().equals(list.get(0).getDesignStatus()) + || DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getDesignStatus())) { + if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { + throw new JeroBootException(LAW_CN + "已经被确认,无法催办"); + } else { + throw new JeroBootException(LAW_EN + "has been confirmed,can't be urged"); + } + } + if (ObjectUtils.isNotEmpty(lawsInventoryEO.getDesignDutyId())) { + userId = lawsInventoryEO.getDesignDutyId(); + } + } else if (FlowTypeEnum.PREHOMOQRLC.getValue().equals(projectTaskUrgVo.getType())) { + dueDate = sdf.format(lawsInventoryEO.getPrehomoDueDate()); + if (DesignComplianceStatusEnum.TO_REVIEW.getValue().equals(list.get(0).getPrehomoStatus()) + || DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getPrehomoStatus())) { + if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { + throw new JeroBootException(LAW_CN + "已经被确认,无法催办"); + } else { + throw new JeroBootException(LAW_EN + "has been confirmed,can't be urged"); + } + } + if (ObjectUtils.isNotEmpty(lawsInventoryEO.getPrehomoDutyId())) { + userId = lawsInventoryEO.getPrehomoDutyId(); + } + } else if (FlowTypeEnum.YZFHXSCLC.getValue().equals(projectTaskUrgVo.getType())) { + dueDate = sdf.format(lawsInventoryEO.getVerifyDueDate()); + if (DesignComplianceStatusEnum.TO_REVIEW.getValue().equals(list.get(0).getVerifyStatus()) + || DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getVerifyStatus())) { + if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { + throw new JeroBootException(LAW_CN + "已经被确认,无法催办"); + } else { + throw new JeroBootException(LAW_EN + "has been confirmed,can't be urged"); + } + } + if (ObjectUtils.isNotEmpty(lawsInventoryEO.getVerifyDutyId())) { + userId = lawsInventoryEO.getVerifyDutyId(); + } + } + + String[] thirdId = new String[1]; + if (ObjectUtils.isNotEmpty(userId)) { + SysUser user = sysUserMapper.selectById(userId); + if (ObjectUtils.isNotEmpty(user)) { + thirdId[0] = user.getThirdId(); + } + } + try { + FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); + feishuMsgVo.setTitle(title); + feishuMsgVo.setCnContentUpper("您好,请尽快查看处理此项任务,谢谢!"); + feishuMsgVo.setCnContentLower("项目: " + projectName + + "\n法规: " + LAW_CN + + "\n发起人: " + currentUser.getUsername() + + "\n截止时间: " + dueDate); + feishuMsgVo.setEnContentUpper("Hello! Please check and address the task ASAP. Thank you!"); + feishuMsgVo.setEnContentLower("Project: " + projectName + + "\nRegulation No: " + LAW_EN + + "\nInitiator: " + currentUser.getUsername() + + "\nDue Date: " + dueDate); + feishuMsgVo.setUrl(hrefFeishu); + feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 + feishuService.sendCard(thirdId, feishuMsgVo); + } catch (IOException e) { + log.error("飞书消息推送失败"); + } + } + if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { + return new Result<>().success("催办成功!"); + } else { + return new Result<>().success("Success of the urging!"); + } + + } + + @Override + public Result updateFlowInfoByProjectLibraryIds(String projectLibraryIds) { + if (StringUtils.isEmpty(projectLibraryIds)) { + throw new JeroBootException("项目库id不能为空"); + } + + List projectLibraryIdList = Arrays.asList(projectLibraryIds.split(",")); + + QueryWrapper lawsInventoryQueryWrap = new QueryWrapper<>(); + lawsInventoryQueryWrap.lambda().in(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryIdList); + List projectLawsInventoryEOList = this.baseMapper.selectList(lawsInventoryQueryWrap); + + projectLawsInventoryEOList.forEach(lawsInventoryEO -> { + this.updateFlowInfo(lawsInventoryEO); + }); + + return new Result<>().success("操作成功!"); + } + + @Override + public Result studioPublish(JSONObject json) { + String projectLibraryId = json.getString("projectLibraryId"); + String cut = json.getString("cut"); + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + String ids = json.getString("ids"); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + //清单确认截止时间 + String inventoryAffirmDueDate = json.getString("inventoryAffirmDueDate"); + Date endTime = new Date(); + try { + endTime = sdf.parse(inventoryAffirmDueDate); + } catch (ParseException e) { + e.printStackTrace(); + } + + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (StringUtils.isEmpty(ids)) { + throw new JeroBootException("至少选择一条数据进行操作!"); + } + queryWrapper.lambda().in(ProjectLawsInventoryEO::getId, Arrays.asList(ids.split(","))); + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + List projectLawsInventoryEOS = this.baseMapper.selectList(queryWrapper); + + List userIdList = new ArrayList<>(); + List processInfoDetailEOList = new ArrayList<>(); + + //交付物类型为NA,写远了不好找,写在这里方便以后优化 + String naType = "1645667531513237506"; + for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOS) { + //未发起或拒绝 可以发起清单确认 + boolean checkStatus = (StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + ); + //如果该数据的法规工程师不为空 + boolean checkUser = (StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId())); + if (checkStatus && checkUser) { + //如果交付物为NA则流程状态直接为不涉及 + if(StringUtils.equals(projectLawsInventoryEO.getDesignDeliverableType(),naType)){ + projectLawsInventoryEO.setDesignFlowStatus(ComplianceFlowStatusEnum.UNINVOLVED.getValue()); + }else if (StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue())) { + projectLawsInventoryEO.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + } + if(StringUtils.equals(projectLawsInventoryEO.getVerifyDeliverableType(),naType)){ + projectLawsInventoryEO.setVerifyFlowStatus(ComplianceFlowStatusEnum.UNINVOLVED.getValue()); + }else if (StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue())) { + projectLawsInventoryEO.setVerifyFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + } + projectLawsInventoryEO.setInventoryAffirmDueDate(endTime); + + userIdList.add(projectLawsInventoryEO.getRegulationOwnerId()); + //如果都是不涉及就不发待办 + if (!projectLawsInventoryEO.getDesignFlowStatus().equals(ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + && !projectLawsInventoryEO.getVerifyFlowStatus().equals(ComplianceFlowStatusEnum.UNINVOLVED.getValue())) { + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId()); + processInfoDetailEO.setUserId(projectLawsInventoryEO.getRegulationOwnerId()); + processInfoDetailEO.setTaskDefinitionKey(InventoryAffirmNodeEnum.REGULATION_OWNER_AUDIT.getKey()); + processInfoDetailEO.setEndTime(endTime); + processInfoDetailEO.setCreateTime(new Date()); + processInfoDetailEO.setCreateBy(currentUser.getId()); + processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); + processInfoDetailEOList.add(processInfoDetailEO); + } + } + } + + this.updateBatchById(projectLawsInventoryEOS); + + ProcessInfoEO processInfoEO = new ProcessInfoEO(); + this.addProcessInfo(processInfoEO, projectLibraryId, endTime); + this.addProcessInfoDetail(processInfoEO.getId(), processInfoDetailEOList, endTime); + + userIdList = userIdList.stream().distinct().collect(Collectors.toList()); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn", "您好,请及时校核法规清单内容并发起符合性流程,谢谢!"); + params.put("contentEn", "Please check the content of the regulation list and initiate the compliance process in a timely manner. Thank you!"); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", inventoryAffirmDueDate); + params.put("userIdList", userIdList); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取法规清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getProjectLawsInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN, com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P", (String) hrefFeishuMap.get("hrefFeishu_CN_P")); + params.put("Initiator", projectLibraryBase.getStudioEngineerName()); + + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE1.getValue(), params); + } + + return Result.OK("发起清单确认成功!"); + } + + @Override + public Result studioWithdrew(JSONObject json) { + String projectLibraryId = json.getString("projectLibraryId"); + String cut = json.getString("cut"); + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + String ids = json.getString("ids"); + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (StringUtils.isEmpty(ids)) { + throw new JeroBootException("至少选择一条数据进行操作!"); + } + queryWrapper.lambda().in(ProjectLawsInventoryEO::getId, Arrays.asList(ids.split(","))); + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + List projectLawsInventoryEOS = this.baseMapper.selectList(queryWrapper); + + projectLawsInventoryEOS = projectLawsInventoryEOS.stream().filter(lawsInventory -> { + boolean flag = false; + boolean toBeCheckedFlag = ( + StringUtils.equals(lawsInventory.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(lawsInventory.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + boolean dutyPersonRejectedFlag = ( + StringUtils.equals(lawsInventory.getDesignFlowStatus(), ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + || StringUtils.equals(lawsInventory.getVerifyFlowStatus(), ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + ); + if (toBeCheckedFlag || dutyPersonRejectedFlag) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + // 将待办中心法规工程师的 清单确认 待办任务转为已办 + QueryWrapper pidQueryWrap = new QueryWrapper<>(); + pidQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, ids); + List pidList = this.processInfoDetailEOService.list(pidQueryWrap); + if (CollectionUtils.isNotEmpty(pidList)) { + pidList.forEach(pid -> { + pid.setStatus(TaskStatusEnum.HAVE_DONE.getValue()); + }); + this.processInfoDetailEOService.updateBatchById(pidList); + } + + + this.lawsInventoryEOListSortByInventoryAffirmDueDate(projectLawsInventoryEOS); + Date inventoryAffirmDueDate = projectLawsInventoryEOS.get(0).getInventoryAffirmDueDate(); + String endTime = ""; + if (inventoryAffirmDueDate != null) { + endTime = DateUtils.formatDate(inventoryAffirmDueDate); + } + + for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOS) { + if (StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue())) { + projectLawsInventoryEO.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); + } + if (StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue())) { + projectLawsInventoryEO.setVerifyFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); + } + } + + List userIdList = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getRegulationOwnerId).distinct().collect(Collectors.toList()); + String serialNumbers = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + this.updateBatchById(projectLawsInventoryEOS); + + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn", "您好,该任务已被发起人撤回。"); + params.put("contentEn", "Hello! This regulation has been withdrawn by the initiator."); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("userIdList", userIdList); + params.put("serialNumbers", serialNumbers); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + // 获取法规清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getProjectLawsInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN, com.jero.modules.system.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P", (String) hrefFeishuMap.get("hrefFeishu_CN_P")); + params.put("Initiator", projectLibraryBase.getStudioEngineerName()); + + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE2.getValue(), params); + } + + return Result.OK("撤回成功!"); + } + + @Override + public Result regulationOwnerReturned(JSONObject json) { + String projectLibraryId = json.getString("projectLibraryId"); + String cut = json.getString("cut"); + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + // studio信息 + SysUser studioUserInfo = this.sysUserMapper.selectOne( + new QueryWrapper().lambda().eq(SysUser::getId, projectLibraryBase.getStudioEngineer()) + ); + + String ids = json.getString("ids"); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (StringUtils.isEmpty(ids)) { + throw new JeroBootException("至少选择一条数据进行操作!"); + } + queryWrapper.lambda().in(ProjectLawsInventoryEO::getId, Arrays.asList(ids.split(","))); + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + List projectLawsInventoryEOS = this.baseMapper.selectList(queryWrapper); + for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOS) { + if (StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue())) { + projectLawsInventoryEO.setDesignFlowStatus(ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()); + } + if (StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(projectLawsInventoryEO.getVerifyFlowStatus(), ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue())) { + projectLawsInventoryEO.setVerifyFlowStatus(ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()); + } + } + + this.updateBatchById(projectLawsInventoryEOS); + + this.lawsInventoryEOListSortByInventoryAffirmDueDate(projectLawsInventoryEOS); + Date inventoryAffirmDueDate = projectLawsInventoryEOS.get(0).getInventoryAffirmDueDate(); + String endTime = ""; + if (inventoryAffirmDueDate != null) { + endTime = DateUtils.formatDate(inventoryAffirmDueDate); + } + List userIdList = Arrays.asList(studioUserInfo.getId().split(",")); + String serialNumbers = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + // 给studio发消息 + Map params = new HashMap<>(); + String contentCn = "您好,该任务被" + currentUser.getUsername() + "退回,请及时查看处理。"; + String contentEn = "Hello! This task is rejected by " + currentUser.getUsername() + ". Please check and address it in a timely manner."; + params.put("contentCn", contentCn); + params.put("contentEn", contentEn); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("userIdList", userIdList); + params.put("serialNumbers", serialNumbers); + + // 获取法规清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getProjectLawsInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN, com.jero.modules.system.enums.ProjectRoleEnum.STUDIO_ENGINEER.getValue()); + params.put("hrefFeishu_CN", (String) hrefFeishuMap.get("hrefFeishu_CN")); + params.put("hrefFeishu_EN", (String) hrefFeishuMap.get("hrefFeishu_EN")); + params.put("hrefFeishu_CN_P", (String) hrefFeishuMap.get("hrefFeishu_CN_P")); + params.put("Initiator", projectLibraryBase.getStudioEngineerName()); + + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE3.getValue(), params); + } + return Result.OK("退回成功!"); + } + + @Override + public String getDeliverableTypeNameById(String projectLawsInventoryId, String cut, String flowType, List projectLawsInventoryEOList, List categoryList) { + String result = ""; + + for (ProjectLawsInventoryEO lawsInventory : projectLawsInventoryEOList) { + if (StringUtils.equals(projectLawsInventoryId, lawsInventory.getId())) { + if (StringUtils.equals(flowType, FlowTypeEnum.SJFHXSHLC.getValue())) { + List designDeliverableTypeList = Arrays.asList(lawsInventory.getDesignDeliverableType().split(",")); + result = this.getTreeName(cut, categoryList, designDeliverableTypeList); + } else if (StringUtils.equals(flowType, FlowTypeEnum.YZFHXSCLC.getValue())) { + lawsInventory.getVerifyDeliverableType(); + List verifyDeliverableTypeList = Arrays.asList(lawsInventory.getVerifyDeliverableType().split(",")); + result = this.getTreeName(cut, categoryList, verifyDeliverableTypeList); + } + } + } + return result; + } + + @Override + public String getDutyTerritoryNameById(String projectLawsInventoryId, String cut, List projectLawsInventoryEOList, List sysDictItems, String dicCode) { + String result = ""; + for (ProjectLawsInventoryEO lawsInventory : projectLawsInventoryEOList) { + if (StringUtils.equals(projectLawsInventoryId, lawsInventory.getId())) { + String dutyTerritory = lawsInventory.getDutyTerritory(); + result = disposeShowDictItemValue(sysDictItems, dutyTerritory, cut, ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()); + break; + } + } + return result; + } + + @Override + public void sendMessageByTemplateId(String templeteId, Map params) { + LoginUser currentUser = null; + try { + currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + } catch (Exception ex) { + log.error("获取当前用户信息失败!"); + } + + List userIdList = (List) params.get("userIdList"); + if (CollectionUtils.isNotEmpty(userIdList)) { + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + + String projectLibraryId = (String) params.get("projectLibraryId"); + String endTime = (String) params.get("endTime"); + String Initiator = (String) params.get("Initiator"); + String serialNumbers = (String) params.get("serialNumbers"); + String contentCn = (String) params.get("contentCn"); + String contentEn = (String) params.get("contentEn"); + String flowTypeCn = (String) params.get("flowTypeCn"); + String flowTypeEn = (String) params.get("flowTypeEn"); + String hrefFeishu_CN = (String) params.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) params.get("hrefFeishu_EN"); + String hrefFeishu_CN_P = (String) params.get("hrefFeishu_CN_P"); + + + ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.selectById(projectLibraryId); + if (ObjectUtils.isNotEmpty(projectLibraryBase)) { + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + try { + for (String userId : userIdList) { + String thirdId = this.sysUserService.getUserThirdIdByUserId(userInfoList, userId); + + if (StringUtils.isNotEmpty(thirdId)) { + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", templeteId); + larkMesJson.put("userIds", thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("contentCn", contentCn); + templateVariableMap.put("contentEn", contentEn); + templateVariableMap.put("projectNameCn", PRN_CN); + templateVariableMap.put("projectNameEn", PRN_EN); + templateVariableMap.put("Initiator", Initiator); + templateVariableMap.put("studioEngineerName", projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime", endTime); + templateVariableMap.put("viewBtnUrlCn", hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlCnPhone", hrefFeishu_CN_P); + templateVariableMap.put("viewBtnUrlEn", hrefFeishu_EN); + templateVariableMap.put("operateUserName", ObjectUtils.isNotEmpty(currentUser) ? currentUser.getUsername() : projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("standName", serialNumbers); + templateVariableMap.put("flowTypeCn", flowTypeCn); + templateVariableMap.put("flowTypeEn", flowTypeEn); + + larkMesJson.put("templateVariableMap", templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + } + } + } + + @Override + public Map getProjectLawsInventoryLinkHrefFeishu(String projectLibraryId, String PRN_CN, String PRN_EN, String roleOpen) { + Map result = new HashMap<>(); + + String hrefFeishu_CN = backUrl + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + + projectLibraryId + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType() + + "&projectName=" + PRN_CN + + "&roleOpen=" + roleOpen; + + //飞书跳转链接 + String hrefFeishu_EN = backUrl + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + + projectLibraryId + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType() + + "&projectName=" + PRN_EN + + "&roleOpen=" + roleOpen; + + //飞书手机跳转链接 + String hrefFeishu_CN_P = backUrlPhone + + JumpLinkEnum.TO_DO_CENTER_PHONE.getLink()+ "?keyWord=" + PRN_CN; + + result.put("hrefFeishu_CN", URLUtil.encode(hrefFeishu_CN)); + result.put("hrefFeishu_EN", URLUtil.encode(hrefFeishu_EN)); + result.put("hrefFeishu_CN_P", URLUtil.encode(hrefFeishu_CN_P)); + return result; + } + + @Override + public Map getToDoCenterLinkHrefFeishu(String projectLibraryId, Map todoCenterParams) { + String projectNameCn = (String) todoCenterParams.get("projectNameCn"); + String projectNameEn = (String) todoCenterParams.get("projectNameEn"); + +// ProjectLibraryBase projectLibraryBase = this.platformProjectLibraryBaseService.getBaseMapper().selectProjectName(projectLibraryId); +// String projectNameCn = projectLibraryBase.getProjectName(); + + Map result = new HashMap<>(); + + String hrefFeishu_CN = backUrl + + JumpLinkEnum.FGRW_TO_DO_CENTER_LINK.getLink() + "?projectName=" + projectNameCn; + + //飞书跳转链接 + String hrefFeishu_EN = backUrl + + JumpLinkEnum.FGRW_TO_DO_CENTER_LINK.getLink() + "?projectName=" + projectNameEn; + + //飞书手机端跳转链接 + String hrefFeishu_CN_P = backUrlPhone + + JumpLinkEnum.TO_DO_CENTER_PHONE.getLink() + "?keyWord=" + projectNameCn; + + result.put("hrefFeishu_CN", URLUtil.encode(hrefFeishu_CN)); + result.put("hrefFeishu_EN", URLUtil.encode(hrefFeishu_EN)); + result.put("hrefFeishu_CN_P",URLUtil.encode(hrefFeishu_CN_P)); + return result; + } + + @Override + public void lawsInventoryEOListSortByInventoryAffirmDueDate(List projectLawsInventoryEOS) { + Collections.sort(projectLawsInventoryEOS, new Comparator() { + @Override + public int compare(ProjectLawsInventoryEO p1, ProjectLawsInventoryEO p2) { + if (p1.getInventoryAffirmDueDate() != null && p2.getInventoryAffirmDueDate() != null) { + return p1.getInventoryAffirmDueDate().compareTo(p2.getInventoryAffirmDueDate()); + } + return 1; + } + }); + } + + @Override + public void lawsInventoryEOListSortByDesignDueDate(List projectLawsInventoryEOS) { + Collections.sort(projectLawsInventoryEOS, new Comparator() { + @Override + public int compare(ProjectLawsInventoryEO p1, ProjectLawsInventoryEO p2) { + if (p1.getDesignDueDate() != null && p2.getDesignDueDate() != null) { + return p1.getDesignDueDate().compareTo(p2.getDesignDueDate()); + } + return 1; + } + }); + } + + @Override + public void lawsInventoryEOListSortByVerifyDueDate(List projectLawsInventoryEOS) { + Collections.sort(projectLawsInventoryEOS, new Comparator() { + @Override + public int compare(ProjectLawsInventoryEO p1, ProjectLawsInventoryEO p2) { + if (p1.getDesignDueDate() != null && p2.getDesignDueDate() != null) { + return p1.getDesignDueDate().compareTo(p2.getDesignDueDate()); + } + return 1; + } + }); + } + + @Override + public void createQueryPermission(int isProjectRole, LoginUser currentUser, QueryWrapper queryWrapper) { + // 如果是法规工程师,只能看到法规工程师是自己的数据 + if (isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_ENGINEER.getValue())) { + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getRegulationOwnerId, currentUser.getId()); + } + // 如果是责任人,只能看到设计符合性或验证符合型 责任人是自己的数据。 + if (isProjectRole == Integer.parseInt(com.jero.modules.system.enums.ProjectRoleEnum.PERSON_LIABLE1.getValue())) { + queryWrapper.and(query -> { + query.lambda().eq(ProjectLawsInventoryEO::getDesignDutyId, currentUser.getId()); + query.or().lambda().eq(ProjectLawsInventoryEO::getVerifyDutyId, currentUser.getId()); + }); + } + // 如果是工程接口人,只能看到工程接口人是自己的数据。 + if (isProjectRole == Integer.parseInt(com.jero.modules.system.enums.ProjectRoleEnum.INTERFACE_PERSON1.getValue())) { + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getEngineeringInterfacePerson, currentUser.getId()); + } + } + + /** + * 系统内所有用户验证 + * + * @param projectLawsInventoryEO + * @param errorMsg + * @param msgList + * @param sysUserList + * @param nameCn + * @param nameEn + * @param fieldNumber + */ + private void sysUserVerify(ProjectLawsInventoryEO projectLawsInventoryEO, + String errorMsg, List msgList, + String userName, + List sysUserList, + String nameCn, String nameEn, + String fieldNumber) { + //单选 + if (userName.contains(",")) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + "导入只能填写一个用户名, "; + } else { + errorMsg += "Only one user name can be entered for" + nameEn + "import, "; + } + msgList.add(errorMsg); + } + + if (sysUserList.size() != 0) { + int count = 0; + for (SysUser sysUser : sysUserList) { + if (StringUtils.equals(userName, sysUser.getUsername())) { + count++; + if (ProjectRoleEnum.DESIGNDUTY.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setDesignDutyId(sysUser.getId()); + } else if (ProjectRoleEnum.VERIFYDUTY.getValue().equals(fieldNumber)) { + projectLawsInventoryEO.setVerifyDutyId(sysUser.getId()); + } + break; + } + } + if (count == 0) { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + userName + "在系统中不存在, "; + } else { + errorMsg += nameEn + userName + "Does not exist in the system, "; + } + msgList.add(errorMsg); + } + } else { + if (CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())) { + errorMsg += nameCn + userName + "在系统中不存在, "; + } else { + errorMsg += nameEn + userName + "Does not exist in the system, "; + } + msgList.add(errorMsg); + } + } + + + @Override + public Result resetFlowTemp(JSONObject parmas) { + String ids = parmas.getString("ids"); + String projectLibraryId = parmas.getString("projectLibraryId"); + if (StringUtils.isNotEmpty(ids)) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectLawsInventoryEO::getId, Arrays.asList(ids.split(","))); + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + List projectLawsInventoryEOS = this.list(queryWrapper); + + List idList = Arrays.asList(ids.split(",")); + String projectLawsInventoryIds = ids; + String pIds = ""; + + ProjectLawsInventoryEO projectLawsInventoryEO = new ProjectLawsInventoryEO(); + projectLawsInventoryEO.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); + projectLawsInventoryEO.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + //清单、任务确认初始化。 + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.in(ProjectLawsInventoryEO::getId, idList); + updateWrapper.set(ProjectLawsInventoryEO::getRegulationOwnerSubmitStatus, null); + updateWrapper.set(ProjectLawsInventoryEO::getHomologationEngineerSubmitStatus, null); + updateWrapper.set(ProjectLawsInventoryEO::getSendMsgFlag, null); + updateWrapper.set(ProjectLawsInventoryEO::getSendMsgCurrentFlag, null); + updateWrapper.set(ProjectLawsInventoryEO::getInventoryAffirmDueDate, null); + updateWrapper.set(ProjectLawsInventoryEO::getTaskAffirmDueDate, null); + updateWrapper.set(ProjectLawsInventoryEO::getDesignFlowStatus, ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); + updateWrapper.set(ProjectLawsInventoryEO::getVerifyFlowStatus, ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); + super.update(projectLawsInventoryEO, updateWrapper); + + QueryWrapper processInfoQueryWrap = new QueryWrapper<>(); + processInfoQueryWrap.lambda().in(ProcessInfoEO::getProjectLawsInventoryId, idList); + List processInfoEOList = this.processInfoEOService.list(processInfoQueryWrap); + List actiProcInstIdList = processInfoEOList.stream().filter(processInfo -> { + boolean flag = false; + if (StringUtils.equals(processInfo.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue()) || StringUtils.equals(processInfo.getFlowType(), FlowTypeEnum.YZFHXSCLC.getValue())) { + flag = true; + } + return flag; + }).map(ProcessInfoEO::getActiProcInstId).distinct().collect(Collectors.toList()); + + pIds = actiProcInstIdList.stream().map(String::valueOf).collect(Collectors.joining(",")); + JSONObject params = new JSONObject(); + params.put("projectLawsInventoryIds", projectLawsInventoryIds); + params.put("pIds", pIds); + //根据流程实例id 、 法规清单id 删除相关流程。 + workFlowFeignClient.deleteProcessInstanceByProjectLawsInventoryIds(params); + + //清除流程中心对应的数据 + params.put("ids", ids); + this.processInfoEOService.change(params); + + // 删除流程历史数据 + this.processHistoryEOService.deleteBiActiProcInstIdList(actiProcInstIdList); + } + return Result.OK("变更成功!"); + } + + @Override + public Result updateFlowStatusBatch(JSONObject json) { + String flowStatus = json.getString("flowStatus"); + JSONArray lawsInventoryArray = json.getJSONArray("lawsInventoryArray"); + if (CollectionUtils.isNotEmpty(lawsInventoryArray)) { + List> lawsInventoryMapList = new ArrayList<>(); + Map lawsInventoryMap = null; + for (Object lawsInventory : lawsInventoryArray) { + lawsInventoryMap = JSONObject.parseObject(JSONObject.toJSONString(lawsInventory), Map.class); + lawsInventoryMapList.add(lawsInventoryMap); + } + + List lawsInventoryIdList = lawsInventoryMapList.stream().map(e -> (String) e.get("id")).distinct().collect(Collectors.toList()); + + QueryWrapper pliQueryWrap = new QueryWrapper<>(); + pliQueryWrap.lambda().in(ProjectLawsInventoryEO::getId, lawsInventoryIdList); + List pliEoList = this.list(pliQueryWrap); + if (CollectionUtils.isNotEmpty(pliEoList) && CollectionUtils.isNotEmpty(lawsInventoryMapList)) { + for (Map map : lawsInventoryMapList) { + String id = (String) map.get("id"); + String operateType = (String) map.get("operateType"); + pliEoList.forEach(pliEo -> { + if (StringUtils.equals(id, pliEo.getId())) { + if (StringUtils.contains(operateType, OperatorTypeEnum.LAWS_INVENTORY_DESIGN_UPDATE_FLOW_STATUS.getValue())) { + pliEo.setDesignFlowStatus(flowStatus); + } + if (StringUtils.contains(operateType, OperatorTypeEnum.LAWS_INVENTORY_VERIFY_UPDATE_FLOW_STATUS.getValue())) { + pliEo.setVerifyFlowStatus(flowStatus); + } + } + }); + } + this.updateBatchById(pliEoList); + } + } + return new Result<>().success("批量更新状态成功!"); + } + + @Override + public Result citeDeliverable(JSONObject json) { + String cut = json.getString("cut"); + String operateType = json.getString("operateType"); + String flowType = ""; + if (StringUtils.equals(operateType, OperatorTypeEnum.LAWS_INVENTORY_DESIGN_CITE_DELIVERABLE.getValue())) { + flowType = FlowTypeEnum.SJFHXSHLC.getValue(); + } else if (StringUtils.equals(operateType, OperatorTypeEnum.LAWS_INVENTORY_VERIFY_CITE_DELIVERABLE.getValue())) { + flowType = FlowTypeEnum.YZFHXSCLC.getValue(); + } + + String resultMsg = ""; + ProcessHistoryEO citePhEo = null; + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + resultMsg = "引用交付物成功!"; + } else { + resultMsg = "Successfully referenced deliverables!"; + } + + String serialNumber = json.getString("serialNumber"); + String dutyTerritory = json.getString("dutyTerritory"); + String citeProjectLibraryId = json.getString("citeProjectLibraryId"); + if (StringUtils.isEmpty(citeProjectLibraryId)) { + throw new JeroBootException("请选择引用的项目!"); + } + + // 符合性流程已完成的状态 + List complianceFlowStatusList = new ArrayList<>(); + complianceFlowStatusList.add(ComplianceFlowStatusEnum.CONFORMITY.getValue()); + complianceFlowStatusList.add(ComplianceFlowStatusEnum.INCONFORMITY.getValue()); + complianceFlowStatusList.add(ComplianceFlowStatusEnum.TO_TRACK.getValue()); + complianceFlowStatusList.add(ComplianceFlowStatusEnum.UNINVOLVED.getValue()); + + QueryWrapper citePliQueryWrap = new QueryWrapper<>(); + citePliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, citeProjectLibraryId); + if (StringUtils.equals(flowType, FlowTypeEnum.SJFHXSHLC.getValue())) { + citePliQueryWrap.lambda().in(ProjectLawsInventoryEO::getDesignFlowStatus, complianceFlowStatusList); + } else if (StringUtils.equals(flowType, FlowTypeEnum.YZFHXSCLC.getValue())) { + citePliQueryWrap.lambda().in(ProjectLawsInventoryEO::getVerifyFlowStatus, complianceFlowStatusList); + } + List citePliEoList = this.list(citePliQueryWrap); + if (CollectionUtils.isNotEmpty(citePliEoList)) { + List citePliEoListTemp = citePliEoList.stream().filter(citePliEo -> { + boolean serialNumberFlag = (StringUtils.equals(serialNumber, citePliEo.getSerialNumber())); + boolean dutyTerritoryFlag = Arrays.equals(dutyTerritory.split(","), citePliEo.getDutyTerritory().split(",")); + boolean deliverableTypeFlag = false; + + if (StringUtils.equals(operateType, OperatorTypeEnum.LAWS_INVENTORY_DESIGN_CITE_DELIVERABLE.getValue())) { + String designDeliverableType = json.getString("designDeliverableType"); + deliverableTypeFlag = Arrays.equals(designDeliverableType.split(","), citePliEo.getDesignDeliverableType().split(",")); + } else if (StringUtils.equals(operateType, OperatorTypeEnum.LAWS_INVENTORY_VERIFY_CITE_DELIVERABLE.getValue())) { + String verifyDeliverableType = json.getString("verifyDeliverableType"); + deliverableTypeFlag = Arrays.equals(verifyDeliverableType.split(","), citePliEo.getVerifyDeliverableType().split(",")); + } + + return serialNumberFlag && dutyTerritoryFlag && deliverableTypeFlag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(citePliEoListTemp)) { + ProjectLawsInventoryEO citePliEo = citePliEoListTemp.get(0); + String citePliEoId = citePliEo.getId(); + + QueryWrapper citePiQueryWrap = new QueryWrapper<>(); + citePiQueryWrap.lambda().eq(ProcessInfoEO::getProjectLawsInventoryId, citePliEoId); + citePiQueryWrap.lambda().eq(ProcessInfoEO::getFlowType, flowType); + citePiQueryWrap.orderByDesc("create_time"); + List citePiEoList = this.processInfoEOService.list(citePiQueryWrap); + if (CollectionUtils.isNotEmpty(citePiEoList)) { + ProcessInfoEO citePiEo = citePiEoList.get(0); + String citePiEoActiProcInstId = citePiEo.getActiProcInstId(); + + List taskDefinitionKeyList = new ArrayList<>(); + if (StringUtils.equals(flowType, FlowTypeEnum.SJFHXSHLC.getValue())) { + taskDefinitionKeyList.add(DesignComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue()); + taskDefinitionKeyList.add(DesignComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue()); + } else if (StringUtils.equals(flowType, FlowTypeEnum.YZFHXSCLC.getValue())) { + taskDefinitionKeyList.add(VerifyComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue()); + taskDefinitionKeyList.add(VerifyComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue()); + } + + QueryWrapper citePhQueryWrap = new QueryWrapper<>(); + citePhQueryWrap.lambda().eq(ProcessHistoryEO::getActiProcInstId, citePiEoActiProcInstId); + citePhQueryWrap.lambda().in(ProcessHistoryEO::getTaskDefinitionKey, taskDefinitionKeyList); + citePhQueryWrap.orderByDesc("create_time"); + List citePhEoList = this.processHistoryEOService.list(citePhQueryWrap); + if (CollectionUtils.isNotEmpty(citePhEoList)) { + citePhEo = citePhEoList.get(0); + } + } + } + + if (ObjectUtils.isEmpty(citePhEo)) { + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + resultMsg = "所选引用项目中,没有匹配到数据,请重新选择!"; + } else { + resultMsg = "There is no matching data in the selected reference project. Please reselect!"; + } + } + } else { + if (StringUtils.equals(cut, CutEnum.CN.getValue())) { + resultMsg = "所选引用项目中流程完成数据为空,请重新选择!"; + } else { + resultMsg = "The process completion data in the selected reference project is empty, please reselect!"; + } + } + return Result.OK(resultMsg, citePhEo); + } + + @Override + public Result compulsoryTransfer(JSONObject json) { + String projectLibraryId = json.getString("projectLibraryId"); + String ids = json.getString("ids"); + if (StringUtils.isEmpty(ids)) { + throw new JeroBootException("请选择数据进行强制转办操作!"); + } + List projectLawsInventoryIdList = Arrays.asList(ids.split(",")); + + String designTransferUserId = json.getString("designTransferUserId"); + String verifyTransferUserId = json.getString("verifyTransferUserId"); + + QueryWrapper pliQueryWrap = new QueryWrapper<>(); + pliQueryWrap.lambda().in(ProjectLawsInventoryEO::getId, projectLawsInventoryIdList); + List pliEoList = this.list(pliQueryWrap); + if (CollectionUtils.isNotEmpty(pliEoList)) { + QueryWrapper piQueryWrap = new QueryWrapper<>(); + piQueryWrap.lambda().in(ProcessInfoEO::getProjectLawsInventoryId, projectLawsInventoryIdList); + List piEoList = this.processInfoEOService.list(piQueryWrap); + + if (CollectionUtils.isNotEmpty(piEoList)) { + if (StringUtils.isNotEmpty(designTransferUserId)) { + pliEoList.forEach(pliEo -> { + pliEo.setDesignDutyId(designTransferUserId); + }); + // 设计符合性相关待办任务强制转办 + this.designCompulsoryTransfer(projectLibraryId, designTransferUserId, pliEoList, piEoList); + } + if (StringUtils.isNotEmpty(verifyTransferUserId)) { + pliEoList.forEach(pliEo -> { + pliEo.setVerifyDutyId(verifyTransferUserId); + }); + // 验证符合性相关待办任务强制转办 + this.verifyCompulsoryTransfer(projectLibraryId, verifyTransferUserId, pliEoList, piEoList); + } + + this.updateBatchById(pliEoList); + } + } + return Result.OK("强制转办成功!"); + } + + @Override + public List> getTaskToConfirmStatistics(List projectLawsInventoryEOList) { + List> result = new ArrayList<>(); + + int notStartedCount = 0; + int toConfirmCount = 0; + int acceptedCount = 0; + int rejectedCount = 0; + if(CollectionUtils.isNotEmpty(projectLawsInventoryEOList)){ + // 未发起 + int designNotStartedCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + return flag; + }).count(); + int verifyNotStartedCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + return flag; + }).count(); + notStartedCount = designNotStartedCount + verifyNotStartedCount; + + // 待确认 + int designToConfirmCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).count(); + int verifyToConfirmCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).count(); + toConfirmCount = designToConfirmCount + verifyToConfirmCount; + + // 接受 + int designAcceptedCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + return flag; + }).count(); + int verifyAcceptedCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + return flag; + }).count(); + acceptedCount = designAcceptedCount + verifyAcceptedCount; + + // 拒绝 + int designRejectedCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + ); + return flag; + }).count(); + int verifyRejectedCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + ); + return flag; + }).count(); + rejectedCount = designRejectedCount + verifyRejectedCount; + } + + Map notStartedMap = new HashMap<>(); + Map toConfirmMap = new HashMap<>(); + Map acceptedMap = new HashMap<>(); + Map rejectedMap = new HashMap<>(); + + notStartedMap.put("taskAffirmStatus",TaskAffirmStatusEnum.NOT_STARTED.getValue()); + notStartedMap.put("taskAffirmStatusCount",notStartedCount); + + toConfirmMap.put("taskAffirmStatus",TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + toConfirmMap.put("taskAffirmStatusCount",toConfirmCount); + + acceptedMap.put("taskAffirmStatus",TaskAffirmStatusEnum.ACCEPTED.getValue()); + acceptedMap.put("taskAffirmStatusCount",acceptedCount); + + rejectedMap.put("taskAffirmStatus",TaskAffirmStatusEnum.REJECTED.getValue()); + rejectedMap.put("taskAffirmStatusCount",rejectedCount); + + result.add(notStartedMap); + result.add(toConfirmMap); + result.add(acceptedMap); + result.add(rejectedMap); + return result; + } + + @Override + public List> getDesignComplianceStatistice(List projectLawsInventoryEOList) { + List> result = new ArrayList<>(); + + int notStartedCount = 0; + int toConfirmCount = 0; + int complianceCount = 0; + int nonComplianceCount = 0; + if(CollectionUtils.isNotEmpty(projectLawsInventoryEOList)){ + // 未发起 + notStartedCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) +// || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).count(); + + // 待确认 + toConfirmCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) +// || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + return flag; + }).count(); + + // 符合 + complianceCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + ); + return flag; + }).count(); + + // 不符合 + nonComplianceCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + return flag; + }).count(); + } + + Map notStartedMap = new HashMap<>(); + Map toConfirmMap = new HashMap<>(); + Map acceptedMap = new HashMap<>(); + Map rejectedMap = new HashMap<>(); + + notStartedMap.put("designFlowTaskStatus",TaskAffirmStatusEnum.NOT_STARTED.getValue()); + notStartedMap.put("designFlowTaskStatusCount",notStartedCount); + + toConfirmMap.put("designFlowTaskStatus",TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + toConfirmMap.put("designFlowTaskStatusCount",toConfirmCount); + + acceptedMap.put("designFlowTaskStatus",ComplianceFlowStatusEnum.CONFORMITY.getValue()); + acceptedMap.put("designFlowTaskStatusCount",complianceCount); + + rejectedMap.put("designFlowTaskStatus",ComplianceFlowStatusEnum.INCONFORMITY.getValue()); + rejectedMap.put("designFlowTaskStatusCount",nonComplianceCount); + + result.add(notStartedMap); + result.add(toConfirmMap); + result.add(acceptedMap); + result.add(rejectedMap); + return result; + } + + @Override + public List> getVerifyComplianceStatistice(List projectLawsInventoryEOList) { + List> result = new ArrayList<>(); + + int notStartedCount = 0; + int toConfirmCount = 0; + int complianceCount = 0; + int nonComplianceCount = 0; + if(CollectionUtils.isNotEmpty(projectLawsInventoryEOList)){ + // 未发起 + notStartedCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) +// || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).count(); + + // 待确认 + toConfirmCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) +// || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + return flag; + }).count(); + + // 符合 + complianceCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + ); + return flag; + }).count(); + + // 不符合 + nonComplianceCount = (int) projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + return flag; + }).count(); + } + + Map notStartedMap = new HashMap<>(); + Map toConfirmMap = new HashMap<>(); + Map acceptedMap = new HashMap<>(); + Map rejectedMap = new HashMap<>(); + + notStartedMap.put("verifyFlowTaskStatus",TaskAffirmStatusEnum.NOT_STARTED.getValue()); + notStartedMap.put("verifyFlowTaskStatusCount",notStartedCount); + + toConfirmMap.put("verifyFlowTaskStatus",TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + toConfirmMap.put("verifyFlowTaskStatusCount",toConfirmCount); + + acceptedMap.put("verifyFlowTaskStatus",ComplianceFlowStatusEnum.CONFORMITY.getValue()); + acceptedMap.put("verifyFlowTaskStatusCount",complianceCount); + + rejectedMap.put("verifyFlowTaskStatus",ComplianceFlowStatusEnum.INCONFORMITY.getValue()); + rejectedMap.put("verifyFlowTaskStatusCount",nonComplianceCount); + + result.add(notStartedMap); + result.add(toConfirmMap); + result.add(acceptedMap); + result.add(rejectedMap); + return result; + } + + @Override + public List> queryNotComplianList(Map params) { + String cut = (String) params.get("cut"); + + List complianceFlowStatusList = new ArrayList<>(); + complianceFlowStatusList.add(ComplianceFlowStatusEnum.INCONFORMITY.getValue()); + complianceFlowStatusList.add(ComplianceFlowStatusEnum.TO_TRACK.getValue()); + params.put("complianceFlowStatusList",complianceFlowStatusList); + List> result = this.baseMapper.queryNotComplianList(params); + if(CollectionUtils.isNotEmpty(result)){ + List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); + + List userIdList = new ArrayList<>(); + + List regulationOwnerIdList = result.stream().filter( + data -> StringUtils.isNotEmpty((String) data.get("regulationOwnerId")) + ).map(e -> (String) e.get("regulationOwnerId")).distinct().collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(regulationOwnerIdList)){ + userIdList.addAll(regulationOwnerIdList); + } + + List dutyIdList = result.stream().filter( + data -> StringUtils.isNotEmpty((String) data.get("dutyId")) + ).map(e -> (String) e.get("dutyId")).distinct().collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(dutyIdList)){ + userIdList.addAll(dutyIdList); + } + List userList = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(userIdList)){ + userList = this.sysUserService.querySysUserListByIdList(userIdList); + } + //流程实例id + List processInfoDetailEOS = new ArrayList<>(); + List projectLawsInventoryIdList = result.stream().map(e -> (String) e.get("id")).collect(Collectors.toList()); + List processHistoryEOList = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(projectLawsInventoryIdList)){ + QueryWrapper processInfoDetailEOQueryWrapper = new QueryWrapper<>(); + processInfoDetailEOQueryWrapper.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId,projectLawsInventoryIdList); + processInfoDetailEOQueryWrapper.orderByDesc("create_time"); + processInfoDetailEOS = this.processInfoDetailEOService.list(processInfoDetailEOQueryWrapper); + if(ObjectUtils.isNotEmpty(processInfoDetailEOS)){ + List actiProcInstIdList = processInfoDetailEOS.stream().map(ProcessInfoDetailEO::getActiProcInstId).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(actiProcInstIdList)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByAsc("create_time"); + queryWrapper.lambda().in(ProcessHistoryEO::getActiProcInstId, actiProcInstIdList); + processHistoryEOList = processHistoryEOService.list(queryWrapper); + if(ObjectUtils.isNotEmpty(processHistoryEOList)){ + this.processHistoryEOServiceImpl.disposeData(processHistoryEOList,cut); + } + } + } + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + for (Map dataMap : result) { + dataMap.put("uuid",dataMap.get("id")); + //相关法规 + dataMap.put("lawsName",dataMap.get("serialNumber")); + //相关项目(旧数据的未符合项,都是属于这一个项目的) + dataMap.put("projectName",params.get("projectName")); + dataMap.put("projectid",params.get("projectLibraryId")); + //创建时间 + dataMap.put("createTime",dataMap.get("createTime")); + //更新时间 + dataMap.put("updateTime",dataMap.get("updateTime")); + + String dutyTerritory = (String) dataMap.get("dutyTerritory"); + if(StringUtils.isNotEmpty(dutyTerritory)){ + if(StringUtils.isNotEmpty(dutyTerritory)){ + String dutyTerritory_dictText = this.disposeShowDictItemValue(sysDictItems, dutyTerritory,cut,ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()); + dataMap.put("dutyTerritory_dictText",dutyTerritory_dictText); + //责任部门 + dataMap.put("dutyTerritory",dutyTerritory_dictText); + } + } + + String flowStatus = (String) dataMap.get("flowStatus"); + String problemType_dictText = ""; + if(StringUtils.isNotEmpty(flowStatus)){ + String textByValue = ComplianceFlowStatusEnum.getTextByValue(flowStatus, cut); + if(ComplianceFlowStatusEnum.INCONFORMITY.getCnName().equals(textByValue) + || ComplianceFlowStatusEnum.INCONFORMITY.getEnName().equals(textByValue)){ + //问题类型 + if(CutEnum.CN.getValue().equals(cut)){ + problemType_dictText = ComplianceFlowStatusEnum.LAWS_INCONFORMITY.getCnName(); + dataMap.put("problemType_dictText",problemType_dictText); + }else{ + problemType_dictText = ComplianceFlowStatusEnum.LAWS_INCONFORMITY.getEnName(); + dataMap.put("problemType_dictText",problemType_dictText); + } + //问题状态 + dataMap.put("problemState", ColourEnum.RED.getName()); + } + if(ComplianceFlowStatusEnum.TO_TRACK.getCnName().equals(textByValue) + ||ComplianceFlowStatusEnum.TO_TRACK.getEnName().equals(textByValue)){ + //问题类型 + if(CutEnum.CN.getValue().equals(cut)){ + problemType_dictText = ComplianceFlowStatusEnum.LAWS_TO_TRACK.getCnName(); + dataMap.put("problemType_dictText",problemType_dictText); + }else{ + problemType_dictText = ComplianceFlowStatusEnum.LAWS_TO_TRACK.getEnName(); + dataMap.put("problemType_dictText",problemType_dictText); + } + //问题状态 + dataMap.put("problemState",ColourEnum.YELLOW.getName()); + } + dataMap.put("flowStatusName",ComplianceFlowStatusEnum.getTextByValue(flowStatus,cut)); + } + + if(CollectionUtils.isNotEmpty(userList)){ + String regulationOwnerId = (String) dataMap.get("regulationOwnerId"); + if(StringUtils.isNotEmpty(regulationOwnerId)){ + String regulationOwnerIdName = this.sysUserService.getUsernameByUserId(userList,regulationOwnerId); + dataMap.put("regulationOwnerIdName",regulationOwnerIdName); + } + String dutyId = (String) dataMap.get("dutyId"); + if(StringUtils.isNotEmpty(dutyId)){ + String dutyIdName = this.sysUserService.getUsernameByUserId(userList,dutyId); + dataMap.put("dutyIdName",dutyIdName); + //创建人 + dataMap.put("createBy",dutyIdName); + } + } + + String flowType = (String) dataMap.get("flowType"); + if(StringUtils.isNotEmpty(flowType)){ + dataMap.put("flowTypeName",FlowTypeEnum.getTextByValue(flowType,cut)); + } + //标题 + if(CutEnum.CN.getValue().equals(cut)){ + dataMap.put("title",(String) dataMap.get("flowTypeName") + problemType_dictText); + }else{ + dataMap.put("title",(String) dataMap.get("flowTypeName") +" " + problemType_dictText); + } + + dataMap.put("flag", DataEnum.OLD.getValue()); + + // 更新时间,创建时间 + if(ObjectUtils.isNotEmpty(processInfoDetailEOS)){ + List collect = processInfoDetailEOS.stream() + .filter(e -> StringUtils.isNotBlank(e.getFlowType()) && e.getFlowType().equals(flowType)).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(collect)){ + dataMap.put("actiProcInstId",collect.get(0).getActiProcInstId()); + if(ObjectUtils.isNotEmpty(processHistoryEOList)){ + List processHistoryEOSTemp = processHistoryEOList.stream().filter(e -> StringUtils.isNotBlank(e.getActiProcInstId()) + && e.getActiProcInstId().equals(collect.get(0).getActiProcInstId())).collect(Collectors.toList()); + //创建时间为任务节点为符合性审查,处理结果为不符合或待追踪的操作时间 + //更新时间为最新的流程时间 + if(!processHistoryEOSTemp.isEmpty()){ + //更新时间 + if(ObjectUtils.isNotEmpty(processHistoryEOSTemp.get(processHistoryEOSTemp.size()-1).getCreateTime())){ + dataMap.put("updateTime",sdf.format(processHistoryEOSTemp.get(processHistoryEOSTemp.size()-1).getCreateTime())); + } + //创建时间 + List processHistoryEOS = processHistoryEOSTemp.stream().filter(e -> StringUtils.isNotBlank(e.getTaskDefinitionKey()) + && DesignComplianceFlowNodeKeyEnum.FGGCSSH.getValue().equals(e.getTaskDefinitionKey()) + && (ComplianceFlowStatusEnum.INCONFORMITY.getValue().equals(e.getOperatorResult()) || ComplianceFlowStatusEnum.TO_TRACK.getValue().equals(e.getOperatorResult()))).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(processHistoryEOS)) { + if(ObjectUtils.isNotEmpty(processHistoryEOS.get(0).getCreateTime())){ + dataMap.put("createTime",sdf.format(processHistoryEOS.get(0).getCreateTime())); + } + } + } + } + } + } +// QueryWrapper processInfoDetailEOQueryWrapper = new QueryWrapper<>(); +// processInfoDetailEOQueryWrapper.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId,(String)dataMap.get("id")); +// processInfoDetailEOQueryWrapper.lambda().eq(ProcessInfoDetailEO::getFlowType,flowType); +// processInfoDetailEOQueryWrapper.orderByDesc("create_time"); +// List processInfoDetailEOS = this.processInfoDetailEOService.list(processInfoDetailEOQueryWrapper); +// if(CollectionUtils.isNotEmpty(processInfoDetailEOS)){ +// dataMap.put("actiProcInstId",processInfoDetailEOS.get(0).getActiProcInstId()); +// } + } + + + + } + //新数据 + List> mapList = getNewData(params, cut); + if(ObjectUtils.isNotEmpty(mapList)){ + result.addAll(mapList); + } + //条件查询 + result = dataParameter(params, result); + //表头排序 + heartSort(params, result); + + + return result; + } + + private void heartSort(Map params, List> result) { + Collator comparator = Collator.getInstance(Locale.CHINESE); + if ("title".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("title")) ? String.valueOf(e1.get("title")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("title")) ? String.valueOf(e2.get("title")) : ""; + return comparator.compare(e1Field, e2Field); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("title")) ? String.valueOf(e1.get("title")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("title")) ? String.valueOf(e2.get("title")) : ""; + return comparator.compare(e2Field, e1Field); + }); + } + } + if ("lawsName".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("lawsName")) ? String.valueOf(e1.get("lawsName")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("lawsName")) ? String.valueOf(e2.get("lawsName")) : ""; + return comparator.compare(e1Field, e2Field); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("lawsName")) ? String.valueOf(e1.get("lawsName")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("lawsName")) ? String.valueOf(e2.get("lawsName")) : ""; + return comparator.compare(e2Field, e1Field); + }); + } + } + if ("projectName".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("projectName")) ? String.valueOf(e1.get("projectName")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("projectName")) ? String.valueOf(e2.get("projectName")) : ""; + return comparator.compare(e1Field, e2Field); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("projectName")) ? String.valueOf(e1.get("projectName")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("projectName")) ? String.valueOf(e2.get("projectName")) : ""; + return comparator.compare(e2Field, e1Field); + }); + } + } + if ("problemType_dictText".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("problemType_dictText")) ? String.valueOf(e1.get("problemType_dictText")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("problemType_dictText")) ? String.valueOf(e2.get("problemType_dictText")) : ""; + return comparator.compare(e1Field, e2Field); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("problemType_dictText")) ? String.valueOf(e1.get("problemType_dictText")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("problemType_dictText")) ? String.valueOf(e2.get("problemType_dictText")) : ""; + return comparator.compare(e2Field, e1Field); + }); + } + } + if ("dutyTerritory".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("dutyTerritory")) ? String.valueOf(e1.get("dutyTerritory")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("dutyTerritory")) ? String.valueOf(e2.get("dutyTerritory")) : ""; + return comparator.compare(e1Field, e2Field); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("dutyTerritory")) ? String.valueOf(e1.get("dutyTerritory")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("dutyTerritory")) ? String.valueOf(e2.get("dutyTerritory")) : ""; + return comparator.compare(e2Field, e1Field); + }); + } + } + if ("createBy".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("createBy")) ? String.valueOf(e1.get("createBy")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("createBy")) ? String.valueOf(e2.get("createBy")) : ""; + return comparator.compare(e1Field, e2Field); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("createBy")) ? String.valueOf(e1.get("createBy")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("createBy")) ? String.valueOf(e2.get("createBy")) : ""; + return comparator.compare(e2Field, e1Field); + }); + } + } + if ("problemState".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("problemState")) ? String.valueOf(e1.get("problemState")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("problemState")) ? String.valueOf(e2.get("problemState")) : ""; + return comparator.compare(e1Field, e2Field); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + String e1Field = ObjectUtils.isNotEmpty(e1.get("problemState")) ? String.valueOf(e1.get("problemState")) : ""; + String e2Field = ObjectUtils.isNotEmpty(e2.get("problemState")) ? String.valueOf(e2.get("problemState")) : ""; + return comparator.compare(e2Field, e1Field); + }); + } + } + if ("createTime".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + if (e1.get("createTime") == null || e2.get("createTime") == null) { + return 0; + } + return comparator.compare(e1.get("createTime"), e2.get("createTime")); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + if (e1.get("createTime") == null || e2.get("createTime") == null) { + return 0; + } + return comparator.compare(e2.get("createTime"), e1.get("createTime")); + }); + } + } + if ("updateTime".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + if (e1.get("updateTime") == null || e2.get("updateTime") == null) { + return 0; + } + return comparator.compare(e1.get("updateTime"), e2.get("updateTime")); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(result, (e1, e2) -> { + if (e1.get("updateTime") == null || e2.get("updateTime") == null) { + return 0; + } + return comparator.compare(e2.get("updateTime"), e1.get("updateTime")); + }); + } + } + } + + @NotNull + private List> getNewData(Map params, String cut) { + //新数据 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(ProblemManagementEO::getProjectId,params.get("projectLibraryId")); + List managementEOList = problemManagementEOService.list(wrapper); + //法规 + List lawsIdList = managementEOList.stream() + .filter(e-> StringUtils.isNotBlank(e.getLawsId())).map(ProblemManagementEO::getLawsId).collect(Collectors.toList()); + //项目 + List projectIdList = managementEOList.stream() + .filter(e->StringUtils.isNotBlank(e.getProjectId())).map(ProblemManagementEO::getProjectId).collect(Collectors.toList()); + //相关文件 + List fileList = managementEOList.stream() + .filter(e -> StringUtils.isNotBlank(e.getFile())).map(ProblemManagementEO::getFile).collect(Collectors.toList()); + //审批证据 + List approvalEvidenceList = managementEOList.stream() + .filter(e -> StringUtils.isNotBlank(e.getApprovalEvidence())).map(ProblemManagementEO::getApprovalEvidence).collect(Collectors.toList()); + List connectList = new ArrayList<>(); + if(!fileList.isEmpty()){ + connectList.addAll(fileList); + } + if(!approvalEvidenceList.isEmpty()){ + connectList.addAll(approvalEvidenceList); + } + List fileInfoList = new ArrayList<>(); + if(!connectList.isEmpty()){ + fileInfoList = iOSSFileService.getFileInfosByConnectId(StringUtils.join(connectList,",")); + } + + List documentLibraryEOList = new ArrayList<>(); + if(!lawsIdList.isEmpty()){ + Set lawIdSet = new HashSet<>(); + for (String lawIds : lawsIdList) { + lawIdSet.addAll(Arrays.asList(lawIds.split(","))); + } + if(!lawIdSet.isEmpty()){ + LambdaQueryWrapper wrapperDocument = new LambdaQueryWrapper<>(); + wrapperDocument.in(BussDocumentLibraryEO::getId, lawIdSet); + documentLibraryEOList = bussDocumentLibraryEOService.list(wrapperDocument); + } + } + + List projectLibraryBaseList = new ArrayList<>(); + if(!projectIdList.isEmpty()){ + Set projectIdSet = new HashSet<>(); + for (String projectIds : projectIdList) { + projectIdSet.addAll(Arrays.asList(projectIds.split(","))); + } + if(!projectIdSet.isEmpty()){ + projectLibraryBaseList = problemManagementEOMapper.queryByIds(StringUtils.join(projectIdSet,",")); + } + } + List problemTypeList = sysDictService.queryDictItemsByCode(DicCodeEnum.PROBLEM_TYPE.getCode()); + + List ncrTrackVOList = new ArrayList<>(); + List> mapList = new ArrayList<>(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + for (ProblemManagementEO problemManagementEO : managementEOList) { + Map map = new HashMap<>(); + map.put("title",problemManagementEO.getTitle()); + map.put("psIssue",problemManagementEO.getPsIssue()); + map.put("dutyTerritory",problemManagementEO.getDutyTerritory()); + map.put("problemState",problemManagementEO.getProblemState()); + map.put("problemType",problemManagementEO.getProblemType()); + map.put("description",problemManagementEO.getDescription()); + map.put("conclusion",problemManagementEO.getConclusion()); + map.put("createBy",problemManagementEO.getCreateBy()); + map.put("createTime",sdf.format(problemManagementEO.getCreateTime())); + map.put("updateTime",sdf.format(problemManagementEO.getUpdateTime())); + map.put("uuid",problemManagementEO.getId()); + map.put("id",problemManagementEO.getId()); + map.put("flag",DataEnum.NEW.getValue()); + map.put("projectId",problemManagementEO.getProjectId()); + + List dictModelList = problemTypeList.stream().filter(e -> e.getValue().equals(problemManagementEO.getProblemType())).collect(Collectors.toList()); + + if(!dictModelList.isEmpty()){ + if(CutEnum.CN.getValue().equals(cut)){ + map.put("problemType_dictText",dictModelList.get(0).getText()); + }else{ + map.put("problemType_dictText",dictModelList.get(0).getTextEn()); + } + } + //相关法规 + if(StringUtils.isNotBlank(problemManagementEO.getLawsId())){ + if(!documentLibraryEOList.isEmpty()){ + List documentLibraryEOListTemp = documentLibraryEOList.stream() + .filter(e->StringUtils.isNotBlank(problemManagementEO.getLawsId()) + && problemManagementEO.getLawsId().contains(e.getId())).collect(Collectors.toList()); + List serialNumberList = documentLibraryEOListTemp.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList()); + problemManagementEO.setLawsName(StringUtils.join(serialNumberList,",")); + map.put("lawsName",StringUtils.join(serialNumberList,",")); + map.put("lawsId",problemManagementEO.getLawsId()); + } + } + //相关项目 + if(StringUtils.isNotBlank(problemManagementEO.getProjectId())){ + List projectLibraryBaseListTemp = projectLibraryBaseList.stream() + .filter(e->StringUtils.isNotBlank(problemManagementEO.getProjectId()) + && problemManagementEO.getProjectId().contains(e.getId())).collect(Collectors.toList()); + //目标市场数据字典 + List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); + List projectNameList = new ArrayList<>(); + for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseListTemp) { + //目标市场 + String targetMarket = problemManagementEOService.getMarket(cut, targetMarketList, projectLibraryBase); + //主项目的版本号 + String projectVersion = ""; + if(com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId())){ + projectVersion = "00"; + }else{ + projectVersion = projectLibraryBase.getProjectVersion(); + } + projectNameList.add(projectLibraryBase.getProjectName() + + "-" + projectLibraryBase.getYearName() + + "-" + targetMarket + +"-"+projectVersion); + } + if(!projectNameList.isEmpty()){ + problemManagementEO.setProjectName(StringUtils.join(projectNameList,",")); + map.put("projectName",StringUtils.join(projectNameList,",")); + map.put("projectId",problemManagementEO.getProjectId()); + } + } + + //相关文件连接 + if(StringUtils.isNotBlank(problemManagementEO.getFileLink())){ + List list = new ArrayList<>(); + for (String fileLink : problemManagementEO.getFileLink().split(",")) { + ProblemManagementVO problemManagementVO = new ProblemManagementVO(); + problemManagementVO.setFileLink(fileLink); + list.add(problemManagementVO); + } + problemManagementEO.setFileLinkList(list); + map.put("fileLinkList",list); + } + + //审批证据连接 + if(StringUtils.isNotBlank(problemManagementEO.getApprovalEvidenceLink())){ + List list = new ArrayList<>(); + for (String approvalEvidenceLink : problemManagementEO.getApprovalEvidenceLink().split(",")) { + ProblemManagementVO problemManagementVO = new ProblemManagementVO(); + problemManagementVO.setApprovalEvidenceLink(approvalEvidenceLink); + list.add(problemManagementVO); + } + problemManagementEO.setApprovalEvidenceLinkList(list); + map.put("approvalEvidenceLinkList",list); + } + //进度追踪 + if(StringUtils.isNotBlank(problemManagementEO.getProgressTracking())){ + List list = new ArrayList<>(); + for (String progressTracking : problemManagementEO.getProgressTracking().split(",")) { + ProblemManagementVO problemManagementVO = new ProblemManagementVO(); + problemManagementVO.setProgressTracking(progressTracking); + list.add(problemManagementVO); + } + problemManagementEO.setProgressTrackingList(list); + map.put("progressTrackingList",list); + } + //相关文件 + if(StringUtils.isNotBlank(problemManagementEO.getFile())){ + List collect = fileInfoList.stream() + .filter(e -> e.getConnectId().equals(problemManagementEO.getFile())).collect(Collectors.toList()); + problemManagementEO.setFileList(collect); + map.put("fileList",collect); + map.put("file",problemManagementEO.getFile()); + } + //审批证据 + if(StringUtils.isNotBlank(problemManagementEO.getApprovalEvidence())){ + List collect = fileInfoList.stream() + .filter(e -> e.getConnectId().equals(problemManagementEO.getApprovalEvidence())).collect(Collectors.toList()); + problemManagementEO.setApprovalEvidenceFileList(collect); + map.put("approvalEvidenceFileList",collect); + map.put("approvalEvidence",problemManagementEO.getApprovalEvidence()); + + } + mapList.add(map); + NcrTrackVO ncrTrackVOTemp = new NcrTrackVO(); + BeanUtils.copyProperties(problemManagementEO,ncrTrackVOTemp); + ncrTrackVOTemp.setUuid(ncrTrackVOTemp.getId()); + ncrTrackVOTemp.setFlag(DataEnum.NEW.getValue()); + ncrTrackVOList.add(ncrTrackVOTemp); + } + return mapList; + } + + private List> dataParameter(Map params, List> mapList) { + if(ObjectUtils.isNotEmpty(params.get("title"))){//标题 + mapList = mapList.stream().filter(e->ObjectUtils.isNotEmpty(e.get("title")) + && e.get("title").toString().contains(params.get("title").toString())).collect(Collectors.toList()); + } + if(ObjectUtils.isNotEmpty(params.get("lawsName"))){//相关法规 + mapList = mapList.stream().filter(e->ObjectUtils.isNotEmpty(e.get("lawsName")) + && e.get("lawsName").toString().contains(params.get("lawsName").toString())).collect(Collectors.toList()); + } + if(ObjectUtils.isNotEmpty(params.get("projectId"))){//相关项目 + mapList = mapList.stream().filter(e->ObjectUtils.isNotEmpty(e.get("projectId")) + && String.valueOf(e.get("projectId")).equals(String.valueOf(params.get("projectId")))).collect(Collectors.toList()); + } + if(ObjectUtils.isNotEmpty(params.get("problemType_dictText"))){//问题类型 + mapList = mapList.stream().filter(e->ObjectUtils.isNotEmpty(e.get("problemType_dictText")) + && e.get("problemType_dictText").toString().equals(params.get("problemType_dictText").toString())).collect(Collectors.toList()); + } + if(ObjectUtils.isNotEmpty(params.get("dutyTerritory"))){//责任领域 + mapList = mapList.stream().filter(e->ObjectUtils.isNotEmpty(e.get("dutyTerritory")) + && e.get("dutyTerritory").toString().contains(params.get("dutyTerritory").toString())).collect(Collectors.toList()); + } + if(ObjectUtils.isNotEmpty(params.get("problemState"))){//问题状态 + mapList = mapList.stream().filter(e->ObjectUtils.isNotEmpty(e.get("problemState")) + && e.get("problemState").toString().contains(params.get("problemState").toString())).collect(Collectors.toList()); + } + return mapList; + } + + @Override + public void exportNotComplianList(HttpServletResponse response, HttpServletRequest request, Map params) { +// params.put("projectLibraryId","1546314907190935554"); +// params.put("projectName","EDS1.2 EVO-G1.1-中国-00"); +// params.put("cut","en"); + +// Map map1 = new HashMap<>(); +// map1.put("id","e4a2fe2b042e4150943e82094250f54d"); +// Map map2 = new HashMap<>(); +// map2.put("id","e1d5b1aa19344abb8154deea15539daa"); +// List> ncrTrackVOList =new ArrayList<>(); +// ncrTrackVOList.add(map1); +// ncrTrackVOList.add(map2); +// +// params.put("ncrTrackVOList",ncrTrackVOList); + + + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdfTemp = new SimpleDateFormat("yyyy-MM-dd"); + String cut = (String) params.get("cut"); + String header = ""; + String sheetName = ""; + if (StringUtils.equals(cut,CutEnum.CN.getValue())) { + sheetName = "问题管理"; + header = "标题,问题类型,PS_ISSUE,创建人,创建时间,相关法规,责任部门,问题状态,描述和分析"; +// header = "标题,问题类型,PS_ISSUE,创建人,创建时间,相关法规,相关项目,责任部门,问题状态,描述和分析"; + } else if (StringUtils.equals(cut,CutEnum.EN.getValue())) { + header = "Title,Issue Type,PS-ISSUE,Creator,Create Date,Related Regualtions,Related Project,Resonsible Field,Status,Description"; + sheetName = "Problem management"; + } + + OutputStream os = null; + Workbook workbook = new XSSFWorkbook(); + Sheet sheet = workbook.createSheet(sheetName); + + List> dataList = this.queryNotComplianList(params); + + List> expertDataList = new ArrayList<>(); + if(ObjectUtils.allNotNull(dataList)){ + List> mapList = (List>) params.get("ncrTrackVOList"); + if(ObjectUtils.isNotEmpty(mapList)){ + for (Map map : mapList) { + List> collect = dataList.stream().filter(e -> ObjectUtils.isNotEmpty(e.get("id")) && e.get("id").equals(map.get("id"))).collect(Collectors.toList()); + expertDataList.addAll(collect); + } + dataList = expertDataList; + } + } + + CellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setAlignment(HorizontalAlignment.CENTER); + Row rowHeader = sheet.createRow(0);//开始创建标题行 + if (com.jero.modules.system.util.StringUtils.isNotBlank(header)) { + String[] headerArr = header.split(","); + for (int i = 0; i < headerArr.length; i++) { + sheet.setColumnWidth(i, 5000); // 设置列宽度为5000 + Cell cellHeader = rowHeader.createCell(i); + cellHeader.setCellStyle(cellStyle); + cellHeader.setCellValue(headerArr[i]); + } + } + + if(CollectionUtils.isNotEmpty(dataList)){ + for (int i = 0; i < dataList.size(); i++) { + Row row = sheet.createRow(i + 1); + row.createCell(0).setCellValue((String) dataList.get(i).get("title")); + row.createCell(1).setCellValue((String) dataList.get(i).get("problemType_dictText")); + row.createCell(2).setCellValue((String) dataList.get(i).get("psIssue")); + row.createCell(3).setCellValue((String) dataList.get(i).get("createBy")); + row.createCell(4).setCellValue((String) dataList.get(i).get("createTime")); + row.createCell(5).setCellValue((String) dataList.get(i).get("lawsName")); +// row.createCell(6).setCellValue((String) dataList.get(i).get("projectName")); + row.createCell(6).setCellValue((String) dataList.get(i).get("dutyTerritory")); + row.createCell(7).setCellValue((String) dataList.get(i).get("problemState")); + row.createCell(8).setCellValue((String) dataList.get(i).get("description")); + } + } + try { + String path = uploadpath + "/tempZip"; + File fileTemp = new File(path); + if (fileTemp.exists()) { + fileTemp.delete(); + } + fileTemp.mkdirs(); + String name = ""; + if(CutEnum.CN.getValue().equals(cut)){ + name = "问题管理"; + }else{ + name = "Problem management"; + } + OutputStream excelOS = new FileOutputStream(path + File.separator + name + sdfTemp.format(new Date())+".xlsx"); + workbook.write(excelOS); + excelOS.flush(); + + //处理文件 + List connectIdList = new ArrayList<>(); + List fileList = dataList.stream() + .filter(e -> ObjectUtils.isNotEmpty(e.get("file"))).map(e -> e.get("file")).collect(Collectors.toList()); + List approvalEvidenceList = dataList.stream() + .filter(e -> ObjectUtils.isNotEmpty(e.get("approvalEvidence"))).map(e -> e.get("approvalEvidence")).collect(Collectors.toList()); + if(!fileList.isEmpty()){ + connectIdList.addAll(fileList); + } + if(!approvalEvidenceList.isEmpty()){ + connectIdList.addAll(approvalEvidenceList); + } + if(!connectIdList.isEmpty()){ + List fileInfosList = iOSSFileService.getFileInfosByConnectId(StringUtils.join(connectIdList, ",")); + for (Map map : dataList) { + String title = (String) map.get("title"); + String createTime = ""; + if(ObjectUtils.isNotEmpty(map.get("createTime"))){ + createTime = String.valueOf(map.get("createTime")).split(" ")[0]; + } + String folder = title+createTime; + List connectIdListTemp = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(map.get("file"))){ + connectIdListTemp.add((String) map.get("file")); + } + if(ObjectUtils.isNotEmpty(map.get("approvalEvidence"))){ + connectIdListTemp.add((String) map.get("approvalEvidence")); + } + if(!connectIdListTemp.isEmpty()){ + List ossFileList = fileInfosList.stream().filter(e -> connectIdListTemp.contains(e.getConnectId())).collect(Collectors.toList()); + if (ossFileList.size() != 0) { + String fileNowPath = path + File.separator + folder; + File file = new File(fileNowPath); + if (file.exists()) { + file.delete(); + } + file.mkdirs(); + for (OSSFile ossFile : ossFileList) { + String url = ossFile.getUrl(); + //判断文件是否存在 + if(StringUtils.isNotBlank(url)){ + //判断文件是否存在 + boolean b = CosBootUtil.doesObjectExist(url); + if(b){ + InputStream download = CosBootUtil.download(url); + if(url.endsWith(".pdf") || url.endsWith(".PDF")){ + String currentTime = sdf.format(new Date()); + String waterContent = loginUser.getUsername() + " " + currentTime; + File newFile = PDFUtils.PDFWatermark(download,uploadpath,ossFile.getFileName(),waterContent); + download = new FileInputStream(newFile.getPath()); + } + documentLibraryEOService.copyFile(download, fileNowPath + File.separator + ossFile.getFileName()); + } + } + } + } + } + } + } + ZipUtil.zip(path, path + ".zip"); + //文件 + FileInputStream fis = new FileInputStream(path + ".zip"); + os = response.getOutputStream(); + + int len = 0; + while ((len = fis.read()) != -1) { + os.write(len); + } + os.flush(); + fis.close(); + } catch (IOException e) { + e.printStackTrace(); + if(CutEnum.CN.getValue().equals(cut)){ + throw new JeroBootException("导出失败"); + }else{ + throw new JeroBootException("Export failure"); + } + }finally { + IOUtils.closeQuietly(os); + File file = new File(uploadpath + "/tempZip"); + FileUtil.deleteContents(file); + File fileTemp = new File(uploadpath + "/tempZip.zip"); + FileUtil.deleteContents(fileTemp); + } + } + + /** + * 设计符合性相关待办任务强制转办 + * + * @param projectLibraryId + * @param designTransferUserId + * @param pliEoList + * @param piEoList + */ + private void designCompulsoryTransfer(String projectLibraryId, String designTransferUserId, List pliEoList, List piEoList) { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List designPiEoList = piEoList.stream().filter(piEo -> { + boolean flag = false; + if (StringUtils.equals(piEo.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + List taskDefinitionKeyList = new ArrayList<>(); + taskDefinitionKeyList.add(DesignComplianceFlowNodeKeyEnum.ZRRQR.getValue()); + taskDefinitionKeyList.add(DesignComplianceFlowNodeKeyEnum.DEZRRQR.getValue()); + taskDefinitionKeyList.add(DesignComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue()); + taskDefinitionKeyList.add(DesignComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue()); + + List actiProcInstIdList = designPiEoList.stream().map(ProcessInfoEO::getActiProcInstId).distinct().collect(Collectors.toList()); + QueryWrapper pidQueryWrap = new QueryWrapper<>(); + pidQueryWrap.lambda().in(ProcessInfoDetailEO::getActiProcInstId, actiProcInstIdList); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getStatus, TaskStatusEnum.NOT_DONE.getValue()); + pidQueryWrap.lambda().in(ProcessInfoDetailEO::getTaskDefinitionKey, taskDefinitionKeyList); + List pidEoList = this.processInfoDetailEOService.list(pidQueryWrap); + + if (CollectionUtils.isNotEmpty(pidEoList)) { + pidEoList.forEach(pidEo -> { + pidEo.setUserId(designTransferUserId); + }); + String taskIds = pidEoList.stream().map(ProcessInfoDetailEO::getTaskId).distinct().collect(Collectors.joining(",")); + Result changeAssigneeBatchResult = this.workFlowFeignClient.changeAssigneeBatch(taskIds, designTransferUserId); + if (changeAssigneeBatchResult.isSuccess()) { + this.processInfoDetailEOService.updateBatchById(pidEoList); + + for (ProcessInfoDetailEO pidEo : pidEoList) { + List piEoListTemp = piEoList.stream().filter(piEo -> { + boolean flag = false; + if (StringUtils.equals(piEo.getActiProcInstId(), pidEo.getActiProcInstId())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(piEoListTemp)) { + ProcessInfoEO piEoTemp = piEoListTemp.get(0); + String projectLawsInventoryId = piEoTemp.getProjectLawsInventoryId(); + + List pliEoListTemp = pliEoList.stream().filter(pliEo -> { + boolean flag = false; + if (StringUtils.equals(pliEo.getId(), projectLawsInventoryId)) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(pliEoListTemp)) { + ProjectLawsInventoryEO pliEoTemp = pliEoListTemp.get(0); + + Map params = new HashMap<>(); + + String endTime = ""; + String contentCn = ""; + String contentEn = ""; + String templateId = ""; + String taskDefinitionKey = pidEo.getTaskDefinitionKey(); + if (StringUtils.equals(taskDefinitionKey, DesignComplianceFlowNodeKeyEnum.ZRRQR.getValue()) + || StringUtils.equals(taskDefinitionKey, DesignComplianceFlowNodeKeyEnum.DEZRRQR.getValue())) { + + params.put("flowTypeCn","设计符合性流程"); + params.put("flowTypeEn","Design Compliance Process"); + contentCn = "您好,请及时查看确认以下任务要求,谢谢!"; + contentEn = "Hello! Please check and confirm the following task requirement in a timely manner. Thank you!"; + templateId = TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION4.getValue(); + endTime = DateUtils.formatDate(pliEoTemp.getDesignDutyDueDate()); + } else if (StringUtils.equals(taskDefinitionKey, DesignComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue()) + || StringUtils.equals(taskDefinitionKey, DesignComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue())) { + contentCn = "您好," + currentUser.getUsername() + "向您分发了该任务,请及时查看处理,谢谢!"; + contentEn = "Hello! " + currentUser.getUsername() + " has assigned the task to you. Please check and address it in a timely manner. Thank you!"; + templateId = TemplateInfoEnum2.DESIGN_COMPLIANCE_CONFIRMATION1.getValue(); + endTime = DateUtils.formatDate(pliEoTemp.getDesignDueDate()); + } + + params.put("userIdList", Arrays.asList(designTransferUserId.split(","))); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("serialNumbers", pliEoTemp.getSerialNumber()); + params.put("contentCn", contentCn); + params.put("contentEn", contentEn); + params.put("id", projectLawsInventoryId); + + JSONObject sendMsgJson = new JSONObject(); + sendMsgJson.put("actiProcInstId",pidEo.getActiProcInstId()); + sendMsgJson.put("taskDefinitionKey", taskDefinitionKey); + sendMsgJson.put("requestSource", RequestSourceEnum.WORK_FLOW.getValue()); + sendMsgJson.put("operatorType", OperatorTypeEnum.SEND_MSG.getValue()); + sendMsgJson.put("templateId", templateId); + sendMsgJson.put("flowType", "Design"); + sendMsgJson.put("params", params); + this.processCall(sendMsgJson); + } + } + } + } + } + } + + /** + * 验证符合性相关待办任务强制转办 + * + * @param projectLibraryId + * @param verifyTransferUserId + * @param pliEoList + * @param piEoList + */ + private void verifyCompulsoryTransfer(String projectLibraryId, String verifyTransferUserId, List pliEoList, List piEoList) { + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + List verifyPiEoList = piEoList.stream().filter(piEo -> { + boolean flag = false; + if (StringUtils.equals(piEo.getFlowType(), FlowTypeEnum.YZFHXSCLC.getValue())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + List taskDefinitionKeyList = new ArrayList<>(); + taskDefinitionKeyList.add(VerifyComplianceFlowNodeKeyEnum.ZRRQR.getValue()); + taskDefinitionKeyList.add(VerifyComplianceFlowNodeKeyEnum.DEZRRQR.getValue()); + taskDefinitionKeyList.add(VerifyComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue()); + taskDefinitionKeyList.add(VerifyComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue()); + + List actiProcInstIdList = verifyPiEoList.stream().map(ProcessInfoEO::getActiProcInstId).distinct().collect(Collectors.toList()); + QueryWrapper pidQueryWrap = new QueryWrapper<>(); + pidQueryWrap.lambda().in(ProcessInfoDetailEO::getActiProcInstId, actiProcInstIdList); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getStatus, TaskStatusEnum.NOT_DONE.getValue()); + pidQueryWrap.lambda().in(ProcessInfoDetailEO::getTaskDefinitionKey, taskDefinitionKeyList); + List pidEoList = this.processInfoDetailEOService.list(pidQueryWrap); + + if (CollectionUtils.isNotEmpty(pidEoList)) { + pidEoList.forEach(pidEo -> { + pidEo.setUserId(verifyTransferUserId); + }); + String taskIds = pidEoList.stream().map(ProcessInfoDetailEO::getTaskId).distinct().collect(Collectors.joining(",")); + Result changeAssigneeBatchResult = this.workFlowFeignClient.changeAssigneeBatch(taskIds, verifyTransferUserId); + if (changeAssigneeBatchResult.isSuccess()) { + this.processInfoDetailEOService.updateBatchById(pidEoList); + + for (ProcessInfoDetailEO pidEo : pidEoList) { + List piEoListTemp = piEoList.stream().filter(piEo -> { + boolean flag = false; + if (StringUtils.equals(piEo.getActiProcInstId(), pidEo.getActiProcInstId())) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(piEoListTemp)) { + ProcessInfoEO piEoTemp = piEoListTemp.get(0); + String projectLawsInventoryId = piEoTemp.getProjectLawsInventoryId(); + + List pliEoListTemp = pliEoList.stream().filter(pliEo -> { + boolean flag = false; + if (StringUtils.equals(pliEo.getId(), projectLawsInventoryId)) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(pliEoListTemp)) { + ProjectLawsInventoryEO pliEoTemp = pliEoListTemp.get(0); + + Map params = new HashMap<>(); + + String endTime = ""; + String contentCn = ""; + String contentEn = ""; + String templateId = ""; + String taskDefinitionKey = pidEo.getTaskDefinitionKey(); + if (StringUtils.equals(taskDefinitionKey, VerifyComplianceFlowNodeKeyEnum.ZRRQR.getValue()) + || StringUtils.equals(taskDefinitionKey, VerifyComplianceFlowNodeKeyEnum.DEZRRQR.getValue())) { + params.put("flowTypeCn","验证符合性流程"); + params.put("flowTypeEn","Validation Compliance Process"); + + contentCn = "您好,请及时查看确认以下任务要求,谢谢!"; + contentEn = "Hello! Please check and confirm the following task requirement in a timely manner. Thank you!"; + templateId = TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION4.getValue(); + endTime = DateUtils.formatDate(pliEoTemp.getVerifyDutyDueDate()); + } else if (StringUtils.equals(taskDefinitionKey, VerifyComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue()) + || StringUtils.equals(taskDefinitionKey, VerifyComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue())) { + contentCn = "您好," + currentUser.getUsername() + "向您分发了该任务,请及时查看处理,谢谢!"; + contentEn = "Hello! " + currentUser.getUsername() + " has assigned the task to you. Please check and address it in a timely manner. Thank you!"; + templateId = TemplateInfoEnum2.VALIDATION_COMPLIANCE_CONFIRMATION1.getValue(); + endTime = DateUtils.formatDate(pliEoTemp.getVerifyDueDate()); + } + + params.put("userIdList", Arrays.asList(verifyTransferUserId.split(","))); + params.put("projectLibraryId", projectLibraryId); + params.put("endTime", endTime); + params.put("serialNumbers", pliEoTemp.getSerialNumber()); + params.put("contentCn", contentCn); + params.put("contentEn", contentEn); + params.put("id", projectLawsInventoryId); + + JSONObject sendMsgJson = new JSONObject(); + sendMsgJson.put("actiProcInstId",pidEo.getActiProcInstId()); + sendMsgJson.put("taskDefinitionKey", taskDefinitionKey); + sendMsgJson.put("requestSource", RequestSourceEnum.WORK_FLOW.getValue()); + sendMsgJson.put("operatorType", OperatorTypeEnum.SEND_MSG.getValue()); + sendMsgJson.put("templateId", templateId); + sendMsgJson.put("flowType", "Verify"); + sendMsgJson.put("params", params); + this.processCall(sendMsgJson); + } + } + } + } + } + } + + + @Override + public Map groupByFGRwqrStatus(List pliEos) { + Map result = new HashMap<>(); + + Map projectScheduleExportMap = new HashMap<>(); + Map toBeReleasedMap = new HashMap<>(); + Map toBeVerifiedMap = new HashMap<>(); + Map toBeConfirmedMap = new HashMap<>(); + Map acceptMap = new HashMap<>(); + Map refuseMap = new HashMap<>(); + + double toBeReleasedCount = 0; + double toBeVerifiedCount = 0; + double toBeConfirmedCount = 0; + double acceptCount = 0; + double refuseCount = 0; + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + if(CollectionUtils.isNotEmpty(pliEos)){ + List designToBeReleased = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + List verifyToBeReleased = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + toBeReleasedMap.put("designToBeReleased",designToBeReleased); + toBeReleasedMap.put("verifyToBeReleased",verifyToBeReleased); + + List designToBeVerified = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + List verifyToBeVerified = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + toBeVerifiedMap.put("designToBeVerified",designToBeVerified); + toBeVerifiedMap.put("verifyToBeVerified",verifyToBeVerified); + + List designToBeConfirmed = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + List verifyToBeConfirmed = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + toBeConfirmedMap.put("designToBeConfirmed",designToBeConfirmed); + toBeConfirmedMap.put("verifyToBeConfirmed",verifyToBeConfirmed); + + List designAccept = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) +// || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + List verifyAccept = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) +// || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + acceptMap.put("designAccept",designAccept); + acceptMap.put("verifyAccept",verifyAccept); + + List designRefuse = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + List verifyRefuse = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + refuseMap.put("designRefuse",designRefuse); + refuseMap.put("verifyRefuse",verifyRefuse); + + toBeReleasedCount = designToBeReleased.size() + verifyToBeReleased.size(); + toBeVerifiedCount = designToBeVerified.size() + verifyToBeVerified.size(); + toBeConfirmedCount = designToBeConfirmed.size() + verifyToBeConfirmed.size(); + acceptCount = designAccept.size() + verifyAccept.size(); + refuseCount = designRefuse.size() + verifyRefuse.size(); + count = toBeReleasedCount + toBeVerifiedCount + toBeConfirmedCount + acceptCount + refuseCount; + if(count <= 0){ + percentage = 0; + }else{ + // 计算百分比 + percentage = acceptCount / count * 100; + } + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + result.put(ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue(),toBeReleasedMap); + result.put(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue(),toBeVerifiedMap); + result.put(ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue(),toBeConfirmedMap); + result.put(ComplianceFlowStatusEnum.CONFORMITY.getValue(),acceptMap); + result.put(ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue(),refuseMap); + + projectScheduleExportMap.put("toBeReleased",toBeReleasedCount); + projectScheduleExportMap.put("toBeVerified",toBeVerifiedCount); + projectScheduleExportMap.put("toBeConfirmed",toBeConfirmedCount); + projectScheduleExportMap.put("accept",acceptCount); + projectScheduleExportMap.put("refuse",refuseCount); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } + + @Override + public Map groupByDesignStatus(List pliEos) { + Map result = new HashMap<>(); + + Map projectScheduleExportMap = new HashMap<>(); + + double notStartCount = 0; // 未发起 + double toBeSubmittedCount = 0; // 待提交 + double toBeReviewedCount = 0; // 待审查 + double complianceCount = 0; // 符合 + double nonComplianceCount = 0; // 不符合 + double toBeTrackedCount = 0; // 待追踪 + double notInvolvedCount = 0; // 不涉及 + double taskTerminationCount = 0; // 任务终止 + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + if(CollectionUtils.isNotEmpty(pliEos)){ + List designNotStart = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designToBeSubmitted = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designToBeReviewed = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designCompliance = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designNonCompliance = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designToBeTracked = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List designNotInvolved = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List taskTermination = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TERMINATION_OF_TASK.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + notStartCount = designNotStart.size(); + toBeSubmittedCount = designToBeSubmitted.size(); + toBeReviewedCount = designToBeReviewed.size(); + complianceCount = designCompliance.size(); + nonComplianceCount = designNonCompliance.size(); + toBeTrackedCount = designToBeTracked.size(); + notInvolvedCount = designNotInvolved.size(); + taskTerminationCount = taskTermination.size(); + count = notStartCount + toBeSubmittedCount + toBeReviewedCount + complianceCount + nonComplianceCount + toBeTrackedCount + taskTerminationCount; + // 计算百分比 + if(count <= 0){ + percentage = 0; + }else{ + percentage = complianceCount / count * 100; + } + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + + projectScheduleExportMap.put("notStart",notStartCount); + projectScheduleExportMap.put("toBeSubmitted",toBeSubmittedCount); + projectScheduleExportMap.put("toBeReviewed",toBeReviewedCount); + projectScheduleExportMap.put("compliance",complianceCount); + projectScheduleExportMap.put("nonCompliance",nonComplianceCount); + projectScheduleExportMap.put("toBeTracked",toBeTrackedCount); + projectScheduleExportMap.put("notInvolved",notInvolvedCount); + projectScheduleExportMap.put("taskTermination",taskTerminationCount); + projectScheduleExportMap.put("count",count); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } + + @Override + public Map groupByVerifyStatus(List pliEos) { + Map result = new HashMap<>(); + + Map projectScheduleExportMap = new HashMap<>(); + + double notStartCount = 0; // 未发起 + double toBeSubmittedCount = 0; // 待提交 + double toBeReviewedCount = 0; // 待审查 + double complianceCount = 0; // 符合 + double nonComplianceCount = 0; // 不符合 + double toBeTrackedCount = 0; // 待追踪 + double notInvolvedCount = 0; // 不涉及 + double taskTerminationCount = 0; // 任务终止 + double count = 0; + // 计算百分比 + double percentage = 0; + String percentageStr = "0"; + if(CollectionUtils.isNotEmpty(pliEos)){ + List verifyNotStart = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyToBeSubmitted = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyToBeReviewed = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyCompliance = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyNonCompliance = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyToBeTracked = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List verifyNotInvolved = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + List taskTermination = pliEos.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TERMINATION_OF_TASK.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + notStartCount = verifyNotStart.size(); + toBeSubmittedCount = verifyToBeSubmitted.size(); + toBeReviewedCount = verifyToBeReviewed.size(); + complianceCount = verifyCompliance.size(); + nonComplianceCount = verifyNonCompliance.size(); + toBeTrackedCount = verifyToBeTracked.size(); + notInvolvedCount = verifyNotInvolved.size(); + taskTerminationCount = taskTermination.size(); + + count = notStartCount + toBeSubmittedCount + toBeReviewedCount + complianceCount + nonComplianceCount + toBeTrackedCount + taskTerminationCount; + if(count <= 0){ + percentage = 0; + }else{ + // 计算百分比 + percentage = complianceCount / count * 100; + } + percentageStr = percentage != 0 ? df.format(percentage) : "0"; + } + + projectScheduleExportMap.put("notStart",notStartCount); + projectScheduleExportMap.put("toBeSubmitted",toBeSubmittedCount); + projectScheduleExportMap.put("toBeReviewed",toBeReviewedCount); + projectScheduleExportMap.put("compliance",complianceCount); + projectScheduleExportMap.put("nonCompliance",nonComplianceCount); + projectScheduleExportMap.put("toBeTracked",toBeTrackedCount); + projectScheduleExportMap.put("notInvolved",notInvolvedCount); + projectScheduleExportMap.put("taskTermination",taskTerminationCount); + projectScheduleExportMap.put("count",count); + projectScheduleExportMap.put("percentage",percentageStr + percentSign); + result.put("projectScheduleExportMap",projectScheduleExportMap); + return result; + } + + @Override + public IPage queryPage(ProjectLawsInventoryEO projectLawsInventoryEO, Integer pageNo, Integer pageSize, HttpServletRequest req) { + String dutyTerritoryStr = ""; + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getDutyTerritory())) { + dutyTerritoryStr = projectLawsInventoryEO.getDutyTerritory(); + projectLawsInventoryEO.setDutyTerritory(null); + } + String designFlowStatusStr = ""; + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignFlowStatus())) { + designFlowStatusStr = projectLawsInventoryEO.getDesignFlowStatus(); + projectLawsInventoryEO.setDesignFlowStatus(null); + } + String verifyFlowStatusStr = ""; + if (StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyFlowStatus())) { + verifyFlowStatusStr = projectLawsInventoryEO.getVerifyFlowStatus(); + projectLawsInventoryEO.setVerifyFlowStatus(null); + } + + // 根据一级责任领域(统计节点),查询该一级责任领域下所有子责任领域的法规清单数据。 + if(StringUtils.isNotEmpty(projectLawsInventoryEO.getFirstLevelDutyTerritory())){ + List sysDictItems = this.sysDictItemServiceImpl.selectItemsAll(); + List dutyTerritorys = new ArrayList<>(); + Map> firstLevelDTMap = this.sysDictItemServiceImpl.getFirstLevelSysDictItemByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue(), sysDictItems); + String[] firstLevelDTArr = projectLawsInventoryEO.getFirstLevelDutyTerritory().split(","); + for (String firstLevelDT : firstLevelDTArr){ + if(CollectionUtils.isNotEmpty(firstLevelDTMap.get(firstLevelDT))){ + dutyTerritorys.addAll(firstLevelDTMap.get(firstLevelDT)); + } + } + if(CollectionUtils.isNotEmpty(dutyTerritorys)){ + dutyTerritoryStr = dutyTerritorys.stream().map(SysDictItem::getItemValue).distinct().collect(Collectors.joining(",")); + } + } + String serialNumber = projectLawsInventoryEO.getSerialNumber(); + if(StringUtils.isNotBlank(serialNumber) && serialNumber.contains("*")){ + serialNumber = serialNumber.replaceAll("\\*",""); + } + projectLawsInventoryEO.setSerialNumber(null); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(projectLawsInventoryEO, req.getParameterMap()); + if(StringUtils.isNotBlank(serialNumber)){ + queryWrapper.lambda().like(ProjectLawsInventoryEO::getSerialNumber,serialNumber); + } + queryWrapper.orderByDesc("create_time","serial_number"); + + if (StringUtils.isNotEmpty(dutyTerritoryStr)) { + String finalDutyTerritoryStr = dutyTerritoryStr.replaceAll("\\*",""); + queryWrapper.and(query -> { + query.lambda().like(ProjectLawsInventoryEO::getDutyTerritory, finalDutyTerritoryStr); + if(StringUtils.contains(finalDutyTerritoryStr,",")){ + String[] dutyTerritoryArr = finalDutyTerritoryStr.split(","); + for (String duty : dutyTerritoryArr) { + query.or(q -> { + q.like("duty_territory",duty); + }); + } + } + }); + } + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + int isProjectRole = Integer.parseInt(projectLawsInventoryEO.getRoleCode()); + if (isProjectRole == Integer.parseInt(ProjectRoleEnum.VIEWER.getValue())) { + //查当前用户Viewer对应责任领域 + List dutyTerritoryList = this.projectUserDutyTerritoryService.queryDutyTerritoryByUserId(currentUser.getId()); + if (ObjectUtils.isNotEmpty(dutyTerritoryList)) { + queryWrapper.and(query -> { + for (String duty : dutyTerritoryList) { + query.or(q -> { + q.like("duty_territory", duty); + }); + } + }); + } + } + if (StringUtils.isNotEmpty(designFlowStatusStr)) { + String finalDesignFlowStatusStr = designFlowStatusStr.replaceAll("\\*",""); + queryWrapper.and(query -> { + query.lambda().like(ProjectLawsInventoryEO::getDesignFlowStatus, finalDesignFlowStatusStr); + if(StringUtils.contains(finalDesignFlowStatusStr,",")){ + String[] designFlowStatusArr = finalDesignFlowStatusStr.split(","); + for (String dsf : designFlowStatusArr) { + query.or(q -> { + q.like("design_flow_status",dsf); + }); + } + } + }); + } + if (StringUtils.isNotEmpty(verifyFlowStatusStr)) { + String finalVerifyFlowStatusStr = verifyFlowStatusStr.replaceAll("\\*",""); + queryWrapper.and(query -> { + query.lambda().like(ProjectLawsInventoryEO::getVerifyFlowStatus, finalVerifyFlowStatusStr); + if(StringUtils.contains(finalVerifyFlowStatusStr,",")){ + String[] verifyFlowStatusArr = finalVerifyFlowStatusStr.split(","); + for (String vsf : verifyFlowStatusArr) { + query.or(q -> { + q.like("verify_flow_status",vsf); + }); + } + } + }); + } + + if(isProjectRole != Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue()) + && isProjectRole != Integer.parseInt(ProjectRoleEnum.MANAGER.getValue()) + && isProjectRole != Integer.parseInt(ProjectRoleEnum.ADMIN.getValue()) + && isProjectRole != Integer.parseInt(ProjectRoleEnum.VIEWER.getValue()) + && isProjectRole != Integer.parseInt(ProjectRoleEnum.REGULATI_ENGINEER.getValue())){ + // 创建查询权限 + this.createQueryPermission(isProjectRole,currentUser,queryWrapper); + } + + Page page = new Page(pageNo, pageSize); + IPage pageList = this.page(page, queryWrapper); + List result = pageList.getRecords(); + + this.dataDispose(result,currentUser,isProjectRole,projectLawsInventoryEO.getCut()); + this.dataDictDispose(result,projectLawsInventoryEO.getCut()); + //表头排序 + result = this.hearSort(projectLawsInventoryEO, result); + return pageList; + } + + @Override + public Result finalizationVerify(Map params) { + boolean result = false; // 返回true,可以定版,返回false 不能定版 + String projectLibraryId = (String) params.get("projectLibraryId"); + if(StringUtils.isEmpty(projectLibraryId)){ + throw new JeroBootException("项目库id不能为空,请检查!"); + } + QueryWrapper pliQueryWrap = new QueryWrapper<>(); + pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); + List pliEoList = this.list(pliQueryWrap); + if(CollectionUtils.isNotEmpty(pliEoList)){ + for (ProjectLawsInventoryEO pliEo : pliEoList) { + String designFlowStatus = pliEo.getDesignFlowStatus(); + String verifyFlowStatus = pliEo.getVerifyFlowStatus(); + boolean designFlowStatusFlag = ( + StringUtils.equals(designFlowStatus,ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(designFlowStatus,ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(designFlowStatus,ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(designFlowStatus,ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(designFlowStatus,ComplianceFlowStatusEnum.TO_TRACK.getValue()) + || StringUtils.equals(designFlowStatus,ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + boolean verifyFlowStatusFlag = ( + StringUtils.equals(verifyFlowStatus,ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(verifyFlowStatus,ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(verifyFlowStatus,ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(verifyFlowStatus,ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(verifyFlowStatus,ComplianceFlowStatusEnum.TO_TRACK.getValue()) + || StringUtils.equals(verifyFlowStatus,ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + if(designFlowStatusFlag && verifyFlowStatusFlag){ + result = true; + }else { + result = false; + break; + } + } + } + return Result.OK(result); + } + + @Override + public Map>> queryDutyPersonByProjectId(Map params) { + Map>> result = new HashMap<>(); + String projectLibraryId = (String) params.get("projectLibraryId"); + if(StringUtils.isNotEmpty(projectLibraryId)){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); + List pliList = this.list(queryWrapper); + List designDutyList = new ArrayList<>(); + List verifyDutyList = new ArrayList<>(); + for (ProjectLawsInventoryEO pli: pliList) { + if(StringUtils.isNotEmpty(pli.getDesignDutyId())){ + designDutyList.add(pli.getDesignDutyId()); + } + if(StringUtils.isNotEmpty(pli.getVerifyDutyId())){ + verifyDutyList.add(pli.getVerifyDutyId()); + } + } + if(CollectionUtils.isNotEmpty(designDutyList)){ + List> resList = new ArrayList<>(); + List userList = this.sysUserService.querySysUserListByIdList(designDutyList); + if(CollectionUtils.isNotEmpty(userList)){ + for (SysUser user : userList) { + Map userMap = new HashMap<>(); + userMap.put("id",user.getId()); + userMap.put("userName",user.getUsername()); + resList.add(userMap); + } + } + result.put("designDutyList",resList); + } + + if(CollectionUtils.isNotEmpty(verifyDutyList)){ + List> resList = new ArrayList<>(); + List userList = this.sysUserService.querySysUserListByIdList(verifyDutyList); + if(CollectionUtils.isNotEmpty(userList)){ + for (SysUser user : userList) { + Map userMap = new HashMap<>(); + userMap.put("id",user.getId()); + userMap.put("userName",user.getUsername()); + resList.add(userMap); + } + } + result.put("verifyDutyList",resList); + } + } + return result; + } + + @Override + public List getUserDutyTerritoryList(Map params) { + List result = new ArrayList<>(); + String userId = (String) params.get("userId"); + String projectLibraryId = (String) params.get("projectLibraryId"); + List dutyTerritorySdiList = (List) params.get("dutyTerritorySdiList"); + + QueryWrapper pliQueryWrap = new QueryWrapper<>(); + pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); + pliQueryWrap.and(pliQuery -> { + pliQuery.lambda().eq(ProjectLawsInventoryEO::getRegulationOwnerId,userId) + .or().eq(ProjectLawsInventoryEO::getDesignDutyId,userId) + .or().eq(ProjectLawsInventoryEO::getVerifyDutyId,userId); + }); + List pliEoList = this.list(pliQueryWrap); + if(CollectionUtils.isNotEmpty(pliEoList)){ + List dutyTerritoryIdList = Arrays.asList( + pliEoList.stream().map(ProjectLawsInventoryEO::getDutyTerritory).collect(Collectors.joining(",")).split(",") + ).stream().distinct().collect(Collectors.toList()); + + result = dutyTerritorySdiList.stream().filter(dutyTerritory -> { + boolean flag = false; + for (String dutyTerritoryId : dutyTerritoryIdList) { + if (StringUtils.equals(dutyTerritoryId, dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + + return result; + } + @Override + public void replacementUser(JSONObject json) { + String userId = json.getString("userId"); + String projectLibraryId = json.getString("projectLibraryId"); + List> replacementUserList = (List>) json.get("replacementUserList"); + + QueryWrapper pliQueryWrap = new QueryWrapper<>(); + pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + List pliEoList = this.list(pliQueryWrap); + + // 根据法规清单id,获取该法规清单在待办中心的任务明细。 + List oldPliEoIdList = pliEoList.stream().map(ProjectLawsInventoryEO::getId).distinct().collect(Collectors.toList()); + QueryWrapper pidEoQueryWrap = new QueryWrapper<>(); + pidEoQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, oldPliEoIdList); + List pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap); + + List updateEoList = new ArrayList<>(); + for (Map replacementUserMap : replacementUserList) { + String dutyTerritory = (String) replacementUserMap.get("dutyTerritory"); + String newUserId = (String) replacementUserMap.get("newUserId"); + if (StringUtils.isNotEmpty(newUserId)) { + for (ProjectLawsInventoryEO pliEo : pliEoList) { + if (StringUtils.contains(pliEo.getDutyTerritory(), dutyTerritory)) { +// QueryWrapper oldPliQueryWrap = new QueryWrapper<>(); +// oldPliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getId,pliEo.getId()); +// List oldPliEoList = this.list(oldPliQueryWrap); + // 过滤出来修改之前的法规清单数据 + List oldPliEoList = pliEoList.stream().filter(p -> StringUtils.equals(p.getId(),pliEo.getId())).distinct().collect(Collectors.toList()); + ProjectLawsInventoryEO newPliEo = new ProjectLawsInventoryEO(); + + if (StringUtils.equals(pliEo.getRegulationOwnerId(), userId)) { + newPliEo.setRegulationOwnerId(newUserId); + // 处理编辑法规工程师的逻辑 + this.editService.updateRegulationOwner(newPliEo, oldPliEoList,pidEoList); + pliEo.setRegulationOwnerId(newUserId); + } + if (StringUtils.equals(pliEo.getEngineeringInterfacePerson(), userId)) { + pliEo.setEngineeringInterfacePerson(newUserId); + } + + if(StringUtils.equals(pliEo.getDesignDutyId(), userId) || StringUtils.equals(pliEo.getVerifyDutyId(), userId)){ + if (StringUtils.equals(pliEo.getDesignDutyId(), userId)) { + newPliEo.setDesignDutyId(newUserId); + } + if (StringUtils.equals(pliEo.getVerifyDutyId(), userId)) { + newPliEo.setVerifyDutyId(newUserId); + } + // 处理编辑责任人的逻辑 + this.editService.updateDutyPerson(newPliEo, oldPliEoList,pidEoList); + if (StringUtils.equals(pliEo.getDesignDutyId(), userId)) { + pliEo.setDesignDutyId(newUserId); + } + if (StringUtils.equals(pliEo.getVerifyDutyId(), userId)) { + pliEo.setVerifyDutyId(newUserId); + } + } + updateEoList.add(pliEo); + } + } + } + } + + if (CollectionUtils.isNotEmpty(updateEoList)) { + this.updateBatchById(updateEoList); + } + } + + + /** + * 验证用户在该项目中的角色 + * + * @param projectLibraryId 项目库id + * @param currentUserId 登录人id + * @param lawsInventoryId 法规清单id + * @return + */ + @Override + public int checkUserRole(String projectLibraryId, String currentUserId, String lawsInventoryId) { + int result = -1; + try { + QueryWrapper projectLibraryBaseQueryWrapper = new QueryWrapper<>(); + projectLibraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getId, projectLibraryId); + projectLibraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getStudioEngineer, currentUserId); + Integer projectLibrayBaseCount = platformProjectLibraryBaseMapper.selectCount(projectLibraryBaseQueryWrapper); + if (projectLibrayBaseCount > 0) { + result = Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue()); + } else { + if (StringUtils.isNotEmpty(lawsInventoryId)) { + //查询用户是否是法规工程师 + QueryWrapper queryWrapperFG = new QueryWrapper<>(); + queryWrapperFG.lambda().eq(ProjectLawsInventoryEO::getRegulationOwnerId, currentUserId); + queryWrapperFG.lambda().eq(ProjectLawsInventoryEO::getId, lawsInventoryId); + Integer lawsInventoryCountFG = super.baseMapper.selectCount(queryWrapperFG); + + QueryWrapper queryWrapperRZ = new QueryWrapper<>(); + queryWrapperRZ.lambda().eq(ProjectLawsInventoryEO::getHomologationEngineerId, currentUserId); + queryWrapperRZ.lambda().eq(ProjectLawsInventoryEO::getId, lawsInventoryId); + Integer lawsInventoryCountRZ = super.baseMapper.selectCount(queryWrapperRZ); + + //如果两个工程师都是这个用户 + if (lawsInventoryCountFG > 0 && lawsInventoryCountRZ > 0) { + result = Integer.parseInt(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue()); + } else if (lawsInventoryCountFG > 0) { + result = Integer.parseInt(ProjectRoleEnum.REGULATI_ENGINEER.getValue()); + } else if (lawsInventoryCountRZ > 0) { + result = Integer.parseInt(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue()); + } + } + } + } catch (Exception ex) { + log.error("验证用户在该项目中的角色失败:" + ex.getMessage()); + throw new JeroBootException("验证用户在该项目中的角色失败!"); + } + return result; + } + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectLibraryBaseServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectLibraryBaseServiceImpl.java new file mode 100644 index 000000000..2f0adfbce --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectLibraryBaseServiceImpl.java @@ -0,0 +1,3556 @@ +package com.jero.modules.platform.service.impl; + +import com.alibaba.fastjson.JSONArray; +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.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.api.vo.Result; +import com.jero.common.constant.enums.CutEnum; +import com.jero.common.constant.enums.YesOrNoEnum; +import com.jero.common.exception.JeroBootException; +import com.jero.common.system.vo.DictModel; +import com.jero.common.system.vo.LoginUser; +import com.jero.modules.cert.collect.entity.ParamsCollectManifestEO; +import com.jero.modules.cert.collect.entity.ParamsManifestEO; +import com.jero.modules.cert.collect.enums.CollectManifestStateEnum; +import com.jero.modules.cert.collect.enums.CollectManifestStatisticsStateEnum; +import com.jero.modules.cert.collect.service.IParamsCollectManifestEOService; +import com.jero.modules.cert.collect.service.IParamsManifestEOService; +import com.jero.modules.cert.template.enums.ControlTypeEnum; +import com.jero.modules.dummy.enums.OrderEnum; +import com.jero.modules.enums.DictCodeEnum; +import com.jero.modules.feishu.enums.TemplateInfoEnum2; +import com.jero.modules.oss.entity.OSSFile; +import com.jero.modules.oss.service.IOSSFileService; +import com.jero.modules.ota.service.impl.OtaManageApplyEOServiceImpl; +import com.jero.modules.platform.mapper.PlatformProjectLawsInventoryEOMapper; +import com.jero.modules.platform.mapper.PlatformProjectLibraryBaseMapper; +import com.jero.modules.platform.service.IPlatformProjectCertificationInventoryEOService; +import com.jero.modules.platform.service.IPlatformProjectLibraryBaseService; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import com.jero.modules.project.entity.ProjectLawsInventoryLogEO; +import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.project.entity.ProjectLibraryRoleRelEO; +import com.jero.modules.project.entity.ProjectRelatedPersonnel; +import com.jero.modules.project.entity.ProjectTaskInventoryEO; +import com.jero.modules.project.entity.ProjectTaskPlanning; +import com.jero.modules.project.entity.ProjectUserPermission; +import com.jero.modules.project.enums.CertificationFlowNodeEnum; +import com.jero.modules.project.enums.CertificationInventoryFlowStatusEnum; +import com.jero.modules.project.enums.CertificationProgressEnum; +import com.jero.modules.project.enums.ComplianceFlowStatusEnum; +import com.jero.modules.project.enums.DesignComplianceStatusEnum; +import com.jero.modules.project.enums.HSStatisticalNodesEnum; +import com.jero.modules.project.enums.OperatorTypeEnum; +import com.jero.modules.project.enums.PermissionDescriptionEnum; +import com.jero.modules.project.enums.ProjectInventoryFieldEnum; +import com.jero.modules.project.enums.ProjectRoleEnum; +import com.jero.modules.project.enums.ProjectTaskPlanningNameEnum; +import com.jero.modules.project.enums.ProjectUserLocationEnum; +import com.jero.modules.project.enums.RoleRelModelTypeEnum; +import com.jero.modules.project.enums.TaskAffirmStatusEnum; +import com.jero.modules.project.enums.TaskStatusEnum; +import com.jero.modules.project.enums.TopEnum; +import com.jero.modules.project.mapper.ProjectRelatedPersonnelMapper; +import com.jero.modules.project.mapper.ProjectTaskInventoryEOMapper; +import com.jero.modules.project.mapper.ProjectUserPermissionMapper; +import com.jero.modules.project.service.IProjectLibraryRoleRelEOService; +import com.jero.modules.project.service.IProjectLibraryStatisticsService; +import com.jero.modules.project.service.IProjectUserPermissionService; +import com.jero.modules.project.service.impl.ProjectLawsInventoryLogEOServiceImpl; +import com.jero.modules.project.service.impl.ProjectRelatedPersonnelServiceImpl; +import com.jero.modules.project.service.impl.ProjectTaskPlanningServiceImpl; +import com.jero.modules.project.vo.TimeNodeVO; +import com.jero.modules.system.entity.SysDictItem; +import com.jero.modules.system.entity.SysUser; +import com.jero.modules.system.enums.DicCodeEnum; +import com.jero.modules.system.mapper.SysDictItemMapper; +import com.jero.modules.system.mapper.SysRoleMapper; +import com.jero.modules.system.mapper.SysUserMapper; +import com.jero.modules.system.service.IProjectUserBrandService; +import com.jero.modules.system.service.ISysDictService; +import com.jero.modules.system.service.ISysUserService; +import com.jero.modules.system.service.impl.SysDictItemServiceImpl; +import com.jero.modules.system.util.StringUtils; +import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; +import com.jero.modules.todoCenter.enums.TodoCenterStatusEnum; +import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService; +import com.jero.modules.top.entity.TopProjectEO; +import com.jero.modules.top.service.ITopProjectEOService; +import com.jero.modules.wkflow.enums.FlowTypeEnum; +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.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.shiro.SecurityUtils; +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 javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.OutputStream; +import java.text.Collator; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @Description: 项目库基础表 + * @Author: jero-boot + * @Date: 2022-04-11 + * @Version: V1.0 + */ +@Service +public class PlatformProjectLibraryBaseServiceImpl extends ServiceImpl implements IPlatformProjectLibraryBaseService { + @Autowired + private PlatformProjectLibraryBaseMapper platformProjectLibraryBaseMapper; + + @Autowired + private SysUserMapper sysUserMapper; + + @Autowired + private ProjectRelatedPersonnelServiceImpl projectRelatedPersonnelService; + @Autowired + private ProjectTaskPlanningServiceImpl projectTaskPlanningService; + + @Autowired + private PlatformProjectLawsInventoryEOMapper platformProjectLawsInventoryEOMapper; + + @Autowired + private ProjectTaskInventoryEOMapper projectTaskInventoryEOMapper; + + @Autowired + private SysDictItemServiceImpl sysDictItemServiceImpl; + + @Autowired + private IProjectLibraryRoleRelEOService projectLibraryRoleRelEOService; + + @Autowired + private PlatformProjectLawsInventoryEOServiceImpl platformProjectLawsInventoryEOService; + + @Autowired + private ProjectLawsInventoryLogEOServiceImpl projectLawsInventoryLogEOService; + + @Autowired + private ProjectRelatedPersonnelMapper projectRelatedPersonnelMapper; + + @Autowired + private IParamsManifestEOService paramsManifestEOService; + + @Autowired + private ISysDictService sysDictService; + + @Autowired + private ISysUserService sysUserService; + + @Autowired + private SysRoleMapper sysRoleMapper; + + @Autowired + private IProjectUserPermissionService projectUserPermissionService; + + @Autowired + private ProjectUserPermissionMapper projectUserPermissionMapper; + + @Autowired + private IProjectUserBrandService projectUserBrandService; + + @Autowired + private ITopProjectEOService iTopProjectEOService; + + @Autowired + private IPlatformProjectCertificationInventoryEOService platformProjectCertificationInventoryEOService; + + @Autowired + private IProcessInfoDetailEOService processInfoDetailEOService; + + @Autowired + private IParamsCollectManifestEOService paramsCollectManifestEOService; + + @Autowired + private IProjectLibraryStatisticsService projectLibraryStatisticsService; + @Autowired + private OtaManageApplyEOServiceImpl otaManageApplyEOService; + @Autowired + private SysDictItemMapper sysDictItemMapper; + @Autowired + private IOSSFileService iOSSFileService; + + private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + private static DecimalFormat df = new DecimalFormat("#.00"); + private static String percentSign = "%"; + + /** + * 保存 + * + * @param projectLibraryBase + * @return + */ + @Override + @Transactional + public void add(ProjectLibraryBase projectLibraryBase) throws ParseException { + projectLibraryBase.setPlatform(YesOrNoEnum.YES.getNameEn()); + Date now = new Date(); + + projectLibraryBase.setCreateTime(now); + projectLibraryBase.setUpdateTime(now); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + projectLibraryBase.setCreateBy(sysUser.getUsername()); + projectLibraryBase.setUpdateBy(sysUser.getUsername()); + +// checkExitData(projectLibraryBase); + + if(StringUtils.isNotBlank(projectLibraryBase.getBrandLabel())){ + String valueTemp = UUID.randomUUID().toString().replace("-", ""); + List oSSFileList = new ArrayList<>(); + for (String fileId : projectLibraryBase.getBrandLabel().split(",")) { + OSSFile ossFile = new OSSFile(); + ossFile.setId(fileId); + ossFile.setConnectId(valueTemp); + oSSFileList.add(ossFile); + } + iOSSFileService.updateFileInfo(oSSFileList); + +// projectLibraryBase.setBrandLabel(valueTemp); + } + save(projectLibraryBase); + + //创建任务计划时间轴 + projectTaskPlanningService.setProjectTaskPlanning(projectLibraryBase.getId()); + + List projectLibraryRoleRelEOList = new ArrayList<>(); + //初始化当前项目的studio与项目库 法规清单 角色关系 + ProjectLibraryRoleRelEO lawsInventoryRoleRelEO = new ProjectLibraryRoleRelEO(); + lawsInventoryRoleRelEO.setProjectLibraryId(projectLibraryBase.getId()); + lawsInventoryRoleRelEO.setUserId(projectLibraryBase.getStudioEngineer()); + lawsInventoryRoleRelEO.setRoleCode(ProjectRoleEnum.STUDIO_ENGINEER.getValue()); + lawsInventoryRoleRelEO.setModelType(RoleRelModelTypeEnum.LAWS_INVENTORY.getValue()); + projectLibraryRoleRelEOList.add(lawsInventoryRoleRelEO); + + // 初始化当前项目的studio与项目库 认证清单 角色关系 + ProjectLibraryRoleRelEO certificationInventoryRoleRelEO = new ProjectLibraryRoleRelEO(); + certificationInventoryRoleRelEO.setProjectLibraryId(projectLibraryBase.getId()); + certificationInventoryRoleRelEO.setUserId(projectLibraryBase.getStudioEngineer()); + certificationInventoryRoleRelEO.setRoleCode(ProjectRoleEnum.STUDIO_ENGINEER.getValue()); + certificationInventoryRoleRelEO.setModelType(RoleRelModelTypeEnum.CERTIFICATION_INVENTORY.getValue()); + projectLibraryRoleRelEOList.add(certificationInventoryRoleRelEO); + this.projectLibraryRoleRelEOService.saveBatch(projectLibraryRoleRelEOList); + + //项目权限表添加 + List adds = new ArrayList<>(); + if (ObjectUtils.isNotEmpty(projectLibraryBase.getStudioEngineer())) { + ProjectUserPermission projectUserPermission = new ProjectUserPermission(); + projectUserPermission.setProjectId(projectLibraryBase.getId()); + projectUserPermission.setUserId(projectLibraryBase.getStudioEngineer()); + projectUserPermission.setBelong(ProjectUserLocationEnum.PROJECT_ADD_STUDIO.getValue()); + projectUserPermission.setCreateTime(now); + projectUserPermission.setUpdateTime(now); + adds.add(projectUserPermission); + } + if (ObjectUtils.isNotEmpty(projectLibraryBase.getCertificationEngineer())) { + for (String id : projectLibraryBase.getCertificationEngineer().split(",")) { + ProjectUserPermission projectUserPermission = new ProjectUserPermission(); + projectUserPermission.setProjectId(projectLibraryBase.getId()); + projectUserPermission.setUserId(id); + projectUserPermission.setBelong(ProjectUserLocationEnum.PROJECT_ADD_CERTIFICATION.getValue()); + projectUserPermission.setCreateTime(now); + projectUserPermission.setUpdateTime(now); + adds.add(projectUserPermission); + } + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + + } + + + + /** + * 项目扩展(添加子项目--子项目基本信息、相关人员名单、法规/认证任务计划与被扩展项目保持一致) + * @param projectLibraryBase + * @throws ParseException + */ + @Override + @Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class) + public void addChild(ProjectLibraryBase projectLibraryBase) throws ParseException { + String id = projectLibraryBase.getId();//主项目id + String projectId = UUID.randomUUID().toString().replace("-", ""); + //主表中添加数据 + ProjectLibraryBase projectLibraryBaseTemp = this.getById(id); + projectLibraryBaseTemp.setCreateBy(null); + projectLibraryBaseTemp.setCreateTime(null); + projectLibraryBaseTemp.setUpdateBy(null); + projectLibraryBaseTemp.setUpdateTime(null); + projectLibraryBaseTemp.setId(projectId); + projectLibraryBaseTemp.setParentId(id); + projectLibraryBaseTemp.setProjectVersion(projectLibraryBase.getProjectVersion()); + projectLibraryBaseTemp.setExplanation(projectLibraryBase.getExplanation()); + this.save(projectLibraryBaseTemp); + + //处理版本号排序问题,如果版本号插入到中间,后面版本数字顺眼 + checkVersionOrder(id,projectLibraryBase.getProjectVersion(),projectId); + + Date now = new Date(); + //相关人员名单中添加数据 + List projectRelatedPersonnelList = projectRelatedPersonnelMapper.queryPageList(id, + DictCodeEnum.DUTY_TERRITORY.getValue(), + null, + null, + null, + null,null); + if(projectRelatedPersonnelList.size() != 0){ + List relatedPersonnelPermissionList = new ArrayList<>(); + for (ProjectRelatedPersonnel projectRelatedPersonnel : projectRelatedPersonnelList) { + String relatedPersonnelId = UUID.randomUUID().toString().replace("-", ""); + projectRelatedPersonnel.setId(relatedPersonnelId); + projectRelatedPersonnel.setProjectId(projectId); + + //添加人员权限 + if (ObjectUtils.isNotEmpty(projectRelatedPersonnel.getLawEngineer())) { + for (String lawEngineerId : projectRelatedPersonnel.getLawEngineer().split(",")) { + //projectUserPermissionService.queryRelatedPersonnelPermission(projectLibraryBase.getId(),lawEngineerId,ProjectUserLocationEnum.PROJECT_DETAIL_RELEVANT_PERSONNEL_LAW.getValue()); + ProjectUserPermission permission = new ProjectUserPermission(); + permission.setProjectId(projectId); + permission.setUserId(lawEngineerId); + permission.setBelong(ProjectUserLocationEnum.PROJECT_DETAIL_RELEVANT_PERSONNEL_LAW.getValue()); + permission.setDescription(PermissionDescriptionEnum.PROJECT_RELATED_PERSONNEL.getValue() + relatedPersonnelId); + permission.setCreateTime(now); + permission.setUpdateTime(now); + relatedPersonnelPermissionList.add(permission); + } + } + if (ObjectUtils.isNotEmpty(projectRelatedPersonnel.getEngineeringInterfacePerson())) { + for (String engineeringInterfacePersonId : projectRelatedPersonnel.getEngineeringInterfacePerson().split(",")) { + ProjectUserPermission permission = new ProjectUserPermission(); + permission.setProjectId(projectId); + permission.setUserId(engineeringInterfacePersonId); + permission.setBelong(ProjectUserLocationEnum.PROJECT_DETAIL_RELEVANT_PERSONNEL_INTERFACE.getValue()); + permission.setDescription(PermissionDescriptionEnum.PROJECT_RELATED_PERSONNEL.getValue() + relatedPersonnelId); + permission.setCreateTime(now); + permission.setUpdateTime(now); + relatedPersonnelPermissionList.add(permission); + } + } + if (ObjectUtils.isNotEmpty(projectRelatedPersonnel.getCertificationEngineer())) { + for (String certificationEngineerId : projectRelatedPersonnel.getCertificationEngineer().split(",")) { + ProjectUserPermission permission = new ProjectUserPermission(); + permission.setProjectId(projectId); + permission.setUserId(certificationEngineerId); + permission.setBelong(ProjectUserLocationEnum.PROJECT_DETAIL_RELEVANT_PERSONNEL_CERTIFICATION.getValue()); + permission.setDescription(PermissionDescriptionEnum.PROJECT_RELATED_PERSONNEL.getValue() + relatedPersonnelId); + permission.setCreateTime(now); + permission.setUpdateTime(now); + relatedPersonnelPermissionList.add(permission); + } + + } + + } + projectRelatedPersonnelService.saveBatch(projectRelatedPersonnelList); + if (ObjectUtils.isNotEmpty(relatedPersonnelPermissionList)) { + projectUserPermissionService.saveBatch(relatedPersonnelPermissionList); + } + } + + //法规/认证任务计划添加数据 projectTaskPlanningService + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(ProjectTaskPlanning::getProjectId,projectLibraryBase.getId()); + ProjectTaskPlanning projectTaskPlanning = projectTaskPlanningService.getOne(wrapper); + if(ObjectUtils.isNotEmpty(projectTaskPlanning)){ + projectTaskPlanning.setId(UUID.randomUUID().toString().replace("-", "")); + projectTaskPlanning.setProjectId(projectId); + projectTaskPlanningService.add(projectTaskPlanning); + } + + + //初始化当前项目的studio与项目库 角色关系 projectLibraryRoleRelEOService + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(ProjectLibraryRoleRelEO::getProjectLibraryId,projectLibraryBase.getId()); + List projectLibraryRoleRelEOList = projectLibraryRoleRelEOService.list(queryWrapper); + + List studioUserPermissions = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(projectLibraryRoleRelEOList)){ + for (ProjectLibraryRoleRelEO projectLibraryRoleRelEO : projectLibraryRoleRelEOList) { + projectLibraryRoleRelEO.setId(UUID.randomUUID().toString().replace("-", "")); + projectLibraryRoleRelEO.setProjectLibraryId(projectId); + projectLibraryRoleRelEOService.add(projectLibraryRoleRelEO); + //添加studio权限 + ProjectUserPermission studioUserPermission = new ProjectUserPermission(); + studioUserPermission.setProjectId(projectId); + studioUserPermission.setUserId(projectLibraryRoleRelEO.getUserId()); + studioUserPermission.setBelong(ProjectUserLocationEnum.PROJECT_ADD_STUDIO.getValue()); + studioUserPermission.setCreateTime(now); + studioUserPermission.setUpdateTime(now); + studioUserPermissions.add(studioUserPermission); + } + } + if (ObjectUtils.isNotEmpty(studioUserPermissions)) { + projectUserPermissionService.saveBatch(studioUserPermissions); + } + } + + /** + * 如果创建的子项目版本号重复,处理排序 + * @param id + * @param version + * @param projectId + */ + private void checkVersionOrder(String id,String version,String projectId) { + LambdaQueryWrapper wrapperVer = new LambdaQueryWrapper<>(); + //查找其他统计子版本项目 + wrapperVer.eq(ProjectLibraryBase::getParentId, id); + wrapperVer.orderByAsc(ProjectLibraryBase::getProjectVersion); + List clist = this.list(wrapperVer); + int tmpInt = Integer.parseInt(version); + for (ProjectLibraryBase plb : clist) { + int ver = Integer.parseInt(plb.getProjectVersion()); + if(!plb.getId().equals(projectId) && ver == tmpInt){ + tmpInt++; + String verStr = String.valueOf(tmpInt); + if(verStr.length() <= 1){ + verStr= "0" + verStr; + } + plb.setProjectVersion(verStr); + this.updateById(plb); + } + } + } + + + /**检查车型名称id,年款号,目标市场,版本同时存在,报错*/ + public void checkExitData(ProjectLibraryBase projectLibraryBase){ + String projectNameId = projectLibraryBase.getProjectNameId(); + String yearNameId = projectLibraryBase.getYearNameId(); + String targetMarket = projectLibraryBase.getTargetMarket(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("project_name_id",projectNameId) + .eq("year_name_id",yearNameId) + .eq("target_market",targetMarket) + .eq("project_version",targetMarket); + if(StringUtils.isNotBlank(projectLibraryBase.getId())){ + queryWrapper.ne("id",projectLibraryBase.getId()); + } + Integer count = platformProjectLibraryBaseMapper.selectCount(queryWrapper); + if (count > 0) { + if(CutEnum.CN.getValue().equals(projectLibraryBase.getCut())) { + throw new JeroBootException("已存在车型名称,年款号,目标市场均同的数据"); + }else{ + throw new JeroBootException("There are data with the same model name, model number and target market."); + } + } + } + /** + * 更新 + * + * @param projectLibraryBase + * @return + */ + @Override + public void editById(ProjectLibraryBase projectLibraryBase) { + projectLibraryBase.setPlatform(YesOrNoEnum.YES.getNameEn()); + Date now = new Date(); + projectLibraryBase.setUpdateTime(now); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + projectLibraryBase.setUpdateBy(sysUser.getUsername()); + + ProjectLibraryBase original = baseMapper.selectById(projectLibraryBase.getId()); + + // 如果studio编辑了认证工程师,需要给旧的认证工程师发送认证清单任务消息 + if(StringUtils.isNotEmpty(projectLibraryBase.getCertificationEngineer()) && StringUtils.isNotEmpty(original.getCertificationEngineer())){ + this.editCertificationEngineer(projectLibraryBase, original); + } + + checkExitData(projectLibraryBase); + saveOrUpdate(projectLibraryBase); + checkVersionOrder(projectLibraryBase.getParentId(),projectLibraryBase.getProjectVersion(),projectLibraryBase.getId()); + + // 删除当前项目的studio与项目库 角色关系 + QueryWrapper deleteLibraryRoleRelWrapper = new QueryWrapper<>(); + deleteLibraryRoleRelWrapper.lambda().eq(ProjectLibraryRoleRelEO::getProjectLibraryId,projectLibraryBase.getId()); + projectLibraryRoleRelEOService.remove(deleteLibraryRoleRelWrapper); + //删除当前项目studio项目权限 + QueryWrapper delStudioPermission = new QueryWrapper<>(); + delStudioPermission.eq("project_id", projectLibraryBase.getId()).eq("belong", ProjectUserLocationEnum.PROJECT_ADD_STUDIO.getValue()); + projectUserPermissionService.remove(delStudioPermission); + //删除当前项目certification engineer项目权限 + QueryWrapper delCertificationPermission = new QueryWrapper<>(); + delCertificationPermission.eq("project_id", projectLibraryBase.getId()).eq("belong", ProjectUserLocationEnum.PROJECT_ADD_CERTIFICATION.getValue()); + projectUserPermissionService.remove(delCertificationPermission); + + /*// 初始化当前项目的studio与项目库 角色关系 + ProjectLibraryRoleRelEO projectLibraryRoleRelEO = new ProjectLibraryRoleRelEO(); + projectLibraryRoleRelEO.setProjectLibraryId(projectLibraryBase.getId()); + projectLibraryRoleRelEO.setUserId(projectLibraryBase.getStudioEngineer()); + projectLibraryRoleRelEO.setRoleCode(ProjectRoleEnum.STUDIO_ENGINEER.getValue()); + projectLibraryRoleRelEOService.add(projectLibraryRoleRelEO);*/ + + List projectLibraryRoleRelEOList = new ArrayList<>(); + //初始化当前项目的studio与项目库 法规清单 角色关系 + ProjectLibraryRoleRelEO lawsInventoryRoleRelEO = new ProjectLibraryRoleRelEO(); + lawsInventoryRoleRelEO.setProjectLibraryId(projectLibraryBase.getId()); + lawsInventoryRoleRelEO.setUserId(projectLibraryBase.getStudioEngineer()); + lawsInventoryRoleRelEO.setRoleCode(ProjectRoleEnum.STUDIO_ENGINEER.getValue()); + lawsInventoryRoleRelEO.setModelType(RoleRelModelTypeEnum.LAWS_INVENTORY.getValue()); + projectLibraryRoleRelEOList.add(lawsInventoryRoleRelEO); + + // 初始化当前项目的studio与项目库 认证清单 角色关系 + ProjectLibraryRoleRelEO certificationInventoryRoleRelEO = new ProjectLibraryRoleRelEO(); + certificationInventoryRoleRelEO.setProjectLibraryId(projectLibraryBase.getId()); + certificationInventoryRoleRelEO.setUserId(projectLibraryBase.getStudioEngineer()); + certificationInventoryRoleRelEO.setRoleCode(ProjectRoleEnum.STUDIO_ENGINEER.getValue()); + certificationInventoryRoleRelEO.setModelType(RoleRelModelTypeEnum.CERTIFICATION_INVENTORY.getValue()); + projectLibraryRoleRelEOList.add(certificationInventoryRoleRelEO); + this.projectLibraryRoleRelEOService.saveBatch(projectLibraryRoleRelEOList); + + //重新设置当前项目studio项目权限 + List engineers = new ArrayList<>(); + ProjectUserPermission studioPermission = new ProjectUserPermission(); + studioPermission.setProjectId(projectLibraryBase.getId()); + studioPermission.setUserId(projectLibraryBase.getStudioEngineer()); + studioPermission.setBelong(ProjectUserLocationEnum.PROJECT_ADD_STUDIO.getValue()); + studioPermission.setCreateTime(now); + studioPermission.setUpdateTime(now); + engineers.add(studioPermission); + //重新设置当前项目certification engineer项目权限 + if (ObjectUtils.isNotEmpty(projectLibraryBase.getCertificationEngineer())) { + for (String certificationEngineer : projectLibraryBase.getCertificationEngineer().split(",")) { + ProjectUserPermission certificationPermission = new ProjectUserPermission(); + certificationPermission.setProjectId(projectLibraryBase.getId()); + certificationPermission.setUserId(certificationEngineer); + certificationPermission.setBelong(ProjectUserLocationEnum.PROJECT_ADD_CERTIFICATION.getValue()); + certificationPermission.setCreateTime(now); + certificationPermission.setUpdateTime(now); + engineers.add(certificationPermission); + } + } + if (ObjectUtils.isNotEmpty(engineers)) { + projectUserPermissionService.saveBatch(engineers); + } + + //编辑时如果认证工程师发生变化,同步修改相关人员名单中的认证工程师 + List result = projectRelatedPersonnelMapper.queryPageList(projectLibraryBase.getId(), + DictCodeEnum.DUTY_TERRITORY.getValue(), null, null, null, null,null); + //项目的认证工程师 + String certificationEngineer = projectLibraryBase.getCertificationEngineer(); + //一个都不选的情况下 + if ("".equals(certificationEngineer)) { + //删除当前项目的相关人员名单中认证工程师权限 + QueryWrapper delWrapper = new QueryWrapper<>(); + delWrapper.eq("project_id", projectLibraryBase.getId()) + .eq("belong", ProjectUserLocationEnum.PROJECT_DETAIL_RELEVANT_PERSONNEL_CERTIFICATION.getValue()); + projectUserPermissionService.remove(delWrapper); + //删除当前项目的法规清单中认证工程师权限 + QueryWrapper delLawInventoryWrapper = new QueryWrapper<>(); + delLawInventoryWrapper.eq("project_id", projectLibraryBase.getId()) + .eq("belong", ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_HOMOLOGATION.getValue()); + projectUserPermissionService.remove(delLawInventoryWrapper); + } + //选择了其他工程师 + if(StringUtils.isNotBlank(certificationEngineer)){ + if(StringUtils.isNotEmpty(original.getCertificationEngineer())){ + for (String id : original.getCertificationEngineer().split(",")) { + if (!certificationEngineer.contains(id)) { + //如果原来的认证工程师被删除了,则需要同步删除当前项目的相关人员名单中该认证工程师权限 + QueryWrapper delWrapper = new QueryWrapper<>(); + delWrapper.eq("project_id", projectLibraryBase.getId()).eq("user_id",id). + eq("belong", ProjectUserLocationEnum.PROJECT_DETAIL_RELEVANT_PERSONNEL_CERTIFICATION.getValue()); + projectUserPermissionService.remove(delWrapper); + //如果原来的认证工程师被删除了,则需要同步删除当前项目的法规清单中该认证工程师权限 + QueryWrapper delLawInventoryWrapper = new QueryWrapper<>(); + delLawInventoryWrapper.eq("project_id", projectLibraryBase.getId()).eq("user_id",id). + eq("belong", ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_HOMOLOGATION.getValue()); + projectUserPermissionService.remove(delLawInventoryWrapper); + } + } + } + + + for (ProjectRelatedPersonnel projectRelatedPersonnel : result) { + //相关人员名单的认证工程师 + String certificationEngineerTemp = projectRelatedPersonnel.getCertificationEngineer(); + if(StringUtils.isNotBlank(certificationEngineerTemp)){ + StringBuilder sb = new StringBuilder(); + for (String s : certificationEngineerTemp.split(",")) { + if(certificationEngineer.contains(s)){ + sb.append(s + ","); + } + } + String substring = ""; + if(StringUtils.isNotBlank(sb)){ + substring = sb.substring(0, sb.length() - 1); + } + projectRelatedPersonnel.setCertificationEngineer(substring); + } + } + //批量修改相关人员名单信息中的认证工程师 + projectRelatedPersonnelService.updateBatchById(result); + } + /** + *法规清单发起任务前或任务结束后修改studio或者修改认证工程师时, + *如果设计符合性确认、Pre-Homo确认、 验证符合性确认中的发起人跟责任人引用到了这两人, + *而且这两个人不属于相关人员名单的工程接口人和法规工程师,同步删除这两人的权限 + */ + + List belongs = new ArrayList<>(); + belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_INITIATOR.getValue()); + belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_DUTY.getValue()); + belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_INITIATOR.getValue()); + belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_DUTY.getValue()); + belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_INITIATOR.getValue()); + belongs.add(ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_DUTY.getValue()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("project_library_id", projectLibraryBase.getId()); + List list = platformProjectLawsInventoryEOService.list(queryWrapper); + if (ObjectUtils.isNotEmpty(list)) { + for (ProjectLawsInventoryEO lawsInventoryEO : list) { + boolean boo = false; + //发起任务前 + if (TaskAffirmStatusEnum.NOT_STARTED.getValue().equals(lawsInventoryEO.getTaskAffirmStatus())) { + boo = true; + } + //任务结束后 + if (!boo) { + int count = 0; + QueryWrapper taskInventoryQueryWrapper = new QueryWrapper<>(); + taskInventoryQueryWrapper.eq("project_laws_inventory_id",lawsInventoryEO.getId()); + List taskInventoryRecords = projectTaskInventoryEOMapper.selectList(taskInventoryQueryWrapper); + for (ProjectTaskInventoryEO taskInventoryRecord : taskInventoryRecords) { + String designStatus = taskInventoryRecord.getDesignStatus(); + String verifyStatus = taskInventoryRecord.getVerifyStatus(); + String prehomoStatus = taskInventoryRecord.getPrehomoStatus(); + boolean designStatusFlag = StringUtils.isBlank(designStatus) || designStatus.equals(DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue()); + boolean verifyStatusFlag = StringUtils.isBlank(verifyStatus) || verifyStatus.equals(DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue()); + boolean prehomoStatusFlag = StringUtils.isBlank(prehomoStatus) || prehomoStatus.equals(DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue()); + if (designStatusFlag && verifyStatusFlag && prehomoStatusFlag) { + count++; + } + } + if (count == 3) { + boo = true; + } + } + if (boo) { + QueryWrapper personnelQueryWrapper = new QueryWrapper<>(); + personnelQueryWrapper.eq("duty_territory", lawsInventoryEO.getDutyTerritory()).eq("project_id", projectLibraryBase.getId()); + List personnels = projectRelatedPersonnelService.list(personnelQueryWrapper); + + if (!original.getStudioEngineer().equals(projectLibraryBase.getStudioEngineer())) { + StringBuilder participator = new StringBuilder(); + if (ObjectUtils.isNotEmpty(personnels)) { + if (ObjectUtils.isNotEmpty(personnels.get(0).getLawEngineer())) { + participator.append(personnels.get(0).getLawEngineer() + ","); + } + if (ObjectUtils.isNotEmpty(personnels.get(0).getCertificationEngineer())) { + participator.append(personnels.get(0).getCertificationEngineer() + ","); + } + if (ObjectUtils.isNotEmpty(personnels.get(0).getEngineeringInterfacePerson())) { + participator.append(personnels.get(0).getEngineeringInterfacePerson() + ","); + } + } + if (!participator.toString().contains(original.getStudioEngineer())) { + //删除当前studio在法规清单中的人员权限 + QueryWrapper del = new QueryWrapper<>(); + del.eq("project_id", projectLibraryBase.getId()).eq("user_id", original.getStudioEngineer()).in("belong",belongs). + eq("description", PermissionDescriptionEnum.PROJECT_LAWS_INVENTORY.getValue() + lawsInventoryEO.getId()); + projectUserPermissionService.remove(del); + } + } + if (ObjectUtils.isNotEmpty(original.getCertificationEngineer())) { + for (String id : original.getCertificationEngineer().split(",")) { + if (!certificationEngineer.contains(id)) { + StringBuilder participator = new StringBuilder(); + if (ObjectUtils.isNotEmpty(personnels)) { + if (ObjectUtils.isNotEmpty(personnels.get(0).getLawEngineer())) { + participator.append(personnels.get(0).getLawEngineer() + ","); + } + if (ObjectUtils.isNotEmpty(personnels.get(0).getEngineeringInterfacePerson())) { + participator.append(personnels.get(0).getEngineeringInterfacePerson() + ","); + } + } + participator.append(original.getStudioEngineer()); + if (!participator.toString().contains(id)) { + //删除当前studio在法规清单中的人员权限 + QueryWrapper del = new QueryWrapper<>(); + del.eq("project_id", projectLibraryBase.getId()).eq("user_id", id).in("belong",belongs). + eq("description", PermissionDescriptionEnum.PROJECT_LAWS_INVENTORY.getValue() + lawsInventoryEO.getId()); + projectUserPermissionService.remove(del); + } + } + } + } + } + } + } + + } + + /** + * 编辑认证工程师逻辑处理 + * @param newPlbEO + * @param oldPlbEO + */ + private void editCertificationEngineer(ProjectLibraryBase newPlbEO, ProjectLibraryBase oldPlbEO) { + List oldCertificationEngineerIdList = Arrays.asList(oldPlbEO.getCertificationEngineer().split(",")); + List newCertificationEngineerIdList = Arrays.asList(newPlbEO.getCertificationEngineer().split(",")); + + oldCertificationEngineerIdList = oldCertificationEngineerIdList.stream().filter(originalCertificationEngineerId -> { + boolean flag = true; + for (String newCertificationEngineerId : newCertificationEngineerIdList) { + // 如果新传进来的 认证工程师id跟现有的认证工程师id一致,不用发消息 + if(StringUtils.equals(newCertificationEngineerId,originalCertificationEngineerId)){ + flag = false; + break; + } + } + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(oldCertificationEngineerIdList)){ + // 判断当前项目下是否还有需要认证工程师操作的数据 只有清单待校核、结果待审查 这两个状态的数据由认证工程师操作。 + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + + QueryWrapper certificationInventoryEOQueryWrapper = new QueryWrapper<>(); + certificationInventoryEOQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, newPlbEO.getId()); + certificationInventoryEOQueryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.platformProjectCertificationInventoryEOService.list(certificationInventoryEOQueryWrapper); + if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ + this.platformProjectCertificationInventoryEOService.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); + List userInfoList = this.sysUserService.querySysUserListByIdList(oldCertificationEngineerIdList); + this.platformProjectCertificationInventoryEOService.sendMessageByTemplateId( + projectCertificationInventoryEOList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE13.getValue(), + oldCertificationEngineerIdList, + userInfoList, + projectCertificationInventoryEOList.get(0).getEndTime(),"" + ); + } + } + + this.setRzlcCertificationEngineerTask(newPlbEO); + } + + /** + * 重新设置认证工程师在待办中心的 认证流程的 待办任务。 + * @param projectLibraryBase + */ + private void setRzlcCertificationEngineerTask(ProjectLibraryBase projectLibraryBase) { + if(org.apache.commons.lang3.StringUtils.isNotEmpty(projectLibraryBase.getCertificationEngineer())){ + List certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryBase.getId()); + List pciEOList = this.platformProjectCertificationInventoryEOService.list(pciQueryWrap); + + if(CollectionUtils.isNotEmpty(pciEOList)){ + // 清单待校核的数据 + List pciToBeCheckedList = pciEOList.stream().filter(pci -> { + boolean flag = false; + if(StringUtils.equals(pci.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + // 如果该项目下清单待校核的数据不为空,给这些认证工程师分配待办任务。 + if(CollectionUtils.isNotEmpty(pciToBeCheckedList)){ + // 删除待办中心(是这个项目库的 pre-Homo流程的待办任务, 认证工程师接受任务节点的数据) + QueryWrapper pidQueryWrap = new QueryWrapper<>(); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSJSRW.getKey()); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); + pidQueryWrap.orderByAsc("end_time"); + List pidEoList = this.processInfoDetailEOService.list(pidQueryWrap); + if(CollectionUtils.isNotEmpty(pidEoList)){ + List pidEoIdList = pidEoList.stream().map(ProcessInfoDetailEO::getId).distinct().collect(Collectors.toList()); + this.processInfoDetailEOService.deleteByIds(pidEoIdList); + } + + // 获取责任确认截止时间 最早的时间 + this.platformProjectCertificationInventoryEOService.certificationInventoryEOListSortByTaskConfirmEndTimeAsc(pciToBeCheckedList); + Date endTime = pciToBeCheckedList.get(0).getInventoryVerifyEndTime(); + if(ObjectUtils.isEmpty(endTime)){ + endTime = pidEoList.get(0).getEndTime(); + } + + // 给认证工程师分配任务 + List processInfoDetailEOList = new ArrayList<>(); + for (String userId : certificationEngineerIdList) { + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setUserId(userId); + processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSJSRW.getKey()); + processInfoDetailEO.setCreateTime(new Date()); + processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); + processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId()); + processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId()); + processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); + processInfoDetailEO.setEndTime(endTime); + processInfoDetailEOList.add(processInfoDetailEO); + } + this.processInfoDetailEOService.saveBatch(processInfoDetailEOList); + } + + // 结果待提交的数据 + List pciToBeReviewEDList = pciEOList.stream().filter(pci -> { + boolean flag = false; + if(StringUtils.equals(pci.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(pciToBeReviewEDList)){ + // 删除待办中心(是这个项目库的 pre-Homo流程的待办任务, 认证工程师审查 任务节点的数据) + QueryWrapper pidQueryWrap = new QueryWrapper<>(); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSSC.getKey()); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); + pidQueryWrap.orderByAsc("end_time"); + List pidEoList = this.processInfoDetailEOService.list(pidQueryWrap); + + // 获取截止日期最早的一天。 + this.platformProjectCertificationInventoryEOService.certificationInventoryEOListSortByEndTimeAsc(pciToBeReviewEDList); + Date endTime = pciToBeReviewEDList.get(0).getEndTime(); + if(CollectionUtils.isNotEmpty(pidEoList)){ + endTime = pidEoList.get(0).getEndTime(); + + List pidEoIdList = pidEoList.stream().map(ProcessInfoDetailEO::getId).distinct().collect(Collectors.toList()); + this.processInfoDetailEOService.deleteByIds(pidEoIdList); + } + + // 给认证工程师分配任务 + List processInfoDetailEOList = new ArrayList<>(); + for (String userId : certificationEngineerIdList) { + ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); + processInfoDetailEO.setUserId(userId); + processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSSC.getKey()); + processInfoDetailEO.setCreateTime(new Date()); + processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue()); + processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId()); + processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId()); + processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); + processInfoDetailEO.setEndTime(endTime); + processInfoDetailEOList.add(processInfoDetailEO); + } + this.processInfoDetailEOService.saveBatch(processInfoDetailEOList); + } + } + } + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @Override + public void deleteById(String id,String cut) { + checkData(id,cut); + + // 关联删除项目下的所有收集清单 + paramsManifestEOService.deleteByProjectId(id); + + //删除主项目 + removeById(id); + + //删除子项目 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ProjectLibraryBase::getParentId,id); + List list = this.list(wrapper); + if(ObjectUtils.isNotEmpty(list)){ + List idList = list.stream().map(ProjectLibraryBase::getId).collect(Collectors.toList()); + this.removeByIds(idList); + } + + //关联删除-相关人员 + QueryWrapper relatedPersonnelQueryWrapper = new QueryWrapper<>(); + relatedPersonnelQueryWrapper.eq("project_id",id); + projectRelatedPersonnelService.remove(relatedPersonnelQueryWrapper); + + //关联删除-任务计划时间轴 + QueryWrapper taskPlanningQueryWrapper = new QueryWrapper<>(); + taskPlanningQueryWrapper.eq("project_id",id); + projectTaskPlanningService.remove(taskPlanningQueryWrapper); + + //关联删除-法规清单 + QueryWrapper lawsInventoryEOQueryWrapper = new QueryWrapper<>(); + lawsInventoryEOQueryWrapper.eq("project_library_id ",id); + platformProjectLawsInventoryEOService.remove(lawsInventoryEOQueryWrapper); + + //关联删除-法规清单log + QueryWrapper logEOQueryWrapper = new QueryWrapper<>(); + logEOQueryWrapper.in("project_library_id",id); + projectLawsInventoryLogEOService.remove(logEOQueryWrapper); + + //删除权限 + QueryWrapper permissionQueryWrapper = new QueryWrapper<>(); + permissionQueryWrapper.eq("project_id", id); + projectUserPermissionService.remove(permissionQueryWrapper); + } + + /* + * 判断是否可以删除 + */ + @Override + public void checkData(String id, String cut) { + //判断该条项目是否是自己创建,如果不是则不能删除 + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List projectLibraryBases = this.queryById(id,null); + //管理员和创建人可以删除,其余人不能删除 + boolean administrator = sysUserService.isAdministrator(); + if(!loginUser.getUsername().equals(projectLibraryBases.get(0).getCreateBy()) && !administrator){ + if(CutEnum.CN.getValue().equals(cut)){ + throw new JeroBootException("该条项目非本人创建,不能删除"); + }else{ + throw new JeroBootException("This item is not created by myself and cannot be deleted"); + } + } + QueryWrapper lawsInventoryQueryWrapper = new QueryWrapper<>(); + lawsInventoryQueryWrapper.eq("project_library_id",id); + List lawsInventoryRecords = platformProjectLawsInventoryEOMapper.selectList(lawsInventoryQueryWrapper); + for(ProjectLawsInventoryEO projectLawsInventoryEO : lawsInventoryRecords){ + String inventoryAffirmStatus = projectLawsInventoryEO.getInventoryAffirmStatus();//清单确认状态 + //清单确认状态(未发起、接受、拒绝) + boolean inventoryAffirmFlag = ( + org.apache.commons.lang3.StringUtils.equals(inventoryAffirmStatus,TaskAffirmStatusEnum.NOT_STARTED.getValue()) || + org.apache.commons.lang3.StringUtils.equals(inventoryAffirmStatus,TaskAffirmStatusEnum.ACCEPTED.getValue()) || + org.apache.commons.lang3.StringUtils.equals(inventoryAffirmStatus,TaskAffirmStatusEnum.REJECTED.getValue()) + ); + + String taskAffirmStatus = projectLawsInventoryEO.getTaskAffirmStatus();//任务确认状态 + //任务确认状态(未发起、接受、拒绝) + boolean taskAffirmFlag = ( + org.apache.commons.lang3.StringUtils.equals(taskAffirmStatus,TaskAffirmStatusEnum.NOT_STARTED.getValue()) || + org.apache.commons.lang3.StringUtils.equals(taskAffirmStatus,TaskAffirmStatusEnum.ACCEPTED.getValue()) || + org.apache.commons.lang3.StringUtils.equals(taskAffirmStatus,TaskAffirmStatusEnum.REJECTED.getValue()) + ); + + if (!(inventoryAffirmFlag && taskAffirmFlag)) { + if (CutEnum.CN.getValue().equals(cut)) { + throw new JeroBootException("当前项目下有未走完的流程,不能删除"); + }else{ + throw new JeroBootException("There are unfinished processes under the current project and cannot be deleted."); + } + } + + String lawsInventoryId = projectLawsInventoryEO.getId(); + + QueryWrapper taskInventoryQueryWrapper = new QueryWrapper<>(); + taskInventoryQueryWrapper.eq("project_laws_inventory_id",lawsInventoryId); + List taskInventoryRecords = projectTaskInventoryEOMapper.selectList(taskInventoryQueryWrapper); + //设计、验证、prehomo流程(流程状态是空 或 审查完成) + for(ProjectTaskInventoryEO projectTaskInventoryEO : taskInventoryRecords){ + String designStatus = projectTaskInventoryEO.getDesignStatus(); + String verifyStatus = projectTaskInventoryEO.getVerifyStatus(); + String prehomoStatus = projectTaskInventoryEO.getPrehomoStatus(); + + boolean designStatusFlag = StringUtils.isBlank(designStatus) || designStatus.equals(DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue()); + boolean verifyStatusFlag = StringUtils.isBlank(verifyStatus) || verifyStatus.equals(DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue()); + boolean prehomoStatusFlag = StringUtils.isBlank(prehomoStatus) || prehomoStatus.equals(DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue()); + + if (!(designStatusFlag && verifyStatusFlag && prehomoStatusFlag)) { + if (CutEnum.CN.getValue().equals(cut)) { + throw new JeroBootException("当前项目下有未走完的流程,不能删除"); + }else{ + throw new JeroBootException("There are unfinished processes under the current project and cannot be deleted."); + } + } + } + } + } + /** + * 批量删除 + * + * @param ids + * @return + */ + @Override + public void deleteByIds(List ids,String cut) { + for(String id :ids){ + checkData(id,cut); + } + removeByIds(ids); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @Override + public List queryById(String id,String cut) { + List records = platformProjectLibraryBaseMapper.queryById(id); + disposeData(records,cut,false); + //目标市场数据字典 + List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); + for(ProjectLibraryBase projectLibraryBase: records){ + //历史数据的主版本没有版本号,所以默认给00 + if(StringUtils.isBlank(projectLibraryBase.getParentId()) && StringUtils.isBlank(projectLibraryBase.getProjectVersion())){ + projectLibraryBase.setProjectVersion("00"); + } + //目标市场 + Map param = new HashMap<>(); + param.put("cut",cut); + String targetMarket = getMarket(param, targetMarketList, projectLibraryBase); + //主项目的版本号 + String projectVersion = ""; + if(StringUtils.isBlank(projectLibraryBase.getParentId())){ + projectVersion = "00"; + }else{ + projectVersion = projectLibraryBase.getProjectVersion(); + } + if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){ + projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() + + "-" + projectLibraryBase.getYearName() + + "-" + targetMarket); +// projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() +// + "-" + projectLibraryBase.getYearName() +// + "-" + targetMarket +// + "-" + projectVersion); + } + } + return records; + } + + /** + * 列表查询 + * + * @return + */ + @Override + public List getList(ProjectLibraryBase projectLibraryBase) { + List list = platformProjectLibraryBaseMapper.getList(projectLibraryBase); + return list; + } + + /** + * 分页列表查询 + * + * @return + */ + @Override + public List queryPageList(Map params) { + String cut = (String) params.get("cut"); + String projectNameId = (String) params.get("projectNameId");//项目名称 + String brand = (String) params.get("brand");//品牌 + String ipdInfo = (String) params.get("ipdInfo");//配置信息 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ProjectLibraryBase::getPlatform,YesOrNoEnum.YES.getNameEn()); + queryWrapper.orderByDesc(ProjectLibraryBase::getCreateTime); + if(StringUtils.isNotBlank(projectNameId)){ + queryWrapper.like(ProjectLibraryBase::getProjectNameId,projectNameId); + } + if(StringUtils.isNotBlank(brand)){ + queryWrapper.eq(ProjectLibraryBase::getBrand,brand); + } + if(StringUtils.isNotBlank(ipdInfo)){ + queryWrapper.like(ProjectLibraryBase::getIpdInfo,ipdInfo); + } + + List result = this.list(queryWrapper); + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List dictItemList = sysDictItemMapper.selectItemsByDictCode(DictCodeEnum.BRAND.getValue()); + + //置顶 + List idList = result.stream().map(ProjectLibraryBase::getId).collect(Collectors.toList()); + List topProjectEOList = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(idList)){ + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(TopProjectEO::getCreateBy,loginUser.getUsername()).in(TopProjectEO::getProjectLibraryBaseId,idList).orderByDesc(TopProjectEO::getSort); + topProjectEOList = iTopProjectEOService.list(wrapper); + } + //列表中的法规工程师和工程接口人 + List sysUserList = getSysUserList(result); + //目标市场数据字典 + List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); + for(ProjectLibraryBase projectLibraryBase: result){ + if(ObjectUtils.isNotEmpty(sysUserList)){ + //法规工程师 + if(StringUtils.isNotBlank(projectLibraryBase.getRegulationOwnerId())){ + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLibraryBase.getRegulationOwnerId())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect)){ + projectLibraryBase.setRegulationOwnerIdName(collect.get(0).getUsername()); + } + } + //工程接口人 + if(StringUtils.isNotBlank(projectLibraryBase.getEngineeringInterfacePerson())){ + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLibraryBase.getEngineeringInterfacePerson())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect)){ + projectLibraryBase.setEngineeringInterfacePersonName(collect.get(0).getUsername()); + } + } + } + //处理品牌 + List sysDictItemList = dictItemList.stream() + .filter(e -> e.getItemValue().equals(projectLibraryBase.getBrand())).collect(Collectors.toList()); + if(!sysDictItemList.isEmpty()){ + if (CutEnum.CN.getValue().equals(cut)) { + projectLibraryBase.setBrandText(sysDictItemList.get(0).getItemText() ); + } else { + projectLibraryBase.setBrandText(sysDictItemList.get(0).getEnName()); + } + } + //置顶处理 + if(ObjectUtils.isNotEmpty(topProjectEOList)){ + List collect = topProjectEOList.stream() + .filter(e -> projectLibraryBase.getId().equals(e.getProjectLibraryBaseId()) + && loginUser.getUsername().equals(e.getCreateBy())) + .collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect)){ + projectLibraryBase.setFlag(collect.get(0).getFlag()); + projectLibraryBase.setSort(collect.get(0).getSort()); + }else{ + projectLibraryBase.setSort("0"); + } + }else{ + projectLibraryBase.setSort("0"); + } + + //目标市场 + Map param = new HashMap<>(); + param.put("cut",cut); + String targetMarket = getMarket(param, targetMarketList, projectLibraryBase); + //项目名称(功率-生产商-目标市场) + String projectName = projectLibraryBase.getPower() + "-" + projectLibraryBase.getProducer() + "-" + targetMarket; + projectLibraryBase.setProjectNameId(projectName);//原设计平台件项目名称去这个字段值 + //平台件项目名称改为拼接的形式,projectNameId不在存数据,如果这个变更影响其他的地方,项目名称取值可以取projectName的值 + projectLibraryBase.setProjectName(projectName); + } + + if(ObjectUtils.isEmpty(params.get("orderByField"))){ + Collections.sort(result, new Comparator() { + @Override + public int compare(ProjectLibraryBase o1, ProjectLibraryBase o2) { + return -o1.getSort().compareTo(o2.getSort()); + } + }); + } + //表头排序 + hearSort(params, result); + return result; + } + + private List getSysUserList(List result) { + List RegulationOwnerIdList = result.stream().map(ProjectLibraryBase::getRegulationOwnerId).distinct().collect(Collectors.toList()); + List EngineeringInterfacePersonList = result.stream().map(ProjectLibraryBase::getEngineeringInterfacePerson).distinct().collect(Collectors.toList()); + List userIdList = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(RegulationOwnerIdList)){ + userIdList.addAll(RegulationOwnerIdList); + } + if(ObjectUtils.isNotEmpty(EngineeringInterfacePersonList)){ + userIdList.addAll(EngineeringInterfacePersonList); + } + List sysUserList = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(userIdList)){ + QueryWrapper userqueryWrapper = new QueryWrapper<>(); + userqueryWrapper.in("id ", userIdList); + sysUserList = sysUserMapper.selectList(userqueryWrapper); + } + return sysUserList; + } + + private void hearSort(Map params, List resultList) { + if(ObjectUtils.isNotEmpty(params.get("orderByField"))){ + Collator comparator = Collator.getInstance(Locale.CHINESE); + //项目名称,R&H Studio,车型平台,数字平台 + if("projectNameId".equals(params.get("orderByField"))){ + if(OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))){ + Collections.sort(resultList,(e1, e2)->{ + String e1Field = StringUtils.isNotBlank(e1.getProjectNameId()) ? e1.getProjectNameId() : ""; + String e2Field = StringUtils.isNotBlank(e2.getProjectNameId()) ? e2.getProjectNameId() : ""; + return comparator.compare(e1Field,e2Field); + }); + }else if(OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))){ + Collections.sort(resultList,(e1,e2)->{ + String e1Field = StringUtils.isNotBlank(e1.getProjectNameId()) ? e1.getProjectNameId() : ""; + String e2Field = StringUtils.isNotBlank(e2.getProjectNameId()) ? e2.getProjectNameId() : ""; + return comparator.compare(e2Field,e1Field); + }); + } + } + //法规工程师 + if("createBy".equals(params.get("orderByField"))){ + if(OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))){ + Collections.sort(resultList,(e1, e2)->{ + String e1Field = StringUtils.isNotBlank(e1.getCreateBy()) ? e1.getCreateBy() : ""; + String e2Field = StringUtils.isNotBlank(e2.getCreateBy()) ? e2.getCreateBy() : ""; + return comparator.compare(e1Field,e2Field); + }); + }else if(OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))){ + Collections.sort(resultList,(e1,e2)->{ + String e1Field = StringUtils.isNotBlank(e1.getCreateBy()) ? e1.getCreateBy() : ""; + String e2Field = StringUtils.isNotBlank(e2.getCreateBy()) ? e2.getCreateBy() : ""; + return comparator.compare(e2Field,e1Field); + }); + } + } + //品牌 + if ("brandText".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(resultList, (e1, e2) -> { + String e1Field = StringUtils.isNotBlank(e1.getBrandText()) ? e1.getBrandText() : ""; + String e2Field = StringUtils.isNotBlank(e2.getBrandText()) ? e2.getBrandText() : ""; + return comparator.compare(e1Field, e2Field); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(resultList, (e1, e2) -> { + String e1Field = StringUtils.isNotBlank(e1.getBrandText()) ? e1.getBrandText() : ""; + String e2Field = StringUtils.isNotBlank(e2.getBrandText()) ? e2.getBrandText() : ""; + return comparator.compare(e2Field, e1Field); + }); + } + } + + //配置项 + if ("ipdInfo".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(resultList, (e1, e2) -> { + String e1Field = StringUtils.isNotBlank(e1.getIpdInfo()) ? e1.getIpdInfo() : ""; + String e2Field = StringUtils.isNotBlank(e2.getIpdInfo()) ? e2.getIpdInfo() : ""; + return comparator.compare(e1Field, e2Field); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(resultList, (e1, e2) -> { + String e1Field = StringUtils.isNotBlank(e1.getIpdInfo()) ? e1.getIpdInfo() : ""; + String e2Field = StringUtils.isNotBlank(e2.getIpdInfo()) ? e2.getIpdInfo() : ""; + return comparator.compare(e2Field, e1Field); + }); + } + } + //说明 + if ("explanation".equals(params.get("orderByField"))) { + if (OrderEnum.POSITIVE.getValue().equals(params.get("orderBy"))) { + Collections.sort(resultList, (e1, e2) -> { + String e1Field = StringUtils.isNotBlank(e1.getExplanation()) ? e1.getExplanation() : ""; + String e2Field = StringUtils.isNotBlank(e2.getExplanation()) ? e2.getExplanation() : ""; + return comparator.compare(e1Field, e2Field); + }); + } else if (OrderEnum.REVERSE.getValue().equals(params.get("orderBy"))) { + Collections.sort(resultList, (e1, e2) -> { + String e1Field = StringUtils.isNotBlank(e1.getExplanation()) ? e1.getExplanation() : ""; + String e2Field = StringUtils.isNotBlank(e2.getExplanation()) ? e2.getExplanation() : ""; + return comparator.compare(e2Field, e1Field); + }); + } + } + } + } + + @NotNull + private List getProjectLibraryBases(List result, List projectLibraryBaseListParent) { + //result中的主项目以及子项目对应的主项目 + List resultParent = new LinkedList<>(); + for (ProjectLibraryBase projectLibraryBase : result) { + if(StringUtils.isBlank(projectLibraryBase.getParentId())){ + resultParent.add(projectLibraryBase); + }else{ + //子项目 + List collect = result.stream() + .filter(e -> projectLibraryBase.getId().equals(e.getParentId())) + .collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect)){ + resultParent.addAll(collect); + } + + } + } + + //搜索结果中子项目的子项目 + List resultChild = new ArrayList<>(); + //所有子项目 + List childrenListTemp = result.stream().filter(e -> StringUtils.isNotBlank(e.getParentId())).collect(Collectors.toList()); + List childrenIdListTemp = childrenListTemp.stream().map(ProjectLibraryBase::getId).collect(Collectors.toList()); + + //子项目的子项目 + List collect3 = result.stream().filter(e -> StringUtils.isNotBlank(e.getParentId()) && childrenIdListTemp.contains(e.getParentId())).collect(Collectors.toList()); + + if(ObjectUtils.isNotEmpty(collect3)){ + //子项目的子项目的父id + List childList = collect3.stream().map(ProjectLibraryBase::getParentId).collect(Collectors.toList()); + //子项目 + resultChild = childrenListTemp.stream().filter(e -> childList.contains(e.getId())).collect(Collectors.toList()); + } + + + //所有的主项目与通过筛选条件查询来的主项目进行过滤 + List resultNew = new LinkedList<>(); + //主项目 + List collect1 = result.stream().filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList()); + resultNew.addAll(collect1); + List projectLibraryBaseList = new ArrayList<>(); + for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseListParent) { + List resultNewTemp = new ArrayList<>(); + //子项目 + List collect = result.stream().filter(e -> projectLibraryBase.getId().equals(e.getParentId())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect)){ + resultNewTemp.addAll(collect); + } + //子项目的子项目 + if(ObjectUtils.isNotEmpty(resultChild)){ + List collect2 = resultChild.stream().filter(e -> e.getParentId().equals(projectLibraryBase.getId())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect2)){ + resultNewTemp.addAll(collect2); + } + } + if(ObjectUtils.isNotEmpty(resultNewTemp)){ + projectLibraryBase.setChildren(resultNewTemp); + projectLibraryBaseList.add(projectLibraryBase); + } + } +// resultNew = resultNew.stream().distinct().collect(Collectors.toList()); + return projectLibraryBaseList; + } +// /** +// * 分页列表查询 +// * +// * @return +// */ +// @Override +// public List queryPageList(Map params) { +// List result = platformProjectLibraryBaseMapper.queryPageList(params); +// disposeData(result,"",false); +// //目标市场 +// List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); +// +// for(ProjectLibraryBase projectLibraryBase: result){ +// //目标市场 +// String targetMarket = getMarket(params, targetMarketList, projectLibraryBase); +// //主项目的版本号 +// String projectVersion = ""; +// if(StringUtils.isBlank(projectLibraryBase.getParentId())){ +// projectVersion = "00"; +// }else{ +// projectVersion = projectLibraryBase.getProjectVersion(); +// } +// if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){ +// projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() +// + "-" + projectLibraryBase.getYearName() +// + "-" + targetMarket +// + "-" + projectVersion); +// } +// } +// //项目名称模糊查询特殊处理(因为项目名称是多字段拼接的) +// if(ObjectUtils.isNotEmpty(params.get("projectName"))){ +// result = result.stream().filter(e->e.getProjectName().toLowerCase().contains(String.valueOf(params.get("projectName")).toLowerCase())).collect(Collectors.toList()); +// } +// //数据组装 +// List resultTemp = new LinkedList<>(); +// for (ProjectLibraryBase projectLibraryBase : result) { +// if(StringUtils.isBlank(projectLibraryBase.getParentId())){ +// resultTemp.add(projectLibraryBase); +// } +// } +// +// for (ProjectLibraryBase projectLibraryBase : resultTemp) { +// //子项目 +// List children = result.stream() +// .filter(e -> StringUtils.isNotBlank(e.getParentId()) && projectLibraryBase.getId().equals(e.getParentId())).collect(Collectors.toList()); +// if(children.size() != 0){ +// //子项目的基础上添加的子项目 +// List childrenIdList = children.stream().map(ProjectLibraryBase::getId).distinct().collect(Collectors.toList()); +// List childrenList = result.stream() +// .filter(e -> StringUtils.isNotBlank(e.getParentId()) && childrenIdList.contains(e.getParentId())).collect(Collectors.toList()); +// children.addAll(childrenList); +// +// //按版本排序 +// Collections.sort(children); +// projectLibraryBase.setChildren(children); +// //最后一个版本号(主项目和主项目都需要设置) +// String versionLast = children.get(children.size() - 1).getProjectVersion(); +// //主版本设置最后一个版本号(用于项目扩展中的版本号) +// projectLibraryBase.setVersionLast(versionLast); +// for (ProjectLibraryBase child : children) { +// //每个子版本版本设置最后一个版本号(用于项目扩展中的版本号) +// child.setVersionLast(versionLast); +// } +// } +// } +// return resultTemp; +// } + + public String getMarket(Map params, List targetMarketList, ProjectLibraryBase projectLibraryBase) { + List dictModelList = new ArrayList<>(); + if(StringUtils.isNotBlank(projectLibraryBase.getTargetMarket())){ + for (String s : projectLibraryBase.getTargetMarket().split(",")) { + List dictModelListTemp = targetMarketList.stream() + .filter(e -> s.equals(e.getValue())).collect(Collectors.toList()); + dictModelList.addAll(dictModelListTemp); + } + } + String targetMarket = ""; + if(dictModelList.size() != 0){ + StringBuilder sb = new StringBuilder(); + for (DictModel dictModel : dictModelList) { + if(CutEnum.CN.getValue().equals(params.get("cut"))){ + sb.append(dictModel.getText()+","); + }else{ + sb.append(dictModel.getTextEn()+","); + } + } + if(StringUtils.isNotBlank(sb)){ + targetMarket = sb.substring(0,sb.length()-1); + } + } + return targetMarket; + } + + public Page getPages(Integer currentPage, Integer pageSize, List list){ + Page page =new Page(); + if(list==null){ + return null; + } + int size = list.size(); + if(pageSize > size){ + pageSize = size; + } + if(pageSize!=0){ + //求出最⼤页数,防⽌currentPage越界 + int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1; + if(currentPage > maxPage){ + currentPage = maxPage; + } + } + //当前页第⼀条数据的下标 + int curIdx = currentPage >1?(currentPage -1)* pageSize :0; + List pageList =new ArrayList(); + //将当前页的数据放进pageList + for(int i =0; i < pageSize && curIdx + i < size; i++){ + pageList.add(list.get(curIdx + i)); + } + page.setCurrent(currentPage).setSize(pageSize).setTotal(list.size()).setRecords(pageList); + return page; + } + + +// /** +// * 分页列表查询 +// * +// * @return +// */ +// @Override +// public IPage queryPageList(Map params) { +// Integer pageNo = Integer.parseInt(params.get("pageNo").toString()); +// Integer pageSize = Integer.parseInt(params.get("pageSize").toString()); +// IPage page = new Page(pageNo, pageSize); +// IPage result = platformProjectLibraryBaseMapper.queryPageList(page, params); +// List records = result.getRecords(); +// disposeData(records,"",false); +// for(ProjectLibraryBase projectLibraryBase: records){ +// if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){ +// projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() + "-" + projectLibraryBase.getYearName()); +// } +// } +// return result; +// } + + @Override + public void disposeData(List records,String cut,boolean disposeTargetMarketFlag) { + List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); + List sysUserList = getSysUserList(records); + for (ProjectLibraryBase projectLibraryBase : records) { + List sysUsers = new ArrayList<>(); + //认证工程师多个id查询 + if (StringUtils.isNotEmpty(projectLibraryBase.getCertificationEngineer())) { + List certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + if (CollectionUtils.isNotEmpty(certificationEngineerIdList)) { + certificationEngineerIdList = certificationEngineerIdList.stream().distinct().collect(Collectors.toList()); + QueryWrapper userqueryWrapper = new QueryWrapper<>(); + userqueryWrapper.in("id ", certificationEngineerIdList); + sysUsers = sysUserMapper.selectList(userqueryWrapper); + } + + if (CollectionUtils.isNotEmpty(sysUsers)) { + String certificationEngineerId = projectLibraryBase.getCertificationEngineer(); + String certificationEngineerName = null; + StringBuilder certificationName = new StringBuilder(); + + for (String data : certificationEngineerIdList) { + if (StringUtils.isNotEmpty(certificationEngineerId)) { + certificationEngineerName = sysUsers.stream().filter(e -> data.equals(e.getId())) + .map(sysUser -> sysUser.getUsername()).collect(Collectors.joining(",")); + } + certificationName.append(certificationEngineerName).append(","); + } + if(StringUtils.isNotBlank(certificationName)){ + String substring = certificationName.substring(0, certificationName.length() - 1); + projectLibraryBase.setCertificationEngineerName(substring); + } + } + } + //法规工程师 + if(StringUtils.isNotBlank(projectLibraryBase.getRegulationOwnerId())){ + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLibraryBase.getRegulationOwnerId())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect)){ + projectLibraryBase.setRegulationOwnerIdName(collect.get(0).getUsername()); + } + } + //工程接口人 + if(StringUtils.isNotBlank(projectLibraryBase.getEngineeringInterfacePerson())){ + List collect = sysUserList.stream() + .filter(e -> e.getId().equals(projectLibraryBase.getEngineeringInterfacePerson())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect)){ + projectLibraryBase.setEngineeringInterfacePersonName(collect.get(0).getUsername()); + } + } + //责任部门 + if(StringUtils.isNotBlank(projectLibraryBase.getDutyDepart())){ + List sysDictItems = sysDictItemServiceImpl.getBaseMapper().selectItemsAll(); + String dutyDepartName = platformProjectLawsInventoryEOService.disposeShowDictItemValue(sysDictItems, projectLibraryBase.getDutyDepart(), cut, ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()); + projectLibraryBase.setDutyDepartName(dutyDepartName); + } + //名牌标签 + if(StringUtils.isNotBlank(projectLibraryBase.getBrandLabel())){ + List fileList = iOSSFileService.getFileInfos(projectLibraryBase.getBrandLabel()); +// List fileList = iOSSFileService.getFileInfosByConnectId(projectLibraryBase.getBrandLabel()); + if(ObjectUtils.isNotEmpty(fileList)){ + List urlList = fileList.stream().map(OSSFile::getUrl).collect(Collectors.toList()); + projectLibraryBase.setUrlList(urlList); + } + } + //目标市场 + Map param = new HashMap<>(); + param.put("cut",cut); + String targetMarketTemp = getMarket(param, targetMarketList, projectLibraryBase); + //项目名称(功率-生产商-目标市场) + String projectName = projectLibraryBase.getPower() + "-" + projectLibraryBase.getProducer() + "-" + targetMarketTemp; + projectLibraryBase.setProjectNameId(projectName);//原设计平台件项目名称去这个字段值 + //平台件项目名称改为拼接的形式,projectNameId不在存数据,如果这个变更影响其他的地方,项目名称取值可以取projectName的值 + projectLibraryBase.setProjectName(projectName); + + if(disposeTargetMarketFlag){ + if(StringUtils.isNotEmpty(projectLibraryBase.getTargetMarket())){ + String targetMarketName = ""; + String[] targetMarketArr = projectLibraryBase.getTargetMarket().split(","); + if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + targetMarketName = targetMarketList.stream().filter(targetMarket -> { + boolean flag = false; + for (String s : targetMarketArr) { + if (StringUtils.equals(s, targetMarket.getValue())) { + flag = true; + } + } + return flag; + }).map(DictModel::getTextEn).collect(Collectors.joining(",")); + }else { + targetMarketName = targetMarketList.stream().filter(targetMarket -> { + boolean flag = false; + for (String s : targetMarketArr) { + if (StringUtils.equals(s, targetMarket.getValue())) { + flag = true; + } + } + return flag; + }).map(DictModel::getText).collect(Collectors.joining(",")); + } + projectLibraryBase.setTargetMarketName(targetMarketName); + } + } + + } + } + + @Override + public Map getProjectDetailsStatistics(String id) { + Map result = new HashMap<>(); + + //当前项目状态 + Map currentProjectStatusMap = new HashMap<>(); + //清单确认 + Map listingToConfirmMap = new HashMap<>(); + //任务确认 + Map taskToConfirmMap = new HashMap<>(); + //设计符合性 + Map designComplianceMap = new HashMap<>(); + //prehomo确认 + Map prehomoMap = new HashMap<>(); + //验证符合性 + Map verifyComplianceMap = new HashMap<>(); + //认证进度 + Map certificationProgressMap = new HashMap<>(); + // 认证任务确认 + Map rzTaskToConfirmMap = new HashMap<>(); + + //清单确认统计 + /*List> listingToConfirmMapList = this.platformProjectLawsInventoryEOMapper.getlistingToConfirmStatistics(id); + listingToConfirmMap.put("listingToConfirmMapList",listingToConfirmMapList); + result.put("listingToConfirmMap",listingToConfirmMap);*/ + + QueryWrapper lawsInventoryEOQueryWrapper = new QueryWrapper<>(); + lawsInventoryEOQueryWrapper.lambda().in(ProjectLawsInventoryEO::getProjectLibraryId,Arrays.asList(id.split(","))); + List projectLawsInventoryEOList = platformProjectLawsInventoryEOMapper.selectList(lawsInventoryEOQueryWrapper); + if(CollectionUtils.isNotEmpty(projectLawsInventoryEOList)){ + List projectLawsInventoryIdList = projectLawsInventoryEOList.stream().distinct().map(ProjectLawsInventoryEO::getId).collect(Collectors.toList()); + + //任务确认统计 + List> taskToConfirmMapList = this.platformProjectLawsInventoryEOService.getTaskToConfirmStatistics(projectLawsInventoryEOList); + int taskAffirmStatusCount = 0; + if(CollectionUtils.isNotEmpty(taskToConfirmMapList)){ + //taskAffirmStatusCount + for (Map taskToConfirm : taskToConfirmMapList) { + taskAffirmStatusCount += (int) taskToConfirm.get("taskAffirmStatusCount"); + } + } + taskToConfirmMap.put("taskToConfirmMapList",taskToConfirmMapList); + taskToConfirmMap.put("count",taskAffirmStatusCount); + result.put("taskToConfirmMap",taskToConfirmMap); + + + //设计符合性 + List> designComplianceMapList = this.platformProjectLawsInventoryEOService.getDesignComplianceStatistice(projectLawsInventoryEOList); + int designFlowTaskStatusCount = 0; + if(CollectionUtils.isNotEmpty(designComplianceMapList)){ + for (Map designCompliance : designComplianceMapList) { + designFlowTaskStatusCount += (int) designCompliance.get("designFlowTaskStatusCount"); + } + } + designComplianceMap.put("designComplianceMapList",designComplianceMapList); + designComplianceMap.put("count",designFlowTaskStatusCount); + result.put("designComplianceMap",designComplianceMap); + + //验证符合性 + List> verifyComplianceMapList = this.platformProjectLawsInventoryEOService.getVerifyComplianceStatistice(projectLawsInventoryEOList); + int verifyFlowTaskStatusCount = 0; + if(CollectionUtils.isNotEmpty(verifyComplianceMapList)){ + for (Map verifyCompliance : verifyComplianceMapList) { + verifyFlowTaskStatusCount += (int) verifyCompliance.get("verifyFlowTaskStatusCount"); + } + } + verifyComplianceMap.put("verifyComplianceMapList",verifyComplianceMapList); + verifyComplianceMap.put("count",verifyFlowTaskStatusCount); + result.put("verifyComplianceMap",verifyComplianceMap); + } + + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getProjectLibraryId,Arrays.asList(id.split(","))); + List pciEoList = this.platformProjectCertificationInventoryEOService.list(pciQueryWrap).stream().filter(pciEo -> { + boolean flag = false; + if (!StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.UNINVOLVED.getValue())) { + flag = true; + } + return flag; + }).distinct().collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(pciEoList)){ + // 认证清单-任务确认统计 + List> rzTaskToConfirmMapList = this.platformProjectCertificationInventoryEOService.getTaskToConfirmStatistics(pciEoList); + int taskAffirmStatusCount = 0; + if(CollectionUtils.isNotEmpty(rzTaskToConfirmMapList)){ + for (Map rzTaskToConfirm : rzTaskToConfirmMapList) { + taskAffirmStatusCount += (int) rzTaskToConfirm.get("taskAffirmStatusCount"); + } + } + rzTaskToConfirmMap.put("rzTaskToConfirmMapList",rzTaskToConfirmMapList); + rzTaskToConfirmMap.put("count",taskAffirmStatusCount); + result.put("rzTaskToConfirmMap",rzTaskToConfirmMap); + + // Pre-Homo 统计 + List> prehomoMapList = this.platformProjectCertificationInventoryEOService.getPrehomoStatistice(pciEoList); + int preHomoCount = 0; + if (CollectionUtils.isNotEmpty(prehomoMapList)) { + for (Map prehomo : prehomoMapList) { + preHomoCount += (int) prehomo.get("taskAffirmStatusCount"); + } + } + prehomoMap.put("prehomoMapList",prehomoMapList); + prehomoMap.put("count",preHomoCount); + result.put("prehomoMap",prehomoMap); + + // 认证进度 统计 + List> allMapList = this.platformProjectCertificationInventoryEOService.getAllCertificationProgressStatistics(pciEoList); + List> carMapList = this.platformProjectCertificationInventoryEOService.getCarCertificationProgressStatistics(pciEoList); + List> partMapList = this.platformProjectCertificationInventoryEOService.getPartCertificationProgressStatistics(pciEoList); + certificationProgressMap.put("allMapList",allMapList);// 全部 + certificationProgressMap.put("carMapList",carMapList);// 整车 + certificationProgressMap.put("partMapList",partMapList);// 零部件 + int allCount = 0; + if(CollectionUtils.isNotEmpty(allMapList)){ + for (Map all : allMapList) { + allCount += (int) all.get("certificationProgressCount"); + } + } + int carCount = 0; + if(CollectionUtils.isNotEmpty(carMapList)){ + for (Map car : carMapList) { + carCount += (int) car.get("certificationProgressCount"); + } + } + int partCount = 0; + if(CollectionUtils.isNotEmpty(partMapList)){ + for (Map part : partMapList) { + partCount += (int) part.get("certificationProgressCount"); + } + } + + certificationProgressMap.put("allCount",allCount);// 全部 + certificationProgressMap.put("carCount",carCount);// 整车 + certificationProgressMap.put("partCount",partCount);// 零部件 + result.put("certificationProgressMap",certificationProgressMap); + } + + return result; + } +// @Override +// public Map getProjectDetailsStatistics(String id) { +// Map result = new HashMap<>(); +// +// //当前项目状态 +// Map currentProjectStatusMap = new HashMap<>(); +// //清单确认 +// Map listingToConfirmMap = new HashMap<>(); +// //任务确认 +// Map taskToConfirmMap = new HashMap<>(); +// //设计符合性 +// Map designComplianceMap = new HashMap<>(); +// //prehomo确认 +// Map prehomoMap = new HashMap<>(); +// //验证符合性 +// Map verifyComplianceMap = new HashMap<>(); +// //认证进度 +// Map certificationProgressMap = new HashMap<>(); +// +// //清单确认统计 +// List> listingToConfirmMapList = this.platformProjectLawsInventoryEOMapper.getlistingToConfirmStatistics(id); +// listingToConfirmMap.put("listingToConfirmMapList",listingToConfirmMapList); +// result.put("listingToConfirmMap",listingToConfirmMap); +// +// //任务确认统计 +// List> taskToConfirmMapList = this.platformProjectLawsInventoryEOMapper.getTaskToConfirmStatistics(id); +// taskToConfirmMap.put("taskToConfirmMapList",taskToConfirmMapList); +// result.put("taskToConfirmMap",taskToConfirmMap); +// +// QueryWrapper lawsInventoryEOQueryWrapper = new QueryWrapper<>(); +// lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,id); +// //lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getInventoryAffirmStatus, InventoryAffirmStatusEnum.ACCEPTED.getValue()); +// //lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getTaskAffirmStatus, TaskAffirmStatusEnum.ACCEPTED.getValue()); +// List projectLawsInventoryEOList = platformProjectLawsInventoryEOMapper.selectList(lawsInventoryEOQueryWrapper); +// if(CollectionUtils.isNotEmpty(projectLawsInventoryEOList)){ +// List projectLawsInventoryIdList = projectLawsInventoryEOList.stream().distinct().map(ProjectLawsInventoryEO::getId).collect(Collectors.toList()); +// +// //当前项目状态统计 获取一个 最差的结果 统计的数据 就是studio看到的数据。 +// List> currentProjectStatusMapList = new ArrayList<>(); +// CurrentProjectStatusEnum[] values = CurrentProjectStatusEnum.values(); +// for (CurrentProjectStatusEnum value : values) { +// Map map = new HashMap<>(); +// map.put("color",value.getValue()); +// currentProjectStatusMapList.add(map); +// } +// int currentProjectStatusTotal; +// List projectStatusAssessList = this.conditionAssessmentEOService.getProjectStatusAssessList(projectLawsInventoryIdList); +// +// for (Map map : currentProjectStatusMapList) { +// List collect = projectStatusAssessList.stream().filter( +// projectStatusAssess -> StringUtils.equals(projectStatusAssess.getConditionAssessment(),map.get("color").toString()) +// ).collect(Collectors.toList()); +// map.put("conditionAssessmentCount",collect.size()); +// } +// +// currentProjectStatusTotal = currentProjectStatusMapList.stream().filter( +// currentProjectStatus -> Integer.parseInt(currentProjectStatus.get("conditionAssessmentCount").toString()) != 0 +// ).mapToInt(currentProjectStatus -> Integer.parseInt(currentProjectStatus.get("conditionAssessmentCount").toString())).sum(); +// +// currentProjectStatusMap.put("currentProjectStatusMapList",currentProjectStatusMapList); +// currentProjectStatusMap.put("currentProjectStatusTotal",currentProjectStatusTotal); +// result.put("currentProjectStatusMap",currentProjectStatusMap); +// +// //设计符合性 +// List> designComplianceMapList = this.projectTaskInventoryEOMapper.getDesignComplianceStatistice(projectLawsInventoryIdList); +// designComplianceMap.put("designComplianceMapList",designComplianceMapList); +// result.put("designComplianceMap",designComplianceMap); +// +// //prehomo确认 +// List> prehomoMapList = this.projectTaskInventoryEOMapper.getPrehomoStatistice(projectLawsInventoryIdList); +// prehomoMap.put("prehomoMapList",prehomoMapList); +// result.put("prehomoMap",prehomoMap); +// +// //验证符合性 +// List> verifyComplianceMapList = this.projectTaskInventoryEOMapper.getVerifyComplianceStatistice(projectLawsInventoryIdList); +// verifyComplianceMap.put("verifyComplianceMapList",verifyComplianceMapList); +// result.put("verifyComplianceMap",verifyComplianceMap); +// +// //认证进度统计 +// int certificationProgressTotal; +// List> certificationProgressMapList = this.projectTaskInventoryEOMapper.getCertificationProgressStatistics(projectLawsInventoryIdList); +// certificationProgressTotal = certificationProgressMapList.stream().filter( +// certificationProgress -> Integer.parseInt(certificationProgress.get("certificationProgressCount").toString()) != 0 +// ).mapToInt(certificationProgress -> Integer.parseInt(certificationProgress.get("certificationProgressCount").toString())).sum(); +// +// CertificationProgressEnum[] CertificationProgressEnumValues = CertificationProgressEnum.values(); +// for (CertificationProgressEnum certificationProgressEnumValue : CertificationProgressEnumValues) { +// boolean flag = true; +// for (Map map : certificationProgressMapList) { +// if(map.get("certificationProgress") != null){ +// if(StringUtils.equals(certificationProgressEnumValue.getValue(),map.get("certificationProgress").toString())){ +// flag = false; +// break; +// } +// } +// } +// if(flag){ +// Map map = new HashMap<>(); +// map.put("certificationProgress",certificationProgressEnumValue.getValue()); +// map.put("certificationProgressCount",0); +// certificationProgressMapList.add(map); +// } +// } +// +// certificationProgressMap.put("certificationProgressTotal",certificationProgressTotal); +// certificationProgressMap.put("certificationProgressMapList",certificationProgressMapList); +// result.put("certificationProgressMap",certificationProgressMap); +// } +// +// return result; +// } + + /** + * 项目详情-统计接口-根据领域分组 + * @param params + * @return + */ + @Override + public Map getProjectDetailsStatisticsGroupByTerritory(Map params) { + String operatorType = (String) params.get("operatorType"); + String projectLibraryId = (String) params.get("projectLibraryId"); + if(StringUtils.isEmpty(projectLibraryId)){ + throw new JeroBootException("项目库id不能为空!"); + } + String cut = (String) params.get("cut"); + Map result = new HashMap<>(); + List> dataList = new ArrayList<>(); + + QueryWrapper lawsInventoryEOQueryWrapper = new QueryWrapper<>(); + lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); + List projectLawsInventoryEOList = platformProjectLawsInventoryEOMapper.selectList(lawsInventoryEOQueryWrapper); + + List sysDictItems = new ArrayList<>(); + // 法规清单所有的责任领域 + String pliDutyTerritoryStr = projectLawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getDutyTerritory).collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(pliDutyTerritoryStr)) { + List pliDutyTerritoryList = Arrays.asList(pliDutyTerritoryStr.split(",")).stream().distinct().collect(Collectors.toList()); + sysDictItems = this.sysDictItemServiceImpl.selectItemsAll().stream().filter(sysDictItem -> { + boolean flag = false; + for (String pliDutyTerritory : pliDutyTerritoryList) { + if(StringUtils.equals(sysDictItem.getItemValue(),pliDutyTerritory)){ + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + + Map pliEoMap = new HashMap<>(); + + Map> firstLevelDutyTerritoryMapFG = this.sysDictItemServiceImpl.getFirstLevelSysDictItemByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue(),sysDictItems); + if(ObjectUtils.isNotEmpty(firstLevelDutyTerritoryMapFG)){ + // 根据责任领域组装法规清单数据,后续计算使用 + for (Map.Entry> firstLevelMap : firstLevelDutyTerritoryMapFG.entrySet()) { + String key = firstLevelMap.getKey(); + List dutyTerritoryList = firstLevelMap.getValue(); + if(StringUtils.isEmpty(key) || CollectionUtils.isEmpty(dutyTerritoryList)){ + continue; + } + List pliEoList = projectLawsInventoryEOList.stream().filter(pliEo -> { + boolean flag = false; + for (SysDictItem dutyTerritory : dutyTerritoryList) { + if (StringUtils.contains(pliEo.getDutyTerritory(), dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + + JSONObject json = new JSONObject(); + json.put("dutyTerritoryList",dutyTerritoryList); + json.put("pliEoList",pliEoList); + pliEoMap.put(key,json); + } + } + String status = (String) params.get("status"); + if (CollectionUtils.isNotEmpty(projectLawsInventoryEOList)) { + for (Map.Entry pliMap : pliEoMap.entrySet()) { + String key = pliMap.getKey(); + JSONObject json = (JSONObject) pliMap.getValue(); + List pliEoList = (List) json.get("pliEoList"); + Map dataMaps = new HashMap<>(); + if(StringUtils.equals(OperatorTypeEnum.QUERY_FG_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getFGTaskToConfirmStatisticsGroupByTerritory(pliEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getDesignComplianceStatisticeGroupByTerritory(pliEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getVerifyComplianceStatisticeGroupByTerritory(pliEoList,params); + } + if(ObjectUtils.isEmpty(dataMaps)){ + continue; + } + Map dataMap = (Map) dataMaps.get(status); + double amount = (double) dataMap.get("amount"); + if(amount != 0){ + dataMap.put("dutyTerritoryName",key); + dataList.add(dataMap); + } + } + if(CollectionUtils.isNotEmpty(dataList)){ + this.projectDetailsStatisticsGroupByTerritoryHearSort(dataList,params); + result.put("dataList",dataList); + return result; + } +// if(StringUtils.equals(OperatorTypeEnum.QUERY_FG_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ +// if(ObjectUtils.isNotEmpty(pliEoMap)){ +// +// List> dataList = new ArrayList<>(); +// for (Map.Entry pliMap : pliEoMap.entrySet()) { +// String key = pliMap.getKey(); +// JSONObject json = (JSONObject) pliMap.getValue(); +// List pliEoList = (List) json.get("pliEoList"); +// Map dataMaps = this.projectLibraryStatisticsService.getFGTaskToConfirmStatisticsGroupByTerritory(pliEoList,params); +// Map dataMap = (Map) dataMaps.get(status); +// double amount = (double) dataMap.get("amount"); +// if(amount != 0){ +// dataMap.put("dutyTerritoryName",key); +// dataList.add(dataMap); +// } +// } +// result.put("dataList",dataList); +// } +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CURRENT_PROJECT_STATUS_STATISTICS.getValue(),operatorType)){ +// params.put("projectLawsInventoryIdList",projectLawsInventoryIdList); +// List> conditionAssessmentMapList = this.conditionAssessmentEOService.getProjectStatusAssessStatisticsGroupByTerritory(params); +// disposeData(conditionAssessmentMapList,cut); +// result.put("dataList",conditionAssessmentMapList); +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_LISTING_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ +// //清单确认 状态 +// String inventoryAffirmStatus = (String) params.get("inventoryAffirmStatus"); +// List> listingToConfirmList = this.platformProjectLawsInventoryEOMapper.getListingToConfirmStatisticsGroupByTerritory(projectLibraryId,inventoryAffirmStatus); +// disposeData(listingToConfirmList,cut); +// result.put("dataList",listingToConfirmList); +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ +// //任务确认 状态 +// String taskAffirmStatus = (String) params.get("taskAffirmStatus"); +// List> taskToConfirmList = this.platformProjectLawsInventoryEOMapper.getTaskToConfirmStatisticsGroupByTerritory(projectLibraryId,taskAffirmStatus); +// disposeData(taskToConfirmList,cut); +// result.put("dataList",taskToConfirmList); +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){ +// //设计符合性 +// List> dataList = new ArrayList<>(); +// for (Map.Entry pliMap : pliEoMap.entrySet()) { +// String key = pliMap.getKey(); +// JSONObject json = (JSONObject) pliMap.getValue(); +// List pliEoList = (List) json.get("pliEoList"); +// Map dataMaps = this.projectLibraryStatisticsService.getDesignComplianceStatisticeGroupByTerritory(pliEoList,params); +// Map dataMap = (Map) dataMaps.get(status); +// double amount = (double) dataMap.get("amount"); +// if(amount != 0){ +// dataMap.put("dutyTerritoryName",key); +// dataList.add(dataMap); +// } +// } +// result.put("dataList",dataList); +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){ +// //prehomo确认 流程任务状态 +// String prehomoFlowTaskStatus = (String) params.get("prehomoFlowTaskStatus"); +// if(CollectionUtils.isNotEmpty(projectLawsInventoryIdList)){ +// List> prehomoList = this.projectTaskInventoryEOMapper.getPrehomoStatisticeGroupByTerritory(projectLawsInventoryIdList,prehomoFlowTaskStatus); +// disposeData(prehomoList,cut); +// result.put("dataList",prehomoList); +// } +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){ +// //验证符合性 流程任务状态 +// List> dataList = new ArrayList<>(); +// for (Map.Entry pliMap : pliEoMap.entrySet()) { +// String key = pliMap.getKey(); +// JSONObject json = (JSONObject) pliMap.getValue(); +// List pliEoList = (List) json.get("pliEoList"); +// Map dataMaps = this.projectLibraryStatisticsService.getVerifyComplianceStatisticeGroupByTerritory(pliEoList,params); +// Map dataMap = (Map) dataMaps.get(status); +// double amount = (double) dataMap.get("amount"); +// if(amount != 0){ +// dataMap.put("dutyTerritoryName",key); +// dataList.add(dataMap); +// } +// } +// result.put("dataList",dataList); +// }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS.getValue(),operatorType)){ +// //认证进度 流程任务状态 +// String certificationProgress = (String) params.get("certificationProgress"); +// +// if(CollectionUtils.isNotEmpty(projectLawsInventoryIdList)){ +// List> certificationProgressList = this.projectTaskInventoryEOMapper.getCertificationProgressStatisticsGroupByTerritory(projectLawsInventoryIdList,certificationProgress); +// disposeData(certificationProgressList,cut); +// result.put("dataList",certificationProgressList); +// } +// } + } + + Map pciEoMap = new HashMap<>(); + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); + List projectCertificationInventoryEOList = this.platformProjectCertificationInventoryEOService.list(pciQueryWrap); + String pciDutyTerritoryStr = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyTerritory).collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(pciDutyTerritoryStr)) { + List pciDutyTerritoryList = Arrays.asList(pciDutyTerritoryStr.split(",")).stream().distinct().collect(Collectors.toList()); + sysDictItems = this.sysDictItemServiceImpl.selectItemsAll().stream().filter(sysDictItem -> { + boolean flag = false; + for (String pliDutyTerritory : pciDutyTerritoryList) { + if(StringUtils.equals(sysDictItem.getItemValue(),pliDutyTerritory)){ + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + Map> firstLevelDutyTerritoryMapRZ = this.sysDictItemServiceImpl.getFirstLevelSysDictItemByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue(),sysDictItems); + if(ObjectUtils.isNotEmpty(firstLevelDutyTerritoryMapRZ)){ + // 根据责任领域组装法规清单数据,后续计算使用 + for (Map.Entry> firstLevelMap : firstLevelDutyTerritoryMapRZ.entrySet()) { + String key = firstLevelMap.getKey(); + List dutyTerritoryList = firstLevelMap.getValue(); + if(StringUtils.isEmpty(key) || CollectionUtils.isEmpty(dutyTerritoryList)){ + continue; + } + List pciEoList = projectCertificationInventoryEOList.stream().filter(pciEo -> { + boolean flag = false; + for (SysDictItem dutyTerritory : dutyTerritoryList) { + if (StringUtils.contains(pciEo.getDutyTerritory(), dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + + JSONObject json = new JSONObject(); + json.put("dutyTerritoryList",dutyTerritoryList); + json.put("pciEoList",pciEoList); + pciEoMap.put(key,json); + } + } + if (CollectionUtils.isNotEmpty(projectCertificationInventoryEOList) && ObjectUtils.isNotEmpty(pciEoMap)) { + for (Map.Entry pciMap : pciEoMap.entrySet()) { + String key = pciMap.getKey(); + JSONObject json = (JSONObject) pciMap.getValue(); + List pciEoList = (List) json.get("pciEoList"); + Map dataMaps = new HashMap<>(); + if(StringUtils.equals(OperatorTypeEnum.QUERY_RZ_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getRZTaskToConfirmStatisticsGroupByTerritory(pciEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getPrehomoStatisticeGroupByTerritory(pciEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_ALL.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getAllCertificationProgressStatisticsGroupByTerritory(pciEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_CAR.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getCarCertificationProgressStatisticsGroupByTerritory(pciEoList,params); + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_PART.getValue(),operatorType)){ + dataMaps = this.projectLibraryStatisticsService.getPartCertificationProgressStatisticsGroupByTerritory(pciEoList,params); + } + if(ObjectUtils.isEmpty(dataMaps)){ + continue; + } + Map dataMap = (Map) dataMaps.get(status); + double amount = (double) dataMap.get("amount"); + if(amount != 0){ + dataMap.put("dutyTerritoryName",key); + dataList.add(dataMap); + } + } + this.projectDetailsStatisticsGroupByTerritoryHearSort(dataList,params); + result.put("dataList",dataList); + } + return result; + } + + /** + * 项目库详情统计-根据责任领域分组统计数据-表头排序 + * @param dataList + * @param params + */ + private void projectDetailsStatisticsGroupByTerritoryHearSort(List> dataList,Map params) { + String orderByField = (String) params.get("orderByField"); + String orderBy = (String) params.get("orderBy"); + if(CollectionUtils.isNotEmpty(dataList)){ + Collator comparator = Collator.getInstance(Locale.CHINESE); + Collections.sort(dataList,(data1,data2)->{ + String param1 = ""; + String param2 = ""; + // 一级责任领域名称 + if("dutyTerritoryName".equals(orderByField)){ + param1 = StringUtils.isNotEmpty((String) data1.get("dutyTerritoryName")) ? (String) data1.get("dutyTerritoryName") : ""; + param2 = StringUtils.isNotEmpty((String) data2.get("dutyTerritoryName")) ? (String) data2.get("dutyTerritoryName") : ""; + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + return comparator.compare(param1,param2); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + return comparator.compare(param2,param1); + } + } + // 数量 + if(StringUtils.isEmpty(orderByField) || "amount".equals(orderByField)){ + double p1 = data1.get("amount") != null ? (double) data1.get("amount") : 0; + double p2 = data2.get("amount") != null ? (double) data2.get("amount") : 0; + if(StringUtils.isEmpty(orderBy) || OrderEnum.POSITIVE.getValue().equals(orderBy)){ + return (int)(p1 - p2); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + return (int)(p2 - p1); + } + } + // 占比 + if("percentage".equals(orderByField)){ + double p1 = StringUtils.isNotEmpty((String) data1.get("percentage")) ? Double.parseDouble (((String) data1.get("percentage")).replace("%","")) : 0; + double p2 = StringUtils.isNotEmpty((String) data2.get("percentage")) ? Double.parseDouble (((String) data2.get("percentage")).replace("%","")) : 0; + if(OrderEnum.POSITIVE.getValue().equals(orderBy)){ + return (int)(p1 - p2); + }else if(OrderEnum.REVERSE.getValue().equals(orderBy)){ + return (int)(p2 - p1); + } + } + return 0; + }); + } + } + + @Override + public void exportProjectDetailsStatisticsGroupByTerritoryXls(HttpServletResponse response, HttpServletRequest request, Map params) { + Map projectDetailsStatisticsGroupByTerritory = getProjectDetailsStatisticsGroupByTerritory(params); + String operatorType = (String) params.get("operatorType"); + String cut = (String) params.get("cut"); + String sheetName = ""; + String title = ""; + if (StringUtils.equals(cut,CutEnum.CN.getValue())) { + title = "责任领域,数量,责任领域内占比"; + if(StringUtils.equals(OperatorTypeEnum.QUERY_FG_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + sheetName = "法规任务确认"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){ + sheetName = "设计符合性"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){ + sheetName = "验证符合性"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_RZ_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + sheetName = "认证任务确认"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){ + sheetName = "Pre-Homo流程"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_ALL.getValue(),operatorType)){ + sheetName = "认证进度"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_CAR.getValue(),operatorType)){ + sheetName = "认证进度"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_PART.getValue(),operatorType)){ + sheetName = "认证进度"; + } + /*if(StringUtils.equals(OperatorTypeEnum.QUERY_CURRENT_PROJECT_STATUS_STATISTICS.getValue(),operatorType)){ + sheetName = "项目状态"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_LISTING_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + sheetName = "清单确认"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + sheetName = "任务确认"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){ + sheetName = "设计符合性"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){ + sheetName = "Pre-homo"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){ + sheetName = "验证符合性"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS.getValue(),operatorType)){ + sheetName = "认证进度"; + }*/ + }else if (StringUtils.equals(cut,CutEnum.EN.getValue())) { + title = "Responsible Field,Quantity,Proportion within the area of responsibility"; + if(StringUtils.equals(OperatorTypeEnum.QUERY_FG_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + sheetName = "Regulation Task Confirmation"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){ + sheetName = "Design Compliance"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){ + sheetName = "Verify Compliance"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_RZ_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + sheetName = "Certification Task Confirmation"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){ + sheetName = "Pre-Homo flow"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_ALL.getValue(),operatorType)){ + sheetName = "Homologation Progress"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_CAR.getValue(),operatorType)){ + sheetName = "Homologation Progress"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS_PART.getValue(),operatorType)){ + sheetName = "Homologation Progress"; + } + /*if(StringUtils.equals(OperatorTypeEnum.QUERY_CURRENT_PROJECT_STATUS_STATISTICS.getValue(),operatorType)){ + sheetName = "Project status"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_LISTING_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + sheetName = "Listing to confirm"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_TASK_TO_CONFIRM_STATISTICS.getValue(),operatorType)){ + sheetName = "Task to confirm"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_DESIGN_STATISTICS.getValue(),operatorType)){ + sheetName = "Design compliance"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_PREHOMO_STATISTICS.getValue(),operatorType)){ + sheetName = "Pre-homo"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_VERIFY_STATISTICS.getValue(),operatorType)){ + sheetName = "Verify compliance"; + }else if(StringUtils.equals(OperatorTypeEnum.QUERY_CERTIFICATION_PROGRESS_STATISTICS.getValue(),operatorType)){ + sheetName = "Certification progress"; + }*/ + } + + + OutputStream os = null; + HSSFWorkbook workbook = new HSSFWorkbook(); + + try { + String fileName = sheetName + ".xlsx"; + response.setHeader("Content-Disposition", + "attachment; filename=" + fileName); + response.setContentType("application/force-download"); + + HSSFSheet sheet = workbook.createSheet(sheetName); + + String[] titleArr = title.split(","); + Row firstRow = sheet.createRow(0); + + CellStyle cellStyleTitle = workbook.createCellStyle(); + cellStyleTitle.setAlignment(HorizontalAlignment.CENTER); + for (int i = 0; i < 3; i++){ + sheet.setColumnWidth(i, 5000); + Cell cell = firstRow.createCell(i); + cell.setCellStyle(cellStyleTitle); + cell.setCellValue(titleArr[i]); + } + + createSheetData(sheet,projectDetailsStatisticsGroupByTerritory,params); + + 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"); + } + } + } + + public void createSheetData(HSSFSheet sheet,Map exportDataMap, Map params){ + List> exportDataList = (List>) exportDataMap.get("dataList"); + int rowIndex = 1; + for (int dataIndex = 0; dataIndex < exportDataList.size(); dataIndex++) { + Row dataRow = sheet.createRow(rowIndex); + dataRow.createCell(0).setCellValue(exportDataList.get(dataIndex).get("dutyTerritoryName").toString()); + dataRow.createCell(1).setCellValue(String.valueOf(Math.round((Double) exportDataList.get(dataIndex).get("amount")))); + dataRow.createCell(2).setCellValue(exportDataList.get(dataIndex).get("percentage").toString()); + rowIndex ++; + } + } + + /** + * 处理 根据领域统计的数据 + * @param datas + * @param cut + */ + public void disposeData(List> datas,String cut){ + List dutyTerritoryList = sysDictItemServiceImpl.selectItemsByDictCode("duty_territory"); + if(CollectionUtils.isNotEmpty(datas)){ + for (Map data : datas) { + if(data.get("dutyTerritory") != null){ + String[] dutyTerritorieArr = data.get("dutyTerritory").toString().split(","); + String dutyTerritories = ""; + for (String dutyTerritorie : dutyTerritorieArr) { + List collect = new ArrayList<>(); + if(StringUtils.equals(cut,CutEnum.CN.getValue())){ + collect = dutyTerritoryList.stream() + .filter(e -> StringUtils.equals(dutyTerritorie, e.getItemValue())) + .map(SysDictItem::getItemText) + .collect(Collectors.toList()); + }else if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + collect = dutyTerritoryList.stream() + .filter(e -> StringUtils.equals(dutyTerritorie, e.getItemValue())) + .map(SysDictItem::getEnName) + .collect(Collectors.toList()); + } + if(CollectionUtils.isNotEmpty(collect)){ + dutyTerritories += collect.get(0) + ","; + } + } + + if(StringUtils.isNotEmpty(dutyTerritories)){ + dutyTerritories = dutyTerritories.substring(0,dutyTerritories.length()-1); + } +// data.put("dutyTerritory",dutyTerritories); + data.put("dutyTerritoryName",dutyTerritories); + } + } + } + } + + @Override + public void top(String id, String flag) { + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + ProjectLibraryBase projectLibraryBase = this.getById(id); + //置顶的时候将取消置顶标识传过来即:flag=1 + if(TopEnum.TOP_CANCEL.getValue().equals(flag)){ + TopProjectEO topProjectEO = new TopProjectEO(); + topProjectEO.setProjectLibraryBaseId(id); + topProjectEO.setFlag(TopEnum.TOP_CANCEL.getValue()); + topProjectEO.setCreateBy(loginUser.getUsername()); + + //置顶 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(TopProjectEO::getCreateBy,loginUser.getUsername()).orderByDesc(TopProjectEO::getSort); + List list = iTopProjectEOService.list(wrapper); + if(list.size() != 0){ + String sort = list.get(0).getSort(); + int sortTemp = Integer.valueOf(sort) + 1; + topProjectEO.setSort(String.valueOf(sortTemp)); + }else{ + //首个置顶的项目排序为1 + topProjectEO.setSort("1"); + } + iTopProjectEOService.save(topProjectEO); + + }else{ + //取消置顶 + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(TopProjectEO::getCreateBy,loginUser.getUsername()).in(TopProjectEO::getProjectLibraryBaseId,id); + iTopProjectEOService.remove(wrapper); + } + } +// @Override +// public void top(String id, String flag) { +// ProjectLibraryBase projectLibraryBase = this.getById(id); +// //置顶的时候将取消置顶标识传过来即:flag=1 +// if(TopEnum.TOP_CANCEL.getValue().equals(flag)){ +// //置顶 +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.isNotNull(ProjectLibraryBase::getSort).orderByDesc(ProjectLibraryBase::getSort); +// List list = this.list(wrapper); +// if(list.size() != 0){ +// String sort = list.get(list.size() - 1).getSort(); +// int sortTemp = Integer.valueOf(sort) + 1; +// projectLibraryBase.setSort(String.valueOf(sortTemp)); +// }else{ +// //首个置顶的项目排序为1 +// projectLibraryBase.setSort("1"); +// } +// projectLibraryBase.setFlag(TopEnum.TOP_CANCEL.getValue()); +// this.updateById(projectLibraryBase); +// +// }else{ +// //取消置顶 +// LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); +// updateWrapper.in(ProjectLibraryBase::getId,id); +// updateWrapper.set(ProjectLibraryBase::getSort,null).set(ProjectLibraryBase::getFlag,null); +// this.update(projectLibraryBase,updateWrapper); +// } +// } + + @Override + public List getVersionsInfo(String id) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(ProjectLibraryBase::getId,id).or().in(ProjectLibraryBase::getParentId,id); + List list = this.list(wrapper); + List result = new ArrayList<>(); + if(list.size() != 0){ + result = list.stream().map(ProjectLibraryBase::getProjectVersion).collect(Collectors.toList()); + Collections.sort(result); + } + return result; + } + + /** + * 版本统计 + * @param id + * @return + */ + @Override + public List versionStatistics(String id) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(ProjectLibraryBase::getId,id).or().in(ProjectLibraryBase::getParentId,id); + List list = this.list(wrapper); + if(list.size() != 0){ +// Collections.sort(list); + } + return list; + } + + /** + * 通过主项目id和子项目版本号 + * @param version + * @param parentId + * @return + */ + @Override + public String getIdByVersionAndParentId(String version, String parentId) { + if ("00".equals(version)) { + return parentId; + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ProjectLibraryBase::getProjectVersion,version); + wrapper.eq(ProjectLibraryBase::getParentId, parentId); + List list = this.list(wrapper); + if (CollectionUtils.isNotEmpty(list)) { + return list.get(0).getId(); + } else { + return null; + } + + } + + @Override + public List getParentAndChildern(String parentId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ProjectLibraryBase::getId,parentId); + wrapper.or().eq(ProjectLibraryBase::getParentId, parentId); + List list = this.list(wrapper); + return list; + } + + @Override + public ProjectLibraryBase selectById(String projectLibraryId) { + ProjectLibraryBase result = null; + List records = this.platformProjectLibraryBaseMapper.queryById(projectLibraryId); + if(CollectionUtils.isNotEmpty(records)){ + List studioEngineerUserIdList = records.stream().map(ProjectLibraryBase::getStudioEngineer).distinct().collect(Collectors.toList()); + List studioEngineerUserInfo = this.sysUserService.querySysUserListByIdList(studioEngineerUserIdList); + disposeData(records,"",false); + + List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); + for(ProjectLibraryBase projectLibraryBase: records){ + //历史数据的主版本没有版本号,所以默认给00 + if(StringUtils.isBlank(projectLibraryBase.getParentId()) && StringUtils.isBlank(projectLibraryBase.getProjectVersion())){ + projectLibraryBase.setProjectVersion("00"); + } + //目标市场 英文 + Map paramEn = new HashMap<>(); + paramEn.put("cut",CutEnum.EN.getValue()); + String targetMarketEn = getMarket(paramEn, targetMarketList, projectLibraryBase); + + //目标市场 中文 + Map paramCn = new HashMap<>(); + paramCn.put("cut",CutEnum.CN.getValue()); + String targetMarketCn = getMarket(paramCn, targetMarketList, projectLibraryBase); + + //主项目的版本号 + String projectVersion = ""; + if(StringUtils.isBlank(projectLibraryBase.getParentId())){ + projectVersion = "00"; + }else{ + projectVersion = projectLibraryBase.getProjectVersion(); + } + if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){ + projectLibraryBase.setProjectNameEn(projectLibraryBase.getProjectName() + + "-" + projectLibraryBase.getYearName() + + "-" + targetMarketEn + + "-" + projectVersion); + + projectLibraryBase.setProjectNameCn(projectLibraryBase.getProjectName() + + "-" + projectLibraryBase.getYearName() + + "-" + targetMarketCn + + "-" + projectVersion); + }else{ + //projectLibraryBase.getYearName()为空的时候代表为平台件数据 + projectLibraryBase.setProjectNameEn(projectLibraryBase.getPower()+"-"+projectLibraryBase.getProducer()+"-"+targetMarketEn); + + projectLibraryBase.setProjectNameCn(projectLibraryBase.getPower()+"-"+projectLibraryBase.getProducer()+"-"+targetMarketCn); + } + + if(StringUtils.isNotEmpty(projectLibraryBase.getStudioEngineer())){ + if(CollectionUtils.isNotEmpty(studioEngineerUserInfo)){ + String studioEngineerUserName = studioEngineerUserInfo.stream().filter(studioEngineerUser -> { + boolean flag = false; + if (StringUtils.equals(projectLibraryBase.getStudioEngineer(), studioEngineerUser.getId())) { + flag = true; + } + return flag; + }).map(SysUser::getUsername).collect(Collectors.joining(",")); + + projectLibraryBase.setStudioEngineerName(studioEngineerUserName); + } + } + } + + result = records.get(0); + } + return result; + } + + /** + * 对接火山引擎接口-获取项目统计信息 + * @return + */ + @Override + public JSONArray getProjectInfo() { + Date now = new Date(); + List plbList = this.getList(new ProjectLibraryBase()); + JSONArray resList = new JSONArray(); + for (ProjectLibraryBase plb: plbList) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("projectId",plb.getId()); + jsonObject.put("projectName",plb.getShowName()); + List> TimeNodeVOsList = projectTaskPlanningService.queryByProjectId(plb.getId(),CutEnum.CN.getValue()); + //获取前置节点 + TimeNodeVO preNodeTnVo = null; + //获取后置节点 + TimeNodeVO postNodeTnVo = null; + if (ObjectUtils.isNotEmpty(TimeNodeVOsList) && TimeNodeVOsList.size() > 0) { + List TimeNodeVOList = TimeNodeVOsList.get(0); + for (TimeNodeVO tnVo : TimeNodeVOList) { + if(tnVo.isG()){ + continue; + } + if (null != postNodeTnVo) { + break; + } + tnVo.setProjectId(plb.getId()); + if (now.after(tnVo.getTime())) { + preNodeTnVo = tnVo; + } + if (now.before(tnVo.getTime())) { + postNodeTnVo = tnVo; + } + } + } + JSONArray preNodeList = getNodeList(preNodeTnVo); + jsonObject.put("preNode", preNodeList); + JSONArray postNodeList = getNodeList(postNodeTnVo); + jsonObject.put("postNode",postNodeList); + resList.add(jsonObject); + } + return resList; + } + + @Override + public JSONArray getProjectProgressInfo() { + List plbList = this.getList(new ProjectLibraryBase()); + JSONArray resList = new JSONArray(); + for (ProjectLibraryBase plb: plbList) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("projectId",plb.getId()); + jsonObject.put("projectName",plb.getShowName()); + jsonObject.put("studio",plb.getStudioEngineerName()); + List> TimeNodeVOsList = projectTaskPlanningService.queryByProjectId(plb.getId(),CutEnum.CN.getValue()); + + JSONArray preNodeList = new JSONArray(); + if (ObjectUtils.isNotEmpty(TimeNodeVOsList) && TimeNodeVOsList.size() > 0) { + List TimeNodeVOList = TimeNodeVOsList.get(0); + for (TimeNodeVO tnVo : TimeNodeVOList) { + if(tnVo.isG()){ + continue; + } + tnVo.setProjectId(plb.getId()); + preNodeList.addAll(getNodeProgressList(tnVo)); + } + } + jsonObject.put("preNode", preNodeList); + resList.add(jsonObject); + } + return resList; + } + + @Override + public void exportProjectProgressStatisticsXls(HttpServletResponse response, HttpServletRequest request, Map params) { + String fileName = ""; + String cut = (String) params.get("cut"); + String projectLibraryId = (String) params.get("projectLibraryId"); + if(StringUtils.isEmpty(projectLibraryId)){ + throw new JeroBootException("项目库id不能为空!"); + } + OutputStream ops = null; + HSSFWorkbook workbook = new HSSFWorkbook(); + this.exportRegulatoryManagement(workbook,params); + this.exportCertificationManagement(workbook,params); +// this.exportParameterCollecting(workbook,params); +// this.exportOtaCollecting(workbook,params); + try { + response.setHeader("Content-Disposition", + "attachment; filename=" + fileName); + response.setContentType("application/force-download"); + ops = response.getOutputStream(); + workbook.write(ops); + ops.flush(); + }catch (IOException ex){ + if(CutEnum.CN.getValue().equals(cut)){ + throw new JeroBootException("下载文件失败"); + }else{ + throw new JeroBootException("Failed to download file"); + } + } + } + + @Override + public List getUserAllDutyTerritoryList(Map params) { + List result = new ArrayList<>(); + List sysDictItems = this.sysDictItemServiceImpl.selectItemsAll(); + List dutyTerritorySdiList = sysDictItems.stream().filter(sysDictItem -> { + return (StringUtils.equals(sysDictItem.getDictCode(), DicCodeEnum.DUTY_TERRITORY.getCode())); + }).collect(Collectors.toList()); + params.put("dutyTerritorySdiList",dutyTerritorySdiList); + + List userAllDutyTerritorySdiList = new ArrayList<>(); + List prpSdiList = this.projectRelatedPersonnelService.getUserDutyTerritoryList(params); + if(CollectionUtils.isNotEmpty(prpSdiList)){ + userAllDutyTerritorySdiList.addAll(prpSdiList); + } + List pliSdiList = this.platformProjectLawsInventoryEOService.getUserDutyTerritoryList(params); + if(CollectionUtils.isNotEmpty(pliSdiList)){ + userAllDutyTerritorySdiList.addAll(pliSdiList); + } + List pciSdiList = this.platformProjectCertificationInventoryEOService.getUserDutyTerritoryList(params); + if(CollectionUtils.isNotEmpty(pciSdiList)){ + userAllDutyTerritorySdiList.addAll(pciSdiList); + } + String projectLibraryId = (String) params.get("projectLibraryId"); + ProjectLibraryBase projectLibraryBase = this.selectById(projectLibraryId); + params.put("parentId",projectLibraryBase.getParentId()); + List pmSdiList = this.paramsManifestEOService.getUserDutyTerritoryList(params); + if(CollectionUtils.isNotEmpty(pmSdiList)){ + userAllDutyTerritorySdiList.addAll(pmSdiList); + } + + userAllDutyTerritorySdiList = userAllDutyTerritorySdiList.stream().distinct().collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(userAllDutyTerritorySdiList)){ + for (SysDictItem sysDictItem : userAllDutyTerritorySdiList) { + DictModel dictModel = new DictModel(); + dictModel.setText(sysDictItem.getItemText()); + dictModel.setTextEn(sysDictItem.getEnName()); + dictModel.setValue(sysDictItem.getItemValue()); + result.add(dictModel); + } + } + return result; + } + + /** + * 全局替换用户 + * @param json + * @return + */ + @Override + public Result overallReplacementUser(JSONObject json) { + this.projectRelatedPersonnelService.replacementUser(json); + this.platformProjectLawsInventoryEOService.replacementUser(json); + this.platformProjectCertificationInventoryEOService.replacementUser(json); + String projectLibraryId = json.getString("projectLibraryId"); + ProjectLibraryBase projectLibraryBase = this.selectById(projectLibraryId); + json.put("parentId",projectLibraryBase.getParentId()); + this.paramsManifestEOService.replacementUser(json); + return Result.OK("全局替换成功!"); + } + + /** + * 导出法规符合性管理 + * @param workbook + * @param params + */ + private void exportRegulatoryManagement(HSSFWorkbook workbook,Map params) { + String cut = (String) params.get("cut"); + String sheetName = "法规符合性管理"; + String firstTitle = "法规任务确认," + + "设计符合性确认," + + "验证符合性确认"; + String secondTitle = "责任领域(一级)," + + "未发起,待确认,接受,拒绝,完成度," + + "未发起,待确认,符合,不符合,完成度," + + "未发起,待确认,符合,不符合,完成度"; + if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + sheetName = "Regulatory compliance management"; + firstTitle = "Regulatory task confirmation," + + "Design Conformity Verification," + + "Verification Conformity Confirmation"; + secondTitle = "Area of responsibility (level 1)," + + "Not launched,To be confirmed,Accept,Refuse,Degree of completion," + + "Not launched,To be confirmed,Meet,Not meet,Degree of completion," + + "Not launched,To be confirmed,Meet,Not meet,Degree of completion"; + } + HSSFSheet sheet = workbook.createSheet(sheetName); + //合并单元格 起始行,结束行,起始列,结束列 + CellRangeAddress region1 = new CellRangeAddress(0, 0, 1, 5); + sheet.addMergedRegion(region1); + CellRangeAddress region2 = new CellRangeAddress(0, 0, 6, 10); + sheet.addMergedRegion(region2); + CellRangeAddress region3 = new CellRangeAddress(0, 0, 11, 15); + sheet.addMergedRegion(region3); + + String[] firstTitleArr = firstTitle.split(","); + String[] secondTitleArr = secondTitle.split(","); + Row firstRow = sheet.createRow(0); + Row secondRow = sheet.createRow(1); + + CellStyle cellStyleTitle = workbook.createCellStyle(); + cellStyleTitle.setAlignment(HorizontalAlignment.CENTER); + for (int i = 0; i <= 15; i++){ + sheet.setColumnWidth(i, 3500); + Cell firstRowCell = firstRow.createCell(i); + firstRowCell.setCellStyle(cellStyleTitle); + if(i == 1){ + firstRowCell.setCellValue(firstTitleArr[0]); + }else if(i==6){ + firstRowCell.setCellValue(firstTitleArr[1]); + }else if(i==11){ + firstRowCell.setCellValue(firstTitleArr[2]); + } + + Cell secondRowCell = secondRow.createCell(i); + secondRowCell.setCellValue(secondTitleArr[i]); + } + + String projectLibraryId = (String) params.get("projectLibraryId"); + + QueryWrapper pliQueryWrap = new QueryWrapper<>(); + pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); + List pliEOList = this.platformProjectLawsInventoryEOMapper.selectList(pliQueryWrap); + List sysDictItems = new ArrayList<>(); + String pliDutyTerritoryStr = pliEOList.stream().map(ProjectLawsInventoryEO::getDutyTerritory).collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(pliDutyTerritoryStr)) { + List pliDutyTerritoryList = Arrays.asList(pliDutyTerritoryStr.split(",")).stream().distinct().collect(Collectors.toList()); + sysDictItems = this.sysDictItemServiceImpl.selectItemsAll().stream().filter(sysDictItem -> { + boolean flag = false; + for (String pliDutyTerritory : pliDutyTerritoryList) { + if(StringUtils.equals(sysDictItem.getItemValue(),pliDutyTerritory)){ + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + + Map> firstLevelDutyTerritoryMap = this.sysDictItemServiceImpl.getFirstLevelSysDictItemByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue(),sysDictItems); + if(ObjectUtils.isNotEmpty(firstLevelDutyTerritoryMap)){ + int dataIndex = 2; + for (Map.Entry> firstLevelMap : firstLevelDutyTerritoryMap.entrySet()) { + String key = firstLevelMap.getKey(); + List dutyTerritoryList = firstLevelMap.getValue(); + if(StringUtils.isEmpty(key) || CollectionUtils.isEmpty(dutyTerritoryList)){ + continue; + } + List pliEoList = pliEOList.stream().filter(pliEo -> { + boolean flag = false; + for (SysDictItem dutyTerritory : dutyTerritoryList) { + if (StringUtils.contains(pliEo.getDutyTerritory(), dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + + this.exportRegulatoryManagementSetData(params, sheet, dataIndex ,key,pliEoList); + dataIndex ++; + } + } + } + + /** + * 导出法规符合性管理-设置数据 + * @param params + * @param sheet + * @param dataIndex + * @param key + * @param pliEoList + */ + private void exportRegulatoryManagementSetData(Map params, HSSFSheet sheet, int dataIndex, String key, List pliEoList) { + Row dataRow = sheet.createRow(dataIndex); + dataRow.createCell(0).setCellValue(key); + + Map taskConfirmMap= this.projectLibraryStatisticsService.getFGTaskToConfirmStatisticsGroupByTerritory(pliEoList, params); + Map taskConfirmNotStartedMap = (Map) taskConfirmMap.get(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + double taskConfirmNotStartedAmount = (double) taskConfirmNotStartedMap.get("amount"); + Map taskConfirmToConfirmMap = (Map) taskConfirmMap.get(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + double taskConfirmToConfirmAmount = (double) taskConfirmToConfirmMap.get("amount"); + Map taskConfirmAcceptedMap = (Map) taskConfirmMap.get(TaskAffirmStatusEnum.ACCEPTED.getValue()); + double taskConfirmAcceptedAmount = (double) taskConfirmAcceptedMap.get("amount"); + Map taskConfirmRejectedMap = (Map) taskConfirmMap.get(TaskAffirmStatusEnum.REJECTED.getValue()); + double taskConfirmRejectedAmount = (double) taskConfirmRejectedMap.get("amount"); + dataRow.createCell(1).setCellValue(taskConfirmNotStartedAmount); + dataRow.createCell(2).setCellValue(taskConfirmToConfirmAmount); + dataRow.createCell(3).setCellValue(taskConfirmAcceptedAmount); + dataRow.createCell(4).setCellValue(taskConfirmRejectedAmount); + double taskConfirmCount = taskConfirmNotStartedAmount + taskConfirmToConfirmAmount + taskConfirmAcceptedAmount + taskConfirmRejectedAmount; + double taskConfirmPercentage = (taskConfirmAcceptedAmount / taskConfirmCount) * 100; + String taskConfirmPercentageStr = (taskConfirmPercentage != 0 && (taskConfirmCount !=0 )) ? df.format(taskConfirmPercentage) : "0"; + dataRow.createCell(5).setCellValue(taskConfirmPercentageStr + percentSign); + + Map designMap = this.projectLibraryStatisticsService.getDesignComplianceStatisticeGroupByTerritory(pliEoList, params); + Map designNotStartedMap = (Map) designMap.get(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + double designNotStartedAmount = (double) designNotStartedMap.get("amount"); + Map designToConfirmMap = (Map) designMap.get(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + double designToConfirmAmount = (double) designToConfirmMap.get("amount"); + Map designComplianceMap = (Map) designMap.get(ComplianceFlowStatusEnum.CONFORMITY.getValue()); + double designComplianceAmount = (double) designComplianceMap.get("amount"); + Map designNonComplianceMap = (Map) designMap.get(ComplianceFlowStatusEnum.INCONFORMITY.getValue()); + double designNonComplianceAmount = (double) designNonComplianceMap.get("amount"); + dataRow.createCell(6).setCellValue(designNotStartedAmount); + dataRow.createCell(7).setCellValue(designToConfirmAmount); + dataRow.createCell(8).setCellValue(designComplianceAmount); + dataRow.createCell(9).setCellValue(designNonComplianceAmount); + double designCount = designNotStartedAmount + designToConfirmAmount + designComplianceAmount + designNonComplianceAmount; + double designPercentage = (designComplianceAmount / designCount) * 100; + String designPercentageStr = (designPercentage != 0 && (designCount !=0 )) ? df.format(designPercentage) : "0"; + dataRow.createCell(10).setCellValue(designPercentageStr + percentSign); + + Map verifyMap = this.projectLibraryStatisticsService.getVerifyComplianceStatisticeGroupByTerritory(pliEoList, params); + Map verifyNotStartedMap = (Map) verifyMap.get(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + double verifyNotStartedAmount = (double) verifyNotStartedMap.get("amount"); + Map verifyToConfirmMap = (Map) verifyMap.get(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + double verifyToConfirmAmount = (double) verifyToConfirmMap.get("amount"); + Map verifyComplianceMap = (Map) verifyMap.get(ComplianceFlowStatusEnum.CONFORMITY.getValue()); + double verifyComplianceAmount = (double) verifyComplianceMap.get("amount"); + Map verifyNonComplianceMap = (Map) verifyMap.get(ComplianceFlowStatusEnum.INCONFORMITY.getValue()); + double verifyNonComplianceAmount = (double) verifyNonComplianceMap.get("amount"); + dataRow.createCell(11).setCellValue(verifyNotStartedAmount); + dataRow.createCell(12).setCellValue(verifyToConfirmAmount); + dataRow.createCell(13).setCellValue(verifyComplianceAmount); + dataRow.createCell(14).setCellValue(verifyNonComplianceAmount); + double verifyCount = verifyNotStartedAmount + verifyToConfirmAmount + verifyComplianceAmount + verifyNonComplianceAmount; + double verifyPercentage = (verifyComplianceAmount / verifyCount) * 100; + String verifyPercentageStr = (verifyPercentage != 0 && (verifyCount !=0 )) ? df.format(verifyPercentage) : "0"; + dataRow.createCell(15).setCellValue(verifyPercentageStr + percentSign); + } + + /** + * 导出认证活动管理 + * @param workbook + * @param params + */ + private void exportCertificationManagement(HSSFWorkbook workbook,Map params){ + String cut = (String) params.get("cut"); +// String sheetName = "认证活动管理"; +// String firstTitle = "认证任务确认," + +// "Pre-Homo," + +// "认证进度"; +// String secondTitle = "责任领域(一级)," + +// "未发起,待确认,接受,拒绝,完成度," + +// "未发起,待确认,审查通过,审查退回,完成度," + +// "未开始,进行中,实验通过,实验失败,部件报告未上传,部件报告已上传,部件报告已入库,完成度"; +// if(StringUtils.equals(cut,CutEnum.EN.getValue())){ +// sheetName = "Certification Activity Management"; +// firstTitle = "Authentication task confirmation," + +// "Pre-Homo," + +// "Certification progress"; +// secondTitle = "Area of responsibility (level 1)," + +// "Not launched,To be confirmed,Accept,Refuse,Degree of completion," + +// "Not launched,To be confirmed,Review of the adoption,Review return,Degree of completion," + +// "Not started,In progress,Experiment passed,Experiment failed,Parts report not uploaded,Parts report uploaded,Parts report in stock,Degree of completion"; +// } + String sheetName = "认证活动管理"; + String firstTitle = "认证任务确认," + + "Pre-Homo"; + String secondTitle = "责任领域(一级)," + + "未发起,待确认,接受,拒绝,完成度," + + "未发起,待提交,审查通过,审查退回,完成度"; +// "未发起,待确认,审查通过,审查退回,完成度"; + if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + sheetName = "Certification Activity Management"; + firstTitle = "Authentication task confirmation," + + "Pre-Homo"; + secondTitle = "Area of responsibility (level 1)," + + "Not launched,To be confirmed,Accept,Refuse,Degree of completion," + + "Not launched,To submit,Review of the adoption,Review return,Degree of completion"; +// "Not launched,To be confirmed,Review of the adoption,Review return,Degree of completion"; + } + HSSFSheet sheet = workbook.createSheet(sheetName); + + //合并单元格 起始行,结束行,起始列,结束列 + CellRangeAddress region1 = new CellRangeAddress(0, 0, 1, 5); + sheet.addMergedRegion(region1); + CellRangeAddress region2 = new CellRangeAddress(0, 0, 6, 10); + sheet.addMergedRegion(region2); +// CellRangeAddress region3 = new CellRangeAddress(0, 0, 11, 18); +// sheet.addMergedRegion(region3); +// CellRangeAddress region4 = new CellRangeAddress(0, 0, 19, 23); +// sheet.addMergedRegion(region4); + + String[] firstTitleArr = firstTitle.split(","); + String[] secondTitleArr = secondTitle.split(","); + Row firstRow = sheet.createRow(0); + Row secondRow = sheet.createRow(1); + + CellStyle cellStyleTitle = workbook.createCellStyle(); + cellStyleTitle.setAlignment(HorizontalAlignment.CENTER); + for (int i = 0; i <= 10; i++){ + sheet.setColumnWidth(i, 3500); + Cell firstRowCell = firstRow.createCell(i); + firstRowCell.setCellStyle(cellStyleTitle); + if(i == 1){ + firstRowCell.setCellValue(firstTitleArr[0]); + }else if(i==6){ + firstRowCell.setCellValue(firstTitleArr[1]); + }else if(i==11){ + firstRowCell.setCellValue(firstTitleArr[2]); + } +// else if(i==19){ +// firstRowCell.setCellValue(firstTitleArr[3]); +// } + Cell secondRowCell = secondRow.createCell(i); + secondRowCell.setCellValue(secondTitleArr[i]); + } + + String projectLibraryId = (String) params.get("projectLibraryId"); + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); + List projectCertificationInventoryEOList = this.platformProjectCertificationInventoryEOService.list(pciQueryWrap).stream().filter(pciEo -> { + boolean flag = false; + if (!StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.UNINVOLVED.getValue())) { + flag = true; + } + return flag; + }).distinct().collect(Collectors.toList()); + String pciDutyTerritoryStr = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyTerritory).collect(Collectors.joining(",")); + List sysDictItems = new ArrayList<>(); + if (StringUtils.isNotEmpty(pciDutyTerritoryStr)) { + List pciDutyTerritoryList = Arrays.asList(pciDutyTerritoryStr.split(",")).stream().distinct().collect(Collectors.toList()); + sysDictItems = this.sysDictItemServiceImpl.selectItemsAll().stream().filter(sysDictItem -> { + boolean flag = false; + for (String pliDutyTerritory : pciDutyTerritoryList) { + if(StringUtils.equals(sysDictItem.getItemValue(),pliDutyTerritory)){ + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + Map> firstLevelDutyTerritoryMap = this.sysDictItemServiceImpl.getFirstLevelSysDictItemByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue(),sysDictItems); + if(ObjectUtils.isNotEmpty(firstLevelDutyTerritoryMap)){ + int dataIndex = 2; + for (Map.Entry> firstLevelMap : firstLevelDutyTerritoryMap.entrySet()) { + String key = firstLevelMap.getKey(); + List dutyTerritoryList = firstLevelMap.getValue(); + if(StringUtils.isEmpty(key) || CollectionUtils.isEmpty(dutyTerritoryList)){ + continue; + } + List pciEoList = projectCertificationInventoryEOList.stream().filter(pciEo -> { + boolean flag = false; + for (SysDictItem dutyTerritory : dutyTerritoryList) { + if (StringUtils.contains(pciEo.getDutyTerritory(), dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + this.exportCertificationManagementSetData(params, sheet, dataIndex, key, pciEoList); + + dataIndex ++; + } + } + } + + /** + * 导出认证活动管理-设置数据 + * @param params + * @param sheet + * @param dataIndex + * @param key + * @param pciEoList + */ + private void exportCertificationManagementSetData(Map params, HSSFSheet sheet, int dataIndex, String key, List pciEoList) { + Row dataRow = sheet.createRow(dataIndex); + dataRow.createCell(0).setCellValue(key); + + Map taskConfirmMap = this.projectLibraryStatisticsService.getRZTaskToConfirmStatisticsGroupByTerritory(pciEoList, params); + Map taskConfirmNotStartedMap = (Map) taskConfirmMap.get(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + double taskConfirmNotStartedAmount = (double) taskConfirmNotStartedMap.get("amount"); + Map taskConfirmToConfirmMap = (Map) taskConfirmMap.get(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + double taskConfirmToConfirmAmount = (double) taskConfirmToConfirmMap.get("amount"); + Map taskConfirmAcceptedMap = (Map) taskConfirmMap.get(TaskAffirmStatusEnum.ACCEPTED.getValue()); + double taskConfirmAcceptedAmount = (double) taskConfirmAcceptedMap.get("amount"); + Map taskConfirmRejectedMap = (Map) taskConfirmMap.get(TaskAffirmStatusEnum.REJECTED.getValue()); + double taskConfirmRejectedAmount = (double) taskConfirmRejectedMap.get("amount"); + dataRow.createCell(1).setCellValue(taskConfirmNotStartedAmount); + dataRow.createCell(2).setCellValue(taskConfirmToConfirmAmount); + dataRow.createCell(3).setCellValue(taskConfirmAcceptedAmount); + dataRow.createCell(4).setCellValue(taskConfirmRejectedAmount); + double taskConfirmCount = taskConfirmNotStartedAmount + taskConfirmToConfirmAmount + taskConfirmAcceptedAmount + taskConfirmRejectedAmount; + double taskConfirmPercentage = (taskConfirmAcceptedAmount / taskConfirmCount) * 100; + String taskConfirmPercentageStr = (taskConfirmPercentage != 0 && (taskConfirmCount !=0 )) ? df.format(taskConfirmPercentage) : "0"; + dataRow.createCell(5).setCellValue(taskConfirmPercentageStr + percentSign); + + Map prehomoMap = this.projectLibraryStatisticsService.getPrehomoStatisticeGroupByTerritory(pciEoList, params); + Map prehomoNotStartedMap = (Map) prehomoMap.get(TaskAffirmStatusEnum.NOT_STARTED.getValue()); + double prehomoNotStartedAmount = (double) prehomoNotStartedMap.get("amount"); + Map prehomoToConfirmMap = (Map) prehomoMap.get(TodoCenterStatusEnum.TO_SUBMIT.getValue()); + double prehomoToConfirmAmount = (double) prehomoToConfirmMap.get("amount"); + Map prehomoAcceptedMap = (Map) prehomoMap.get(CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()); + double prehomoAcceptedAmount = (double) prehomoAcceptedMap.get("amount"); + Map prehomoRejectedMap = (Map) prehomoMap.get(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()); + double prehomoRejectedAmount = (double) prehomoRejectedMap.get("amount"); + dataRow.createCell(6).setCellValue(prehomoNotStartedAmount); + dataRow.createCell(7).setCellValue(prehomoToConfirmAmount); + dataRow.createCell(8).setCellValue(prehomoAcceptedAmount); + dataRow.createCell(9).setCellValue(prehomoRejectedAmount); + double prehomoCount = prehomoNotStartedAmount + prehomoToConfirmAmount + prehomoAcceptedAmount + prehomoRejectedAmount; + double prehomoPercentage = (prehomoAcceptedAmount / prehomoCount) * 100; + String prehomoPercentageStr = (prehomoPercentage != 0 && (prehomoCount !=0 )) ? df.format(prehomoPercentage) : "0"; + dataRow.createCell(10).setCellValue(prehomoPercentageStr + percentSign); + + Map certificationProgressMap = this.projectLibraryStatisticsService.getPartCertificationProgressStatisticsGroupByTerritory(pciEoList, params); + Map certificationProgressNotStartMap = (Map)certificationProgressMap.get(CertificationProgressEnum.NOT_START.getValue()); + double certificationProgressNotStartAmount = (double) certificationProgressNotStartMap.get("amount"); + Map certificationProgressInProgressMap = (Map)certificationProgressMap.get(CertificationProgressEnum.IN_PROGRESS.getValue()); + double certificationProgressInProgressAmount = (double) certificationProgressInProgressMap.get("amount"); + Map certificationProgressTestPassedMap = (Map)certificationProgressMap.get(CertificationProgressEnum.TEST_PASSED.getValue()); + double certificationProgressTestPassedAmount = (double) certificationProgressTestPassedMap.get("amount"); + Map certificationProgressTestFailedMap = (Map)certificationProgressMap.get(CertificationProgressEnum.TEST_FAILED.getValue()); + double certificationProgressTestFailedAmount = (double) certificationProgressTestFailedMap.get("amount"); + Map certificationProgressNotSubmitMap = (Map)certificationProgressMap.get(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()); + double certificationProgressNotSubmitAmount = (double) certificationProgressNotSubmitMap.get("amount"); + Map certificationProgressSubmitMap = (Map)certificationProgressMap.get(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()); + double certificationProgressSubmitAmount = (double) certificationProgressSubmitMap.get("amount"); + Map certificationProgressStoredMap = (Map)certificationProgressMap.get(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()); + double certificationProgressStoredAmount = (double) certificationProgressStoredMap.get("amount"); +// dataRow.createCell(11).setCellValue(certificationProgressNotStartAmount); +// dataRow.createCell(12).setCellValue(certificationProgressInProgressAmount); +// dataRow.createCell(13).setCellValue(certificationProgressTestPassedAmount); +// dataRow.createCell(14).setCellValue(certificationProgressTestFailedAmount); +// dataRow.createCell(15).setCellValue(certificationProgressNotSubmitAmount); +// dataRow.createCell(16).setCellValue(certificationProgressSubmitAmount); +// dataRow.createCell(17).setCellValue(certificationProgressStoredAmount); + double certificationProgressCount = certificationProgressNotStartAmount + certificationProgressInProgressAmount + + certificationProgressTestPassedAmount + certificationProgressTestFailedAmount + + certificationProgressNotSubmitAmount + certificationProgressSubmitAmount + + certificationProgressStoredAmount; + double certificationProgressPercentage = (certificationProgressTestPassedAmount / certificationProgressCount) * 100; + String certificationProgressPercentageStr = (certificationProgressPercentage != 0 && (certificationProgressCount !=0 )) ? df.format(certificationProgressPercentage) : "0"; +// dataRow.createCell(18).setCellValue(certificationProgressPercentageStr + percentSign); + } + + /** + * 导出认证参数收集 + * @param workbook + * @param params + */ + private void exportParameterCollecting(HSSFWorkbook workbook, Map params) { + String cut = (String) params.get("cut"); + String sheetName = "认证参数收集"; + String firstTitle = "认证参数收集"; + String secondTitle = "责任领域(一级),未开始,收集中,已提交,已同步至上报库,完成度"; + if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + sheetName = "Authentication parameter collection"; + firstTitle = "Authentication parameter collection"; + secondTitle = "Area of responsibility (level 1),Not started,Collecting,Has submitted,Synced to the report library,Degree of completion"; + } + HSSFSheet sheet = workbook.createSheet(sheetName); + //合并单元格 起始行,结束行,起始列,结束列 + CellRangeAddress region1 = new CellRangeAddress(0, 0, 1, 5); + sheet.addMergedRegion(region1); + + String[] secondTitleArr = secondTitle.split(","); + Row firstRow = sheet.createRow(0); + Row secondRow = sheet.createRow(1); + + CellStyle cellStyleTitle = workbook.createCellStyle(); + cellStyleTitle.setAlignment(HorizontalAlignment.CENTER); + for (int i = 0; i <= 5; i++){ + sheet.setColumnWidth(i, 3500); + Cell firstRowCell = firstRow.createCell(i); + firstRowCell.setCellStyle(cellStyleTitle); + if(i == 1){ + firstRowCell.setCellValue(firstTitle); + } + + Cell secondRowCell = secondRow.createCell(i); + secondRowCell.setCellValue(secondTitleArr[i]); + } + + String projectLibraryId = (String) params.get("projectLibraryId"); + + QueryWrapper pmQueryWrap = new QueryWrapper<>(); + pmQueryWrap.lambda().eq(ParamsManifestEO::getProjectId,projectLibraryId); + List pmEoList = this.paramsManifestEOService.list(pmQueryWrap); + if(CollectionUtils.isNotEmpty(pmEoList)){ + List pmIdList = pmEoList.stream().map(ParamsManifestEO::getId).distinct().collect(Collectors.toList()); + QueryWrapper pcmQueryWrap = new QueryWrapper<>(); + pcmQueryWrap.lambda().in(ParamsCollectManifestEO::getParamsManifestId,pmIdList); + List pcmEoList = this.paramsCollectManifestEOService.list(pcmQueryWrap); + pcmEoList = pcmEoList.stream().filter(pcmEo -> !StringUtils.equals(pcmEo.getControlType(),ControlTypeEnum.Title.getValue())).collect(Collectors.toList()); + + List sysDictItems = new ArrayList<>(); + String pcmDutyTerritoryStr = pcmEoList.stream().map(ParamsCollectManifestEO::getDutyTerritory).collect(Collectors.joining(",")); + if (StringUtils.isNotEmpty(pcmDutyTerritoryStr)) { + List pcmDutyTerritoryList = Arrays.asList(pcmDutyTerritoryStr.split(",")).stream().distinct().collect(Collectors.toList()); + sysDictItems = this.sysDictItemServiceImpl.selectItemsAll().stream().filter(sysDictItem -> { + boolean flag = false; + for (String pcmDutyTerritory : pcmDutyTerritoryList) { + if(StringUtils.equals(sysDictItem.getItemValue(),pcmDutyTerritory)){ + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + + Map> firstLevelDutyTerritoryMap = this.sysDictItemServiceImpl.getFirstLevelSysDictItemByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue(),sysDictItems); + if(ObjectUtils.isNotEmpty(firstLevelDutyTerritoryMap)){ + int dataIndex = 2; + for (Map.Entry> firstLevelMap : firstLevelDutyTerritoryMap.entrySet()) { + String key = firstLevelMap.getKey(); + List dutyTerritoryList = firstLevelMap.getValue(); + if(StringUtils.isEmpty(key) || CollectionUtils.isEmpty(dutyTerritoryList)){ + continue; + } + List pcmEos = pcmEoList.stream().filter(pcmEo -> { + boolean flag = false; + for (SysDictItem dutyTerritory : dutyTerritoryList) { + if (StringUtils.contains(pcmEo.getDutyTerritory(), dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(pcmEos)){ + this.exportParameterCollectingSetData(params, sheet, dataIndex ,key,pcmEos); + } + dataIndex ++; + } + } + } + } + private void exportOtaCollecting(HSSFWorkbook workbook, Map params) { + String cut = (String) params.get("cut"); + String sheetName = "OTA状态"; + String firstTitle = "匹配状态统计,OTA认证进度统计"; + String secondTitle = "软件版本,待匹配,待审批,锁定,退回,未开始,进行中,实验通过,实验失败,部件报告未提交,部件报告已提交,部件报告已入库"; + if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + sheetName = "OTA status"; + firstTitle = "Matching state statistics,OTA authentication progress statistics"; + secondTitle = "Software version," + + "To be matched," + + "To be approved," + + "lock," + + "Reject,"+ + "Not started," + + "Ongoing," + + "Test Passed," + + "Test Failed," + + "Component report not submitted," + + "Component report submitted," + + "Component report has been stored"; + } + HSSFSheet sheet = workbook.createSheet(sheetName); + //合并单元格 起始行,结束行,起始列,结束列 + CellRangeAddress region1 = new CellRangeAddress(0, 0, 1, 4); + sheet.addMergedRegion(region1); + CellRangeAddress region2 = new CellRangeAddress(0, 0, 5, 11); + sheet.addMergedRegion(region2); + + String[] firstTitleArr = firstTitle.split(","); + String[] secondTitleArr = secondTitle.split(","); + Row firstRow = sheet.createRow(0); + Row secondRow = sheet.createRow(1); + + CellStyle cellStyleTitle = workbook.createCellStyle(); + cellStyleTitle.setAlignment(HorizontalAlignment.CENTER); + for (int i = 0; i <= 11; i++){ + sheet.setColumnWidth(i, 3500); + Cell firstRowCell = firstRow.createCell(i); + firstRowCell.setCellStyle(cellStyleTitle); + if(i == 1){ + firstRowCell.setCellValue(firstTitleArr[0]); + }else if(i==5){ + firstRowCell.setCellValue(firstTitleArr[1]); + } + Cell secondRowCell = secondRow.createCell(i); + secondRowCell.setCellValue(secondTitleArr[i]); + } + + String projectLibraryId = (String) params.get("projectLibraryId"); + List> mapList = otaManageApplyEOService.getStatisticalStatus(projectLibraryId, null, cut,null); + + if(ObjectUtils.isNotEmpty(mapList)){ + int dataIndex = 2; + for (Map map : mapList) { + String plannedBpLaunchBatch = (String) map.get("plannedBpLaunchBatch"); + Map matchStatusMap = (Map)map.get("matchStatusMap"); + Map attestationScheduleMap = (Map)map.get("attestationScheduleMap"); + + String.valueOf(matchStatusMap.get("locked")); + String locked = String.valueOf(matchStatusMap.get("locked")); + String rejected = String.valueOf(matchStatusMap.get("rejected")); + String to_be_approved = String.valueOf(matchStatusMap.get("to_be_approved")); + String to_be_matched = String.valueOf(matchStatusMap.get("to_be_matched")); + String Component_report_has_been_stored = String.valueOf(attestationScheduleMap.get("Component_report_has_been_stored")); + String Component_report_not_submitted = String.valueOf(attestationScheduleMap.get("Component_report_not_submitted")); + String Component_report_submitted = String.valueOf(attestationScheduleMap.get("Component_report_submitted")); + String In_progress = String.valueOf(attestationScheduleMap.get("In_progress")); + String Not_start =String.valueOf(attestationScheduleMap.get("Not_start")); + String Test_failed = String.valueOf(attestationScheduleMap.get("Test_failed")); + String Test_passed = String.valueOf(attestationScheduleMap.get("Test_passed")); + Row dataRow = sheet.createRow(dataIndex); + dataRow.createCell(0).setCellValue(plannedBpLaunchBatch); + dataRow.createCell(1).setCellValue(to_be_matched); + dataRow.createCell(2).setCellValue(to_be_approved); + dataRow.createCell(3).setCellValue(locked); + dataRow.createCell(4).setCellValue(rejected); + dataRow.createCell(5).setCellValue(Not_start); + dataRow.createCell(6).setCellValue(In_progress); + dataRow.createCell(7).setCellValue(Test_passed); + dataRow.createCell(8).setCellValue(Test_failed); + dataRow.createCell(9).setCellValue(Component_report_not_submitted); + dataRow.createCell(10).setCellValue(Component_report_submitted); + dataRow.createCell(11).setCellValue(Component_report_has_been_stored); + dataIndex ++; + } + } + } + + /** + * 导出认证参数收集-设置数据 + * @param params + * @param sheet + * @param dataIndex + * @param key + * @param pcmEos + */ + private void exportParameterCollectingSetData(Map params, HSSFSheet sheet, int dataIndex, String key, List pcmEos) { + Map parameterCollectingMap = this.projectLibraryStatisticsService.getParameterCollectingStatisticsGroupByTerritory(pcmEos,params); + Map notStartMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.NOT_START.getValue()); + double notStartAmount = (double) notStartMap.get("amount"); + Map collectingMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.COLLECTING.getValue()); + double collectingAmount = (double) collectingMap.get("amount"); + Map submitMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.SUBMIT.getValue()); + double submitAmount = (double) submitMap.get("amount"); + Map syncReporMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.SYNC_REPORT.getValue()); + double syncReporAmount = (double) syncReporMap.get("amount"); + + Row dataRow = sheet.createRow(dataIndex); + dataRow.createCell(0).setCellValue(key); + dataRow.createCell(1).setCellValue(notStartAmount); + dataRow.createCell(2).setCellValue(collectingAmount); + dataRow.createCell(3).setCellValue(submitAmount); + dataRow.createCell(4).setCellValue(syncReporAmount); + double parameterCollectingCount = notStartAmount + collectingAmount + submitAmount + syncReporAmount; + double completionCount = submitAmount + syncReporAmount; + double parameterCollectingPercentage = (completionCount / parameterCollectingCount) * 100; + String parameterCollectingPercentageStr = (parameterCollectingPercentage != 0 && (completionCount !=0 )) ? df.format(parameterCollectingPercentage) : "0"; + dataRow.createCell(5).setCellValue(parameterCollectingPercentageStr + percentSign); + } + + private JSONArray getNodeProgressList(TimeNodeVO nodeTnVo) { + //根据节点获取对应进度和时间 + JSONArray nodeList = new JSONArray(); + if(ObjectUtils.isNotEmpty(nodeTnVo)){ + String projectId = nodeTnVo.getProjectId(); + + QueryWrapper pliQueryWrap = new QueryWrapper<>(); + pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectId); + List pliEoList = this.platformProjectLawsInventoryEOService.list(pliQueryWrap); + + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectId); + List pciEoList = this.platformProjectCertificationInventoryEOService.list(pciQueryWrap); + + QueryWrapper pmQueryWrap = new QueryWrapper<>(); + pmQueryWrap.lambda().eq(ParamsManifestEO::getProjectId,projectId); + List pmEoList = this.paramsManifestEOService.list(pmQueryWrap); + List pcmEoList = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(pmEoList)){ + List pmIdList = pmEoList.stream().map(ParamsManifestEO::getId).distinct().collect(Collectors.toList()); + QueryWrapper pcmQueryWrap = new QueryWrapper<>(); + pcmQueryWrap.lambda().in(ParamsCollectManifestEO::getParamsManifestId,pmIdList); + pcmEoList = this.paramsCollectManifestEOService.list(pcmQueryWrap); + } + + Map getProgressParams = new HashMap<>(); + getProgressParams.put("pliEoList",pliEoList); + getProgressParams.put("pciEoList",pciEoList); + getProgressParams.put("pcmEoList",pcmEoList); + + if(ProjectTaskPlanningNameEnum.LEGAL_TASK_CONFIRMATION.getName().equals(nodeTnVo.getName())){ + JSONObject preNode = new JSONObject(); + preNode.put("nodeName", "法规任务确认"); + preNode.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_FGRWQR.getValue(),getProgressParams)); + preNode.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode); + + JSONObject preNode1 = new JSONObject(); + preNode1.put("nodeName", "认证任务确认"); + preNode1.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_RZRWQR.getValue(),getProgressParams)); + preNode1.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode1); + }else if(ProjectTaskPlanningNameEnum.DESIGN_DEADLINE.getName().equals(nodeTnVo.getName())){ + JSONObject preNode = new JSONObject(); + preNode.put("nodeName", "设计符合性流程"); + preNode.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_SJFHX.getValue(),getProgressParams)); + preNode.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode); + }else if(ProjectTaskPlanningNameEnum.VERIFY_DEADLINE.getName().equals(nodeTnVo.getName())){ + JSONObject preNode = new JSONObject(); + preNode.put("nodeName", "验证符合性流程"); + preNode.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_YZFHX.getValue(),getProgressParams)); + preNode.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode); + }else if(ProjectTaskPlanningNameEnum.ATTESTATION_START_TIME.getName().equals(nodeTnVo.getName())){ + JSONObject preNode = new JSONObject(); + preNode.put("nodeName", "Pre-Homo流程"); + preNode.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_PRE_HOMO.getValue(),getProgressParams)); + preNode.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode); + + JSONObject preNode1 = new JSONObject(); + preNode1.put("nodeName", "参数收集进度"); + preNode1.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_CSSJJD.getValue(),getProgressParams)); + preNode1.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode1); + }else if(ProjectTaskPlanningNameEnum.ATTESTATION_END_TIME.getName().equals(nodeTnVo.getName())){ + JSONObject preNode = new JSONObject(); + preNode.put("nodeName", "认证进度"); + preNode.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_RZJD.getValue(),getProgressParams)); + preNode.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode); + } + } + return nodeList; + } + + private JSONArray getNodeList(TimeNodeVO nodeTnVo) { + //根据节点获取对应进度和时间 + JSONArray nodeList = new JSONArray(); + if(ObjectUtils.isNotEmpty(nodeTnVo)){ + String projectId = nodeTnVo.getProjectId(); + + QueryWrapper pliQueryWrap = new QueryWrapper<>(); + pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectId); + List pliEoList = this.platformProjectLawsInventoryEOService.list(pliQueryWrap); + + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectId); + List pciEoList = this.platformProjectCertificationInventoryEOService.list(pciQueryWrap); + + QueryWrapper pmQueryWrap = new QueryWrapper<>(); + pmQueryWrap.lambda().eq(ParamsManifestEO::getProjectId,projectId); + List pmEoList = this.paramsManifestEOService.list(pmQueryWrap); + List pcmEoList = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(pmEoList)){ + List pmIdList = pmEoList.stream().map(ParamsManifestEO::getId).distinct().collect(Collectors.toList()); + QueryWrapper pcmQueryWrap = new QueryWrapper<>(); + pcmQueryWrap.lambda().in(ParamsCollectManifestEO::getParamsManifestId,pmIdList); + pcmEoList = this.paramsCollectManifestEOService.list(pcmQueryWrap); + } + + Map getProgressParams = new HashMap<>(); + getProgressParams.put("pliEoList",pliEoList); + getProgressParams.put("pciEoList",pciEoList); + getProgressParams.put("pcmEoList",pcmEoList); + + if(ProjectTaskPlanningNameEnum.LIST_CONFIRMATION.getName().equals(nodeTnVo.getName()) || ProjectTaskPlanningNameEnum.LEGAL_TASK_CONFIRMATION.getName().equals(nodeTnVo.getName())){ + JSONObject preNode = new JSONObject(); + preNode.put("nodeName", "法规任务确认"); + preNode.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_FGRWQR.getValue(),getProgressParams)); + preNode.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode); + + JSONObject preNode1 = new JSONObject(); + preNode1.put("nodeName", "认证任务确认"); + preNode1.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_RZRWQR.getValue(),getProgressParams)); + preNode1.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode1); + }else if(ProjectTaskPlanningNameEnum.DESIGN_DEADLINE.getName().equals(nodeTnVo.getName())){ + JSONObject preNode = new JSONObject(); + preNode.put("nodeName", "设计符合性流程"); + preNode.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_SJFHX.getValue(),getProgressParams)); + preNode.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode); + }else if(ProjectTaskPlanningNameEnum.PREHOMO_DEADLINE.getName().equals(nodeTnVo.getName()) ||ProjectTaskPlanningNameEnum.ATTESTATION_START_TIME.getName().equals(nodeTnVo.getName())){ + JSONObject preNode = new JSONObject(); + preNode.put("nodeName", "Pre-Homo流程"); + preNode.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_PRE_HOMO.getValue(),getProgressParams)); + preNode.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode); + + JSONObject preNode1 = new JSONObject(); + preNode1.put("nodeName", "参数收集进度"); + preNode1.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_CSSJJD.getValue(),getProgressParams)); + preNode1.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode1); + }else if(ProjectTaskPlanningNameEnum.CERTIFICATION_SUBMISSION.getName().equals(nodeTnVo.getName()) || ProjectTaskPlanningNameEnum.ATTESTATION_END_TIME.getName().equals(nodeTnVo.getName())){ + JSONObject preNode = new JSONObject(); + preNode.put("nodeName", "认证进度"); + preNode.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_RZJD.getValue(),getProgressParams)); + preNode.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode); + + JSONObject preNode1 = new JSONObject(); + preNode1.put("nodeName", "参数收集进度"); + preNode1.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_CSSJJD.getValue(),getProgressParams)); + preNode1.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode1); + }else if(ProjectTaskPlanningNameEnum.VERIFY_DEADLINE.getName().equals(nodeTnVo.getName())){ + JSONObject preNode = new JSONObject(); + preNode.put("nodeName", "验证符合性流程"); + preNode.put("progress", this.getProgress(nodeTnVo,HSStatisticalNodesEnum.HS_YZFHX.getValue(),getProgressParams)); + preNode.put("date", sdf.format(nodeTnVo.getTime())); + nodeList.add(preNode); + } + } + return nodeList; + } + + public String getProgress(TimeNodeVO nodeTnVo,String statisticalNode,Map params){ + DecimalFormat df = new DecimalFormat("#.00"); + double result = 0; + List pliEoList = (List) params.get("pliEoList"); + List pciEoList = (List) params.get("pciEoList"); + List pcmEoList = (List) params.get("pcmEoList"); + + if (StringUtils.equals(statisticalNode,HSStatisticalNodesEnum.HS_FGRWQR.getValue())) { + int count = pliEoList.size() * 2; + if (count > 0) { + double designCompleteCount = (double) pliEoList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.TO_TRACK.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.TERMINATION_OF_TASK.getValue()) + ); + return flag; + }).count(); + + double verifyCompleteCount = (double) pliEoList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.TO_TRACK.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.TERMINATION_OF_TASK.getValue()) + ); + return flag; + }).count(); + + result = ((designCompleteCount + verifyCompleteCount) / count) * 100; + } + } else if (StringUtils.equals(statisticalNode,HSStatisticalNodesEnum.HS_RZRWQR.getValue())) { + int count = pciEoList.size(); + if (count > 0) { + double completeCount = (double) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).count(); + + result = (completeCount / count) * 100; + } + } else if (StringUtils.equals(statisticalNode,HSStatisticalNodesEnum.HS_SJFHX.getValue())) { + int count = pliEoList.size(); + if (count > 0) { + double completeCount = (double) pliEoList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).count(); + + result = (completeCount / count) * 100; + } + } else if (StringUtils.equals(statisticalNode,HSStatisticalNodesEnum.HS_PRE_HOMO.getValue())) { + int count = pciEoList.size(); + if (count > 0) { + double completeCount = (double) pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(),CertificationInventoryFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).count(); + + result = (completeCount / count) * 100; + } + } else if (StringUtils.equals(statisticalNode,HSStatisticalNodesEnum.HS_RZJD.getValue())) { + // 认证清单认证进度为 实验通过的是完成。 + int count = pciEoList.size(); + if (count > 0) { + double completeCount = (double)pciEoList.stream().filter(pciEo -> { + boolean flag = ( + StringUtils.equals(pciEo.getCertificationProgress(),CertificationProgressEnum.TEST_PASSED.getValue()) + ); + return flag; + }).count(); + + result = (completeCount / count) * 100; + } + } else if (StringUtils.equals(statisticalNode,HSStatisticalNodesEnum.HS_YZFHX.getValue())) { + int count = pliEoList.size(); + if (count > 0) { + double completeCount = (double) pliEoList.stream().filter(pliEo -> { + boolean flag = ( + StringUtils.equals(pliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.CONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.UNINVOLVED.getValue()) + ); + return flag; + }).count(); + + result = (completeCount / count) * 100; + } + } else if (StringUtils.equals(statisticalNode,HSStatisticalNodesEnum.HS_CSSJJD.getValue())) { + if(CollectionUtils.isNotEmpty(pcmEoList)){ + int count = pcmEoList.size(); + double completeCount = (double) pcmEoList.stream().filter(pcmEo -> { + boolean flag = ( + StringUtils.equals(pcmEo.getState(), CollectManifestStateEnum.SUBMIT.getValue()) + || StringUtils.equals(pcmEo.getState(),CollectManifestStateEnum.SYNC_REPORT.getValue()) + ); + return flag; + }).count(); + + result = (completeCount / count) * 100; + } + } + + return result != 0 ? df.format(result) : "0"; + } + + + @Override + public List queryList(List projectIdList) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("id",projectIdList); + List res = this.list(queryWrapper); + return res; + } + + @Override + public List getListByIds(List projectIdList) { + List res = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(projectIdList)){ + res = this.getBaseMapper().getListByIds(projectIdList); + } + return res; + } +} + + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectNameInfoEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectNameInfoEOServiceImpl.java new file mode 100644 index 000000000..7da3631ee --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformProjectNameInfoEOServiceImpl.java @@ -0,0 +1,374 @@ +package com.jero.modules.platform.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.system.vo.DictModel; +import com.jero.modules.platform.mapper.PlatformProjectNameInfoEOMapper; +import com.jero.modules.platform.service.IPlatformProjectNameInfoEOService; +import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.project.entity.ProjectNameInfoEO; +import com.jero.modules.project.entity.ProjectYearNameInfoEO; +import com.jero.modules.project.mapper.ProblemManagementEOMapper; +import com.jero.modules.project.service.impl.ProblemManagementEOServiceImpl; +import com.jero.modules.project.service.impl.ProjectYearNameInfoEOServiceImpl; +import com.jero.modules.system.enums.DicCodeEnum; +import com.jero.modules.system.service.ISysDictService; +import com.jero.modules.system.util.StringUtils; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * @Description: 项目名信息表 + * @Author: jero-boot + * @Date: 2022-04-18 + * @Version: V1.0 + */ +@Service +public class PlatformProjectNameInfoEOServiceImpl extends ServiceImpl implements IPlatformProjectNameInfoEOService { + @Autowired + private ProjectYearNameInfoEOServiceImpl projectYearNameInfoEOService; + @Autowired + private ProblemManagementEOMapper problemManagementEOMapper; + @Autowired + private ISysDictService sysDictService; + @Autowired + private ProblemManagementEOServiceImpl problemManagementEOService; + /** + * 保存 + * + * @param projectNameInfoEO + * @return + */ + @Override + public void add(ProjectNameInfoEO projectNameInfoEO) { + Date now = new Date(); + projectNameInfoEO.setCreateTime(now); + projectNameInfoEO.setUpdateTime(now); + save(projectNameInfoEO); + } + + /** + * 更新 + * + * @param projectNameInfoEO + * @return + */ + @Override + public void editById(ProjectNameInfoEO projectNameInfoEO) { + Date now = new Date(); + projectNameInfoEO.setUpdateTime(now); + saveOrUpdate(projectNameInfoEO); + } + + /** + * 通过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 ProjectNameInfoEO queryById(String id) { + return getById(id); + } + + /** + * 列表查询 + * + * @return + */ + @Override + public List queryList() { + QueryWrapper nameInfoEOQueryWrapper = new QueryWrapper<>(); + List projectNameInfoEOList = list(nameInfoEOQueryWrapper); +// List projectNameInfoIdList = projectNameInfoEOList.stream().map(e -> e.getId()).collect(Collectors.toList()); + for (ProjectNameInfoEO projectNameInfoEO : projectNameInfoEOList){ + QueryWrapper yearNameInfoEOQueryWrapper = new QueryWrapper<>(); + yearNameInfoEOQueryWrapper.eq("project_name_id",projectNameInfoEO.getId()); + List yearNameInfoDataList = projectYearNameInfoEOService.list(yearNameInfoEOQueryWrapper); + if(CollectionUtils.isNotEmpty(yearNameInfoDataList)) { + projectNameInfoEO.setYearNameDataList(yearNameInfoDataList); + } + } + +// List projectNameAndYear = projectNameInfoEOMapper.selectProjectNameAndYear(); + return projectNameInfoEOList; + } + /** + * 列表查询 + * + * @return + */ + @Override + public List queryProjectNameList(String cut) { + List projectLibraryBaseList = problemManagementEOMapper.queryByIds(null); + //目标市场数据字典 + List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); + for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) { + //目标市场 + String targetMarket = problemManagementEOService.getMarket(cut, targetMarketList, projectLibraryBase); + //主项目的版本号 + String projectVersion = ""; + if(StringUtils.isBlank(projectLibraryBase.getParentId())){ + projectVersion = "00"; + }else{ + projectVersion = projectLibraryBase.getProjectVersion(); + } + if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){ + projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() + + "-" + projectLibraryBase.getYearName() + + "-" + targetMarket + +"-"+projectVersion); + } + } + return projectLibraryBaseList; + } + +/* @Override + public void getSpaceInfo(String cut){ + String jsonData =""; + try { + jsonData = spaceService.getSign(); + if(StringUtils.isNotBlank(jsonData)) { + //静态测试数据 + *//* jsonData = "{\n" + + " \"resultData\": [\n" + + " {\n" + + " \"modelCode\": \"ES8_00\",\n" + + " \"modelName\": \"ES8\",\n" + + " \"hardwarePltCode\": \"mhp_npa\",\n" + + " \"hardwarePltName\": \"NPA\",\n" + + " \"softwarePltCode\": \"msp_nt1\",\n" + + " \"softwarePltName\": \"NT1\",\n" + + " \"modelYearInfoList\": [\n" + + " {\n" + + " \"yearCode\": \"mp_g1.1\",\n" + + " \"yearName\": \"G1.1\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.2\",\n" + + " \"yearName\": \"G1.2\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.3\",\n" + + " \"yearName\": \"G1.3\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.f\",\n" + + " \"yearName\": \"G1.F\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.f.e\",\n" + + " \"yearName\": \"G1.F.E\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_my2018\",\n" + + " \"yearName\": \"MY2018\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.5\",\n" + + " \"yearName\": \"G1.5\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"modelCode\": \"FURY_00\",\n" + + " \"modelName\": \"FURY\",\n" + + " \"hardwarePltCode\": \"mhp_npa\",\n" + + " \"hardwarePltName\": \"NPA\",\n" + + " \"softwarePltCode\": \"msp_nt1\",\n" + + " \"softwarePltName\": \"NT1\",\n" + + " \"modelYearInfoList\": [\n" + + " {\n" + + " \"yearCode\": \"mp_g1.1\",\n" + + " \"yearName\": \"G1.1\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.2\",\n" + + " \"yearName\": \"G1.2\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.3\",\n" + + " \"yearName\": \"G1.3\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.f\",\n" + + " \"yearName\": \"G1.F\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.6\",\n" + + " \"yearName\": \"G1.6\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.5\",\n" + + " \"yearName\": \"G1.5\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.1.e\",\n" + + " \"yearName\": \"G1.1.E\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"modelCode\": \"FORCE_00\",\n" + + " \"modelName\": \"FORCE\",\n" + + " \"hardwarePltCode\": \"mhp_npb\",\n" + + " \"hardwarePltName\": \"NPB\",\n" + + " \"softwarePltCode\": \"msp_nt2\",\n" + + " \"softwarePltName\": \"NT2\",\n" + + " \"modelYearInfoList\": [\n" + + " {\n" + + " \"yearCode\": \"mp_g1.1\",\n" + + " \"yearName\": \"G1.1\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.1.e\",\n" + + " \"yearName\": \"G1.1.E\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.2\",\n" + + " \"yearName\": \"G1.2\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.3\",\n" + + " \"yearName\": \"G1.3\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.f\",\n" + + " \"yearName\": \"G1.F\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.6\",\n" + + " \"yearName\": \"G1.6\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.5\",\n" + + " \"yearName\": \"G1.5\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"modelCode\": \"Gemini_00\",\n" + + " \"modelName\": \"Gemini\",\n" + + " \"hardwarePltCode\": \"mhp_npa\",\n" + + " \"hardwarePltName\": \"NPA\",\n" + + " \"softwarePltCode\": \"msp_nt2\",\n" + + " \"softwarePltName\": \"NT2\",\n" + + " \"modelYearInfoList\": [\n" + + " {\n" + + " \"yearCode\": \"mp_g1.1\",\n" + + " \"yearName\": \"G1.1\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.1.e\",\n" + + " \"yearName\": \"G1.1.E\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"modelCode\": \"Pegasus_00\",\n" + + " \"modelName\": \"Pegasus\",\n" + + " \"hardwarePltCode\": \"mhp_npc\",\n" + + " \"hardwarePltName\": \"NPC\",\n" + + " \"softwarePltCode\": \"msp_nt2\",\n" + + " \"softwarePltName\": \"NT2\",\n" + + " \"modelYearInfoList\": [\n" + + " {\n" + + " \"yearCode\": \"mp_g1.1\",\n" + + " \"yearName\": \"G1.1\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_g1.1.e\",\n" + + " \"yearName\": \"G1.1.E\"\n" + + " },\n" + + " {\n" + + " \"yearCode\": \"mp_G1.1.RH\",\n" + + " \"yearName\": \"G1.1.RH\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ],\n" + + " \"resultCode\": \"WL-0000\",\n" + + " \"resultDesc\": \"Success\"\n" + + "}";*//* + + JSONObject result = (JSONObject) JSON.parse(jsonData); + JSONArray resultData = result.getJSONArray("resultData"); + + String modelName = "";//项目名称 + String hardwarePltName = "";//车型平台 + String softwarePltName = "";//数字平台 + + //获取resultData中所需的数据 + for (int i = 0; i < resultData.size(); i++) { + JSONObject jsonObject = resultData.getJSONObject(i); + modelName = jsonObject.getString("modelName");//项目名称 + hardwarePltName = jsonObject.getString("hardwarePltName");//车型平台 + softwarePltName = jsonObject.getString("softwarePltName");//数字平台 + String nameInfoId = UUID.randomUUID().toString().replace("-", ""); + + ProjectNameInfoEO projectNameInfoEO = new ProjectNameInfoEO(); + projectNameInfoEO.setId(nameInfoId); + projectNameInfoEO.setProjectName(modelName); + projectNameInfoEO.setVehiclePlatform(hardwarePltName); + projectNameInfoEO.setDigitalPlatform(softwarePltName); + //保存 + save(projectNameInfoEO); + + //设置年款名 + JSONArray modelYearInfoJson = jsonObject.getJSONArray("modelYearInfoList"); + for (int j = 0; j < modelYearInfoJson.size(); j++) { + JSONObject modelYearInfo = modelYearInfoJson.getJSONObject(j); + String yearName = modelYearInfo.getString("yearName"); + + ProjectYearNameInfoEO projectYearNameInfoEO = new ProjectYearNameInfoEO(); + projectYearNameInfoEO.setProjectNameId(nameInfoId); + projectYearNameInfoEO.setYearName(yearName); + //保存 + projectYearNameInfoEOService.save(projectYearNameInfoEO); + + } + if(CutEnum.CN.getValue().equals(cut)) { + throw new JeroBootException("从Space获取项目名称相关数据,成功保存"); + }else{ + throw new JeroBootException("Get the data related to the project name from Space and save it successfully."); + } + } + }else{ + if(CutEnum.CN.getValue().equals(cut)) { + throw new JeroBootException("从Space获取项目名称相关数据为空"); + }else{ + throw new JeroBootException("Data related to obtaining project name from Space is empty."); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + }*/ + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformTaskPlanningEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformTaskPlanningEOServiceImpl.java new file mode 100644 index 000000000..8eb57ed93 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/platform/service/impl/PlatformTaskPlanningEOServiceImpl.java @@ -0,0 +1,226 @@ +package com.jero.modules.platform.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.modules.platform.entity.PlatformTaskPlanningEO; +import com.jero.modules.platform.enums.UpAndDownEnum; +import com.jero.modules.platform.mapper.PlatformTaskPlanningEOMapper; +import com.jero.modules.platform.service.IPlatformTaskPlanningEOService; +import com.jero.modules.project.enums.PlanStatusEnum; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @Description: 平台件合规认证计划 + * @Author: jero-boot + * @Date: 2023-09-14 + * @Version: V1.0 + */ +@Service +public class PlatformTaskPlanningEOServiceImpl extends ServiceImpl implements IPlatformTaskPlanningEOService { + + /** + * 保存 + * + * @param platformTaskPlanningEO + * @return + */ + @Override + public void add(PlatformTaskPlanningEO platformTaskPlanningEO) { + Date now = new Date(); + platformTaskPlanningEO.setCreateTime(now); + platformTaskPlanningEO.setUpdateTime(now); + save(platformTaskPlanningEO); + } + + /** + * 平台件合规认证计划-批量添加 + * @param platformTaskPlanningEOListUp + * @param platformTaskPlanningEOListDown + */ + @Override + public void addBatch(List platformTaskPlanningEOListUp,List platformTaskPlanningEOListDown) { + if(!platformTaskPlanningEOListUp.isEmpty()){ + //先删除在新增 +// LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.eq(PlatformTaskPlanningEO::getCreateBy,loginUser.getUsername()); + wrapper.eq(PlatformTaskPlanningEO::getProjectId,platformTaskPlanningEOListUp.get(0).getProjectId()); + this.remove(wrapper); + + for (PlatformTaskPlanningEO platformTaskPlanningEO : platformTaskPlanningEOListUp) { + Date now = new Date(); + platformTaskPlanningEO.setCreateTime(now); + platformTaskPlanningEO.setUpdateTime(now); + platformTaskPlanningEO.setFlag("up"); + platformTaskPlanningEO.setId(null); + } + for (PlatformTaskPlanningEO platformTaskPlanningEO : platformTaskPlanningEOListDown) { + Date now = new Date(); + platformTaskPlanningEO.setCreateTime(now); + platformTaskPlanningEO.setUpdateTime(now); + platformTaskPlanningEO.setFlag("down"); + platformTaskPlanningEO.setId(null); + } + saveBatch(platformTaskPlanningEOListUp); + saveBatch(platformTaskPlanningEOListDown); + } + } + + /** + * 更新 + * + * @param platformTaskPlanningEO + * @return + */ + @Override + public void editById(PlatformTaskPlanningEO platformTaskPlanningEO) { + Date now = new Date(); + platformTaskPlanningEO.setUpdateTime(now); + saveOrUpdate(platformTaskPlanningEO); + } + + /** + * 通过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 PlatformTaskPlanningEO queryById(String id) { + return getById(id); + } + + /** + * 列表查询 + * + * @return + */ + @Override + public List queryList(String projectId) { + SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd"); + Date date = null; + try { + date = sdf.parse(sdf.format(new Date())); + } catch (ParseException e) { + e.printStackTrace(); + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PlatformTaskPlanningEO::getProjectId,projectId); + wrapper.isNotNull(PlatformTaskPlanningEO::getNodeTime); + wrapper.orderByAsc(PlatformTaskPlanningEO::getNodeTime); + List taskPlanningEOList = list(wrapper); + if(ObjectUtils.isNotEmpty(taskPlanningEOList)){ + for (PlatformTaskPlanningEO platformTaskPlanningEO : taskPlanningEOList) { + platformTaskPlanningEO.setName(platformTaskPlanningEO.getNodeName()); + platformTaskPlanningEO.setTime(platformTaskPlanningEO.getNodeTime()); + + if(ObjectUtils.isNotEmpty(platformTaskPlanningEO.getNodeTime())){ + if(platformTaskPlanningEO.getNodeTime().after(date)){ + platformTaskPlanningEO.setStatus(PlanStatusEnum.LESS_THAN_TIME.getValue()); + }else if(platformTaskPlanningEO.getNodeTime().before(date)){ + platformTaskPlanningEO.setStatus(PlanStatusEnum.OUT_OF_DATE.getValue()); + }else{ + platformTaskPlanningEO.setStatus(PlanStatusEnum.ON_GOING.getValue()); + } + } + + if(UpAndDownEnum.UP.getValue().equals(platformTaskPlanningEO.getFlag())){ + platformTaskPlanningEO.setG(true); + }else if(UpAndDownEnum.DOWN.getValue().equals(platformTaskPlanningEO.getFlag())){ + platformTaskPlanningEO.setG(false); + } + } + } + return taskPlanningEOList; + } + /** + * 平台件合规认证计划-编辑数据回显 + * + * @return + */ + @Override + public Map queryListUpdate(String projectId) { + SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd"); + Date date = null; + try { + date = sdf.parse(sdf.format(new Date())); + } catch (ParseException e) { + e.printStackTrace(); + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PlatformTaskPlanningEO::getProjectId,projectId); + wrapper.orderByAsc(PlatformTaskPlanningEO::getNodeTime); + List taskPlanningEOList = list(wrapper); + Map result = new HashMap<>(); + if(ObjectUtils.isEmpty(taskPlanningEOList)){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.isNull(PlatformTaskPlanningEO::getProjectId); + List list = list(queryWrapper); + + List up = list.stream() + .filter(e -> StringUtils.isNotBlank(e.getFlag()) && UpAndDownEnum.UP.getValue().equals(e.getFlag())).collect(Collectors.toList()); + List down = list.stream() + .filter(e -> StringUtils.isNotBlank(e.getFlag()) && UpAndDownEnum.DOWN.getValue().equals(e.getFlag())).collect(Collectors.toList()); + + result.put("listUp",up); + result.put("listDown",down); + + }else{ + for (PlatformTaskPlanningEO platformTaskPlanningEO : taskPlanningEOList) { + platformTaskPlanningEO.setName(platformTaskPlanningEO.getNodeName()); + platformTaskPlanningEO.setTime(platformTaskPlanningEO.getNodeTime()); + platformTaskPlanningEO.setG(false); + if(ObjectUtils.isNotEmpty(platformTaskPlanningEO.getNodeTime())){ + if(platformTaskPlanningEO.getNodeTime().after(date)){ + platformTaskPlanningEO.setStatus(PlanStatusEnum.LESS_THAN_TIME.getValue()); + }else if(platformTaskPlanningEO.getNodeTime().before(date)){ + platformTaskPlanningEO.setStatus(PlanStatusEnum.OUT_OF_DATE.getValue()); + }else{ + platformTaskPlanningEO.setStatus(PlanStatusEnum.ON_GOING.getValue()); + } + } + } + + List up = taskPlanningEOList.stream() + .filter(e -> StringUtils.isNotBlank(e.getFlag()) && UpAndDownEnum.UP.getValue().equals(e.getFlag())).collect(Collectors.toList()); + List down = taskPlanningEOList.stream() + .filter(e -> StringUtils.isNotBlank(e.getFlag()) && UpAndDownEnum.DOWN.getValue().equals(e.getFlag())).collect(Collectors.toList()); + + result.put("listUp",up); + result.put("listDown",down); + } + return result; + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/LawsInventoryPlatformEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/LawsInventoryPlatformEOController.java new file mode 100644 index 000000000..0433e3699 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/LawsInventoryPlatformEOController.java @@ -0,0 +1,208 @@ +package com.jero.modules.project.controller; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +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.api.vo.Result; +import com.jero.common.aspect.annotation.AutoLog; +import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.query.QueryGenerator; +import com.jero.modules.project.entity.LawsInventoryPlatformEO; +import com.jero.modules.project.service.ILawsInventoryPlatformEOService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + + + /** + * @Description: 车型项目库法规清单关联平台件表 + * @Author: jero-boot + * @Date: 2023-09-19 + * @Version: V1.0 + */ +@Api(tags="车型项目库法规清单关联平台件表") +@RestController +@RequestMapping("/project/lawsInventoryPlatformEO") +@Slf4j +public class LawsInventoryPlatformEOController extends JeroController { + @Autowired + private ILawsInventoryPlatformEOService lawsInventoryPlatformEOService; + + /** + * 分页列表查询 + * + * @param lawsInventoryPlatformEO + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "车型项目库法规清单关联平台件表-分页列表查询") + @ApiOperation(value="车型项目库法规清单关联平台件表-分页列表查询", notes="车型项目库法规清单关联平台件表-分页列表查询") + @GetMapping(value = "/page") + public Result queryPageList(LawsInventoryPlatformEO lawsInventoryPlatformEO, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(lawsInventoryPlatformEO, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = lawsInventoryPlatformEOService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "车型项目库法规清单关联平台件表-列表查询") + @ApiOperation(value="车型项目库法规清单关联平台件表-列表查询", notes="车型项目库法规清单关联平台件表-列表查询") + @GetMapping(value = "/list") + public Result> queryList() { + List list = lawsInventoryPlatformEOService.queryList(); + return Result.OK(list); + } + + /** + * 添加 + * + * @param lawsInventoryPlatformEO + * @return + */ + @AutoLog(value = "车型项目库法规清单关联平台件表-添加") + @ApiOperation(value="车型项目库法规清单关联平台件表-添加", notes="车型项目库法规清单关联平台件表-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody LawsInventoryPlatformEO lawsInventoryPlatformEO) { + lawsInventoryPlatformEOService.add(lawsInventoryPlatformEO); + return Result.OK("添加成功!"); + } + /** + * 批量添加 + * + * @param json + * @return + */ + @AutoLog(value = "车型项目库法规清单关联平台件表-批量添加") + @ApiOperation(value="车型项目库法规清单关联平台件表-批量添加", notes="车型项目库法规清单关联平台件表-批量添加") + @PostMapping(value = "/addBatch") + public Result addBatch(@Validated @RequestBody JSONObject json) { + JSONArray dataList = json.getJSONArray("list"); + List lawsInventoryPlatformEOS = new ArrayList<>(); + for (Object data : dataList) { + LawsInventoryPlatformEO inventoryPlatformEO = JSONObject.parseObject(JSONObject.toJSONString(data), LawsInventoryPlatformEO.class); + lawsInventoryPlatformEOS.add(inventoryPlatformEO); + } + lawsInventoryPlatformEOService.addBatch(lawsInventoryPlatformEOS); + String msg = ""; + if(ObjectUtils.isNotEmpty(json.get("msg"))){ + msg = (String)json.get("msg"); + }else{ + msg = ""; + } + return Result.OK(msg); + } + + /** + * 编辑 + * + * @param lawsInventoryPlatformEO + * @return + */ + @AutoLog(value = "车型项目库法规清单关联平台件表-编辑") + @ApiOperation(value="车型项目库法规清单关联平台件表-编辑", notes="车型项目库法规清单关联平台件表-编辑") + @PutMapping(value = "/edit") + public Result edit(@Validated @RequestBody LawsInventoryPlatformEO lawsInventoryPlatformEO) { + lawsInventoryPlatformEOService.editById(lawsInventoryPlatformEO); + 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) { + lawsInventoryPlatformEOService.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.lawsInventoryPlatformEOService.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) { + LawsInventoryPlatformEO lawsInventoryPlatformEO = lawsInventoryPlatformEOService.queryById(id); + if(lawsInventoryPlatformEO==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(lawsInventoryPlatformEO); + } + + /** + * 导出excel + * + * @param request + * @param lawsInventoryPlatformEO + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, LawsInventoryPlatformEO lawsInventoryPlatformEO) { + return super.exportXls(request, lawsInventoryPlatformEO, LawsInventoryPlatformEO.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, LawsInventoryPlatformEO.class); + } + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/PhoneProjectLawsInventoryEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/PhoneProjectLawsInventoryEOController.java index 9ec966ed0..3506c9e7a 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/PhoneProjectLawsInventoryEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/PhoneProjectLawsInventoryEOController.java @@ -561,4 +561,6 @@ public class PhoneProjectLawsInventoryEOController extends JeroController finalizationVerify(@RequestParam Map params){ return this.projectLawsInventoryEOService.finalizationVerify(params); } + + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java index c943f39cb..b630cae1a 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java @@ -1,32 +1,39 @@ package com.jero.modules.project.controller; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import com.alibaba.fastjson.JSONObject; -import com.jero.common.api.vo.Result; -import com.jero.common.system.query.QueryGenerator; -import com.jero.modules.project.entity.ProjectCertificationInventoryEO; -import com.jero.modules.project.entity.ProjectLawsInventoryEO; -import com.jero.modules.project.service.IProjectCertificationInventoryEOService; 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.modules.system.entity.SysRole; -import lombok.extern.slf4j.Slf4j; +import com.jero.common.api.vo.Result; +import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.query.QueryGenerator; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; +import com.jero.modules.project.service.IProjectCertificationInventoryEOService; +import com.jero.modules.system.entity.SysRole; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import com.jero.common.aspect.annotation.AutoLog; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Map; /** @@ -86,6 +93,19 @@ public class ProjectCertificationInventoryEOController extends JeroController listPlatform(@RequestBody Map params) { + String msg = projectCertificationInventoryEOService.listPlatform(params); + return Result.OK(msg); + } + /** * 列表查询 * diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLawsInventoryEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLawsInventoryEOController.java index 66ab3f348..e96cef2cc 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLawsInventoryEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLawsInventoryEOController.java @@ -575,4 +575,16 @@ public class ProjectLawsInventoryEOController extends JeroController finalizationVerify(@RequestParam Map params){ return this.projectLawsInventoryEOService.finalizationVerify(params); } + /** + * 点击流程状态查看流程详情(平台件) + * + * @return + */ + @AutoLog(value = "点击流程状态查看流程详情(平台件)") + @ApiOperation(value="点击流程状态查看流程详情(平台件)", notes="点击流程状态查看流程详情(平台件)") + @GetMapping(value = "/queryPlatformList") + public Result> queryPlatformList(String lawsInventoryId,String flowFlag,String cut) { + List list = projectLawsInventoryEOService.queryPlatformList(lawsInventoryId,flowFlag,cut); + return Result.OK(list); + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLibraryBaseController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLibraryBaseController.java index 13dc0cc81..2f4fcbf67 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLibraryBaseController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLibraryBaseController.java @@ -61,6 +61,41 @@ public class ProjectLibraryBaseController extends JeroController quotePage(@RequestBody Map params) { + params.put("flag","quote"); + List pageList= projectLibraryBaseService.queryPageList(params); + Page pages = projectLibraryBaseService.getPages(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()), pageList); + return Result.OK(params.get("cut").toString(),pages); + } + + /** + * 勾选法规清单进行关联平台件 + * + * @return + */ + @AutoLog(value = "勾选法规清单进行关联平台件") + @ApiOperation(value="勾选法规清单进行关联平台件", notes="勾选法规清单进行关联平台件") + @PostMapping(value = "/listPlatform") + public Result listPlatform(@RequestBody Map params) { + Map map = projectLibraryBaseService.listPlatform(params); + return Result.OK(params.get("cut").toString(),map); + } + /** + * 不勾选法规清单进行关联平台件 + * + * @return + */ + @AutoLog(value = "不勾选法规清单进行关联平台件") + @ApiOperation(value="不勾选法规清单进行关联平台件", notes="不勾选法规清单进行关联平台件") + @PostMapping(value = "/listPlatformAll") + public Result listPlatformAll(@RequestBody Map params) { + Map mapList = projectLibraryBaseService.listPlatformAll(params); + return Result.OK(params.get("cut").toString(),mapList); + } /** * 列表查询 @@ -170,6 +205,18 @@ public class ProjectLibraryBaseController extends JeroController queryByIdFlow(@RequestParam(name="id",required=true) String id, + @RequestParam(name="cut",required=true) String cut) { + List data = projectLibraryBaseService.queryByIdFlow(id,cut); + if(data==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(cut,data); + } + /** * 导出excel * diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/LawsInventoryPlatformEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/LawsInventoryPlatformEO.java new file mode 100644 index 000000000..1f8118edb --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/LawsInventoryPlatformEO.java @@ -0,0 +1,76 @@ +package com.jero.modules.project.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + + +/** + * @Description: 车型项目库法规清单关联平台件表 + * @Author: jero-boot + * @Date: 2023-09-19 + * @Version: V1.0 + */ +@Data +@TableName("laws_inventory_platform") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="laws_inventory_platform对象", description="车型项目库法规清单关联平台件表") +public class LawsInventoryPlatformEO 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 lawsInventoryId; + + /**平台件项目库法规清单id*/ + @Excel(name = "平台件项目库法规清单id", width = 15) + @ApiModelProperty(value = "平台件项目库法规清单id") + private java.lang.String platformLawsInventoryId; + + @TableField(exist = false) + @ApiModelProperty(value = "平台件项目库法规清单ids") + private java.lang.String platformLawsInventoryIds; + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryDutyEnginnerEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryDutyEnginnerEO.java index 3aa2f9a18..c4734bc86 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryDutyEnginnerEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryDutyEnginnerEO.java @@ -216,4 +216,8 @@ public class ProjectCertificationInventoryDutyEnginnerEO implements Serializable // @Excel(name = "*截止日期", width = 20, format = "yyyy-MM-dd") @TableField(exist = false) private String endTimeStr; + + @ApiModelProperty(value = "备注") +// @Excel(name = "备注", width = 50) + private String remark; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryDutyEnginnerEOEnPlatform.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryDutyEnginnerEOEnPlatform.java new file mode 100644 index 000000000..a615b5bd9 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryDutyEnginnerEOEnPlatform.java @@ -0,0 +1,222 @@ +package com.jero.modules.project.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.jero.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + + +/** + * @Description: 认证清单工程接口人和责任人导出类 + * @Author: jero-boot + * @Date: 2023-03-03 + * @Version: V1.0 + */ +@Data +@TableName("project_certification_inventory") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="project_certification_inventory对象", description="项目库-认证清单表") +public class ProjectCertificationInventoryDutyEnginnerEOEnPlatform implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + + /**创建人*/ + @ApiModelProperty(value = "创建人") + private 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 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 String sysOrgCode; + + /**类别*/ + @Excel(name = "Category", width = 20) + @ApiModelProperty(value = "类别") + private String category; + + /**检验项目*/ + @Excel(name = "Inspection Items", width = 20) + @ApiModelProperty(value = "检验项目") + private String inspectionItem; + + /**配置项*/ + @ApiModelProperty(value = "配置项") + @Dict(dicCode = "ren4_zheng4_qing1_dan1_-_pei4_zhi4_xiang4") + private String configItem; + + /**WVTA ID*/ + @Excel(name = "WVTA ID", width = 20) + @ApiModelProperty(value = "WVTA ID") + private String wvtaId; + + /**标准编号*/ + @Excel(name = "Standard No", width = 20) + @ApiModelProperty(value = "标准编号") + private String serialNumber; + + /**责任领域*/ + @ApiModelProperty(value = "责任领域") + private String dutyTerritory; + /**责任领域名称**/ + @Excel(name = "Responsible Field", width = 20) + @TableField(exist = false) + private String dutyTerritoryName; + /**责任领域名称-英文**/ + @TableField(exist = false) + private String dutyTerritoryNameEn; + + /**工程接口人*/ + @ApiModelProperty(value = "工程接口人") + private String sdt; + /**工程接口人名称**/ + @Excel(name = "Eng. Interface", width = 20) + @TableField(exist = false) + private String sdtName; + + /**责任人*/ + @ApiModelProperty(value = "责任人") + private String dutyPerson; + /**责任人名称**/ + @Excel(name = "Assignee", width = 20) + @TableField(exist = false) + private String dutyPersonName; + + /**交付物模板*/ + @ApiModelProperty(value = "交付物模板") + private String deliverableTemplate; + /**交付物模板名称**/ + @TableField(exist = false) + @Excel(name = "Deliverable Template", width = 40) + private String deliverableTemplateName; + + /**交付物类型*/ + @ApiModelProperty(value = "交付物类型") + private String deliverableType; + // 交付物类型名称 + @Excel(name = "Deliverable Type", width = 20) + @TableField(exist = false) + private String deliverableTypeName; + // 交付物类型名称-英文 + @TableField(exist = false) + private String deliverableTypeNameEn; + + /**交付物*/ +// @Excel(name = "交付物", width = 15) + @ApiModelProperty(value = "交付物") + private String deliverable; + + /**文档库id*/ +// @Excel(name = "文档库id", width = 15) + @ApiModelProperty(value = "文档库id") + private String bussDocumentLibraryId; + + + + /**交付结果*/ + @Excel(name = "Deliverables Result", width = 20) + @ApiModelProperty(value = "交付结果") + private String deliveryResult; + + /**截止日期*/ + @Excel(name = "Due Date", width = 20, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "截止日期") + private java.util.Date endTime; + + /**流程状态*/ + @ApiModelProperty(value = "流程状态") + private String flowStatus; + // 流程状态展示名称 + @Excel(name = "Process Status", width = 20) + @TableField(exist = false) + private String flowStatusName; + + /**报告编号*/ +// @Excel(name = "Report No", width = 20) + @ApiModelProperty(value = "报告编号") + private String reportNumber; + + /**产品型号*/ +// @Excel(name = "Product Model", width = 20) + @ApiModelProperty(value = "产品型号") + private String productModel; + + /**生产企业名称*/ +// @Excel(name = "Name Of Manufacturer", width = 40) + @ApiModelProperty(value = "生产企业名称") + private String productionEnterpriseName; + + /**认证进度*/ + + @ApiModelProperty(value = "认证进度") + private String certificationProgress; + + /**认证进度展示名称**/ + @TableField(exist = false) +// @Excel(name = "Homologation Progress", width = 40) + private String certificationProgress_dictText; + + // @Excel(name = "认证进度备注", width = 15) + @ApiModelProperty(value = "认证进度备注") + private String certificationProgressRemark; + + /**项目库id*/ + @ApiModelProperty(value = "项目库id") + private String projectLibraryId; + + @TableField(exist = false) + private String cut; + + @TableField(exist = false) + private String ids; + + @TableField(exist = false) + private String roleCode; + + /**值类型,对应SysCategoryValueTypeEnum中value**/ + @TableField(exist = false) + private String valueType; + + @TableField(exist = false) + private String excelName; + + // @Excel(name = "截止日期", width = 20, format = "yyyy-MM-dd") + @TableField(exist = false) + private String endTimeStr; + + @ApiModelProperty(value = "备注") + @Excel(name = "Remark", width = 50) + private String remark; +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryDutyEnginnerEOPlatform.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryDutyEnginnerEOPlatform.java new file mode 100644 index 000000000..f667414db --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryDutyEnginnerEOPlatform.java @@ -0,0 +1,223 @@ +package com.jero.modules.project.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.jero.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + + +/** + * @Description: 认证清单工程接口人和责任人导出类 + * @Author: jero-boot + * @Date: 2023-03-03 + * @Version: V1.0 + */ +@Data +@TableName("project_certification_inventory") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="project_certification_inventory对象", description="项目库-认证清单表") +public class ProjectCertificationInventoryDutyEnginnerEOPlatform implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private Date createTime; + + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private String sysOrgCode; + + /**类别*/ + @Excel(name = "类别", width = 20) + @ApiModelProperty(value = "类别") + private String category; + + /**检验项目*/ + @Excel(name = "检验项目", width = 20) + @ApiModelProperty(value = "检验项目") + private String inspectionItem; + + /**配置项*/ + @ApiModelProperty(value = "配置项") + @Dict(dicCode = "ren4_zheng4_qing1_dan1_-_pei4_zhi4_xiang4") + private String configItem; + + /**WVTA ID*/ + @Excel(name = "WVTA ID", width = 20) + @ApiModelProperty(value = "WVTA ID") + private String wvtaId; + + /**标准编号*/ + @Excel(name = "标准编号", width = 20) + @ApiModelProperty(value = "标准编号") + private String serialNumber; + + /**责任领域*/ + @ApiModelProperty(value = "责任领域") + private String dutyTerritory; + /**责任领域名称**/ + @Excel(name = "责任领域", width = 20) + @TableField(exist = false) + private String dutyTerritoryName; + /**责任领域名称-英文**/ + @TableField(exist = false) + private String dutyTerritoryNameEn; + + /**工程接口人*/ + @ApiModelProperty(value = "工程接口人") + private String sdt; + /**工程接口人名称**/ + @Excel(name = "工程接口人", width = 20) + @TableField(exist = false) + private String sdtName; + + /**责任人*/ + @ApiModelProperty(value = "责任人") + private String dutyPerson; + /**责任人名称**/ + @Excel(name = "责任人", width = 20) + @TableField(exist = false) + private String dutyPersonName; + + /**交付物模板*/ + @ApiModelProperty(value = "交付物模板") + private String deliverableTemplate; + /**交付物模板名称**/ + @TableField(exist = false) + @Excel(name = "交付物模板", width = 20) + private String deliverableTemplateName; + + /**交付物类型*/ + @ApiModelProperty(value = "交付物类型") + private String deliverableType; + // 交付物类型名称 + @Excel(name = "交付物类型", width = 20) + @TableField(exist = false) + private String deliverableTypeName; + // 交付物类型名称-英文 + @TableField(exist = false) + private String deliverableTypeNameEn; + + /**交付物*/ +// @Excel(name = "交付物", width = 15) + @ApiModelProperty(value = "交付物") + private String deliverable; + + /**文档库id*/ +// @Excel(name = "文档库id", width = 15) + @ApiModelProperty(value = "文档库id") + private String bussDocumentLibraryId; + + + + /**交付结果*/ + @Excel(name = "交付结果", width = 20) + @ApiModelProperty(value = "交付结果") + private String deliveryResult; + + /**截止日期*/ + @Excel(name = "截止日期", width = 20, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "截止日期") + private Date endTime; + /**流程状态*/ + @ApiModelProperty(value = "流程状态") + private String flowStatus; + // 流程状态展示名称 + @Excel(name = "流程状态", width = 20) + @TableField(exist = false) + private String flowStatusName; + + /**报告编号*/ +// @Excel(name = "报告编号", width = 20) + @ApiModelProperty(value = "报告编号") + private String reportNumber; + + /**产品型号*/ +// @Excel(name = "产品型号", width = 20) + @ApiModelProperty(value = "产品型号") + private String productModel; + + /**生产企业名称*/ +// @Excel(name = "生产企业名称", width = 20) + @ApiModelProperty(value = "生产企业名称") + private String productionEnterpriseName; + + /**认证进度*/ + + @ApiModelProperty(value = "认证进度") + private String certificationProgress; + + /**认证进度展示名称**/ +// @Excel(name = "认证进度", width = 20) + @TableField(exist = false) + private String certificationProgress_dictText; + +// @Excel(name = "认证进度备注", width = 15) + @ApiModelProperty(value = "认证进度备注") + private String certificationProgressRemark; + + + /**项目库id*/ + @ApiModelProperty(value = "项目库id") + private String projectLibraryId; + + @TableField(exist = false) + private String cut; + + @TableField(exist = false) + private String ids; + + @TableField(exist = false) + private String roleCode; + + /**值类型,对应SysCategoryValueTypeEnum中value**/ + @TableField(exist = false) + private String valueType; + + @TableField(exist = false) + private String excelName; + +// @Excel(name = "*截止日期", width = 20, format = "yyyy-MM-dd") + @TableField(exist = false) + private String endTimeStr; + + @ApiModelProperty(value = "备注") + @Excel(name = "备注", width = 50) + private String remark; +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEO.java index 7f8c25293..816d2d002 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEO.java @@ -1,24 +1,22 @@ package com.jero.modules.project.entity; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.util.Date; - import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; 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.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; /** @@ -258,7 +256,16 @@ public class ProjectCertificationInventoryEO implements Serializable { @ApiModelProperty(value = "认证类型") private String attestationType; + /**备注*/ + @ApiModelProperty(value = "备注") + @Excel(name = "备注", width = 50) + private String remark; + /**一级责任领域**/ @TableField(exist = false) private String firstLevelDutyTerritory; + + @ApiModelProperty(value = "关联平台件数据") + @TableField(exist = false) + private List projectCertificationInventoryEOS; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEOEnPlatform.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEOEnPlatform.java new file mode 100644 index 000000000..c8a58fed9 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEOEnPlatform.java @@ -0,0 +1,228 @@ +package com.jero.modules.project.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.jero.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + + +/** + * @Description: 项目库-认证清单表 + * @Author: jero-boot + * @Date: 2023-03-03 + * @Version: V1.0 + */ +@Data +@TableName("project_certification_inventory") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="project_certification_inventory对象", description="项目库-认证清单表") +public class ProjectCertificationInventoryEOEnPlatform implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + + /**创建人*/ + @ApiModelProperty(value = "创建人") + private 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 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 String sysOrgCode; + + /**类别*/ + @Excel(name = "Category", width = 20) + @ApiModelProperty(value = "类别") + private String category; + + /**检验项目*/ + @Excel(name = "Inspection Items", width = 20) + @ApiModelProperty(value = "检验项目") + private String inspectionItem; + + /**配置项*/ + @ApiModelProperty(value = "配置项") + @Dict(dicCode = "ren4_zheng4_qing1_dan1_-_pei4_zhi4_xiang4") + private String configItem; + + /**认证类型*/ + @Excel(name = "Certification Type", width = 20) + @ApiModelProperty(value = "认证类型") + @TableField(exist = false) + private String attestationTypeName; + + /**WVTA ID*/ + @Excel(name = "WVTA ID", width = 20) + @ApiModelProperty(value = "WVTA ID") + private String wvtaId; + + /**标准编号*/ + @Excel(name = "Standard No", width = 20) + @ApiModelProperty(value = "标准编号") + private String serialNumber; + + /**责任领域*/ + @ApiModelProperty(value = "责任领域") + private String dutyTerritory; + /**责任领域名称**/ + @Excel(name = "Responsible Field", width = 20) + @TableField(exist = false) + private String dutyTerritoryName; + /**责任领域名称-英文**/ + @TableField(exist = false) + private String dutyTerritoryNameEn; + + /**工程接口人*/ + @ApiModelProperty(value = "工程接口人") + private String sdt; + /**工程接口人名称**/ + @Excel(name = "Eng. Interface", width = 20) + @TableField(exist = false) + private String sdtName; + + /**责任人*/ + @ApiModelProperty(value = "责任人") + private String dutyPerson; + /**责任人名称**/ + @Excel(name = "Assignee", width = 20) + @TableField(exist = false) + private String dutyPersonName; + + /**交付物模板*/ + @ApiModelProperty(value = "交付物模板") + private String deliverableTemplate; + /**交付物模板名称**/ + @TableField(exist = false) + @Excel(name = "Deliverable Template", width = 40) + private String deliverableTemplateName; + + /**交付物类型*/ + @ApiModelProperty(value = "交付物类型") + private String deliverableType; + // 交付物类型名称 + @Excel(name = "Deliverable Type", width = 20) + @TableField(exist = false) + private String deliverableTypeName; + // 交付物类型名称-英文 + @TableField(exist = false) + private String deliverableTypeNameEn; + + /**交付物*/ +// @Excel(name = "交付物", width = 15) + @ApiModelProperty(value = "交付物") + private String deliverable; + + /**文档库id*/ +// @Excel(name = "文档库id", width = 15) + @ApiModelProperty(value = "文档库id") + private String bussDocumentLibraryId; + + + + /**交付结果*/ + @Excel(name = "Deliverables Result", width = 20) + @ApiModelProperty(value = "交付结果") + private String deliveryResult; + + /**截止日期*/ + @Excel(name = "Due Date", width = 20, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "截止日期") + private java.util.Date endTime; + + /**流程状态*/ + @ApiModelProperty(value = "流程状态") + private String flowStatus; + // 流程状态展示名称 + @Excel(name = "Process Status", width = 20) + @TableField(exist = false) + private String flowStatusName; + + /**报告编号*/ + @Excel(name = "Report No", width = 20) + @ApiModelProperty(value = "报告编号") + private String reportNumber; + + /**产品型号*/ + @Excel(name = "Product Model", width = 20) + @ApiModelProperty(value = "产品型号") + private String productModel; + + /**生产企业名称*/ + @Excel(name = "Name Of Manufacturer", width = 40) + @ApiModelProperty(value = "生产企业名称") + private String productionEnterpriseName; + + /**认证进度*/ + + @ApiModelProperty(value = "认证进度") + private String certificationProgress; + + /**认证进度展示名称**/ + @TableField(exist = false) + private String certificationProgress_dictText; + + // @Excel(name = "认证进度备注", width = 15) + @ApiModelProperty(value = "认证进度备注") + private String certificationProgressRemark; + + /**项目库id*/ + @ApiModelProperty(value = "项目库id") + private String projectLibraryId; + + @TableField(exist = false) + private String cut; + + @TableField(exist = false) + private String ids; + + @TableField(exist = false) + private String roleCode; + + /**值类型,对应SysCategoryValueTypeEnum中value**/ + @TableField(exist = false) + private String valueType; + + @TableField(exist = false) + private String excelName; + + // @Excel(name = "截止日期", width = 20, format = "yyyy-MM-dd") + @TableField(exist = false) + private String endTimeStr; + + @ApiModelProperty(value = "备注") + @Excel(name = "Remark", width = 50) + private String remark; + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEOPlatform.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEOPlatform.java new file mode 100644 index 000000000..0f0a69806 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEOPlatform.java @@ -0,0 +1,268 @@ +package com.jero.modules.project.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.jero.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + + +/** + * @Description: 项目库-认证清单表 + * @Author: jero-boot + * @Date: 2023-03-03 + * @Version: V1.0 + */ +@Data +@TableName("project_certification_inventory") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="project_certification_inventory对象", description="项目库-认证清单表") +public class ProjectCertificationInventoryEOPlatform implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private Date createTime; + + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private String sysOrgCode; + + /**类别*/ + @Excel(name = "类别", width = 20) + @ApiModelProperty(value = "类别") + private String category; + + /**检验项目*/ + @Excel(name = "检验项目", width = 20) + @ApiModelProperty(value = "检验项目") + private String inspectionItem; + + /**配置项*/ + @ApiModelProperty(value = "配置项") + @Dict(dicCode = "ren4_zheng4_qing1_dan1_-_pei4_zhi4_xiang4") + private String configItem; + + /**认证类型名称**/ + @Excel(name = "认证类型", width = 20) + @TableField(exist = false) + private String attestationTypeName; + + /**WVTA ID*/ + @Excel(name = "WVTA ID", width = 20) + @ApiModelProperty(value = "WVTA ID") + private String wvtaId; + + /**标准编号*/ + @Excel(name = "标准编号", width = 20) + @ApiModelProperty(value = "标准编号") + private String serialNumber; + + /**责任领域*/ + @ApiModelProperty(value = "责任领域") + private String dutyTerritory; + /**责任领域名称**/ + @Excel(name = "责任领域", width = 20) + @TableField(exist = false) + private String dutyTerritoryName; + /**责任领域名称-英文**/ + @TableField(exist = false) + private String dutyTerritoryNameEn; + + /**责任部门*/ + @ApiModelProperty(value = "责任部门") + private String dutyDepart; + /**工程接口人*/ + @ApiModelProperty(value = "工程接口人") + private String sdt; + /**工程接口人名称**/ + @Excel(name = "工程接口人", width = 20) + @TableField(exist = false) + private String sdtName; + + /**责任人*/ + @ApiModelProperty(value = "责任人") + private String dutyPerson; + /**责任人名称**/ + @Excel(name = "责任人", width = 20) + @TableField(exist = false) + private String dutyPersonName; + + /**交付物模板*/ + @ApiModelProperty(value = "交付物模板") + private String deliverableTemplate; + /**交付物模板名称**/ + @TableField(exist = false) + @Excel(name = "交付物模板", width = 20) + private String deliverableTemplateName; + + /**交付物类型*/ + @ApiModelProperty(value = "交付物类型") + private String deliverableType; + // 交付物类型名称 + @Excel(name = "交付物类型", width = 20) + @TableField(exist = false) + private String deliverableTypeName; + // 交付物类型名称-英文 + @TableField(exist = false) + private String deliverableTypeNameEn; + + /**交付物*/ +// @Excel(name = "交付物", width = 15) + @ApiModelProperty(value = "交付物") + private String deliverable; + + /**文档库id*/ +// @Excel(name = "文档库id", width = 15) + @ApiModelProperty(value = "文档库id") + private String bussDocumentLibraryId; + + + + /**交付结果*/ + @Excel(name = "交付结果", width = 20) + @ApiModelProperty(value = "交付结果") + private String deliveryResult; + + /**截止日期*/ + @Excel(name = "截止日期", width = 20, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "截止日期") + private Date endTime; + /**流程状态*/ + @ApiModelProperty(value = "流程状态") + private String flowStatus; + // 流程状态展示名称 + @Excel(name = "流程状态", width = 20) + @TableField(exist = false) + private String flowStatusName; + + /**报告编号*/ + @Excel(name = "报告编号", width = 20) + @ApiModelProperty(value = "报告编号") + private String reportNumber; + + /**产品型号*/ + @Excel(name = "产品型号", width = 20) + @ApiModelProperty(value = "产品型号") + private String productModel; + + /**生产企业名称*/ + @Excel(name = "生产企业名称", width = 20) + @ApiModelProperty(value = "生产企业名称") + private String productionEnterpriseName; + + /**认证进度*/ + @ApiModelProperty(value = "认证进度") + private String certificationProgress; + + // 认证进度排序字段 + @TableField(exist = false) + private String certificationProgressNumber; + + /**认证进度展示名称**/ + @TableField(exist = false) + private String certificationProgress_dictText; + +// @Excel(name = "认证进度备注", width = 15) + @ApiModelProperty(value = "认证进度备注") + private String certificationProgressRemark; + + /**项目库id*/ + @ApiModelProperty(value = "项目库id") + private String projectLibraryId; + + @TableField(exist = false) + private String cut; + + @TableField(exist = false) + private String ids; + + @TableField(exist = false) + private String roleCode; + + /**值类型,对应SysCategoryValueTypeEnum中value**/ + @TableField(exist = false) + private String valueType; + + @TableField(exist = false) + private String excelName; + +// @Excel(name = "*截止日期", width = 20, format = "yyyy-MM-dd") + @TableField(exist = false) + private String endTimeStr; + + @TableField(exist = false) + private String reasonForReturn; + + //排序(1->正序, 2->倒序) + @TableField(exist = false) + private String orderBy; + + //排序字段 + @TableField(exist = false) + private String orderByField; + + /**清单校核截止时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "清单校核截止时间") + private Date inventoryVerifyEndTime; + + /**责任确认截止时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "责任确认截止时间") + private Date taskConfirmEndTime; + + /**认证类型*/ + @ApiModelProperty(value = "认证类型") + private String attestationType; + + /**一级责任领域**/ + @TableField(exist = false) + private String firstLevelDutyTerritory; + + @ApiModelProperty(value = "关联平台件数据") + @TableField(exist = false) + private List projectCertificationInventoryEOS; + + @ApiModelProperty(value = "备注") + @Excel(name = "备注", width = 50) + private String remark; +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java index bec053579..042171f70 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java @@ -1,12 +1,10 @@ package com.jero.modules.project.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.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; -import com.jero.common.aspect.annotation.Dict; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -17,6 +15,7 @@ import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; +import java.util.List; /** @@ -187,6 +186,10 @@ public class ProjectLawsInventoryEO implements Serializable { @ApiModelProperty(value = "法规工程师名称") private String regulationOwnerName;//法规工程师名称 + @TableField(exist = false) + @ApiModelProperty(value = "法规工程师名称(前端指定要的)") + private String regulationOwnerIdName;//法规工程师名称(前端指定要的) + /**认证工程师id*/ @ApiModelProperty(value = "认证工程师id") private String homologationEngineerId; @@ -538,4 +541,13 @@ public class ProjectLawsInventoryEO implements Serializable { /**一级责任领域**/ @TableField(exist = false) private String firstLevelDutyTerritory; + + @TableField(exist = false) + private String projectName;//项目名称 + + @TableField(exist = false) + private List projectLawsInventoryEOS; + + @TableField(exist = false) + private String platformIds;//平台件数据id } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLibraryBase.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLibraryBase.java index 2fdadb87a..0fa5d5c54 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLibraryBase.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLibraryBase.java @@ -161,6 +161,112 @@ public class ProjectLibraryBase implements Comparable { @TableField(exist = false) private String projectNameCn; + @ApiModelProperty(value = "平台件数据标识,platform = YES,为平台件数据,platform为空是项目库数据") + private String platform; + + //平台件项目库字段-------------------------------------------------------------------------------------------------------------- + + @ApiModelProperty(value = "功率") + private String power; + + @ApiModelProperty(value = "生产商") + private String producer; + + @ApiModelProperty(value = "责任部门") + private String dutyDepart; + + @TableField(exist = false) + private String dutyDepartName; + + @ApiModelProperty(value = "法规工程师") + private String regulationOwnerId; + + @TableField(exist = false) + @ApiModelProperty(value = "法规工程师回显") + private String regulationOwnerIdName; + + @ApiModelProperty(value = "工程接口人") + private String engineeringInterfacePerson; + + @TableField(exist = false) + @ApiModelProperty(value = "工程接口人回显") + private String engineeringInterfacePersonName; + + @ApiModelProperty(value = "名牌标签") + private String brandLabel; + + @ApiModelProperty(value = "产品型号") + private String productModel; + + @ApiModelProperty(value = "电芯生产企业") + private String cellEnterprise; + + @ApiModelProperty(value = "总成生产企业") + private String assemblyEnterprise; + + @ApiModelProperty(value = "零件号(国内)") + private String partNumberCn; + + @ApiModelProperty(value = "零件号(国外)") + private String partNumberEn; + + @ApiModelProperty(value = "24位备案码") + private String filingCode; + + @ApiModelProperty(value = "供应商代码(1-3)") + private String supplierCode; + + @ApiModelProperty(value = "产品类型代码(4)") + private String productTypeCode; + + @ApiModelProperty(value = "电池类型代码(5)") + private String batteryTypeCode; + + @ApiModelProperty(value = "规格代码(6-7)") + private String specificationCode; + + @ApiModelProperty(value = "追溯代码(8)") + private String traceabilityCode; + + @ApiModelProperty(value = "生产也月日序列号") + private String ymdNumber; + + @ApiModelProperty(value = "尺寸") + private String size; + + @ApiModelProperty(value = "额定容量") + private String ratedCapacity; + + @ApiModelProperty(value = "标称电压") + private String nominalVoltage; + + @ApiModelProperty(value = "额定质量") + private String ratedMass; + + @ApiModelProperty(value = "包含模块个数") + private String moduleNumber; + + @ApiModelProperty(value = "模块串并联方式") + private String connectionType; + + @ApiModelProperty(value = "所用模块或单体规格代码") + private String moduleSpecificationCode; + + @ApiModelProperty(value = "冷却方式") + private String coolingMethod; + + @ApiModelProperty(value = "备案完成时间") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + private java.util.Date filingCompletionTime; + + @ApiModelProperty(value = "备注") + private String remark; + + @TableField(exist = false) + private List urlList; + + @Override public int compareTo(ProjectLibraryBase o) { if (!this.getProjectName().equals(o.getProjectName())) { diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationInventoryFlowStatusEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationInventoryFlowStatusEnum.java index ae3e31c20..211b6c269 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationInventoryFlowStatusEnum.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationInventoryFlowStatusEnum.java @@ -32,8 +32,8 @@ public enum CertificationInventoryFlowStatusEnum { RESULTS_TO_BE_SUBMITTED("结果待提交","Results to be submitted","Results to be submitted"), //ENGINEER_RETURN("工程师退回","Engineer return","Engineer return"), RESULTS_TO_BE_REVIEWED("结果待审查","Results to be reviewed","Results to be reviewed"), - REVIEW_AND_PASS("审查通过","Review and pass","Review and pass"), - REVIEW_AND_RETURN("审查退回","Review and return","Review and return"), + REVIEW_AND_PASS("审查通过","Approve","Review and pass"), + REVIEW_AND_RETURN("审查退回","Reject","Review and return"), UNINVOLVED("不涉及","NA","NA"), ; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/FlowFlagEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/FlowFlagEnum.java new file mode 100644 index 000000000..06ffd9ad3 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/FlowFlagEnum.java @@ -0,0 +1,45 @@ +package com.jero.modules.project.enums; + +/** + * 任务状态枚举类 + */ +public enum FlowFlagEnum { + DESIGN("设计符合性流程状态","design"), + VERIFY("验证符合性流程状态","verify"), + ; + + + String name; + String value; + + private FlowFlagEnum(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public static String getTextByValue(String value) { + FlowFlagEnum[] values = values(); + for (FlowFlagEnum taskStatusEnum : values) { + if (taskStatusEnum.value.equals(value)) { + return taskStatusEnum.name; + } + } + return null; + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/FlowStateEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/FlowStateEnum.java new file mode 100644 index 000000000..10ba287e5 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/FlowStateEnum.java @@ -0,0 +1,66 @@ +package com.jero.modules.project.enums; + +import java.util.LinkedList; +import java.util.List; + +/** + * 消息类型枚举类 + */ +public enum FlowStateEnum { + INCONFORMITY("不符合","Non-Compliance","Non-Compliance"), + TO_TRACK("待追踪","To be tracked","To be tracked"), + CONFORMITY("符合","Compliance","Compliance"), + UNINVOLVED("不涉及","NA","NA"), + LIST_TO_BE_RELEASED("清单待发布","List to be released","List to be released"), + LIST_TO_BE_CHECKED("任务待发起","Task to be initiated","List to be checked"), + REGULATORY_ENGINEER_RETURNS("法规工程师退回","Regulatory engineer returns","Regulatory engineer returns"), + REFUSAL_OF_RESPONSIBLE_PERSON("责任人拒绝","Refusal of responsible person","Duty Person Rejected"), + TASK_TO_BE_CONFIRMED("任务待确认","Task to be confirmed","Task to be confirmed"), + RESULTS_TO_BE_SUBMITTED("结果待提交","Results to be submitted","Results to be submitted"), + RESULTS_TO_BE_REVIEWED("结果待审查","Results to be reviewed","Results to be reviewed"), + + ; + + String nameCn; + String nameEn; + String value; + + private FlowStateEnum(String nameCn, String nameEn, String value) { + this.nameCn = nameCn; + this.nameEn = nameEn; + this.value = value; + } + + public String getNameCn() { + return nameCn; + } + + public void setNameCn(String nameCn) { + this.nameCn = nameCn; + } + + public String getNameEn() { + return nameEn; + } + + public void setNameEn(String nameEn) { + this.nameEn = nameEn; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public static List getValueInfo() { + List result = new LinkedList<>(); + FlowStateEnum[] values = values(); + for (FlowStateEnum flowStateEnum : values) { + result.add(flowStateEnum.getValue()); + } + return result; + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/PrehomoJob.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/PrehomoJob.java index 04736c68e..2c0a4ac94 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/PrehomoJob.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/PrehomoJob.java @@ -73,7 +73,7 @@ public class PrehomoJob implements Job { @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { log.info("prehomo流程,定时任务开启 ====================================================="); - +/* //查询出已经启动了prehomo流程的数据。 并且流程没有结束。 QueryWrapper queryProjectTaskInventoryWrapper = new QueryWrapper<>(); queryProjectTaskInventoryWrapper.isNotNull("prehomo_p_id"); @@ -367,5 +367,7 @@ public class PrehomoJob implements Job { } } log.info("prehomo流程,定时任务结束 ====================================================="); + + */ } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/LawsInventoryPlatformEOMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/LawsInventoryPlatformEOMapper.java new file mode 100644 index 000000000..b8357525e --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/LawsInventoryPlatformEOMapper.java @@ -0,0 +1,17 @@ +package com.jero.modules.project.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import com.jero.modules.project.entity.LawsInventoryPlatformEO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 车型项目库法规清单关联平台件表 + * @Author: jero-boot + * @Date: 2023-09-19 + * @Version: V1.0 + */ +public interface LawsInventoryPlatformEOMapper extends BaseMapper { + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/ProblemManagementEOMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/ProblemManagementEOMapper.java index 2ce1e634d..b306ae681 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/ProblemManagementEOMapper.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/ProblemManagementEOMapper.java @@ -1,11 +1,11 @@ package com.jero.modules.project.mapper; -import java.util.List; - +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jero.modules.project.entity.ProblemManagementEO; import com.jero.modules.project.entity.ProjectLibraryBase; import org.apache.ibatis.annotations.Param; -import com.jero.modules.project.entity.ProblemManagementEO; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import java.util.List; /** * @Description: 问题管理 @@ -17,4 +17,6 @@ public interface ProblemManagementEOMapper extends BaseMapper queryByIds(@Param("ids") String ids); + List queryByIdsProblem(@Param("ids") String ids); + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/ProjectLibraryBaseMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/ProjectLibraryBaseMapper.java index 177df9c1b..26e572258 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/ProjectLibraryBaseMapper.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/ProjectLibraryBaseMapper.java @@ -1,7 +1,6 @@ package com.jero.modules.project.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.jero.modules.project.entity.ProjectLibraryBase; import org.apache.ibatis.annotations.Param; @@ -25,6 +24,8 @@ public interface ProjectLibraryBaseMapper extends BaseMapper /**根据id查询*/ List queryById(String id); + List queryByIdFlow(String id); + ProjectLibraryBase selectProjectName(@Param("projectLibraryId") String projectLibraryId); List getListByIds(@Param("idList") List idList); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/LawsInventoryPlatformEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/LawsInventoryPlatformEOMapper.xml new file mode 100644 index 000000000..c93297b1d --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/LawsInventoryPlatformEOMapper.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/NcrTrackMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/NcrTrackMapper.xml index e74921d7a..323bd8b58 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/NcrTrackMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/NcrTrackMapper.xml @@ -31,6 +31,8 @@ pni.project_name, plb.target_market, plb.project_version, + plb.project_name_id, + plb.platform, pyni.year_name, pli.serial_number, pli.title, @@ -62,6 +64,7 @@ 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 + 1=1 - ( + and( design_flow_status =#{ncrTrackVO.inconformity} or verify_flow_status =#{ncrTrackVO.inconformity} ) @@ -104,7 +107,6 @@ and (pli.regulation_owner_id =#{ncrTrackVO.userId} or pli.homologation_engineer_id =#{ncrTrackVO.userId} or pli.engineering_interface_person =#{ncrTrackVO.userId} - or ptid.user_id =#{ncrTrackVO.userId} ) @@ -161,6 +163,7 @@ 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 + plb.id =#{ncrTrackVO.projectLibraryId} and @@ -186,8 +189,8 @@ and ( - design_flow_status =#{ncrTrackVO.inconformity} or design_flow_status =#{ncrTrackVO.track} - or verify_flow_status =#{ncrTrackVO.inconformity} or verify_flow_status =#{ncrTrackVO.track} + design_flow_status =#{ncrTrackVO.inconformity} + or verify_flow_status =#{ncrTrackVO.inconformity} ) and pli.duty_territory in diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProblemManagementEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProblemManagementEOMapper.xml index 82ebedceb..cbb36f8ad 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProblemManagementEOMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProblemManagementEOMapper.xml @@ -54,11 +54,50 @@ left join project_year_name_info as pyni on plb.year_name_id=pyni.id - plb.id in + and plb.id in #{item} + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectLibraryBaseMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectLibraryBaseMapper.xml index 0a9425628..5419e9765 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectLibraryBaseMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectLibraryBaseMapper.xml @@ -52,6 +52,8 @@ plb.sort, plb.flag, plb.brand, + plb.power, + plb.producer, sdi.item_text brandText, sdi.en_name brandTextEn from project_library_base as plb @@ -66,11 +68,16 @@ + 1=1 + + and plb.platform is null + + - ( pni.project_name like '%1%%' escape '1' or pni.project_name like '%1%%' escape '1') + and ( pni.project_name like '%1%%' escape '1' or pni.project_name like '%1%%' escape '1') @@ -127,14 +134,23 @@ and plb.brand = #{params.brand} - order by plb.sort desc, plb.create_time desc + + order by plb.platform, plb.sort desc, plb.create_time desc + + + order by plb.sort desc, plb.create_time desc + + @@ -206,6 +222,7 @@ + plb.platform is null @@ -274,7 +291,16 @@ - plb.id=#{id} + and plb.id=#{id} + + + order by plb.create_time desc + + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectRxswinEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectRxswinEOMapper.xml index ed116b16d..1d03212f0 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectRxswinEOMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/ProjectRxswinEOMapper.xml @@ -34,7 +34,8 @@ LEFT JOIN project_name_info AS pni ON plb.project_name_id = pni.id LEFT JOIN project_year_name_info AS pyni ON plb.year_name_id = pyni.id LEFT JOIN sys_dict_item AS sdi ON sdi.item_value = plb.target_market - where plb.parent_id = #{parentId} + where + plb.parent_id = #{parentId} or plb.id = #{id} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/ILawsInventoryPlatformEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/ILawsInventoryPlatformEOService.java new file mode 100644 index 000000000..3a3c4f99d --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/ILawsInventoryPlatformEOService.java @@ -0,0 +1,67 @@ +package com.jero.modules.project.service; + +import com.jero.modules.project.entity.LawsInventoryPlatformEO; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * @Description: 车型项目库法规清单关联平台件表 + * @Author: jero-boot + * @Date: 2023-09-19 + * @Version: V1.0 + */ +public interface ILawsInventoryPlatformEOService extends IService { + + /** + * 保存 + * + * @param lawsInventoryPlatformEO + * @return + */ + void add(LawsInventoryPlatformEO lawsInventoryPlatformEO); + + /** + * 批量保存 + * @param lawsInventoryPlatformEOList + */ + void addBatch(List lawsInventoryPlatformEOList); + + /** + * 更新 + * + * @param lawsInventoryPlatformEO + * @return + */ + void editById(LawsInventoryPlatformEO lawsInventoryPlatformEO); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + LawsInventoryPlatformEO queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java index 16dcdbaaf..f205301bb 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java @@ -4,10 +4,9 @@ import com.alibaba.fastjson.JSONObject; 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.api.vo.Result; -import com.jero.common.system.vo.DictModel; -import com.jero.modules.project.entity.ProjectCertificationInventoryEO; import com.baomidou.mybatisplus.extension.service.IService; +import com.jero.common.api.vo.Result; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; import com.jero.modules.system.entity.SysCategory; import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysRole; @@ -339,4 +338,11 @@ public interface IProjectCertificationInventoryEOService extends IService matchRelevantPeople(Map params); + + /** + * 勾选认证清单进行关联平台件 + * @param params + * @return + */ + String listPlatform(Map params); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java index d6280ef2a..2f2687e23 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java @@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.itextpdf.text.DocumentException; import com.jero.common.api.vo.Result; import com.jero.common.constant.enums.MessageTypeEnum; -import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.LoginUser; import com.jero.modules.feishu.vo.FeishuMsgVo; import com.jero.modules.project.entity.ProjectLawsInventoryEO; @@ -323,4 +322,6 @@ public interface IProjectLawsInventoryEOService extends IService queryPlatformList(String lawsInventoryId,String flowFlag,String cut); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryBaseService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryBaseService.java index 887732bec..49fe9059a 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryBaseService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryBaseService.java @@ -70,6 +70,8 @@ public interface IProjectLibraryBaseService extends IService */ List queryById(String id,String cut); + List queryByIdFlow(String id,String cut); + /** * 列表查询 * @@ -83,6 +85,20 @@ public interface IProjectLibraryBaseService extends IService * @return */ List queryPageList(Map params); + + /** + * 勾选法规清单进行关联平台件 + * @param params + * @return + */ + Map listPlatform(Map params); + + /** + * 不勾选法规清单进行关联平台件 + * @param params + * @return + */ + Map listPlatformAll(Map params); // IPage queryPageList(Map params); /** diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryStatisticsService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryStatisticsService.java index 8bac94398..4046b8f59 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryStatisticsService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryStatisticsService.java @@ -75,6 +75,8 @@ public interface IProjectLibraryStatisticsService { */ Map getPartCertificationProgressStatisticsGroupByTerritory(List datas, Map params); + Map getPartCertificationProgressStatisticsGroupByTerritoryTemp(List datas, Map params); + /** * 获取认证参数收集-统计信息 * @param datas @@ -82,4 +84,6 @@ public interface IProjectLibraryStatisticsService { * @return */ Map getParameterCollectingStatisticsGroupByTerritory(List datas, Map params); + + Map getParameterCollectingStatisticsGroupByTerritoryExport(List datas, Map params); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/editImpl/ProjectLawsInventoryEOEditServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/editImpl/ProjectLawsInventoryEOEditServiceImpl.java index 3f12952e8..ffc3b1571 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/editImpl/ProjectLawsInventoryEOEditServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/editImpl/ProjectLawsInventoryEOEditServiceImpl.java @@ -14,8 +14,21 @@ import com.jero.modules.dummy.util.ListDiff; import com.jero.modules.feishu.enums.TemplateInfoEnum2; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; -import com.jero.modules.project.entity.*; -import com.jero.modules.project.enums.*; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.project.entity.ProjectLibraryRoleRelEO; +import com.jero.modules.project.entity.ProjectRelatedPersonnel; +import com.jero.modules.project.entity.ProjectUserPermission; +import com.jero.modules.project.enums.ComplianceFlowStatusEnum; +import com.jero.modules.project.enums.InventoryAffirmNodeEnum; +import com.jero.modules.project.enums.JumpLinkEnum; +import com.jero.modules.project.enums.PermissionDescriptionEnum; +import com.jero.modules.project.enums.ProjectInventoryFieldEnum; +import com.jero.modules.project.enums.ProjectMessageEnum; +import com.jero.modules.project.enums.ProjectRoleEnum; +import com.jero.modules.project.enums.ProjectUserLocationEnum; +import com.jero.modules.project.enums.RoleRelModelTypeEnum; +import com.jero.modules.project.enums.TaskStatusEnum; import com.jero.modules.project.service.IProjectLawsInventoryEOService; import com.jero.modules.project.service.IProjectLibraryRoleRelEOService; import com.jero.modules.project.service.IProjectUserPermissionService; @@ -43,14 +56,20 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; -import org.apache.xmlbeans.impl.xb.xsdschema.Public; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; /** @@ -1248,6 +1267,243 @@ public class ProjectLawsInventoryEOEditServiceImpl { throw new JeroBootException("该用户没有权限操作该数据!"); } } + public void editByIdPlatform(ProjectLawsInventoryEO projectLawsInventoryEO) { + Date now = new Date(); + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// boolean checkResult = checkData(projectLawsInventoryEO.getProjectLibraryId(), currentUser.getId(), projectLawsInventoryEO.getId()); +// if (checkResult) { + QueryWrapper oldPliQueryWrap = new QueryWrapper<>(); + oldPliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getId, projectLawsInventoryEO.getId()); + List oldPliEoList = projectLawsInventoryEOService.list(oldPliQueryWrap); + + this.updateProjectLawsInventorySendMessage(projectLawsInventoryEO); + + // 根据法规清单id,获取该法规清单在待办中心的任务明细。 + List oldPliEoIdList = oldPliEoList.stream().map(ProjectLawsInventoryEO::getId).distinct().collect(Collectors.toList()); + QueryWrapper pidEoQueryWrap = new QueryWrapper<>(); + pidEoQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, oldPliEoIdList); + List pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap); + if (CollectionUtils.isNotEmpty(pidEoList)) { + // 处理编辑法规工程师的逻辑 + this.updateRegulationOwner(projectLawsInventoryEO, oldPliEoList, pidEoList); + // 处理编辑责任人的逻辑 + this.updateDutyPerson(projectLawsInventoryEO, oldPliEoList, pidEoList); + } + // 处理修改设计或验证符合性截止日期的逻辑 + this.updateDesignOrVerifyEndTime(projectLawsInventoryEO, oldPliEoList); + + projectLawsInventoryEO.setUpdateTime(now); + ProjectLawsInventoryEO projectLawsInventoryEOCopy = SerializationUtils.clone(projectLawsInventoryEO);//复制 + + //更新log + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String username = sysUser.getUsername(); + + String contentLog = username + "编辑了清单中的“" + projectLawsInventoryEO.getSerialNumber() + "”:
"; + String enContentLog = username + " edited the “" + projectLawsInventoryEO.getSerialNumber() + "” in the list:
"; + + List infoEOList = new ArrayList<>(); + infoEOList.add(projectLawsInventoryEO); + List infoEOListCopy = new ArrayList<>(); + infoEOListCopy.add(projectLawsInventoryEOCopy); + + //查询数据库里原来的数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + List dataList = projectLawsInventoryEOService.list(queryWrapper.eq("id", projectLawsInventoryEO.getId())); + List dataListCopy = DeepCopyListUtil.depCopy(dataList); + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.in(ProjectLawsInventoryEO::getId, projectLawsInventoryEO.getId()); + setDateNull(projectLawsInventoryEO, updateWrapper); + //保存 + projectLawsInventoryEOService.update(projectLawsInventoryEO, updateWrapper); +// saveOrUpdate(projectLawsInventoryEO); + + //获取编辑中的责任领域 + List dutyTerritoryList = new ArrayList<>(); + dutyTerritoryList = Arrays.asList(projectLawsInventoryEO.getDutyTerritory().split(",")); + dutyTerritoryList = dutyTerritoryList.stream().distinct().collect(Collectors.toList()); + //获取当前的projectLibrartId + String projectLibrartId = projectLawsInventoryEO.getProjectLibraryId(); + String cut = projectLawsInventoryEO.getCut(); + + Map params = new HashMap<>(); + params.put("projectLibraryId", projectLibrartId); + params.put("userId", currentUser.getId()); + params.put("modelType", RoleRelModelTypeEnum.LAWS_INVENTORY.getValue()); + ProjectLibraryRoleRelEO projectLibraryRoleRelEO = projectLibraryRoleRelEOService.queryByProjectLibraryIdAndUserId(params); + String roleCode1 = projectLibraryRoleRelEO.getRoleCode(); + //分别获取当前编辑中的设计符合性和认证符合性责任人 + List designDutyIdList = new ArrayList<>(); + designDutyIdList = Arrays.asList(projectLawsInventoryEO.getDesignDutyId().split(",")); + List verifyDutyIdList = new ArrayList<>(); + verifyDutyIdList = Arrays.asList(projectLawsInventoryEO.getVerifyDutyId().split(",")); + + //allDutyList 为法规工程师中验证符合性和确认符合中的责任人 + List allDutyList = new ArrayList<>(); + allDutyList.addAll(designDutyIdList); + allDutyList.addAll(verifyDutyIdList); + allDutyList = allDutyList.stream().distinct().collect(Collectors.toList()); + + //获取相关责任领域下的和projectLibrartId的相关人员名单的信息 + List projectRelatedPersonnelList = projectRelatedPersonnelService.queryByProjectIdAndDutyTerritoy(projectLibrartId, dutyTerritoryList); + + List allList = new ArrayList<>(); + List enginnerList = new ArrayList<>(); + List lawEnginnerList = new ArrayList<>(); + List enginnerLawSetList = new ArrayList<>(); + List enginnerAttSetList = new ArrayList<>(); + //根据相关人员名单获取的工程接口人 + for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) { + String enginneringInterfacePerson = relatedPersonnel.getEngineeringInterfacePerson(); + if (!StringUtils.isEmpty(enginneringInterfacePerson)) { + enginnerList = Arrays.stream(enginneringInterfacePerson.split(",")).collect(Collectors.toList()); + allList.addAll(enginnerList); + } + } + //获取相关人员名单中的法规工程师 + for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) { + String lawEngineer = relatedPersonnel.getLawEngineer(); + if (!StringUtils.isEmpty(lawEngineer)) { + lawEnginnerList = Arrays.stream(lawEngineer.split(",")).collect(Collectors.toList()); + allList.addAll(lawEnginnerList); + } + } + //获取相关人员名单中的工程接口-法规工程师设置 + for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) { + String engineerLawSet = relatedPersonnel.getEngineerLawSet(); + if (!StringUtils.isEmpty(engineerLawSet)) { + enginnerLawSetList = Arrays.stream(engineerLawSet.split(",")).collect(Collectors.toList()); + allList.addAll(enginnerLawSetList); + } + } + //获取相关人员名单中的工程接口-认证工程师设置 + for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) { + String engineerAttSet = relatedPersonnel.getEngineerAttSet(); + if (!StringUtils.isEmpty(engineerAttSet)) { + enginnerAttSetList = Arrays.stream(engineerAttSet.split(",")).collect(Collectors.toList()); + allList.addAll(enginnerAttSetList); + } + } + //获取当前项目库id的studio工程师和认证工程师 + List studionList = new ArrayList<>(); + List certificationEngineerList = new ArrayList<>(); + List projectLibraryBases = projectLibraryBaseService.queryById(projectLibrartId, cut); + for (ProjectLibraryBase projectLibraryBase : projectLibraryBases) { + studionList.add(projectLibraryBase.getStudioEngineer()); + + String certificationEngineer = projectLibraryBase.getCertificationEngineer(); + if (!StringUtils.isEmpty(certificationEngineer)) { + certificationEngineerList = Arrays.stream(certificationEngineer.split(",")).collect(Collectors.toList()); + allList.addAll(certificationEngineerList); + } + } + allList = allList.stream().filter(all -> { + return StringUtils.isNotBlank(all); + }).distinct().collect(Collectors.toList()); + /* + for(String all : allList){ + if(all.equals("")){ + allList.remove(all); + } + } + */ + //遍历所有人alllist中是否包含责任人,如果包含,不用操作。 + //-------如果不包含,再去判断当前用户的角色是studio、法规还是认证 + for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) { + if (allList.size() > 0) { + for (String allDuty : allDutyList) { + String dutyPerson = allDuty; + if (StringUtils.isNotEmpty(dutyPerson) && !allList.contains(dutyPerson) && StringUtils.isNotEmpty(roleCode1)) { + if (roleCode1.equals(com.jero.modules.project.enums.ProjectRoleEnum.STUDIO_ENGINEER.getValue())) { + if (relatedPersonnel.getEngineeringInterfacePerson() != null) { + String engineeringInterfacePerson = dutyPerson + "," + relatedPersonnel.getEngineeringInterfacePerson(); + relatedPersonnel.setEngineeringInterfacePerson(engineeringInterfacePerson); + } else { + relatedPersonnel.setEngineeringInterfacePerson(dutyPerson); + } + } else if (roleCode1.equals(com.jero.modules.project.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue())) { + if (relatedPersonnel.getEngineerLawSet() != null) { + String engineerLawSet = dutyPerson + "," + relatedPersonnel.getEngineerLawSet(); + relatedPersonnel.setEngineerLawSet(engineerLawSet); + } else { + relatedPersonnel.setEngineerLawSet(dutyPerson); + } + } else if (roleCode1.equals(com.jero.modules.project.enums.ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())) { + if (relatedPersonnel.getEngineerAttSet() != null) { + String engineerAttSet = dutyPerson + "," + relatedPersonnel.getEngineerAttSet(); + relatedPersonnel.setEngineerAttSet(engineerAttSet); + } else { + relatedPersonnel.setEngineerAttSet(dutyPerson); + } + } + } + } + } + } + this.projectRelatedPersonnelService.updateBatchById(projectRelatedPersonnelList); + + + //翻译-中文 + translateData(infoEOList); + translateData(dataList); + //翻译-英文 + translateDataToEn(infoEOListCopy); + translateDataToEn(dataListCopy); + + //比对不同字段 + Map infoDiff = ListDiff.compareObject(dataList.get(0), projectLawsInventoryEO); + Map infoDiffEn = ListDiff.compareObject(dataListCopy.get(0), projectLawsInventoryEOCopy); + + //设置更新log + setContentLog(infoDiff, contentLog, infoDiffEn, enContentLog, projectLawsInventoryEO.getProjectLibraryId()); + + + //验证用户是否是该法规上级 项目库的studio, 如果是,则同步更新流程 + int roleCode = projectLawsInventoryEOService.checkUserRole(projectLawsInventoryEO.getProjectLibraryId(), currentUser.getId(), ""); + if (StringUtils.equals(String.valueOf(roleCode), ProjectRoleEnum.STUDIO_ENGINEER.getValue())) { + //更新流程信息 + projectLawsInventoryEOService.updateFlowInfo(projectLawsInventoryEO); + } + + //设置权限 先删后加 + List adds = new ArrayList<>(); + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId())) { + setProjectLawsInventoryPermission(projectLawsInventoryEO.getRegulationOwnerId(), projectLawsInventoryEO.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_REGULATION.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId())) { + setProjectLawsInventoryPermission(projectLawsInventoryEO.getHomologationEngineerId(), projectLawsInventoryEO.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_HOMOLOGATION.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) { + setProjectLawsInventoryPermission(projectLawsInventoryEO.getEngineeringInterfacePerson(), projectLawsInventoryEO.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_INTERFACE.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getDesignInitiatorId())) { + setProjectLawsInventoryPermission(projectLawsInventoryEO.getDesignInitiatorId(), projectLawsInventoryEO.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_INITIATOR.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())) { + setProjectLawsInventoryPermission(projectLawsInventoryEO.getDesignDutyId(), projectLawsInventoryEO.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_DESIGN_DUTY.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())) { + setProjectLawsInventoryPermission(projectLawsInventoryEO.getPrehomoInitiatorId(), projectLawsInventoryEO.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_INITIATOR.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())) { + setProjectLawsInventoryPermission(projectLawsInventoryEO.getPrehomoDutyId(), projectLawsInventoryEO.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_PREHOMO_DUTY.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())) { + setProjectLawsInventoryPermission(projectLawsInventoryEO.getVerifyInitiatorId(), projectLawsInventoryEO.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_INITIATOR.getValue()); + } + if (ObjectUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())) { + setProjectLawsInventoryPermission(projectLawsInventoryEO.getVerifyDutyId(), projectLawsInventoryEO.getProjectLibraryId(), projectLawsInventoryEO.getId(), now, adds, ProjectUserLocationEnum.PROJECT_LAWS_INVENTORY_VERIFY_DUTY.getValue()); + } + if (ObjectUtils.isNotEmpty(adds)) { + projectUserPermissionService.saveBatch(adds); + } + + +// } +// else { +// throw new JeroBootException("该用户没有权限操作该数据!"); +// } + } /** * 发送消息 diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsInventoryPlatformEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsInventoryPlatformEOServiceImpl.java new file mode 100644 index 000000000..76024f23d --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsInventoryPlatformEOServiceImpl.java @@ -0,0 +1,119 @@ +package com.jero.modules.project.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.modules.project.entity.LawsInventoryPlatformEO; +import com.jero.modules.project.mapper.LawsInventoryPlatformEOMapper; +import com.jero.modules.project.service.ILawsInventoryPlatformEOService; +import com.jero.modules.system.util.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @Description: 车型项目库法规清单关联平台件表 + * @Author: jero-boot + * @Date: 2023-09-19 + * @Version: V1.0 + */ +@Service +public class LawsInventoryPlatformEOServiceImpl extends ServiceImpl implements ILawsInventoryPlatformEOService { + + /** + * 保存 + * + * @param lawsInventoryPlatformEO + * @return + */ + @Override + public void add(LawsInventoryPlatformEO lawsInventoryPlatformEO) { + Date now = new Date(); + lawsInventoryPlatformEO.setCreateTime(now); + lawsInventoryPlatformEO.setUpdateTime(now); + save(lawsInventoryPlatformEO); + } + /** + * 批量保存 + * + * @param lawsInventoryPlatformEOList + * @return + */ + @Override + public void addBatch(List lawsInventoryPlatformEOList) { + if(!lawsInventoryPlatformEOList.isEmpty()){ + List lawsInventoryPlatformEOS = new ArrayList<>(); + for (LawsInventoryPlatformEO lawsInventoryPlatformEO : lawsInventoryPlatformEOList) { + if(StringUtils.isNotBlank(lawsInventoryPlatformEO.getPlatformLawsInventoryIds())){ + for (String platformLawsInventoryId : lawsInventoryPlatformEO.getPlatformLawsInventoryIds().split(",")) { + LawsInventoryPlatformEO inventoryPlatformEO = new LawsInventoryPlatformEO(); + inventoryPlatformEO.setCreateTime(new Date()); + inventoryPlatformEO.setUpdateTime(new Date()); + inventoryPlatformEO.setLawsInventoryId(lawsInventoryPlatformEO.getLawsInventoryId()); + inventoryPlatformEO.setPlatformLawsInventoryId(platformLawsInventoryId); + lawsInventoryPlatformEOS.add(inventoryPlatformEO); + } + } + } + if(!lawsInventoryPlatformEOS.isEmpty()){ + this.saveBatch(lawsInventoryPlatformEOS); + } + } + } + + /** + * 更新 + * + * @param lawsInventoryPlatformEO + * @return + */ + @Override + public void editById(LawsInventoryPlatformEO lawsInventoryPlatformEO) { + Date now = new Date(); + lawsInventoryPlatformEO.setUpdateTime(now); + saveOrUpdate(lawsInventoryPlatformEO); + } + + /** + * 通过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 LawsInventoryPlatformEO 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/service/impl/NcrTrackServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/NcrTrackServiceImpl.java index 91c89f8d2..2684cea03 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/NcrTrackServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/NcrTrackServiceImpl.java @@ -192,11 +192,16 @@ public class NcrTrackServiceImpl extends ServiceImpl String yearName = trackVO.getYearName(); String market = getMarket(targetMarketList, trackVO,ncrTrackVO.getCut()); String projectVersion = trackVO.getProjectVersion(); - if(StringUtils.isNotBlank(projectVersion)){ - trackVO.setProjectName(projectName+"-"+yearName+"-"+market+"-"+projectVersion); + if(StringUtils.isNotBlank(trackVO.getPlatform())){ + trackVO.setProjectName(trackVO.getProjectNameId()); }else{ - trackVO.setProjectName(projectName+"-"+yearName+"-"+market); + if(StringUtils.isNotBlank(projectVersion)){ + trackVO.setProjectName(projectName+"-"+yearName+"-"+market+"-"+projectVersion); + }else{ + trackVO.setProjectName(projectName+"-"+yearName+"-"+market); + } } + //责任领域中英文切换 if(StringUtils.isNotBlank(trackVO.getDutyTerritory())){ String dutyTerritory = pull(dictItemList, trackVO.getDutyTerritory(), "duty_territory", ncrTrackVO.getCut()); @@ -392,8 +397,9 @@ public class NcrTrackServiceImpl extends ServiceImpl trackVOList = parameterQuery(ncrTrackVO, trackVOList); //表头排序 heartSort(ncrTrackVO, trackVOList); - - + for (NcrTrackVO trackVO : trackVOList) { + trackVO.setAdministrator(administrator ? "true" : "false"); + } return trackVOList; } } @@ -783,10 +789,12 @@ public class NcrTrackServiceImpl extends ServiceImpl private String getMarket(List targetMarketList, NcrTrackVO trackVO,String cut) { //目标市场 List dictModelList = new ArrayList<>(); - for (String s : trackVO.getTargetMarket().split(",")) { - List dictModelListTemp = targetMarketList.stream() - .filter(e -> s.equals(e.getValue())).collect(Collectors.toList()); - dictModelList.addAll(dictModelListTemp); + if(StringUtils.isNotBlank(trackVO.getTargetMarket())){ + for (String s : trackVO.getTargetMarket().split(",")) { + List dictModelListTemp = targetMarketList.stream() + .filter(e -> s.equals(e.getValue())).collect(Collectors.toList()); + dictModelList.addAll(dictModelListTemp); + } } String targetMarket = ""; if(dictModelList.size() != 0){ diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProblemManagementEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProblemManagementEOServiceImpl.java index 5751478fe..8cde535b8 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProblemManagementEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProblemManagementEOServiceImpl.java @@ -265,10 +265,12 @@ public class ProblemManagementEOServiceImpl extends ServiceImpl targetMarketList, ProjectLibraryBase projectLibraryBase) { List dictModelList = new ArrayList<>(); - for (String s : projectLibraryBase.getTargetMarket().split(",")) { - List dictModelListTemp = targetMarketList.stream() - .filter(e -> s.equals(e.getValue())).collect(Collectors.toList()); - dictModelList.addAll(dictModelListTemp); + if(StringUtils.isNotBlank(projectLibraryBase.getTargetMarket())){ + for (String s : projectLibraryBase.getTargetMarket().split(",")) { + List dictModelListTemp = targetMarketList.stream() + .filter(e -> s.equals(e.getValue())).collect(Collectors.toList()); + dictModelList.addAll(dictModelListTemp); + } } String targetMarket = ""; if(dictModelList.size() != 0){ diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationDirectoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationDirectoryEOServiceImpl.java index 014883c0d..31bce9294 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationDirectoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationDirectoryEOServiceImpl.java @@ -59,7 +59,7 @@ public class ProjectCertificationDirectoryEOServiceImpl extends ServiceImpl pciEoList = this.list(pciQueryWrap); if(CollectionUtils.isNotEmpty(pciEoList)){ - List inventoryVerifyEndTimeList = pciEoList.stream().map(ProjectCertificationInventoryEO::getInventoryVerifyEndTime).distinct().collect(Collectors.toList()); + List inventoryVerifyEndTimeList = pciEoList.stream().filter(e->ObjectUtils.isNotEmpty(e.getInventoryVerifyEndTime())) + .map(ProjectCertificationInventoryEO::getInventoryVerifyEndTime).distinct().collect(Collectors.toList()); inventoryVerifyEndTimeList.add(inventoryVerifyEndTime); Collections.sort(inventoryVerifyEndTimeList, (d1, d2) -> d1.compareTo(d2)); // 根据时间顺序排序 inventoryVerifyEndTime = inventoryVerifyEndTimeList.get(0); @@ -1880,11 +1929,80 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl pageList = this.page(page, queryWrapper); + //平台件数据处理 + platformDispose(projectCertificationInventoryEO, pageList.getRecords()); + + + this.disposeData(pageList.getRecords(),cut); List records = this.hearSort(projectCertificationInventoryEO, pageList.getRecords()); pageList.setRecords(records); return pageList; } + private void platformDispose(ProjectCertificationInventoryEO projectCertificationInventoryEO, List result) { + List lawsInventoryPlatformEOList = new ArrayList<>(); + List projectCertificationInventoryEOS = new ArrayList<>(); + + if(!result.isEmpty()){ + //认证清单ID + List certificationInventoryIdList = result.stream().map(ProjectCertificationInventoryEO::getId).collect(Collectors.toList()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(LawsInventoryPlatformEO::getLawsInventoryId,certificationInventoryIdList); + lawsInventoryPlatformEOList = lawsInventoryPlatformEOService.list(wrapper); + if(!lawsInventoryPlatformEOList.isEmpty()){ + List collect = lawsInventoryPlatformEOList.stream().map(LawsInventoryPlatformEO::getPlatformLawsInventoryId).distinct().collect(Collectors.toList()); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.in(ProjectCertificationInventoryEO::getId,collect); + projectCertificationInventoryEOS = this.list(lambdaQueryWrapper);//平台件清单 + } + } + for (ProjectCertificationInventoryEO certificationInventoryEO : result) { + if(!projectCertificationInventoryEOS.isEmpty()){ + List projectLibraryBaseList = new ArrayList<>(); + List collect = lawsInventoryPlatformEOList.stream() + .filter(e -> certificationInventoryEO.getId().equals(e.getLawsInventoryId())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect)){ + List platformLawsInventoryIdList = collect.stream() + .map(LawsInventoryPlatformEO::getPlatformLawsInventoryId).distinct().collect(Collectors.toList()); + + List inventoryEOList = projectCertificationInventoryEOS.stream() + .filter(e -> platformLawsInventoryIdList.contains(e.getId())).collect(Collectors.toList()); + certificationInventoryEO.setProjectCertificationInventoryEOS(inventoryEOList); + + if(ObjectUtils.isNotEmpty(inventoryEOList)){ + List projectLibraryIdList = inventoryEOList.stream() + .map(ProjectCertificationInventoryEO::getProjectLibraryId).distinct().collect(Collectors.toList()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(ProjectLibraryBase::getId,projectLibraryIdList); + projectLibraryBaseList = projectLibraryBaseService.list(wrapper); + } + + } + + + List inventoryPlatformEOList = lawsInventoryPlatformEOList.stream() + .filter(e -> certificationInventoryEO.getId().equals(e.getLawsInventoryId())).collect(Collectors.toList()); + if(!inventoryPlatformEOList.isEmpty()){ + List idList = inventoryPlatformEOList.stream() + .map(LawsInventoryPlatformEO::getPlatformLawsInventoryId).collect(Collectors.toList()); + List certificationInventoryEOS = projectCertificationInventoryEOS.stream() + .filter(e -> idList.contains(e.getId())).collect(Collectors.toList()); + + List libraryBaseList = projectLibraryBaseList.stream() + .filter(e -> certificationInventoryEOS.get(0).getProjectLibraryId().equals(e.getId())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(libraryBaseList)){ + certificationInventoryEO.setConfigItem(libraryBaseList.get(0).getProjectNameId()); + } + + if(!certificationInventoryEOS.isEmpty()){ + setProjectCertificationInventoryEO(certificationInventoryEOS.get(0),certificationInventoryEO); + } + + + } + } + } + } /** * 表头排序 @@ -3272,7 +3390,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); - List certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + List certificationEngineerList = new ArrayList<>(); + List certificationEngineerIdList = new ArrayList<>(); + if(StringUtils.isNotBlank(projectLibraryBase.getCertificationEngineer())){ + certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + } + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 @@ -3635,6 +3759,10 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.in(LawsInventoryPlatformEO::getLawsInventoryId,Arrays.asList(ids.split(","))); + lawsInventoryPlatformEOService.remove(wrapper); return Result.OK("流程重置成功!"); } @@ -4158,6 +4286,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryEOList = this.list(queryWrap); projectCertificationInventoryEOList.forEach(certificationInventoryEO -> { certificationInventoryEO.setConfigItem(configItem); + certificationInventoryEO.setSdt(sdt); }); this.updateBatchById(projectCertificationInventoryEOList); @@ -4331,11 +4461,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl 1){ @@ -4689,6 +4819,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl list = Arrays.asList(value.split(",")); + List ddList = dictItemList.stream().filter(e -> "duty_territory".equals(e.getDictCode()) && list.contains(e.getItemValue())).collect(Collectors.toList()); + List valueList = ddList.stream().map(SysDictItem::getStatNode).collect(Collectors.toList()); + projectCertificationInventoryEO.setDutyDepart(StringUtils.join(valueList,",")); } } //工程接口人(责任领域下的工程接口人) @@ -4857,6 +4993,18 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl 500){ + String message = ""; + if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){ + message = errorMsg + "备注不能超过500个字符"; + }else{ + message = errorMsg + " The Remark cannot contain more than 200 characters"; + } + msgList.add(message); + } + } + } return msgList; } @@ -5527,6 +5675,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl list = Arrays.asList(title.split(",")); int index = 0; if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){ - index = list.indexOf("生产企业名称") + 1; + index = list.indexOf("备注") + 1; }else{ - index = list.indexOf("Name Of Manufacturer") + 1; + index = list.indexOf("Remark") + 1; } //创建临时文件夹 @@ -6413,9 +6563,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl inProgressPciEoList = pciEos.stream().filter(data -> { boolean flag = ( StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.IN_PROGRESS.getValue()) + || StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) ); return flag; }).collect(Collectors.toList()); @@ -6444,6 +6595,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl testPassedPciEoList = pciEos.stream().filter(data -> { boolean flag = ( StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_PASSED.getValue()) + || StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) + || StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) ); return flag; }).collect(Collectors.toList()); @@ -6459,33 +6612,34 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl notSubmitPciEoList = pciEos.stream().filter(data -> { - boolean flag = ( - StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) - ); - return flag; - }).collect(Collectors.toList()); - notSubmitCount = (double) notSubmitPciEoList.size(); +// List notSubmitPciEoList = pciEos.stream().filter(data -> { +// boolean flag = ( +// StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) +// ); +// return flag; +// }).collect(Collectors.toList()); +// notSubmitCount = (double) notSubmitPciEoList.size(); // 部件报告已提交 - List reportSubmitPciEoList = pciEos.stream().filter(data -> { - boolean flag = ( - StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) - ); - return flag; - }).collect(Collectors.toList()); - reportSubmitCount = (double) reportSubmitPciEoList.size(); +// List reportSubmitPciEoList = pciEos.stream().filter(data -> { +// boolean flag = ( +// StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) +// ); +// return flag; +// }).collect(Collectors.toList()); +// reportSubmitCount = (double) reportSubmitPciEoList.size(); // 部件报告已入库 - List storedPciEoList = pciEos.stream().filter(data -> { - boolean flag = ( - StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) - ); - return flag; - }).collect(Collectors.toList()); - storedCount = (double) storedPciEoList.size(); +// List storedPciEoList = pciEos.stream().filter(data -> { +// boolean flag = ( +// StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) +// ); +// return flag; +// }).collect(Collectors.toList()); +// storedCount = (double) storedPciEoList.size(); - count = notStartCount + inProgressCount + testPassedCount + testFailedCount + testFailedCount + notSubmitCount + reportSubmitCount + storedCount; +// count = notStartCount + inProgressCount + testPassedCount + testFailedCount + testFailedCount + notSubmitCount + reportSubmitCount + storedCount; + count = notStartCount + inProgressCount + testPassedCount + testFailedCount + testFailedCount; if(count<=0){ percentage = 0; }else { @@ -6498,9 +6652,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl params) { +// String ids = (String) params.get("ids");//认证清单id +// String projectLibraryIds = (String) params.get("projectLibraryIds");//平台件项目id +// +// //认证清单数据 +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.in(ProjectCertificationInventoryEO::getId,Arrays.asList(ids.split(","))); +// List certificationInventoryEOList = this.list(wrapper); +// +// //平台件项目对应的认证清单数据 +// LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); +// wrapper1.in(ProjectCertificationInventoryEO::getProjectLibraryId,Arrays.asList(projectLibraryIds.split(","))); +// List certificationInventoryEOS = this.list(wrapper1); +// +// if(!certificationInventoryEOS.isEmpty()){ +// //平台件项目信息 +// List projectLibraryBaseList = new ArrayList<>(); +// if(!certificationInventoryEOList.isEmpty()){ +// List projectIdList = certificationInventoryEOS.stream().map(ProjectCertificationInventoryEO::getProjectLibraryId).distinct().collect(Collectors.toList()); +// LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper<>(); +// wrapper2.in(ProjectLibraryBase::getId,projectIdList); +// projectLibraryBaseList = projectLibraryBaseService.list(wrapper2); +// } +// +// List lawsInventoryPlatformEOS = new ArrayList<>(); +// +// List projectCertificationInventoryEOList = new ArrayList<>(); +// for (ProjectCertificationInventoryEO projectCertificationInventoryEO : certificationInventoryEOList) { +// //类别 +// String category = projectCertificationInventoryEO.getCategory(); +// //检验项目 +// String inspectionItem = projectCertificationInventoryEO.getInspectionItem(); +// //配置项 +// String configItem = projectCertificationInventoryEO.getConfigItem(); +// //编号 +// String serialNumber = projectCertificationInventoryEO.getSerialNumber(); +// //责任领域 +// String dutyTerritory = projectCertificationInventoryEO.getDutyTerritory(); +// +// List result = new ArrayList<>(); +// //如果车型项目库中的配置项为空或为标配时,不去匹配直接关联 +// if(StringUtils.isBlank(configItem) || "标配".equals(configItem)){ +// if(!certificationInventoryEOS.isEmpty()){ +// result = setData(certificationInventoryEOS, projectCertificationInventoryEO); +// } +// }else if(StringUtils.isNotBlank(configItem) && !"标配".equals(configItem)){ +// //如果车型项目库中的配置项不为空且不为标配时,如果车型项目库认证清单的配置项与平台件认证清单的配置项不一致,则不再匹配 +// //如果一致,则用类别,检验项目,编号,责任领域去做匹配 +// +// List projectCertificationInventoryEOS = new ArrayList<>(); +// for (int i = 0; i < certificationInventoryEOS.size(); i++) { +// int finalI = i; +// List libraryBaseList = projectLibraryBaseList.stream() +// .filter(e -> certificationInventoryEOS.get(finalI).getProjectLibraryId().equals(e.getId())).collect(Collectors.toList()); +// //平台件项目库中的认证清单的配置项为平台件项目名称 +// String configItemTemp = ""; +// if(!libraryBaseList.isEmpty()){ +// //配置项 +// configItemTemp = libraryBaseList.get(0).getProjectNameId(); +// } +// //类别 +// String categoryTemp = certificationInventoryEOS.get(i).getCategory(); +// //检验项目 +// String inspectionItemTemp = certificationInventoryEOS.get(i).getInspectionItem(); +// //编号 +// String serialNumberTemp = certificationInventoryEOS.get(i).getSerialNumber(); +// //责任领域 +// String dutyTerritoryTemp = certificationInventoryEOS.get(i).getDutyTerritory(); +// +// if(configItem.equals(configItemTemp) +// && category.equals(categoryTemp) +// && inspectionItem.equals(inspectionItemTemp) +// && serialNumber.equals(serialNumberTemp) +// && dutyTerritory.equals(dutyTerritoryTemp)){ +// +// projectCertificationInventoryEOS.add(certificationInventoryEOS.get(i)); +// } +// } +// if(!projectCertificationInventoryEOS.isEmpty()){ +// result = setData(projectCertificationInventoryEOS, projectCertificationInventoryEO); +// } +// } +// if(!result.isEmpty()){ +// this.saveOrUpdateBatch(result); +// } +// } +// } +// } + + private List setData(List certificationInventoryEOS, + ProjectCertificationInventoryEO projectCertificationInventoryEO) { + List projectCertificationInventoryEOS = new ArrayList<>(); + //设置平台件认证清单数据 + setProjectCertificationInventoryEO(certificationInventoryEOS.get(0), projectCertificationInventoryEO); + projectCertificationInventoryEOS.add(projectCertificationInventoryEO); + + //如果车型项目库中的配置项为空或为标配时,不去匹配直接关联,此时一对多,一指的是车型库认证清单,多指的是平台件认证清单 + //例:一条车型库认证清单对应3条平台件认证清单,此时需要复制两条项目库认证清单,将这两条认证清单中的交付物模板到生产企业名称 + //的字段值替换为平台件认证清单的数据,原有的那条认证清单这部分数据也需要替换 + for (int i = 1; i < certificationInventoryEOS.size(); i++) { + ProjectCertificationInventoryEO certificationInventoryEO = new ProjectCertificationInventoryEO(); + BeanUtils.copyProperties(projectCertificationInventoryEO,certificationInventoryEO); + certificationInventoryEO.setId(UUID.randomUUID().toString().replace("-","")); + //设置平台件认证清单数据 + setProjectCertificationInventoryEO(certificationInventoryEOS.get(i), certificationInventoryEO); + projectCertificationInventoryEOS.add(certificationInventoryEO); + } + return projectCertificationInventoryEOS; + } + + private void setProjectCertificationInventoryEO(ProjectCertificationInventoryEO certificationInventoryEO, + ProjectCertificationInventoryEO projectCertificationInventoryEO) { + //类别 category + projectCertificationInventoryEO.setCategory(StringUtils.isNotEmpty(certificationInventoryEO.getCategory()) ? certificationInventoryEO.getCategory() : ""); + //检验项目 inspectionItem + projectCertificationInventoryEO.setInspectionItem(StringUtils.isNotEmpty(certificationInventoryEO.getInspectionItem()) ? certificationInventoryEO.getInspectionItem() : ""); + //认证类型 attestationType + projectCertificationInventoryEO.setAttestationType(StringUtils.isNotEmpty(certificationInventoryEO.getAttestationType()) ? certificationInventoryEO.getAttestationType() : ""); + //WVTA ID wvtaId + projectCertificationInventoryEO.setWvtaId(StringUtils.isNotEmpty(certificationInventoryEO.getWvtaId()) ? certificationInventoryEO.getWvtaId() : ""); + //标准编号 serialNumber + projectCertificationInventoryEO.setSerialNumber(StringUtils.isNotEmpty(certificationInventoryEO.getSerialNumber()) ? certificationInventoryEO.getSerialNumber() : ""); + //责任部门 dutyDepart + projectCertificationInventoryEO.setDutyDepart(StringUtils.isNotEmpty(certificationInventoryEO.getDutyDepart()) ? certificationInventoryEO.getDutyDepart() : ""); + //责任领域 firstLevelDutyTerritory + projectCertificationInventoryEO.setFirstLevelDutyTerritory(StringUtils.isNotEmpty(certificationInventoryEO.getFirstLevelDutyTerritory()) ? certificationInventoryEO.getFirstLevelDutyTerritory() : ""); + //工程接口人 sdt + projectCertificationInventoryEO.setSdt(StringUtils.isNotEmpty(certificationInventoryEO.getSdt()) ? certificationInventoryEO.getSdt() : ""); + //责任人 dutyPerson + projectCertificationInventoryEO.setDutyPerson(StringUtils.isNotEmpty(certificationInventoryEO.getDutyPerson()) ? certificationInventoryEO.getDutyPerson() : ""); + + //交付物模板-deliverableTemplate + projectCertificationInventoryEO.setDeliverableTemplate(StringUtils.isNotEmpty(certificationInventoryEO.getDeliverableTemplate()) ? certificationInventoryEO.getDeliverableTemplate() : ""); + //交付物类型-deliverableType + projectCertificationInventoryEO.setDeliverableType(StringUtils.isNotEmpty(certificationInventoryEO.getDeliverableType()) ? certificationInventoryEO.getDeliverableType() : ""); + //交付结果-deliveryResult + projectCertificationInventoryEO.setDeliveryResult(StringUtils.isNotEmpty(certificationInventoryEO.getDeliveryResult()) ? certificationInventoryEO.getDeliveryResult() : ""); + //截止日期-endTime + projectCertificationInventoryEO.setEndTime(certificationInventoryEO.getEndTime()); + //流程状态-flowStatus + projectCertificationInventoryEO.setFlowStatus(StringUtils.isNotEmpty(certificationInventoryEO.getFlowStatus()) ? certificationInventoryEO.getFlowStatus() : ""); + //报告编号-reportNumber + projectCertificationInventoryEO.setReportNumber(StringUtils.isNotEmpty(certificationInventoryEO.getReportNumber()) ? certificationInventoryEO.getReportNumber() : ""); + //产品型号-productModel + projectCertificationInventoryEO.setProductModel(StringUtils.isNotEmpty(certificationInventoryEO.getProductModel()) ? certificationInventoryEO.getProductModel() : ""); + //生产企业名称-productionEnterpriseName + projectCertificationInventoryEO.setProductionEnterpriseName(StringUtils.isNotEmpty(certificationInventoryEO.getProductionEnterpriseName()) ? certificationInventoryEO.getProductionEnterpriseName() : ""); + } + /** + * 勾选认证清单进行关联平台件 + * + * @return + */ + @Override + public String listPlatform(Map params) { + String cut = (String) params.get("cut");// + String ids = (String) params.get("ids");//认证清单id + String projectLibraryIds = (String) params.get("projectLibraryIds");//平台件项目id + + //认证清单数据 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(ProjectCertificationInventoryEO::getId,Arrays.asList(ids.split(","))); + List certificationInventoryEOList = this.list(wrapper); + + //平台件项目对应的认证清单数据 + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.in(ProjectCertificationInventoryEO::getProjectLibraryId,Arrays.asList(projectLibraryIds.split(","))); + List certificationInventoryEOS = this.list(wrapper1); + + //平台件项目信息 + List projectLibraryBaseList = new ArrayList<>(); + if(!certificationInventoryEOList.isEmpty()){ + List projectIdList = certificationInventoryEOS.stream().map(ProjectCertificationInventoryEO::getProjectLibraryId).distinct().collect(Collectors.toList()); + LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper<>(); + wrapper2.in(ProjectLibraryBase::getId,projectIdList); + projectLibraryBaseList = projectLibraryBaseService.list(wrapper2); + } + List sysDictItemList = sysDictItemMapper.selectItemsByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue()); + + List lawsInventoryPlatformEOS = new ArrayList<>(); + + List result = new ArrayList<>(); + + List emptyList = new ArrayList<>(); + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : certificationInventoryEOList) { + //类别 + String category = projectCertificationInventoryEO.getCategory(); + //检验项目 + String inspectionItem = projectCertificationInventoryEO.getInspectionItem(); + //配置项 + String configItem = projectCertificationInventoryEO.getConfigItem(); + //编号 + String serialNumber = projectCertificationInventoryEO.getSerialNumber(); + //责任领域 + String dutyTerritory = projectCertificationInventoryEO.getDutyTerritory(); + + List lawsInventoryPlatformEOList = new ArrayList<>(); + List projectCertificationInventoryEOList = new ArrayList<>(); + + for (ProjectCertificationInventoryEO certificationInventoryEO : certificationInventoryEOS) { + List libraryBaseList = projectLibraryBaseList.stream() + .filter(e -> certificationInventoryEO.getProjectLibraryId().equals(e.getId())).collect(Collectors.toList()); + //平台件项目库中的认证清单的配置项为平台件项目名称 + String configItemTemp = ""; + if(!libraryBaseList.isEmpty()){ + //配置项 + configItemTemp = libraryBaseList.get(0).getProjectNameId(); + } + //类别 + String categoryTemp = certificationInventoryEO.getCategory(); + //检验项目 + String inspectionItemTemp = certificationInventoryEO.getInspectionItem(); + //编号 + String serialNumberTemp = certificationInventoryEO.getSerialNumber(); + //责任领域 + String dutyTerritoryTemp = certificationInventoryEO.getDutyTerritory(); + + if((StringUtils.isBlank(configItem) || "标配".equals(configItem)) + && category.equals(categoryTemp) + && inspectionItem.equals(inspectionItemTemp) + && serialNumber.equals(serialNumberTemp) + && dutyTerritory.equals(dutyTerritoryTemp)){ + //如果车型项目库中的配置项为空或为标配时,则用类别,检验项目,编号,责任领域去匹配,匹配上后将平台件信息添加到关联表 + projectCertificationInventoryEOList.add(certificationInventoryEO); + + + }else if(StringUtils.isNotBlank(configItem) && !"标配".equals(configItem)){ + //如果车型项目库中的配置项不为空且不为标配时,如果车型项目库认证清单的配置项与平台件认证清单的配置项不一致,则不再匹配 + //如果一致,则用类别,检验项目,编号,责任领域去做匹配 + if(configItem.equals(configItemTemp) + && category.equals(categoryTemp) + && inspectionItem.equals(inspectionItemTemp) + && serialNumber.equals(serialNumberTemp) + && dutyTerritory.equals(dutyTerritoryTemp)){ + projectCertificationInventoryEOList.add(certificationInventoryEO); + } + } + } + if(projectCertificationInventoryEOList.isEmpty()){ + emptyList.add(projectCertificationInventoryEO); + } + + if(!projectCertificationInventoryEOList.isEmpty()){ + setDataTemp(lawsInventoryPlatformEOS, projectCertificationInventoryEO, projectCertificationInventoryEOList.get(0)); + if(projectCertificationInventoryEOList.size() > 1){ + //往认证清单表中添加projectCertificationInventoryEOList.size()-1条数据 + List list = new ArrayList<>(); + for (int i = 1; i < projectCertificationInventoryEOList.size(); i++) { + ProjectCertificationInventoryEO projectCertificationInventoryEOTemp = new ProjectCertificationInventoryEO(); + BeanUtils.copyProperties(projectCertificationInventoryEO,projectCertificationInventoryEOTemp); + projectCertificationInventoryEOTemp.setId(UUID.randomUUID().toString().replace("-", "")); + list.add(projectCertificationInventoryEOTemp); + + setDataTemp(lawsInventoryPlatformEOS, projectCertificationInventoryEOTemp, projectCertificationInventoryEOList.get(i)); + } + if(!list.isEmpty()){ + result.addAll(list); + } + } + } + } + if(!result.isEmpty()){ + this.saveBatch(result); + } + if(!lawsInventoryPlatformEOS.isEmpty()){ + lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS); + } + //认证清单未匹配上平台件的提示语 + String html = getMsg(cut, sysDictItemList, emptyList); + return html; + } + + @NotNull + private String getMsg(String cut, List sysDictItemList, List emptyList) { + List msgList = new ArrayList<>(); + //未匹配上法规清单 + if(ObjectUtils.isNotEmpty(emptyList)){ + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : emptyList) { + List list = new LinkedList<>(); + if(com.jero.modules.system.util.StringUtils.isNotBlank(projectCertificationInventoryEO.getDutyTerritory())){ + for (String s : projectCertificationInventoryEO.getDutyTerritory().split(",")) { + List collect = sysDictItemList.stream().filter(e -> e.getItemValue().equals(s)).collect(Collectors.toList()); + if(CutEnum.CN.getValue().equals(cut) && !collect.isEmpty()){ + list.add(collect.get(0).getItemText()); + }else if(CutEnum.EN.getValue().equals(cut) && !collect.isEmpty()){ + list.add(collect.get(0).getEnName()); + } + } + } + String serialNumber = projectCertificationInventoryEO.getSerialNumber(); + String dutyTerritoryName = com.jero.modules.system.util.StringUtils.join(list,","); + String msg = ""; + if(CutEnum.CN.getValue().equals(cut)){ + msg = serialNumber+" "+dutyTerritoryName+"未匹配到数据"; + }else{ + msg = serialNumber+" "+dutyTerritoryName+" no data matched"; + } + msgList.add(msg); + } + } + String html = ""; + for (String s : msgList) { + html += s + "
"; + } + return html; + } + + private void setDataTemp(List lawsInventoryPlatformEOS, + ProjectCertificationInventoryEO projectCertificationInventoryEO, + ProjectCertificationInventoryEO certificationInventoryEO) { + LawsInventoryPlatformEO inventoryPlatformEO = new LawsInventoryPlatformEO(); + inventoryPlatformEO.setCreateTime(new Date()); + inventoryPlatformEO.setUpdateTime(new Date()); + inventoryPlatformEO.setLawsInventoryId(projectCertificationInventoryEO.getId()); + inventoryPlatformEO.setPlatformLawsInventoryId(certificationInventoryEO.getId()); + lawsInventoryPlatformEOS.add(inventoryPlatformEO); + } +// @Override +// public void listPlatform(Map params) { +// String cut = (String) params.get("cut");// +// String ids = (String) params.get("ids");//认证清单id +// String projectLibraryIds = (String) params.get("projectLibraryIds");//平台件项目id +// +// //认证清单数据 +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.in(ProjectCertificationInventoryEO::getId,Arrays.asList(ids.split(","))); +// List certificationInventoryEOList = this.list(wrapper); +// +// //平台件项目对应的认证清单数据 +// LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); +// wrapper1.in(ProjectCertificationInventoryEO::getProjectLibraryId,Arrays.asList(projectLibraryIds.split(","))); +// List certificationInventoryEOS = this.list(wrapper1); +// +// //平台件项目信息 +// List projectLibraryBaseList = new ArrayList<>(); +// if(!certificationInventoryEOList.isEmpty()){ +// List projectIdList = certificationInventoryEOS.stream().map(ProjectCertificationInventoryEO::getProjectLibraryId).distinct().collect(Collectors.toList()); +// LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper<>(); +// wrapper2.in(ProjectLibraryBase::getId,projectIdList); +// projectLibraryBaseList = projectLibraryBaseService.list(wrapper2); +// } +// +// List lawsInventoryPlatformEOS = new ArrayList<>(); +// +// for (ProjectCertificationInventoryEO projectCertificationInventoryEO : certificationInventoryEOList) { +// //类别 +// String category = projectCertificationInventoryEO.getCategory(); +// //检验项目 +// String inspectionItem = projectCertificationInventoryEO.getInspectionItem(); +// //配置项 +// String configItem = projectCertificationInventoryEO.getConfigItem(); +// //编号 +// String serialNumber = projectCertificationInventoryEO.getSerialNumber(); +// //责任领域 +// String dutyTerritory = projectCertificationInventoryEO.getDutyTerritory(); +// +// for (ProjectCertificationInventoryEO certificationInventoryEO : certificationInventoryEOS) { +// List libraryBaseList = projectLibraryBaseList.stream() +// .filter(e -> certificationInventoryEO.getProjectLibraryId().equals(e.getId())).collect(Collectors.toList()); +// //平台件项目库中的认证清单的配置项为平台件项目名称 +// String configItemTemp = ""; +// if(!libraryBaseList.isEmpty()){ +// //配置项 +// configItemTemp = libraryBaseList.get(0).getProjectNameId(); +// } +// //类别 +// String categoryTemp = certificationInventoryEO.getCategory(); +// //检验项目 +// String inspectionItemTemp = certificationInventoryEO.getInspectionItem(); +// //编号 +// String serialNumberTemp = certificationInventoryEO.getSerialNumber(); +// //责任领域 +// String dutyTerritoryTemp = certificationInventoryEO.getDutyTerritory(); +// +// if(StringUtils.isBlank(configItem) || "标配".equals(configItem)){ +// //如果车型项目库中的配置项为空或为标配时,直接将平台件信息添加到关联表 +// setDataTemp(lawsInventoryPlatformEOS, projectCertificationInventoryEO, certificationInventoryEO); +// }else if(StringUtils.isNotBlank(configItem) && !"标配".equals(configItem)){ +// //如果车型项目库中的配置项不为空且不为标配时,如果车型项目库认证清单的配置项与平台件认证清单的配置项不一致,则不再匹配 +// //如果一致,则用类别,检验项目,编号,责任领域去做匹配 +// if(configItem.equals(configItemTemp) +// && category.equals(categoryTemp) +// && inspectionItem.equals(inspectionItemTemp) +// && serialNumber.equals(serialNumberTemp) +// && dutyTerritory.equals(dutyTerritoryTemp)){ +// setDataTemp(lawsInventoryPlatformEOS, projectCertificationInventoryEO, certificationInventoryEO); +// } +// } +// } +// } +// if(!lawsInventoryPlatformEOS.isEmpty()){ +// lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS); +// } +// } + + + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java index ae9423dc4..b1ba0d549 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java @@ -289,6 +289,10 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(LawsInventoryPlatformEO::getLawsInventoryId,projectLawsInventoryEO.getId()); + wrapper.in(LawsInventoryPlatformEO::getPlatformLawsInventoryId,Arrays.asList(projectLawsInventoryEO.getPlatformIds().split(","))); + lawsInventoryPlatformEOService.remove(wrapper); + } } /** @@ -629,6 +639,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl categoryList, List technologyTerritoryList) { + public String getTreeName(String cut, List categoryList, List technologyTerritoryList) { StringBuilder sb = new StringBuilder(); for (String technologyTerritory : technologyTerritoryList) { List collect = categoryList.stream().filter(e -> technologyTerritory.equals(e.getId())).collect(Collectors.toList()); @@ -4771,6 +4787,11 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl piFlowTypeList = new ArrayList<>(); @@ -4794,14 +4815,11 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl taskInventoryQueryWrapper = new QueryWrapper<>(); - taskInventoryQueryWrapper.lambda().in(ProjectTaskInventoryEO::getProjectLawsInventoryId,idList); - List projectTaskInventoryList = this.projectTaskInventoryEOService.getBaseMapper().selectList(taskInventoryQueryWrapper); - - //删除流程历史 - if(CollectionUtils.isNotEmpty(projectTaskInventoryList)){ - List actiProcInstIdList = new ArrayList<>(); - List verifyPIdList = projectTaskInventoryList.stream().map(ProjectTaskInventoryEO::getVerifyPId).distinct().collect(Collectors.toList()); - List prehomoPIdList = projectTaskInventoryList.stream().map(ProjectTaskInventoryEO::getPrehomoPId).distinct().collect(Collectors.toList()); - List designPIdList = projectTaskInventoryList.stream().map(ProjectTaskInventoryEO::getDesignPId).distinct().collect(Collectors.toList()); - - actiProcInstIdList.addAll(verifyPIdList); - actiProcInstIdList.addAll(prehomoPIdList); - actiProcInstIdList.addAll(designPIdList); - - actiProcInstIdList = actiProcInstIdList.stream().distinct().collect(Collectors.toList());; - if(CollectionUtils.isNotEmpty(actiProcInstIdList)){ - QueryWrapper processHistoryDeleteWrapper = new QueryWrapper<>(); - processHistoryDeleteWrapper.lambda().in(ProcessHistoryEO::getActiProcInstId,actiProcInstIdList); - processHistoryEOService.remove(processHistoryDeleteWrapper); - } - pIds = actiProcInstIdList.stream().map(String::valueOf).collect(Collectors.joining(",")); - } - - QueryWrapper queryLawsInventoryWrapper = new QueryWrapper<>(); - queryLawsInventoryWrapper.lambda().in(ProjectLawsInventoryEO::getId,idList); - - List projectTaskInventoryEOList = new ArrayList<>(); - List projectLawsInventoryEOList = this.baseMapper.selectList(queryLawsInventoryWrapper); - projectLawsInventoryEOList.forEach(projectLawsInventory -> { - ProjectTaskInventoryEO projectTaskInventoryEO = new ProjectTaskInventoryEO(); - String projectTaskInventoryId = UUID.randomUUID().toString().replace("-", ""); - projectTaskInventoryEO.setId(projectTaskInventoryId); - projectTaskInventoryEO.setProjectLawsInventoryId(projectLawsInventory.getId()); - projectTaskInventoryEO.setStandId(projectLawsInventory.getStandId()); - projectTaskInventoryEO.setCertificationProgress(CertificationProgressEnum.NOT_START.getValue()); - projectTaskInventoryEOList.add(projectTaskInventoryEO); - }); -// idList.forEach(id -> { -// ProjectTaskInventoryEO projectTaskInventoryEO = new ProjectTaskInventoryEO(); -// String projectTaskInventoryId = UUID.randomUUID().toString().replace("-", ""); -// projectTaskInventoryEO.setId(projectTaskInventoryId); -// projectTaskInventoryEO.setProjectLawsInventoryId(id); -// projectTaskInventoryEOList.add(projectTaskInventoryEO); -// }); - //项目任务清单数据初始化。 - this.projectTaskInventoryEOService.deleteByProjectLawsInventoryIds(idList); - this.projectTaskInventoryEOService.saveBatch(projectTaskInventoryEOList); - - //初始化项目状态评估 - projectTaskInventoryEOList.forEach(taskInventory -> { - this.initConditionAssessmentEO(taskInventory.getProjectLawsInventoryId()); - }); - - //删除该法规的任务明细数据 - QueryWrapper deleteTaskInventoryDetailWrapper = new QueryWrapper<>(); - deleteTaskInventoryDetailWrapper.lambda().in(ProjectTaskInventoryDetailEO::getProjectTaskInventoryId,idList); - this.projectTaskInventoryDetailEOService.remove(deleteTaskInventoryDetailWrapper); - - //查询反馈意见表 获取id 用于删除 反馈意见历史数据。 - QueryWrapper queryTaskInventoryFeedbackWrapper = new QueryWrapper<>(); - queryTaskInventoryFeedbackWrapper.lambda().in(ProjectTaskInventoryFeedbackEO::getProjectTaskInventoryId,idList); - List projectTaskInventoryFeedbackEOList = projectTaskInventoryFeedbackEOService.getBaseMapper().selectList(queryTaskInventoryFeedbackWrapper); - List feedbackIdList = projectTaskInventoryFeedbackEOList.stream().map(ProjectTaskInventoryFeedbackEO::getId).distinct().collect(Collectors.toList()); - if(CollectionUtils.isNotEmpty(feedbackIdList)){ - QueryWrapper deleteFeedbackHistoryWrapper = new QueryWrapper<>(); - deleteFeedbackHistoryWrapper.lambda().in(FeedbackHistory::getFeedbackId,feedbackIdList); - feedbackHistoryService.remove(deleteFeedbackHistoryWrapper); - } - - //删除反馈意见数据 - QueryWrapper deleteTaskInventoryFeedbackWrapper = new QueryWrapper<>(); - deleteTaskInventoryFeedbackWrapper.lambda().in(ProjectTaskInventoryFeedbackEO::getProjectTaskInventoryId,idList); - this.projectTaskInventoryFeedbackEOService.remove(deleteTaskInventoryFeedbackWrapper); - - //删除当前项目状态表 - QueryWrapper deleteConditionAssessmentWrapper = new QueryWrapper<>(); - deleteConditionAssessmentWrapper.lambda().in(ConditionAssessmentEO::getProjectLawsInventoryId,idList); - this.conditionAssessmentEOService.remove(deleteConditionAssessmentWrapper);*/ - JSONObject params = new JSONObject(); params.put("projectLawsInventoryIds", projectLawsInventoryIds); params.put("pIds", pIds); @@ -4955,7 +4893,10 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.in(LawsInventoryPlatformEO::getLawsInventoryId,Arrays.asList(ids.split(","))); + lawsInventoryPlatformEOService.remove(wrapper); } private void importDatas(List dataList, @@ -5581,6 +5522,11 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl list = Arrays.asList(value.split(",")); + List ddList = dictItemList.stream().filter(e -> "duty_territory".equals(e.getDictCode()) && list.contains(e.getItemValue())).collect(Collectors.toList()); + List valueList = ddList.stream().map(SysDictItem::getStatNode).collect(Collectors.toList()); + projectLawsInventoryEO.setDutyDepart(StringUtils.join(valueList,",")); + //工程接口人(责任领域下的工程接口人) Map objectMap = iProjectRelatedPersonnelService.queryPersonByProjectId(projectLawsInventoryEOTemp.getProjectLibraryId(), value); @@ -9904,6 +9850,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl { boolean flag = ( StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) ); return flag; }).count(); @@ -10235,7 +10192,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl { boolean flag = ( StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) ); return flag; }).count(); @@ -10293,6 +10252,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl> queryNotComplianList(Map params) { + //如果当前登录用户是系统管理员角色,可以查看所有的数据 + boolean administrator = this.sysUserService.isAdministrator(); String cut = (String) params.get("cut"); List complianceFlowStatusList = new ArrayList<>(); @@ -10357,6 +10318,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl> mapList = getNewData(params, cut); + List> mapList = getNewData(params, cut, administrator); if(ObjectUtils.isNotEmpty(mapList)){ result.addAll(mapList); } @@ -10481,7 +10444,6 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl> getNewData(Map params, String cut) { + private List> getNewData(Map params, String cut,boolean administrator) { //新数据 LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.like(ProblemManagementEO::getProjectId,params.get("projectLibraryId")); @@ -10701,6 +10663,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl dictModelList = problemTypeList.stream().filter(e -> e.getValue().equals(problemManagementEO.getProblemType())).collect(Collectors.toList()); @@ -11398,8 +11361,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl designNotInvolved = pliEos.stream().filter(pliEo -> { - boolean flag = ( - StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) - ); - return flag; - }).collect(Collectors.toList()); +// List designNotInvolved = pliEos.stream().filter(pliEo -> { +// boolean flag = ( +// StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) +// ); +// return flag; +// }).collect(Collectors.toList()); - List taskTermination = pliEos.stream().filter(pliEo -> { - boolean flag = ( - StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TERMINATION_OF_TASK.getValue()) - ); - return flag; - }).collect(Collectors.toList()); +// List taskTermination = pliEos.stream().filter(pliEo -> { +// boolean flag = ( +// StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TERMINATION_OF_TASK.getValue()) +// ); +// return flag; +// }).collect(Collectors.toList()); notStartCount = designNotStart.size(); toBeSubmittedCount = designToBeSubmitted.size(); @@ -11471,9 +11434,10 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl verifyNotInvolved = pliEos.stream().filter(pliEo -> { - boolean flag = ( - StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) - ); - return flag; - }).collect(Collectors.toList()); +// List verifyNotInvolved = pliEos.stream().filter(pliEo -> { +// boolean flag = ( +// StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue()) +// ); +// return flag; +// }).collect(Collectors.toList()); - List taskTermination = pliEos.stream().filter(pliEo -> { - boolean flag = ( - StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TERMINATION_OF_TASK.getValue()) - ); - return flag; - }).collect(Collectors.toList()); +// List taskTermination = pliEos.stream().filter(pliEo -> { +// boolean flag = ( +// StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TERMINATION_OF_TASK.getValue()) +// ); +// return flag; +// }).collect(Collectors.toList()); notStartCount = verifyNotStart.size(); toBeSubmittedCount = verifyToBeSubmitted.size(); @@ -11582,10 +11546,10 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl pageList = this.page(page, queryWrapper); List result = pageList.getRecords(); + //关联平台件数据 + platformDispose(projectLawsInventoryEO, result); + this.dataDispose(result,currentUser,isProjectRole,projectLawsInventoryEO.getCut()); this.dataDictDispose(result,projectLawsInventoryEO.getCut()); //表头排序 @@ -11724,6 +11691,241 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl result) { + List valueList = FlowStateEnum.getValueInfo(); + List lawsInventoryPlatformEOList = new ArrayList<>(); + List projectLawsInventoryEOS = new ArrayList<>(); + + List lawsInventoryIdList = new ArrayList<>(); + List inventoryIdList = new ArrayList<>(); + List fileIdList = new ArrayList<>(); + List userIdList = new ArrayList<>(); + if(!result.isEmpty()){ + lawsInventoryIdList = result.stream().map(ProjectLawsInventoryEO::getId).collect(Collectors.toList()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(LawsInventoryPlatformEO::getLawsInventoryId,lawsInventoryIdList); + lawsInventoryPlatformEOList = lawsInventoryPlatformEOService.list(wrapper); + if(!lawsInventoryPlatformEOList.isEmpty()){ + List collect = lawsInventoryPlatformEOList.stream().map(LawsInventoryPlatformEO::getPlatformLawsInventoryId).distinct().collect(Collectors.toList()); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.in(ProjectLawsInventoryEO::getId,collect); + projectLawsInventoryEOS = this.list(lambdaQueryWrapper); + if(!projectLawsInventoryEOS.isEmpty()){ + inventoryIdList = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getId).collect(Collectors.toList()); + List collect1 = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getDesignDutyId).distinct().collect(Collectors.toList()); + List collect2 = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getVerifyDutyId).distinct().collect(Collectors.toList()); + List collect3 = projectLawsInventoryEOS.stream().filter(e->StringUtils.isNotBlank(e.getDesignDeliverableTemplate())).map(ProjectLawsInventoryEO::getDesignDeliverableTemplate).distinct().collect(Collectors.toList()); + List collect4 = projectLawsInventoryEOS.stream().filter(e->StringUtils.isNotBlank(e.getVerifyDeliverableTemplate())).map(ProjectLawsInventoryEO::getVerifyDeliverableTemplate).distinct().collect(Collectors.toList()); + if(!collect1.isEmpty()){ + userIdList.addAll(collect1); + } + if(!collect2.isEmpty()){ + userIdList.addAll(collect2); + } + if(!collect3.isEmpty()){ + fileIdList.addAll(collect3); + } + if(!collect4.isEmpty()){ + fileIdList.addAll(collect4); + } + } + } + } + //树形结构数据字典(技术领域) + List categoryList = sysCategoryService.list(); + //文件 + List fileInfos = new ArrayList<>(); + if (fileIdList.size() != 0) { + fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ",")); + } + List sysUsers = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(userIdList)) { + userIdList = userIdList.stream().distinct().collect(Collectors.toList()); + QueryWrapper sysUserQueryWrapper = new QueryWrapper<>(); + sysUserQueryWrapper.lambda().in(SysUser::getId, userIdList); + sysUsers = sysUserMapper.selectList(sysUserQueryWrapper); + } + List projectLawsInventoryEOList = new ArrayList<>(); + String cut = projectLawsInventoryEO.getCut(); + for (ProjectLawsInventoryEO lawsInventoryEO : result) { + if(!lawsInventoryPlatformEOList.isEmpty()){ + List inventoryPlatformEOList = lawsInventoryPlatformEOList.stream() + .filter(e -> lawsInventoryEO.getId().equals(e.getLawsInventoryId())).collect(Collectors.toList()); + if(!inventoryPlatformEOList.isEmpty()){ + List idList = inventoryPlatformEOList.stream() + .map(LawsInventoryPlatformEO::getPlatformLawsInventoryId).collect(Collectors.toList()); + List lawsInventoryEOS = projectLawsInventoryEOS.stream() + .filter(e -> idList.contains(e.getId())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(lawsInventoryEOS)){ + for (String value : valueList) { + List collect = lawsInventoryEOS.stream() + .filter(e -> value.equals(e.getDesignFlowStatus())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect)){ + //流程状态 + lawsInventoryEO.setDesignFlowStatus(value); + break; + } + } + for (String value : valueList) { + List collect = lawsInventoryEOS.stream() + .filter(e -> value.equals(e.getVerifyFlowStatus())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect)){ + //流程状态 + lawsInventoryEO.setVerifyFlowStatus(value); + break; + } + } + } + lawsInventoryEO.setProjectLawsInventoryEOS(lawsInventoryEOS); + if(!lawsInventoryEOS.isEmpty()){ + projectLawsInventoryEOList.addAll(lawsInventoryEOS); + } + //如果关联平台件数据不为空,编辑时将设计符合性和验证符合性的数据覆盖 + if(!lawsInventoryEOS.isEmpty()){ + for (ProjectLawsInventoryEO inventoryEO : lawsInventoryEOS) { + //设计 + String designDeliverableType = inventoryEO.getDesignDeliverableType();//交付物类型 + String designDutyId = inventoryEO.getDesignDutyId();//责任人 + String designDeliverableTemplate = inventoryEO.getDesignDeliverableTemplate();//交付物模板 + //验证 + String verifyDeliverableType = inventoryEO.getVerifyDeliverableType();//交付物类型 + String verifyDutyId = inventoryEO.getVerifyDutyId();//责任人 + String verifyDeliverableTemplate = inventoryEO.getVerifyDeliverableTemplate();//交付物模板 + //设计交付物类型 + if (StringUtils.isNotBlank(designDeliverableType)) { +// lawsInventoryEO.setDesignDeliverableType(designDeliverableType); + List designDeliverableTypeList = Arrays.asList(designDeliverableType.split(",")); + String name = getTreeName(cut, categoryList, designDeliverableTypeList); + inventoryEO.setDesignDeliverableTypeName(name); + } + //验证交付物类型 + if (StringUtils.isNotBlank(verifyDeliverableType)) { +// lawsInventoryEO.setVerifyDeliverableType(verifyDeliverableType); + List verifyDeliverableTypeList = Arrays.asList(verifyDeliverableType.split(",")); + String name = getTreeName(cut, categoryList, verifyDeliverableTypeList); + inventoryEO.setVerifyDeliverableTypeName(name); + } + //交付物类型模板 + if (fileInfos.size() != 0) { + if (StringUtils.isNotBlank(designDeliverableTemplate)) { +// lawsInventoryEO.setDesignDeliverableTemplate(designDeliverableTemplate); + String fileName = this.editService.getFileName(null, fileInfos, designDeliverableTemplate); + if (StringUtils.isNotBlank(fileName)) { + inventoryEO.setDesignDeliverableTemplateName(fileName); + } + } + if (StringUtils.isNotBlank(verifyDeliverableTemplate)) { +// lawsInventoryEO.setVerifyDeliverableTemplate(verifyDeliverableTemplate); + String fileName = this.editService.getFileName(null, fileInfos, verifyDeliverableTemplate); + if (StringUtils.isNotBlank(fileName)) { + inventoryEO.setVerifyDeliverableTemplateName(fileName); + } + } + } + //设计责任人 + if (StringUtils.isNotEmpty(designDutyId)) { +// lawsInventoryEO.setVerifyDutyId(designDutyId); + String designDutyName = sysUsers.stream().filter(e -> designDutyId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + inventoryEO.setDesignDutyIdName(designDutyName); + } else { + inventoryEO.setDesignDutyIdName(""); + } + //验证责任人 + if (StringUtils.isNotEmpty(verifyDutyId)) { +// lawsInventoryEO.setVerifyDutyId(verifyDutyId); + String verifyDutyName = sysUsers.stream().filter(e -> verifyDutyId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + inventoryEO.setVerifyDutyIdName(verifyDutyName); + } else { + inventoryEO.setVerifyDutyIdName(""); + } + } + //设计交付物类型 + lawsInventoryEO.setDesignDeliverableType(lawsInventoryEOS.get(0).getDesignDeliverableType()); + lawsInventoryEO.setDesignDeliverableTypeName(lawsInventoryEOS.get(0).getDesignDeliverableTypeName()); + //验证交付物类型 + lawsInventoryEO.setVerifyDeliverableType(lawsInventoryEOS.get(0).getVerifyDeliverableType()); + lawsInventoryEO.setVerifyDeliverableTypeName(lawsInventoryEOS.get(0).getVerifyDeliverableTypeName()); + //交付物类型模板 + lawsInventoryEO.setDesignDeliverableTemplate(lawsInventoryEOS.get(0).getDesignDeliverableTemplate()); + lawsInventoryEO.setDesignDeliverableTemplateName(lawsInventoryEOS.get(0).getDesignDeliverableTemplateName()); + + lawsInventoryEO.setVerifyDeliverableTemplate(lawsInventoryEOS.get(0).getVerifyDeliverableTemplate()); + lawsInventoryEO.setVerifyDeliverableTemplateName(lawsInventoryEOS.get(0).getVerifyDeliverableTemplateName()); + + //责任人 + lawsInventoryEO.setVerifyDutyId(lawsInventoryEOS.get(0).getDesignDutyId()); + lawsInventoryEO.setDesignDutyIdName(lawsInventoryEOS.get(0).getDesignDutyIdName()); + + lawsInventoryEO.setVerifyDutyId(lawsInventoryEOS.get(0).getVerifyDutyId()); + lawsInventoryEO.setVerifyDutyIdName(lawsInventoryEOS.get(0).getVerifyDutyIdName()); + + //截止时间 + lawsInventoryEO.setDesignDueDate(lawsInventoryEOS.get(0).getDesignDueDate()); + lawsInventoryEO.setVerifyDueDate(lawsInventoryEOS.get(0).getVerifyDueDate()); + + //交付物说明 + lawsInventoryEO.setDesignRemark(lawsInventoryEOS.get(0).getDesignRemark()); + lawsInventoryEO.setVerifyRemark(lawsInventoryEOS.get(0).getVerifyRemark()); + //编号 serialNumber + lawsInventoryEO.setSerialNumber(lawsInventoryEOS.get(0).getSerialNumber()); + //标题 title + lawsInventoryEO.setTitle(lawsInventoryEOS.get(0).getTitle()); + //子标题 subtitle + lawsInventoryEO.setSubtitle(lawsInventoryEOS.get(0).getSubtitle()); + //使用增补件 applicableSupplement + lawsInventoryEO.setApplicableSupplement(lawsInventoryEOS.get(0).getApplicableSupplement()); + //认证类型 attestationType + lawsInventoryEO.setAttestationType(lawsInventoryEOS.get(0).getAttestationType()); + //认证级别 attestationRank + lawsInventoryEO.setAttestationRank(lawsInventoryEOS.get(0).getAttestationRank()); + //责任部门 dutyDepart + lawsInventoryEO.setDutyDepart(lawsInventoryEOS.get(0).getDutyDepart()); + //责任领域 dutyTerritory + lawsInventoryEO.setDutyTerritory(lawsInventoryEOS.get(0).getDutyTerritory()); + //法规工程师 regulationOwnerId + lawsInventoryEO.setRegulationOwnerId(lawsInventoryEOS.get(0).getRegulationOwnerId()); + //工程接口人 engineeringInterfacePerson + lawsInventoryEO.setEngineeringInterfacePerson(lawsInventoryEOS.get(0).getEngineeringInterfacePerson()); + //备注 remark + lawsInventoryEO.setRemark(lawsInventoryEOS.get(0).getRemark()); + } + } + } + } + if(!projectLawsInventoryEOList.isEmpty()){ + List projectLibraryIdList = projectLawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getProjectLibraryId).distinct().collect(Collectors.toList()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(ProjectLibraryBase::getId,projectLibraryIdList); + List libraryBaseList = projectLibraryBaseService.list(wrapper); + for (ProjectLawsInventoryEO lawsInventoryEO : result) { + List lawsInventoryEOS = lawsInventoryEO.getProjectLawsInventoryEOS(); + if(ObjectUtils.isNotEmpty(lawsInventoryEOS)){ + for (ProjectLawsInventoryEO inventoryEO : lawsInventoryEOS) { + List collect = libraryBaseList.stream().filter(e -> inventoryEO.getProjectLibraryId().equals(e.getId())).collect(Collectors.toList()); + if(!collect.isEmpty()){ + inventoryEO.setProjectName(collect.get(0).getProjectNameId()); + } + } + } + } + //平台件信息默认按项目名称正序排序 + for (ProjectLawsInventoryEO lawsInventoryEO : result) { + List nventoryEOList = lawsInventoryEO.getProjectLawsInventoryEOS(); + if(ObjectUtils.isNotEmpty(nventoryEOList)){ + Collator comparator = Collator.getInstance(Locale.CHINESE); + Collections.sort(nventoryEOList,(e1,e2)->{ + String e1ProjectName = StringUtils.isNotBlank(e1.getProjectName()) ? e1.getProjectName() : ""; + String e2ProjectName = StringUtils.isNotBlank(e2.getProjectName()) ? e2.getProjectName() : ""; + return comparator.compare(e1ProjectName,e2ProjectName); + }); + lawsInventoryEO.setProjectLawsInventoryEOS(nventoryEOList); + } + } + } + } + @Override public Result finalizationVerify(Map params) { boolean result = false; // 返回true,可以定版,返回false 不能定版 @@ -11964,4 +12166,161 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl queryPlatformList(String lawsInventoryId,String flowFlag,String cut){ + if(StringUtils.isBlank(lawsInventoryId) || StringUtils.isBlank(flowFlag)){ + return new ArrayList<>(); + } + List sysDictItems = this.sysDictItemServiceImpl.selectItemsAll(); + List categoryList = sysCategoryService.list(); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(LawsInventoryPlatformEO::getLawsInventoryId,lawsInventoryId); + List lawsInventoryPlatformEOS = lawsInventoryPlatformEOService.list(wrapper); + List idList = new ArrayList<>(); + List projectLawsInventoryEOList = new ArrayList<>(); + List projectLibraryBaseList = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(lawsInventoryPlatformEOS)){ + idList = lawsInventoryPlatformEOS.stream().map(LawsInventoryPlatformEO::getPlatformLawsInventoryId).collect(Collectors.toList()); + projectLawsInventoryEOList = this.listByIds(idList); + if(ObjectUtils.isNotEmpty(projectLawsInventoryEOList)){ + List projectIdList = projectLawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getProjectLibraryId).collect(Collectors.toList()); + projectLibraryBaseList = projectLibraryBaseService.listByIds(projectIdList); + } + List userIdList = new ArrayList<>(); + List collect1 = projectLawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getDesignDutyId).distinct().collect(Collectors.toList()); + List collect2 = projectLawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getVerifyDutyId).distinct().collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect1)){ + userIdList.addAll(collect1); + } + if(ObjectUtils.isNotEmpty(collect2)){ + userIdList.addAll(collect2); + } + + List fileIdList = new ArrayList<>(); + List collect3 = projectLawsInventoryEOList.stream() + .filter(e->StringUtils.isNotBlank(e.getDesignDeliverableTemplate())).map(ProjectLawsInventoryEO::getDesignDeliverableTemplate).distinct().collect(Collectors.toList()); + List collect4 = projectLawsInventoryEOList.stream() + .filter(e->StringUtils.isNotBlank(e.getVerifyDeliverableTemplate())).map(ProjectLawsInventoryEO::getVerifyDeliverableTemplate).distinct().collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(collect3)){ + fileIdList.addAll(collect3); + } + if(ObjectUtils.isNotEmpty(collect4)){ + fileIdList.addAll(collect4); + } + + List sysUsers = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(userIdList)) { + userIdList = userIdList.stream().distinct().collect(Collectors.toList()); + QueryWrapper sysUserQueryWrapper = new QueryWrapper<>(); + sysUserQueryWrapper.lambda().in(SysUser::getId, userIdList); + sysUsers = sysUserMapper.selectList(sysUserQueryWrapper); + } + + List fileInfos = new ArrayList<>(); + if (fileIdList.size() != 0) { + fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ",")); + } + + for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOList) { + List libraryBaseList = projectLibraryBaseList.stream() + .filter(e -> e.getId().equals(projectLawsInventoryEO.getProjectLibraryId())).collect(Collectors.toList()); + if(ObjectUtils.isNotEmpty(libraryBaseList)){ + projectLawsInventoryEO.setProjectName(libraryBaseList.get(0).getProjectNameId()); + } + //流程状态 + String flowStatus = ""; + if(FlowFlagEnum.DESIGN.getValue().equals(flowFlag)){//流程标识,点击设计符合性流程状态跳转 + flowStatus = projectLawsInventoryEO.getDesignFlowStatus(); + }else if(FlowFlagEnum.VERIFY.getValue().equals(flowFlag)){//流程标识,点击验证符合性流程状态跳转 + flowStatus = projectLawsInventoryEO.getVerifyFlowStatus(); + } + if (StringUtils.isNotEmpty(flowStatus)) { + String designFlowStatusName = ComplianceFlowStatusEnum.getTextByValue(flowStatus, cut); + if("design".equals(flowFlag)){ + projectLawsInventoryEO.setDesignFlowStatusName(designFlowStatusName); + }else{ + projectLawsInventoryEO.setVerifyFlowStatusName(designFlowStatusName); + } + } + + //发起人. +// if("design".equals(flowFlag)){ +// projectLawsInventoryEO.get +// }else{ +// +// } + //责任人 + String dutyId = ""; + if("design".equals(flowFlag)){ + dutyId = projectLawsInventoryEO.getDesignDutyId(); + }else{ + dutyId = projectLawsInventoryEO.getVerifyDutyId(); + } + if (StringUtils.isNotEmpty(dutyId)) { + String finalDutyId = dutyId; + String designDutyName = sysUsers.stream().filter(e -> finalDutyId.equals(e.getId())). + map(SysUser::getUsername).collect(Collectors.joining(",")); + if("design".equals(flowFlag)){ + projectLawsInventoryEO.setDesignDutyIdName(designDutyName); + }else{ + projectLawsInventoryEO.setVerifyDutyIdName(designDutyName); + } + } else { + projectLawsInventoryEO.setDesignDutyIdName(""); + } + + //交付物模板 + String deliverableTemplate = ""; + if("design".equals(flowFlag)){ + deliverableTemplate = projectLawsInventoryEO.getDesignDeliverableTemplate(); + }else{ + deliverableTemplate = projectLawsInventoryEO.getVerifyDeliverableTemplate(); + } + if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignDeliverableTemplate())) { + String fileName = this.editService.getFileName(projectLawsInventoryEO, fileInfos, projectLawsInventoryEO.getDesignDeliverableTemplate()); + if (StringUtils.isNotBlank(fileName)) { + if("design".equals(flowFlag)){ + projectLawsInventoryEO.setDesignDeliverableTemplateName(fileName); + }else{ + projectLawsInventoryEO.setVerifyDeliverableTemplateName(fileName); + } + } + } + //交付物类型 + String deliverableType = ""; + if("design".equals(flowFlag)){ + deliverableType = projectLawsInventoryEO.getDesignDeliverableType(); + }else{ + deliverableType = projectLawsInventoryEO.getVerifyDeliverableType(); + } + if (StringUtils.isNotBlank(deliverableType)) { + List designDeliverableTypeList = Arrays.asList(deliverableType.split(",")); + String name = getTreeName(cut, categoryList, designDeliverableTypeList); + if("design".equals(flowFlag)){ + projectLawsInventoryEO.setDesignDeliverableTypeName(name); + }else{ + projectLawsInventoryEO.setVerifyDeliverableTypeName(name); + } + + } + + //责任领域 + String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); + if (StringUtils.isNotEmpty(dutyTerritory)) { + String dutyTerritory_dictText = disposeShowDictItemValue(sysDictItems, dutyTerritory, cut, ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()); + projectLawsInventoryEO.setDutyTerritory_dictText(dutyTerritory_dictText); + } + //交付物说明 + String remark = ""; + if("design".equals(flowFlag)){ + remark = projectLawsInventoryEO.getDesignRemark(); + }else{ + remark = projectLawsInventoryEO.getVerifyRemark(); + } + } + } + return projectLawsInventoryEOList; + } + + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java index 00b571f64..fccc89134 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java @@ -22,18 +22,47 @@ import com.jero.modules.cert.template.enums.ControlTypeEnum; import com.jero.modules.dummy.enums.OrderEnum; import com.jero.modules.enums.DictCodeEnum; import com.jero.modules.feishu.enums.TemplateInfoEnum2; -import com.jero.modules.ota.entity.OtaManageApplyEO; import com.jero.modules.ota.service.impl.OtaManageApplyEOServiceImpl; -import com.jero.modules.project.entity.*; -import com.jero.modules.project.enums.*; +import com.jero.modules.project.entity.LawsInventoryPlatformEO; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import com.jero.modules.project.entity.ProjectLawsInventoryLogEO; +import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.project.entity.ProjectLibraryRoleRelEO; +import com.jero.modules.project.entity.ProjectRelatedPersonnel; +import com.jero.modules.project.entity.ProjectTaskInventoryEO; +import com.jero.modules.project.entity.ProjectTaskPlanning; +import com.jero.modules.project.entity.ProjectUserPermission; +import com.jero.modules.project.enums.CertificationFlowNodeEnum; +import com.jero.modules.project.enums.CertificationInventoryFlowStatusEnum; +import com.jero.modules.project.enums.CertificationProgressEnum; +import com.jero.modules.project.enums.ComplianceFlowStatusEnum; +import com.jero.modules.project.enums.DesignComplianceStatusEnum; +import com.jero.modules.project.enums.FlowStateEnum; +import com.jero.modules.project.enums.HSStatisticalNodesEnum; +import com.jero.modules.project.enums.OperatorTypeEnum; +import com.jero.modules.project.enums.PermissionDescriptionEnum; +import com.jero.modules.project.enums.ProjectRoleEnum; +import com.jero.modules.project.enums.ProjectTaskPlanningNameEnum; +import com.jero.modules.project.enums.ProjectUserLocationEnum; +import com.jero.modules.project.enums.RoleRelModelTypeEnum; +import com.jero.modules.project.enums.TaskAffirmStatusEnum; +import com.jero.modules.project.enums.TaskStatusEnum; +import com.jero.modules.project.enums.TopEnum; import com.jero.modules.project.mapper.ProjectLawsInventoryEOMapper; import com.jero.modules.project.mapper.ProjectLibraryBaseMapper; import com.jero.modules.project.mapper.ProjectNameInfoEOMapper; import com.jero.modules.project.mapper.ProjectRelatedPersonnelMapper; import com.jero.modules.project.mapper.ProjectTaskInventoryEOMapper; import com.jero.modules.project.mapper.ProjectUserPermissionMapper; -import com.jero.modules.project.service.*; +import com.jero.modules.project.service.IConditionAssessmentEOService; +import com.jero.modules.project.service.IProjectCertificationInventoryEOService; +import com.jero.modules.project.service.IProjectLibraryBaseService; +import com.jero.modules.project.service.IProjectLibraryRoleRelEOService; +import com.jero.modules.project.service.IProjectLibraryStatisticsService; +import com.jero.modules.project.service.IProjectUserPermissionService; import com.jero.modules.project.vo.TimeNodeVO; +import com.jero.modules.system.entity.SysCategory; import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysUser; import com.jero.modules.system.enums.DicCodeEnum; @@ -43,14 +72,15 @@ import com.jero.modules.system.mapper.SysUserMapper; import com.jero.modules.system.service.IProjectUserBrandService; import com.jero.modules.system.service.ISysDictService; import com.jero.modules.system.service.ISysUserService; +import com.jero.modules.system.service.impl.SysCategoryServiceImpl; import com.jero.modules.system.service.impl.SysDictItemServiceImpl; import com.jero.modules.system.util.StringUtils; import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; +import com.jero.modules.todoCenter.enums.TodoCenterStatusEnum; import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService; import com.jero.modules.top.entity.TopProjectEO; import com.jero.modules.top.service.ITopProjectEOService; import com.jero.modules.wkflow.enums.FlowTypeEnum; -import javafx.beans.binding.ObjectBinding; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.poi.hssf.usermodel.HSSFSheet; @@ -178,6 +208,10 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl queryByIdFlow(String id,String cut) { + List records = projectLibraryBaseMapper.queryByIdFlow(id); + disposeData(records,"",false); + //目标市场数据字典 + List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); + for(ProjectLibraryBase projectLibraryBase: records){ + //历史数据的主版本没有版本号,所以默认给00 + if(StringUtils.isBlank(projectLibraryBase.getParentId()) && StringUtils.isBlank(projectLibraryBase.getProjectVersion())){ + projectLibraryBase.setProjectVersion("00"); + } + //目标市场 + Map param = new HashMap<>(); + param.put("cut",cut); + String targetMarket = getMarket(param, targetMarketList, projectLibraryBase); + //主项目的版本号 + String projectVersion = ""; + if(StringUtils.isBlank(projectLibraryBase.getParentId())){ + projectVersion = "00"; + }else{ + projectVersion = projectLibraryBase.getProjectVersion(); + } + if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){ + projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() + + "-" + projectLibraryBase.getYearName() + + "-" + targetMarket + "-" + projectVersion); + }else{ + projectLibraryBase.setProjectName(projectLibraryBase.getPower()+"-"+projectLibraryBase.getProducer()+"-"+targetMarket); + } + } + return records; + } /** * 列表查询 @@ -1020,6 +1086,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl queryPageList(Map params) { + String quote = (String) params.get("quote"); LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); Integer isViewer = sysRoleMapper.queryUserRoleByCode(ProjectRoleEnum.VIEWER.getName(), loginUser.getId()); Set projectIds = new HashSet<>(); @@ -1084,6 +1151,8 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl listPlatform(Map params) { + String cut = (String) params.get("cut");// + String ids = (String) params.get("ids");//法规清单id + String projectLibraryIds = (String) params.get("projectLibraryIds");//平台件法规清单id + + //法规清单数据 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(ProjectLawsInventoryEO::getId,Arrays.asList(ids.split(","))); + List lawsInventoryEOList = projectLawsInventoryEOService.list(wrapper); + + //平台件项目对应的法规清单数据 + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.in(ProjectLawsInventoryEO::getProjectLibraryId,Arrays.asList(projectLibraryIds.split(","))); + List lawsInventoryEOS = projectLawsInventoryEOService.list(wrapper1); + + //平台件项目信息 + List projectLibraryBaseList = new ArrayList<>(); + if(!lawsInventoryEOList.isEmpty() && ObjectUtils.isNotEmpty(lawsInventoryEOS)){ + List projectIdList = lawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getProjectLibraryId).distinct().collect(Collectors.toList()); + LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper<>(); + wrapper2.in(ProjectLibraryBase::getId,projectIdList); + projectLibraryBaseList = this.list(wrapper2); + } + + //普通数据字典 + List sysDictItemList = sysDictItemMapper.selectItemsByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue()); + List categoryList = sysCategoryService.list(); + List> mapList = new ArrayList<>(); + List> mapListOne = new ArrayList<>(); + List emptyList = new ArrayList<>(); + for (ProjectLawsInventoryEO projectLawsInventoryEO : lawsInventoryEOList) { + Map map = new HashMap<>(); + List projectLawsInventoryEOS = new ArrayList<>(); + //serialNumber dutyTerritory + String serialNumber = projectLawsInventoryEO.getSerialNumber(); + String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); + String subtitle = ""; + if(StringUtils.isNotBlank(projectLawsInventoryEO.getSubtitle())){ + subtitle = projectLawsInventoryEO.getSubtitle(); + } + + //责任领域 + List list = new LinkedList<>(); + if(StringUtils.isNotBlank(dutyTerritory)){ + for (String s : dutyTerritory.split(",")) { + List collect = sysDictItemList.stream().filter(e -> e.getItemValue().equals(s)).collect(Collectors.toList()); + if(CutEnum.CN.getValue().equals(cut) && !collect.isEmpty()){ + list.add(collect.get(0).getItemText()); + }else if(CutEnum.EN.getValue().equals(cut) && !collect.isEmpty()){ + list.add(collect.get(0).getEnName()); + } + } + } + String dutyTerritoryNew = ""; + if(!list.isEmpty()){ + dutyTerritoryNew = StringUtils.join(list, ","); + } + //设计-交付物类型 + String designDeliverableTypeName = ""; + String verifyDeliverableTypeName = ""; + String designDeliverableType = projectLawsInventoryEO.getDesignDeliverableType(); + if(StringUtils.isNotBlank(designDeliverableType)){ + designDeliverableTypeName = projectLawsInventoryEOService.getTreeName(cut, categoryList, Arrays.asList(designDeliverableType.split(","))); + } + + //验证-交付物类型 + String verifyDeliverableType = projectLawsInventoryEO.getVerifyDeliverableType(); + if(StringUtils.isNotBlank(verifyDeliverableType)){ + verifyDeliverableTypeName = projectLawsInventoryEOService.getTreeName(cut, categoryList, Arrays.asList(verifyDeliverableType.split(","))); + } + + for (ProjectLawsInventoryEO lawsInventoryEO : lawsInventoryEOS) { + String serialNumberTemp = lawsInventoryEO.getSerialNumber(); + String dutyTerritoryTemp = lawsInventoryEO.getDutyTerritory(); + if(serialNumber.equals(serialNumberTemp) && StringUtils.isNotBlank(dutyTerritory) && dutyTerritory.equals(dutyTerritoryTemp)){ + List projectLibraryBases = projectLibraryBaseList.stream().filter(e -> e.getId().equals(lawsInventoryEO.getProjectLibraryId())).collect(Collectors.toList()); + if(!projectLibraryBases.isEmpty()){ + lawsInventoryEO.setProjectName(projectLibraryBases.get(0).getProjectNameId()); + } + if(!list.isEmpty()){ + lawsInventoryEO.setDutyTerritory_dictText(dutyTerritoryNew); + } + lawsInventoryEO.setDesignDeliverableTypeName(designDeliverableTypeName); + lawsInventoryEO.setVerifyDeliverableTypeName(verifyDeliverableTypeName); + projectLawsInventoryEOS.add(lawsInventoryEO); + } + } + if(ObjectUtils.isEmpty(projectLawsInventoryEOS)){ + emptyList.add(projectLawsInventoryEO); + } + if(!projectLawsInventoryEOS.isEmpty() && projectLawsInventoryEOS.size() > 1){ + map.put("lawsInventoryId",projectLawsInventoryEO.getId()); + map.put("title",serialNumber+" "+dutyTerritoryNew+" "+subtitle); + map.put("result",projectLawsInventoryEOS); + mapList.add(map); + }else if(!projectLawsInventoryEOS.isEmpty() && projectLawsInventoryEOS.size() == 1){ + Map mapTemp = new HashMap<>(); + mapTemp.put("lawsInventoryId",projectLawsInventoryEO.getId()); + mapTemp.put("result",projectLawsInventoryEOS); + mapListOne.add(mapTemp); + } + } + + if(!mapListOne.isEmpty()){ + //匹配一条平台件时直接新增 + List lawsInventoryPlatformEOS = new ArrayList<>(); + for (Map map : mapListOne) { + LawsInventoryPlatformEO inventoryPlatformEO = new LawsInventoryPlatformEO(); + inventoryPlatformEO.setCreateTime(new Date()); + inventoryPlatformEO.setUpdateTime(new Date()); + inventoryPlatformEO.setLawsInventoryId((String) map.get("lawsInventoryId")); + List projectLawsInventoryEOS = (List) map.get("result"); + inventoryPlatformEO.setPlatformLawsInventoryId(projectLawsInventoryEOS.get(0).getId()); + lawsInventoryPlatformEOS.add(inventoryPlatformEO); + } + + if (!lawsInventoryPlatformEOS.isEmpty()) { + lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS); + } + } + //法规清单未匹配上平台件的提示语 + String html = getMsg(cut, sysDictItemList, emptyList); + + Map map = new HashMap<>(); + map.put("msg",html); + map.put("result",mapList); + return map; + } + + @NotNull + private String getMsg(String cut, List sysDictItemList, List emptyList) { + List msgList = new ArrayList<>(); + //未匹配上法规清单 + if(ObjectUtils.isNotEmpty(emptyList)){ + for (ProjectLawsInventoryEO projectLawsInventoryEO : emptyList) { + List list = new LinkedList<>(); + if(StringUtils.isNotBlank(projectLawsInventoryEO.getDutyTerritory())){ + for (String s : projectLawsInventoryEO.getDutyTerritory().split(",")) { + List collect = sysDictItemList.stream().filter(e -> e.getItemValue().equals(s)).collect(Collectors.toList()); + if(CutEnum.CN.getValue().equals(cut) && !collect.isEmpty()){ + list.add(collect.get(0).getItemText()); + }else if(CutEnum.EN.getValue().equals(cut) && !collect.isEmpty()){ + list.add(collect.get(0).getEnName()); + } + } + } + String serialNumber = projectLawsInventoryEO.getSerialNumber(); + String dutyTerritoryName = StringUtils.join(list,","); + String msg = ""; + if(CutEnum.CN.getValue().equals(cut)){ + msg = serialNumber+" "+dutyTerritoryName+"未匹配到数据"; + }else{ + msg = serialNumber+" "+dutyTerritoryName+" no data matched"; + } + msgList.add(msg); + } + } + String html = ""; + for (String s : msgList) { + html += s + "
"; + } + return html; + } + + /** + * 不勾选法规清单进行关联平台件 + * + * @return + */ + @Override + public Map listPlatformAll(Map params) { + String cut = (String) params.get("cut");// + String projectLibraryIds = (String) params.get("projectLibraryIds");//法规清单id + String platformProjectLibraryIds = (String) params.get("platformProjectLibraryIds");//平台件法规id + //法规清单数据 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(ProjectLawsInventoryEO::getId,Arrays.asList(projectLibraryIds.split(","))); + List lawsInventoryEOList = projectLawsInventoryEOService.list(wrapper); + + ProjectLawsInventoryEO projectLawsInventoryEOTemp = new ProjectLawsInventoryEO(); + projectLawsInventoryEOTemp.setCut(cut); + projectLawsInventoryEOService.platformDispose(projectLawsInventoryEOTemp,lawsInventoryEOList); + //只有法规的设计符合性确认和验证符合性确认中的流程状态均为清单待发布的时候,才能关联平台件数据 + lawsInventoryEOList = lawsInventoryEOList.stream() + .filter(e->ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue().equals(e.getDesignFlowStatus()) + && ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue().equals(e.getVerifyFlowStatus())).collect(Collectors.toList()); + + //平台件项目对应的法规清单数据 + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.in(ProjectLawsInventoryEO::getId,Arrays.asList(platformProjectLibraryIds.split(","))); + List lawsInventoryEOS = projectLawsInventoryEOService.list(wrapper1); + + //平台件项目信息 + List projectLibraryBaseList = new ArrayList<>(); + if(!lawsInventoryEOList.isEmpty()){ + List projectIdList = lawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getProjectLibraryId).distinct().collect(Collectors.toList()); + LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper<>(); + wrapper2.in(ProjectLibraryBase::getId,projectIdList); + projectLibraryBaseList = this.list(wrapper2); + } + + //普通数据字典 + List sysDictItemList = sysDictItemMapper.selectItemsByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue()); + List> mapList = new ArrayList<>(); + List> mapListOne = new ArrayList<>(); + List emptyList = new ArrayList<>(); + for (ProjectLawsInventoryEO projectLawsInventoryEO : lawsInventoryEOList) { + Map map = new HashMap<>(); + List projectLawsInventoryEOS = new ArrayList<>(); + //serialNumber dutyTerritory + String serialNumber = projectLawsInventoryEO.getSerialNumber(); + String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); + String subtitle = StringUtils.isNotEmpty(projectLawsInventoryEO.getSubtitle()) ? projectLawsInventoryEO.getSubtitle() : "";; + //责任领域 + List list = new LinkedList<>(); + if(StringUtils.isNotBlank(dutyTerritory)){ + for (String s : dutyTerritory.split(",")) { + List collect = sysDictItemList.stream().filter(e -> e.getItemValue().equals(s)).collect(Collectors.toList()); + if(CutEnum.CN.getValue().equals(cut) && !collect.isEmpty()){ + list.add(collect.get(0).getItemText()); + }else if(CutEnum.EN.getValue().equals(cut) && !collect.isEmpty()){ + list.add(collect.get(0).getEnName()); + } + } + } + String dutyTerritoryNew = ""; + if(!list.isEmpty()){ + dutyTerritoryNew = StringUtils.join(list, ","); + } + + for (ProjectLawsInventoryEO lawsInventoryEO : lawsInventoryEOS) { + String serialNumberTemp = lawsInventoryEO.getSerialNumber(); + String dutyTerritoryTemp = lawsInventoryEO.getDutyTerritory(); + if(serialNumber.equals(serialNumberTemp) && StringUtils.isNotBlank(dutyTerritory) && dutyTerritory.equals(dutyTerritoryTemp)){ + List projectLibraryBases = projectLibraryBaseList.stream().filter(e -> e.getId().equals(lawsInventoryEO.getProjectLibraryId())).collect(Collectors.toList()); + if(!projectLibraryBases.isEmpty()){ + lawsInventoryEO.setProjectName(projectLibraryBases.get(0).getProjectNameId()); + } + if(!list.isEmpty()){ + lawsInventoryEO.setDutyTerritory_dictText(dutyTerritoryNew); + } + projectLawsInventoryEOS.add(lawsInventoryEO); + } + } + if(ObjectUtils.isEmpty(projectLawsInventoryEOS)){ + emptyList.add(projectLawsInventoryEO); + } + + if(!projectLawsInventoryEOS.isEmpty() && projectLawsInventoryEOS.size() > 1){ + map.put("lawsInventoryId",projectLawsInventoryEO.getId()); + map.put("title",serialNumber+" "+dutyTerritoryNew+" "+subtitle); + map.put("result",projectLawsInventoryEOS); + mapList.add(map); + }else if(!projectLawsInventoryEOS.isEmpty() && projectLawsInventoryEOS.size() == 1){ + Map mapTemp = new HashMap<>(); + mapTemp.put("lawsInventoryId",projectLawsInventoryEO.getId()); + mapTemp.put("result",projectLawsInventoryEOS); + mapListOne.add(mapTemp); + } + } + if(!mapListOne.isEmpty()){ + //匹配一条平台件时直接新增 + List lawsInventoryPlatformEOS = new ArrayList<>(); + for (Map map : mapListOne) { + LawsInventoryPlatformEO inventoryPlatformEO = new LawsInventoryPlatformEO(); + inventoryPlatformEO.setCreateTime(new Date()); + inventoryPlatformEO.setUpdateTime(new Date()); + inventoryPlatformEO.setLawsInventoryId((String) map.get("lawsInventoryId")); + List projectLawsInventoryEOS = (List) map.get("result"); + inventoryPlatformEO.setPlatformLawsInventoryId(projectLawsInventoryEOS.get(0).getId()); + lawsInventoryPlatformEOS.add(inventoryPlatformEO); + } + + if (!lawsInventoryPlatformEOS.isEmpty()) { + lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS); + } + } + //法规清单未匹配上平台件的提示语 + String html = getMsg(cut, sysDictItemList, emptyList); + + Map map = new HashMap<>(); + map.put("msg",html); + map.put("result",mapList); + return map; + } private void hearSort(Map params, List resultLast) { if(ObjectUtils.isNotEmpty(params.get("orderByField"))){ @@ -1393,10 +1753,12 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl params, List targetMarketList, ProjectLibraryBase projectLibraryBase) { List dictModelList = new ArrayList<>(); - for (String s : projectLibraryBase.getTargetMarket().split(",")) { - List dictModelListTemp = targetMarketList.stream() - .filter(e -> s.equals(e.getValue())).collect(Collectors.toList()); - dictModelList.addAll(dictModelListTemp); + if(StringUtils.isNotBlank(projectLibraryBase.getTargetMarket())){ + for (String s : projectLibraryBase.getTargetMarket().split(",")) { + List dictModelListTemp = targetMarketList.stream() + .filter(e -> s.equals(e.getValue())).collect(Collectors.toList()); + dictModelList.addAll(dictModelListTemp); + } } String targetMarket = ""; if(dictModelList.size() != 0){ @@ -1575,32 +1937,6 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl> currentProjectStatusMapList = new ArrayList<>(); - CurrentProjectStatusEnum[] values = CurrentProjectStatusEnum.values(); - for (CurrentProjectStatusEnum value : values) { - Map map = new HashMap<>(); - map.put("color",value.getValue()); - currentProjectStatusMapList.add(map); - } - int currentProjectStatusTotal; - List projectStatusAssessList = this.conditionAssessmentEOService.getProjectStatusAssessList(projectLawsInventoryIdList); - - for (Map map : currentProjectStatusMapList) { - List collect = projectStatusAssessList.stream().filter( - projectStatusAssess -> StringUtils.equals(projectStatusAssess.getConditionAssessment(),map.get("color").toString()) - ).collect(Collectors.toList()); - map.put("conditionAssessmentCount",collect.size()); - } - - currentProjectStatusTotal = currentProjectStatusMapList.stream().filter( - currentProjectStatus -> Integer.parseInt(currentProjectStatus.get("conditionAssessmentCount").toString()) != 0 - ).mapToInt(currentProjectStatus -> Integer.parseInt(currentProjectStatus.get("conditionAssessmentCount").toString())).sum(); - - currentProjectStatusMap.put("currentProjectStatusMapList",currentProjectStatusMapList); - currentProjectStatusMap.put("currentProjectStatusTotal",currentProjectStatusTotal); - result.put("currentProjectStatusMap",currentProjectStatusMap);*/ - //设计符合性 List> designComplianceMapList = this.projectLawsInventoryEOService.getDesignComplianceStatistice(projectLawsInventoryEOList); int designFlowTaskStatusCount = 0; @@ -1624,36 +1960,6 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl> certificationProgressMapList = this.projectTaskInventoryEOMapper.getCertificationProgressStatistics(projectLawsInventoryIdList); - certificationProgressTotal = certificationProgressMapList.stream().filter( - certificationProgress -> Integer.parseInt(certificationProgress.get("certificationProgressCount").toString()) != 0 - ).mapToInt(certificationProgress -> Integer.parseInt(certificationProgress.get("certificationProgressCount").toString())).sum(); - - CertificationProgressEnum[] CertificationProgressEnumValues = CertificationProgressEnum.values(); - for (CertificationProgressEnum certificationProgressEnumValue : CertificationProgressEnumValues) { - boolean flag = true; - for (Map map : certificationProgressMapList) { - if(map.get("certificationProgress") != null){ - if(StringUtils.equals(certificationProgressEnumValue.getValue(),map.get("certificationProgress").toString())){ - flag = false; - break; - } - } - } - if(flag){ - Map map = new HashMap<>(); - map.put("certificationProgress",certificationProgressEnumValue.getValue()); - map.put("certificationProgressCount",0); - certificationProgressMapList.add(map); - } - } - - certificationProgressMap.put("certificationProgressTotal",certificationProgressTotal); - certificationProgressMap.put("certificationProgressMapList",certificationProgressMapList); - result.put("certificationProgressMap",certificationProgressMap);*/ } QueryWrapper pciQueryWrap = new QueryWrapper<>(); @@ -2020,6 +2326,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl pciEoMap = new HashMap<>(); QueryWrapper pciQueryWrap = new QueryWrapper<>(); pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); + pciQueryWrap.lambda().ne(ProjectCertificationInventoryEO::getFlowStatus, FlowStateEnum.UNINVOLVED.getValue()); List projectCertificationInventoryEOList = this.projectCertificationInventoryEOService.list(pciQueryWrap); String pciDutyTerritoryStr = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyTerritory).collect(Collectors.joining(",")); if (StringUtils.isNotEmpty(pciDutyTerritoryStr)) { @@ -2473,6 +2780,11 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl prehomoMap = this.projectLibraryStatisticsService.getPrehomoStatisticeGroupByTerritory(pciEoList, params); Map prehomoNotStartedMap = (Map) prehomoMap.get(TaskAffirmStatusEnum.NOT_STARTED.getValue()); double prehomoNotStartedAmount = (double) prehomoNotStartedMap.get("amount"); - Map prehomoToConfirmMap = (Map) prehomoMap.get(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); + Map prehomoToConfirmMap = (Map) prehomoMap.get(TodoCenterStatusEnum.TO_SUBMIT.getValue()); +// Map prehomoToConfirmMap = (Map) prehomoMap.get(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); double prehomoToConfirmAmount = (double) prehomoToConfirmMap.get("amount"); Map prehomoAcceptedMap = (Map) prehomoMap.get(CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue()); double prehomoAcceptedAmount = (double) prehomoAcceptedMap.get("amount"); @@ -2989,7 +3312,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl certificationProgressMap = this.projectLibraryStatisticsService.getPartCertificationProgressStatisticsGroupByTerritory(pciEoList, params); + Map certificationProgressMap = this.projectLibraryStatisticsService.getPartCertificationProgressStatisticsGroupByTerritoryTemp(pciEoList, params); Map certificationProgressNotStartMap = (Map)certificationProgressMap.get(CertificationProgressEnum.NOT_START.getValue()); double certificationProgressNotStartAmount = (double) certificationProgressNotStartMap.get("amount"); Map certificationProgressInProgressMap = (Map)certificationProgressMap.get(CertificationProgressEnum.IN_PROGRESS.getValue()); @@ -2998,26 +3321,15 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl certificationProgressTestFailedMap = (Map)certificationProgressMap.get(CertificationProgressEnum.TEST_FAILED.getValue()); double certificationProgressTestFailedAmount = (double) certificationProgressTestFailedMap.get("amount"); - Map certificationProgressNotSubmitMap = (Map)certificationProgressMap.get(CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()); - double certificationProgressNotSubmitAmount = (double) certificationProgressNotSubmitMap.get("amount"); - Map certificationProgressSubmitMap = (Map)certificationProgressMap.get(CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()); - double certificationProgressSubmitAmount = (double) certificationProgressSubmitMap.get("amount"); - Map certificationProgressStoredMap = (Map)certificationProgressMap.get(CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()); - double certificationProgressStoredAmount = (double) certificationProgressStoredMap.get("amount"); dataRow.createCell(11).setCellValue(certificationProgressNotStartAmount); dataRow.createCell(12).setCellValue(certificationProgressInProgressAmount); dataRow.createCell(13).setCellValue(certificationProgressTestPassedAmount); dataRow.createCell(14).setCellValue(certificationProgressTestFailedAmount); - dataRow.createCell(15).setCellValue(certificationProgressNotSubmitAmount); - dataRow.createCell(16).setCellValue(certificationProgressSubmitAmount); - dataRow.createCell(17).setCellValue(certificationProgressStoredAmount); double certificationProgressCount = certificationProgressNotStartAmount + certificationProgressInProgressAmount - + certificationProgressTestPassedAmount + certificationProgressTestFailedAmount - + certificationProgressNotSubmitAmount + certificationProgressSubmitAmount - + certificationProgressStoredAmount; + + certificationProgressTestPassedAmount + certificationProgressTestFailedAmount; double certificationProgressPercentage = (certificationProgressTestPassedAmount / certificationProgressCount) * 100; String certificationProgressPercentageStr = (certificationProgressPercentage != 0 && (certificationProgressCount !=0 )) ? df.format(certificationProgressPercentage) : "0"; - dataRow.createCell(18).setCellValue(certificationProgressPercentageStr + percentSign); + dataRow.createCell(15).setCellValue(certificationProgressPercentageStr + percentSign); } /** @@ -3210,7 +3522,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl params, HSSFSheet sheet, int dataIndex, String key, List pcmEos) { - Map parameterCollectingMap = this.projectLibraryStatisticsService.getParameterCollectingStatisticsGroupByTerritory(pcmEos,params); + Map parameterCollectingMap = this.projectLibraryStatisticsService.getParameterCollectingStatisticsGroupByTerritoryExport(pcmEos,params); Map notStartMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.NOT_START.getValue()); double notStartAmount = (double) notStartMap.get("amount"); Map collectingMap = (Map) parameterCollectingMap.get(CollectManifestStatisticsStateEnum.COLLECTING.getValue()); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryStatisticsServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryStatisticsServiceImpl.java index fd57d530d..7f87f897c 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryStatisticsServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryStatisticsServiceImpl.java @@ -12,6 +12,7 @@ import com.jero.modules.project.enums.TaskAffirmStatusEnum; import com.jero.modules.project.service.IProjectCertificationInventoryEOService; import com.jero.modules.project.service.IProjectLawsInventoryEOService; import com.jero.modules.project.service.IProjectLibraryStatisticsService; +import com.jero.modules.todoCenter.enums.TodoCenterStatusEnum; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -155,7 +156,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati || StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) || StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) || StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) - || StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) +// || StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) ); return flag; }).collect(Collectors.toList()); @@ -170,7 +171,8 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati boolean flag = ( StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) || StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) - || StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + || StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) +// || StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) ); return flag; }).collect(Collectors.toList()); @@ -197,6 +199,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati List nonComplianceDesignPliEoList = datas.stream().filter(data -> { boolean flag = ( StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) ); return flag; }).collect(Collectors.toList()); @@ -229,7 +232,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati || StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) || StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.REGULATORY_ENGINEER_RETURNS.getValue()) || StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.DUTY_PERSON_REJECTED.getValue()) - || StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) +// || StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) ); return flag; }).collect(Collectors.toList()); @@ -244,7 +247,8 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati boolean flag = ( StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) || StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) - || StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) + || StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) +// || StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) ); return flag; }).collect(Collectors.toList()); @@ -271,6 +275,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati List nonComplianceVerifyPliEoList = datas.stream().filter(data -> { boolean flag = ( StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue()) ); return flag; }).collect(Collectors.toList()); @@ -356,6 +361,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati result.put(TaskAffirmStatusEnum.NOT_STARTED.getValue(),notStartedMap); result.put(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue(),toConfirmMap); +// result.put(TodoCenterStatusEnum.TO_SUBMIT.getValue(),acceptedMap); result.put(TaskAffirmStatusEnum.ACCEPTED.getValue(),acceptedMap); result.put(TaskAffirmStatusEnum.REJECTED.getValue(),rejectedMap); } @@ -391,7 +397,7 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati notStartedMap.put("amount",notStartedCount); notStartedMap.put("percentage",notStartedPercentageStr + percentSign); - // 待确认 + // 待提交 List toConfirmPciEoList = datas.stream().filter(data -> { boolean flag = ( StringUtils.equals(data.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) @@ -432,7 +438,8 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati rejectedMap.put("percentage",rejectedPercentageStr + percentSign); result.put(TaskAffirmStatusEnum.NOT_STARTED.getValue(),notStartedMap); - result.put(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue(),toConfirmMap); +// result.put(TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue(),toConfirmMap); + result.put(TodoCenterStatusEnum.TO_SUBMIT.getValue(),toConfirmMap); result.put(CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue(),acceptedMap); result.put(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue(),rejectedMap); } @@ -510,7 +517,6 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati } return result; } - @Override public Map getCarCertificationProgressStatisticsGroupByTerritory(List datas, Map params) { Map result = new HashMap<>(); @@ -691,6 +697,76 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati } return result; } + @Override + public Map getPartCertificationProgressStatisticsGroupByTerritoryTemp(List datas, Map params) { + Map result = new HashMap<>(); + if(CollectionUtils.isNotEmpty(datas)){ + Map notStartMap = new HashMap<>(); + Map inProgressMap = new HashMap<>(); + Map testPassedMap = new HashMap<>(); + Map testFailedMap = new HashMap<>(); + + + // 未开始 + List notStartPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.NOT_START.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double notStartCount = (double) notStartPciEoList.size(); + double notStartPercentage = (notStartCount / (datas.size())) * 100; + String notStartPercentageStr = notStartPercentage != 0 ? df.format(notStartPercentage) : "0"; + notStartMap.put("amount",notStartCount); + notStartMap.put("percentage",notStartPercentageStr + percentSign); + // 进行中 + List inProgressPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.IN_PROGRESS.getValue()) + || StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_NOT_SUBMITTED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double inProgressCount = (double) inProgressPciEoList.size(); + double inProgressPercentage = (inProgressCount / (datas.size())) * 100; + String inProgressPercentageStr = inProgressPercentage != 0 ? df.format(inProgressPercentage) : "0"; + inProgressMap.put("amount",inProgressCount); + inProgressMap.put("percentage",inProgressPercentageStr + percentSign); + // 实验通过 + List testPassedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_PASSED.getValue()) + || StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_SUBMITTED.getValue()) + || StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.COMPONENT_REPORT_HAS_BEEN_STORED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double testPassedCount = (double) testPassedPciEoList.size(); + double testPassedPercentage = (testPassedCount / (datas.size())) * 100; + String testPassedPercentageStr = testPassedPercentage != 0 ? df.format(testPassedPercentage) : "0"; + testPassedMap.put("amount",testPassedCount); + testPassedMap.put("percentage",testPassedPercentageStr + percentSign); + + // 实验失败 + List testFailedPciEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getCertificationProgress(),CertificationProgressEnum.TEST_FAILED.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double testFailedCount = (double) testFailedPciEoList.size(); + double testFailedPercentage = (testFailedCount / (datas.size())) * 100; + String testFailedPercentageStr = testFailedPercentage != 0 ? df.format(testFailedPercentage) : "0"; + testFailedMap.put("amount",testFailedCount); + testFailedMap.put("percentage",testFailedPercentageStr + percentSign); + + result.put(CertificationProgressEnum.NOT_START.getValue(),notStartMap); + result.put(CertificationProgressEnum.IN_PROGRESS.getValue(),inProgressMap); + result.put(CertificationProgressEnum.TEST_PASSED.getValue(),testPassedMap); + result.put(CertificationProgressEnum.TEST_FAILED.getValue(),testFailedMap); + } + return result; + } @Override public Map getParameterCollectingStatisticsGroupByTerritory(List datas, Map params) { @@ -700,18 +776,18 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati Map collectingMap = new HashMap<>(); Map submitMap = new HashMap<>(); Map syncReporMap = new HashMap<>(); - + //未发起 List notStartPcmEoList = datas.stream().filter(data -> { boolean flag = ( StringUtils.equals(data.getState(), CollectManifestStateEnum.WAIT_COLLECT.getValue()) || StringUtils.equals(data.getState(), CollectManifestStateEnum.SDT_BACK.getValue()) - || StringUtils.equals(data.getState(), CollectManifestStateEnum.CHANGE.getValue()) +// || StringUtils.equals(data.getState(), CollectManifestStateEnum.CHANGE.getValue()) ); return flag; }).collect(Collectors.toList()); double notStartCount = (double) notStartPcmEoList.size(); notStartMap.put("amount",notStartCount); - + //收集中 List collectingPcmEoList = datas.stream().filter(data -> { boolean flag = ( StringUtils.equals(data.getState(), CollectManifestStateEnum.WAIT_FILL.getValue()) @@ -723,16 +799,75 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati }).collect(Collectors.toList()); double collectingCount = (double) collectingPcmEoList.size(); collectingMap.put("amount",collectingCount); - + //已提交 List submitPcmEoList = datas.stream().filter(data -> { boolean flag = ( StringUtils.equals(data.getState(), CollectManifestStateEnum.SUBMIT.getValue()) + || StringUtils.equals(data.getState(), CollectManifestStateEnum.CHANGE.getValue()) ); return flag; }).collect(Collectors.toList()); double submitCount = (double) submitPcmEoList.size(); submitMap.put("amount",submitCount); + //已同步至上报库 + List syncReporPcmEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getState(), CollectManifestStateEnum.SYNC_REPORT.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double syncReporCount = (double) syncReporPcmEoList.size(); + syncReporMap.put("amount",syncReporCount); + result.put(CollectManifestStatisticsStateEnum.NOT_START.getValue(),notStartMap); + result.put(CollectManifestStatisticsStateEnum.COLLECTING.getValue(),collectingMap); + result.put(CollectManifestStatisticsStateEnum.SUBMIT.getValue(),submitMap); + result.put(CollectManifestStatisticsStateEnum.SYNC_REPORT.getValue(),syncReporMap); + } + return result; + } + @Override + public Map getParameterCollectingStatisticsGroupByTerritoryExport(List datas, Map params) { + Map result = new HashMap<>(); + if(CollectionUtils.isNotEmpty(datas)){ + Map notStartMap = new HashMap<>(); + Map collectingMap = new HashMap<>(); + Map submitMap = new HashMap<>(); + Map syncReporMap = new HashMap<>(); + //未发起 + List notStartPcmEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getState(), CollectManifestStateEnum.WAIT_COLLECT.getValue()) + || StringUtils.equals(data.getState(), CollectManifestStateEnum.SDT_BACK.getValue()) +// || StringUtils.equals(data.getState(), CollectManifestStateEnum.CHANGE.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double notStartCount = (double) notStartPcmEoList.size(); + notStartMap.put("amount",notStartCount); + //收集中 + List collectingPcmEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getState(), CollectManifestStateEnum.WAIT_FILL.getValue()) + || StringUtils.equals(data.getState(),CollectManifestStateEnum.WAIT_SDT.getValue()) + || StringUtils.equals(data.getState(),CollectManifestStateEnum.DRE_BACK.getValue()) + || StringUtils.equals(data.getState(),CollectManifestStateEnum.CERT_BACK.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double collectingCount = (double) collectingPcmEoList.size(); + collectingMap.put("amount",collectingCount); + //已提交 + List submitPcmEoList = datas.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getState(), CollectManifestStateEnum.SUBMIT.getValue()) + || StringUtils.equals(data.getState(), CollectManifestStateEnum.CHANGE.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + double submitCount = (double) submitPcmEoList.size(); + submitMap.put("amount",submitCount); + //已同步至上报库 List syncReporPcmEoList = datas.stream().filter(data -> { boolean flag = ( StringUtils.equals(data.getState(), CollectManifestStateEnum.SYNC_REPORT.getValue()) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectNameInfoEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectNameInfoEOServiceImpl.java index d8474e4af..d4a2463cd 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectNameInfoEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectNameInfoEOServiceImpl.java @@ -17,9 +17,11 @@ import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; +import java.util.Collections; import java.util.Date; +import java.util.LinkedList; import java.util.List; +import java.util.stream.Collectors; /** * @Description: 项目名信息表 @@ -132,27 +134,56 @@ public class ProjectNameInfoEOServiceImpl extends ServiceImpl queryProjectNameList(String cut) { - List projectLibraryBaseList = problemManagementEOMapper.queryByIds(null); + List projectLibraryBaseList = problemManagementEOMapper.queryByIdsProblem(null); //目标市场数据字典 List targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode()); - for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) { - //目标市场 - String targetMarket = problemManagementEOService.getMarket(cut, targetMarketList, projectLibraryBase); - //主项目的版本号 - String projectVersion = ""; - if(com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId())){ - projectVersion = "00"; + + List projectLibraryBaseParentList = projectLibraryBaseList.stream().filter(e -> StringUtils.isBlank(e.getParentId())).distinct().collect(Collectors.toList()); + + List result = new LinkedList<>(); + for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseParentList) { + //子项目 + List children = projectLibraryBaseList.stream() + .filter(e -> StringUtils.isNotBlank(e.getParentId()) && projectLibraryBase.getId().equals(e.getParentId())).collect(Collectors.toList()); + if(children.size() != 0){ + //子项目的基础上添加的子项目 + List childrenIdList = children.stream().map(ProjectLibraryBase::getId).distinct().collect(Collectors.toList()); + List childrenList = projectLibraryBaseList.stream() + .filter(e -> StringUtils.isNotBlank(e.getParentId()) && childrenIdList.contains(e.getParentId())).collect(Collectors.toList()); + children.addAll(childrenList); + + //按版本排序 + Collections.sort(children); + result.add(projectLibraryBase); + result.addAll(children); }else{ - projectVersion = projectLibraryBase.getProjectVersion(); - } - if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){ - projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() - + "-" + projectLibraryBase.getYearName() - + "-" + targetMarket - +"-"+projectVersion); + result.add(projectLibraryBase); } } - return projectLibraryBaseList; + for (ProjectLibraryBase projectLibraryBase : result) { + if(StringUtils.isBlank(projectLibraryBase.getPlatform())){ + //目标市场 + String targetMarket = problemManagementEOService.getMarket(cut, targetMarketList, projectLibraryBase); + //主项目的版本号 + String projectVersion = ""; + if(StringUtils.isBlank(projectLibraryBase.getParentId())){ + projectVersion = "00"; + }else{ + projectVersion = projectLibraryBase.getProjectVersion(); + } + if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){ + String projectName = projectLibraryBase.getProjectName(); + String yearName = projectLibraryBase.getYearName(); + projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() + + "-" + projectLibraryBase.getYearName() + + "-" + targetMarket + +"-"+projectVersion); + } + }else{ + projectLibraryBase.setProjectName(projectLibraryBase.getProjectNameId()); + } + } + return result; } /* @Override diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectStatusBoardServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectStatusBoardServiceImpl.java index 633a99b7d..cf38c9ff3 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectStatusBoardServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectStatusBoardServiceImpl.java @@ -15,7 +15,6 @@ import com.jero.modules.cert.collect.service.IParamsCollectManifestEOService; import com.jero.modules.cert.collect.service.IParamsCollectManifestHistoryEOService; import com.jero.modules.cert.collect.service.IParamsManifestEOService; import com.jero.modules.cert.collect.service.IParamsManifestHistoryEOService; -import com.jero.modules.cert.report.entity.ParamsReportConfigDataEO; import com.jero.modules.cert.template.enums.ControlTypeEnum; import com.jero.modules.ota.entity.OtaManageApplyEO; import com.jero.modules.ota.service.impl.OtaManageApplyEOServiceImpl; @@ -840,38 +839,71 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService private HSSFSheet createCorssProjectProgressSheet(HSSFWorkbook workbook, ProjectLibraryBase projectLibraryBase) { String cut = projectLibraryBase.getCut(); String sheetName = "项目进度"; +// String firstTitle = "项目," + +// "法规任务确认," + +// "设计符合性确认," + +// "验证符合性确认," + +// "认证任务确认," + +// "Pre-Homo确认," + +// "认证进度," + +// "参数收集"; +// String secondTitle = "待发布,待校核,待确认,接受,拒绝,完成度,责任确认日期," + +// "未发起,待提交,待审查,符合,不符合,待追踪,不涉及,任务终止,完成度,设计核查日期," + +// "未发起,待提交,待审查,符合,不符合,待追踪,不涉及,任务终止,完成度,验证核查日期," + +// "待发布,待校核,待确认,接受,拒绝,完成度,责任确认日期," + +// "未发起,待提交,待审查,审查通过,审查退回,完成度,认证开始日期," + +// "待开始,进行中,实验通过,实验失败,部件报告未提交,部件报告已提交,部件报告已入库,完成度,认证提交时间," + +// "未开始,收集中,已提交,已同步至上报库,完成度,认证提交时间"; String firstTitle = "项目," + "法规任务确认," + - "设计符合性确认," + - "验证符合性确认," + + "设计符合性," + + "验证符合性," + "认证任务确认," + - "Pre-Homo确认," + + "Pre-Homo流程," + "认证进度," + - "参数收集"; - String secondTitle = "待发布,待校核,待确认,接受,拒绝,完成度,责任确认日期," + - "未发起,待提交,待审查,符合,不符合,待追踪,不涉及,任务终止,完成度,设计核查日期," + - "未发起,待提交,待审查,符合,不符合,待追踪,不涉及,任务终止,完成度,验证核查日期," + - "待发布,待校核,待确认,接受,拒绝,完成度,责任确认日期," + - "未发起,待提交,待审查,审查通过,审查退回,完成度,认证开始日期," + - "待开始,进行中,实验通过,实验失败,部件报告未提交,部件报告已提交,部件报告已入库,完成度,认证提交时间," + - "未开始,收集中,已提交,已同步至上报库,完成度,认证提交时间"; + "参数收集进度"; + String secondTitle = "清单待发布,任务待发起,任务待确认,责任人接受,责任人拒绝,完成度,责任确认日期," + + "任务待确认,结果待提交,结果待审查,符合,不符合,待追踪,完成度,设计核查日期," +//去掉不涉及,任务终止 + "任务待确认,结果待提交,结果待审查,符合,不符合,待追踪,完成度,验证核查日期," +//删掉2个 + "清单待发布,任务待发起,任务待确认,责任人接受,责任人拒绝,完成度,责任确认日期," + + "任务待确认,结果待提交,结果待审查,审查通过,审查退回,完成度,认证开始日期," + + "待开始,进行中,实验通过,实验失败,完成度,认证提交时间," +//删掉3个 + "未发起,收集中,已提交,已同步至上报库,完成度,认证提交时间"; + if(com.jero.modules.system.util.StringUtils.equals(cut,CutEnum.EN.getValue())){ sheetName = "Project Progress"; firstTitle = "Project," + "Confirmation of regulatory tasks," + - "Confirmation of design compliance," + - "Verification of compliance confirmation," + + "Design compliance," + + "Verification compliance," + "Certification task confirmation," + - "Pre Homo confirmation," + + "Pre Homo process," + "Certification progress," + - "Parameter collection"; - secondTitle = "To be released,To be verified,To be confirmed,Accept,Refuse,Completion degree,Responsibility confirmation date," + - "Not initiated,To be submitted,Pending review,Conform to,Non Conformance,To be tracked,Not involved,Task Termination,Completion degree,Design verification date," + - "Not initiated,To be submitted,Pending review,Conform to,Non Conformance,To be tracked,Not involved,Task Termination,Completion degree,Verification verification date," + - "To be released,To be verified,To be confirmed,Accept,Refuse,Completion degree,Responsibility confirmation date," + - "Not initiated,To be submitted,Pending review,Review passed,Review return,Completion degree,Certification start date," + - "To begin,In progress,Experiment passed,Experimental failure,Component report not submitted,Component report submitted,Component report has been stored,Completion degree,Certification submission time," + - "Not started,Collecting,Submitted,Synchronized to the upper report library,Completion degree,Certification submission time"; + "Parameter collection progress"; + secondTitle = "List to be released,Task to be initiated,Task to be confirmed,Assignee accept,Assignee refuse,Completion degree,Responsibility confirmation date," + + "Task to be confirmed,Results to be submitted,Results to be reviewed,Compliance,Non-compliance,To be tracked,Completion degree,Design verification date," + + "Task to be confirmed,Results to be submitted,Results to be reviewed,Compliance,Non-compliance,To be tracked,Completion degree,Verification verification date," + + "List to be released,Task to be initiated,Task to be confirmed,Assignee accept,Assignee refuse,Completion degree,Responsibility confirmation date," + + "Task to be confirmed,Results to be submitted,Results to be reviewed,Review passed,Review return,Completion degree,Certification start date," + + "To begin,In progress,Experiment passed,Experimental failure,Completion degree,Certification submission time," + + "Not initiated,Collecting,Submitted,Synchronized to the upper report library,Completion degree,Certification submission time"; + + // firstTitle = "Project," + +// "Confirmation of regulatory tasks," + +// "Confirmation of design compliance," + +// "Verification of compliance confirmation," + +// "Certification task confirmation," + +// "Pre Homo confirmation," + +// "Certification progress," + +// "Parameter collection"; + // secondTitle = "To be released,To be verified,To be confirmed,Accept,Refuse,Completion degree,Responsibility confirmation date," + +// "Not initiated,To be submitted,Pending review,Conform to,Non Conformance,To be tracked,Not involved,Task Termination,Completion degree,Design verification date," + +// "Not initiated,To be submitted,Pending review,Conform to,Non Conformance,To be tracked,Not involved,Task Termination,Completion degree,Verification verification date," + +// "To be released,To be verified,To be confirmed,Accept,Refuse,Completion degree,Responsibility confirmation date," + +// "Not initiated,To be submitted,Pending review,Review passed,Review return,Completion degree,Certification start date," + +// "To begin,In progress,Experiment passed,Experimental failure,Component report not submitted,Component report submitted,Component report has been stored,Completion degree,Certification submission time," + +// "Not started,Collecting,Submitted,Synchronized to the upper report library,Completion degree,Certification submission time"; + } HSSFSheet sheet = workbook.createSheet(sheetName); @@ -879,17 +911,17 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService sheet.addMergedRegion(region1); CellRangeAddress region6 = new CellRangeAddress(0, 0, 1, 7); sheet.addMergedRegion(region6); - CellRangeAddress region7 = new CellRangeAddress(0, 0, 8, 17); + CellRangeAddress region7 = new CellRangeAddress(0, 0, 8, 15); sheet.addMergedRegion(region7); - CellRangeAddress region8 = new CellRangeAddress(0, 0, 18, 27); + CellRangeAddress region8 = new CellRangeAddress(0, 0, 16, 23); sheet.addMergedRegion(region8); - CellRangeAddress region9 = new CellRangeAddress(0, 0, 28, 34); + CellRangeAddress region9 = new CellRangeAddress(0, 0, 24, 30); sheet.addMergedRegion(region9); - CellRangeAddress region10 = new CellRangeAddress(0, 0, 35, 41); + CellRangeAddress region10 = new CellRangeAddress(0, 0, 31, 37); sheet.addMergedRegion(region10); - CellRangeAddress region11 = new CellRangeAddress(0, 0, 42, 50); + CellRangeAddress region11 = new CellRangeAddress(0, 0, 38, 43); sheet.addMergedRegion(region11); - CellRangeAddress region12 = new CellRangeAddress(0, 0, 51, 56); + CellRangeAddress region12 = new CellRangeAddress(0, 0, 44, 49); sheet.addMergedRegion(region12); String[] firstTitleArr = firstTitle.split(","); @@ -900,7 +932,7 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService CellStyle cellStyleTitle = workbook.createCellStyle(); cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);//垂直居中 cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中 - for (int i = 0; i <= 56; i++){ + for (int i = 0; i <= 49; i++){ sheet.setColumnWidth(i, 4000); Cell firstRowCell = firstRow.createCell(i); firstRowCell.setCellStyle(cellStyleTitle); @@ -910,15 +942,15 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService firstRowCell.setCellValue(firstTitleArr[1]); }else if(i == 8){ firstRowCell.setCellValue(firstTitleArr[2]); - }else if(i == 18){ + }else if(i == 16){ firstRowCell.setCellValue(firstTitleArr[3]); - }else if(i == 28){ + }else if(i == 24){ firstRowCell.setCellValue(firstTitleArr[4]); - }else if(i == 35){ + }else if(i == 31){ firstRowCell.setCellValue(firstTitleArr[5]); - }else if(i == 42){ + }else if(i == 38){ firstRowCell.setCellValue(firstTitleArr[6]); - }else if(i == 51){ + }else if(i == 44){ firstRowCell.setCellValue(firstTitleArr[7]); } if(i >= 1){ @@ -1014,8 +1046,8 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService double designCompliance = (double) designMapProjectScheduleExportMap.get("compliance"); double designNonCompliance = (double) designMapProjectScheduleExportMap.get("nonCompliance"); double designToBeTracked = (double) designMapProjectScheduleExportMap.get("toBeTracked"); - double designNotInvolved = (double) designMapProjectScheduleExportMap.get("notInvolved"); - double designTaskTermination = (double) designMapProjectScheduleExportMap.get("taskTermination"); +// double designNotInvolved = (double) designMapProjectScheduleExportMap.get("notInvolved"); +// double designTaskTermination = (double) designMapProjectScheduleExportMap.get("taskTermination"); // double designCount = (double) designMapProjectScheduleExportMap.get("count"); String designPercentage = (String) designMapProjectScheduleExportMap.get("percentage"); dataRow.createCell(8).setCellValue(designNotStart); @@ -1024,13 +1056,13 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService dataRow.createCell(11).setCellValue(designCompliance); dataRow.createCell(12).setCellValue(designNonCompliance); dataRow.createCell(13).setCellValue(designToBeTracked); - dataRow.createCell(14).setCellValue(designNotInvolved); - dataRow.createCell(15).setCellValue(designTaskTermination); - cell = dataRow.createCell(16); +// dataRow.createCell(14).setCellValue(designNotInvolved); +// dataRow.createCell(15).setCellValue(designTaskTermination); + cell = dataRow.createCell(14); cell.setCellStyle(style); cell.setCellType(CellType.NUMERIC); cell.setCellValue(Double.valueOf(designPercentage.replace("%",""))/100); - dataRow.createCell(17).setCellValue(designDeadlineStr); + dataRow.createCell(15).setCellValue(designDeadlineStr); Map verifyMap = this.projectLawsInventoryEOService.groupByVerifyStatus(pliEos); Map verifyMapProjectScheduleExportMap = (Map) verifyMap.get("projectScheduleExportMap"); @@ -1040,23 +1072,23 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService double verifyCompliance = (double) verifyMapProjectScheduleExportMap.get("compliance"); double verifyNonCompliance = (double) verifyMapProjectScheduleExportMap.get("nonCompliance"); double verifyToBeTracked = (double) verifyMapProjectScheduleExportMap.get("toBeTracked"); - double verifyNotInvolved = (double) verifyMapProjectScheduleExportMap.get("notInvolved"); - double verifyTaskTermination = (double) verifyMapProjectScheduleExportMap.get("taskTermination"); - double verifyCount = (double) verifyMapProjectScheduleExportMap.get("count"); +// double verifyNotInvolved = (double) verifyMapProjectScheduleExportMap.get("notInvolved"); +// double verifyTaskTermination = (double) verifyMapProjectScheduleExportMap.get("taskTermination"); +// double verifyCount = (double) verifyMapProjectScheduleExportMap.get("count"); String verifyPercentage = (String) verifyMapProjectScheduleExportMap.get("percentage"); - dataRow.createCell(18).setCellValue(verifyNotStart); - dataRow.createCell(19).setCellValue(verifyToBeSubmitted); - dataRow.createCell(20).setCellValue(verifyToBeReviewed); - dataRow.createCell(21).setCellValue(verifyCompliance); - dataRow.createCell(22).setCellValue(verifyNonCompliance); - dataRow.createCell(23).setCellValue(verifyToBeTracked); - dataRow.createCell(24).setCellValue(verifyNotInvolved); - dataRow.createCell(25).setCellValue(verifyTaskTermination); - cell = dataRow.createCell(26); + dataRow.createCell(16).setCellValue(verifyNotStart); + dataRow.createCell(17).setCellValue(verifyToBeSubmitted); + dataRow.createCell(18).setCellValue(verifyToBeReviewed); + dataRow.createCell(19).setCellValue(verifyCompliance); + dataRow.createCell(20).setCellValue(verifyNonCompliance); + dataRow.createCell(21).setCellValue(verifyToBeTracked); +// dataRow.createCell(24).setCellValue(verifyNotInvolved); +// dataRow.createCell(25).setCellValue(verifyTaskTermination); + cell = dataRow.createCell(22); cell.setCellStyle(style); cell.setCellType(CellType.NUMERIC); cell.setCellValue(Double.valueOf(verifyPercentage.replace("%",""))/100); - dataRow.createCell(27).setCellValue(verifyDeadlineStr); + dataRow.createCell(23).setCellValue(verifyDeadlineStr); List pciEos = pciEoList.stream().filter(pciEo -> StringUtils.equals(pciEo.getProjectLibraryId(), plbEo.getId())).collect(Collectors.toList()); Map rzRwqrMap = this.projectCertificationInventoryEOService.groupByFGRwqrStatus(pciEos); @@ -1067,16 +1099,16 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService double rzRqqrAccept = (double) rzRwqrProjectScheduleExportMap.get("accept"); double rzRqqrRefuse = (double) rzRwqrProjectScheduleExportMap.get("refuse"); String rzRqqrPercentage = (String) rzRwqrProjectScheduleExportMap.get("percentage"); - dataRow.createCell(28).setCellValue(rzRqqrToBeReleased); - dataRow.createCell(29).setCellValue(rzRqqrToBeVerified); - dataRow.createCell(30).setCellValue(rzRqqrToBeConfirmed); - dataRow.createCell(31).setCellValue(rzRqqrAccept); - dataRow.createCell(32).setCellValue(rzRqqrRefuse); - cell = dataRow.createCell(33); + dataRow.createCell(24).setCellValue(rzRqqrToBeReleased); + dataRow.createCell(25).setCellValue(rzRqqrToBeVerified); + dataRow.createCell(26).setCellValue(rzRqqrToBeConfirmed); + dataRow.createCell(27).setCellValue(rzRqqrAccept); + dataRow.createCell(28).setCellValue(rzRqqrRefuse); + cell = dataRow.createCell(29); cell.setCellStyle(style); cell.setCellType(CellType.NUMERIC); cell.setCellValue(Double.valueOf(rzRqqrPercentage.replace("%",""))/100); - dataRow.createCell(34).setCellValue(legalTaskConfirmationStr); + dataRow.createCell(30).setCellValue(legalTaskConfirmationStr); Map preHomoMap = this.projectCertificationInventoryEOService.groupByPreHomoStatus(pciEos); Map preHomoProjectScheduleExportMap = (Map) preHomoMap.get("projectScheduleExportMap"); @@ -1086,16 +1118,16 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService double preHomoAccept = (double) preHomoProjectScheduleExportMap.get("accept"); double preHomoRefuse = (double) preHomoProjectScheduleExportMap.get("refuse"); String preHomoPercentage = (String) preHomoProjectScheduleExportMap.get("percentage"); - dataRow.createCell(35).setCellValue(preHomoNotStartCount); - dataRow.createCell(36).setCellValue(preHomoToBeSubmittedCount); - dataRow.createCell(37).setCellValue(preHomoToBeReviewedCount); - dataRow.createCell(38).setCellValue(preHomoAccept); - dataRow.createCell(39).setCellValue(preHomoRefuse); - cell = dataRow.createCell(40); + dataRow.createCell(31).setCellValue(preHomoNotStartCount); + dataRow.createCell(32).setCellValue(preHomoToBeSubmittedCount); + dataRow.createCell(33).setCellValue(preHomoToBeReviewedCount); + dataRow.createCell(34).setCellValue(preHomoAccept); + dataRow.createCell(35).setCellValue(preHomoRefuse); + cell = dataRow.createCell(36); cell.setCellStyle(style); cell.setCellType(CellType.NUMERIC); cell.setCellValue(Double.valueOf(preHomoPercentage.replace("%",""))/100); - dataRow.createCell(41).setCellValue(attestationStartTimeStr); + dataRow.createCell(37).setCellValue(attestationStartTimeStr); Map certificationProgressMap = this.projectCertificationInventoryEOService.groupByCertificationProgress(pciEos); Map certificationProgressMapProjectScheduleExportMap = (Map) certificationProgressMap.get("projectScheduleExportMap"); @@ -1103,23 +1135,23 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService double certificationProgressInProgressCount = (double) certificationProgressMapProjectScheduleExportMap.get("inProgressCount"); double certificationProgressTestPassedCount = (double) certificationProgressMapProjectScheduleExportMap.get("testPassedCount"); double certificationProgressTestFailedCount = (double) certificationProgressMapProjectScheduleExportMap.get("testFailedCount"); - double certificationProgressNotSubmitCount = (double) certificationProgressMapProjectScheduleExportMap.get("notSubmitCount"); - double certificationProgressReportSubmitCount = (double) certificationProgressMapProjectScheduleExportMap.get("reportSubmitCount"); - double certificationProgressStoredCount = (double) certificationProgressMapProjectScheduleExportMap.get("storedCount"); +// double certificationProgressNotSubmitCount = (double) certificationProgressMapProjectScheduleExportMap.get("notSubmitCount"); +// double certificationProgressReportSubmitCount = (double) certificationProgressMapProjectScheduleExportMap.get("reportSubmitCount"); +// double certificationProgressStoredCount = (double) certificationProgressMapProjectScheduleExportMap.get("storedCount"); // String certificationProgressCount = (String) certificationProgressMapProjectScheduleExportMap.get("count"); String certificationProgressPercentage = (String) certificationProgressMapProjectScheduleExportMap.get("percentage"); - dataRow.createCell(42).setCellValue(certificationProgressNotStartCount); - dataRow.createCell(43).setCellValue(certificationProgressInProgressCount); - dataRow.createCell(44).setCellValue(certificationProgressTestPassedCount); - dataRow.createCell(45).setCellValue(certificationProgressTestFailedCount); - dataRow.createCell(46).setCellValue(certificationProgressNotSubmitCount); - dataRow.createCell(47).setCellValue(certificationProgressReportSubmitCount); - dataRow.createCell(48).setCellValue(certificationProgressStoredCount); - cell = dataRow.createCell(49); + dataRow.createCell(38).setCellValue(certificationProgressNotStartCount); + dataRow.createCell(39).setCellValue(certificationProgressInProgressCount); + dataRow.createCell(40).setCellValue(certificationProgressTestPassedCount); + dataRow.createCell(41).setCellValue(certificationProgressTestFailedCount); +// dataRow.createCell(46).setCellValue(certificationProgressNotSubmitCount); +// dataRow.createCell(47).setCellValue(certificationProgressReportSubmitCount); +// dataRow.createCell(48).setCellValue(certificationProgressStoredCount); + cell = dataRow.createCell(42); cell.setCellStyle(style); cell.setCellType(CellType.NUMERIC); cell.setCellValue(Double.valueOf(certificationProgressPercentage.replace("%",""))/100); - dataRow.createCell(50).setCellValue(certificationSubmissionStr); + dataRow.createCell(43).setCellValue(certificationSubmissionStr); List pmEos = pmEoList.stream().filter(pmEo -> { @@ -1164,15 +1196,15 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService double parameterCollectingPercentage = (completionCount / parameterCollectingCount) * 100; parameterCollectingPercentageStr = (parameterCollectingPercentage != 0 && (completionCount !=0 )) ? df.format(parameterCollectingPercentage) : "0"; } - dataRow.createCell(51).setCellValue(notStartAmount); - dataRow.createCell(52).setCellValue(collectingAmount); - dataRow.createCell(53).setCellValue(submitAmount); - dataRow.createCell(54).setCellValue(syncReporAmount); - cell = dataRow.createCell(55); + dataRow.createCell(44).setCellValue(notStartAmount); + dataRow.createCell(45).setCellValue(collectingAmount); + dataRow.createCell(46).setCellValue(submitAmount); + dataRow.createCell(47).setCellValue(syncReporAmount); + cell = dataRow.createCell(48); cell.setCellStyle(style); cell.setCellType(CellType.NUMERIC); cell.setCellValue(Double.valueOf(parameterCollectingPercentageStr)/100); - dataRow.createCell(56).setCellValue(certificationSubmissionStr); + dataRow.createCell(49).setCellValue(certificationSubmissionStr); dataIndex ++; log.info("11111处理"+ dataIndex +"个项目消耗时间:" + (System.currentTimeMillis() - startTime)); @@ -1396,7 +1428,7 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService List pmEos = pmEoList.stream().filter(pmEo -> { - if(pmEo.getProjectVersion().equals("00")){ + if("00".equals(pmEo.getProjectVersion())){ return StringUtils.equals(pmEo.getProjectId(), plbEo.getId()); }else{ return StringUtils.equals(pmEo.getProjectId(), plbEo.getParentId()) && StringUtils.equals(pmEo.getProjectVersion(), plbEo.getProjectVersion()); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectTaskInventoryDetailEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectTaskInventoryDetailEOServiceImpl.java index 6be203fab..582a40d6c 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectTaskInventoryDetailEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectTaskInventoryDetailEOServiceImpl.java @@ -543,19 +543,19 @@ public class ProjectTaskInventoryDetailEOServiceImpl extends ServiceImpl - + case + when + year_name_id is null + THEN plb.project_name_id + when year_name_id is not null + THEN concat( pni.project_name, '-', pyni.year_name, '-', @@ -87,7 +91,7 @@ AND dict_id = ( SELECT id FROM sys_dict WHERE dict_code = 'region' ) ) , '-', plb.project_version - ) AS project_name, + ) end AS project_name, pyni.year_name, pli.serial_number, pli.title, @@ -109,7 +113,8 @@ plb.target_market, plb.studio_engineer, plb.project_version, - plb.parent_id + plb.parent_id, + plb.platform FROM process_info pi left join project_library_base plb on plb.id = pi.project_library_id @@ -160,8 +165,31 @@ pi.project_laws_inventory_id, pi.buss_document_library_id, pi.acti_proc_inst_id, - - + case + when + year_name_id is null + THEN + concat( + plb.power, + '-', + plb.producer, + '-', + ( + SELECT + CASE + WHEN + GROUP_CONCAT( item_text SEPARATOR ',' ) IS NULL THEN + '' ELSE GROUP_CONCAT( item_text SEPARATOR ',' ) + END AS item_text + FROM + sys_dict_item + WHERE + FIND_IN_SET( item_value, plb.target_market ) > 0 + AND dict_id = ( SELECT id FROM sys_dict WHERE dict_code = 'region' ) + ) + ) + when year_name_id is not null + THEN concat( pni.project_name, '-', pyni.year_name, '-', @@ -180,7 +208,7 @@ AND dict_id = ( SELECT id FROM sys_dict WHERE dict_code = 'region' ) ) , '-', plb.project_version - ) AS project_name, + ) end AS project_name, pyni.year_name, pli.serial_number, pli.title, @@ -201,8 +229,9 @@ plb.target_market, plb.studio_engineer, plb.project_version, - plb.parent_id - FROM + plb.parent_id, + plb.platform + FROM process_info pi LEFT JOIN project_library_base plb ON plb.id = pi.project_library_id LEFT JOIN project_name_info pni ON pni.id = plb.project_name_id @@ -230,8 +259,31 @@ pi.project_laws_inventory_id, pi.buss_document_library_id, pi.acti_proc_inst_id, - - + case + when + year_name_id is null + THEN + concat( + plb.power, + '-', + plb.producer, + '-', + ( + SELECT + CASE + WHEN + GROUP_CONCAT( item_text SEPARATOR ',' ) IS NULL THEN + '' ELSE GROUP_CONCAT( item_text SEPARATOR ',' ) + END AS item_text + FROM + sys_dict_item + WHERE + FIND_IN_SET( item_value, plb.target_market ) > 0 + AND dict_id = ( SELECT id FROM sys_dict WHERE dict_code = 'region' ) + ) + ) + when year_name_id is not null + THEN concat( pni.project_name, '-', pyni.year_name, '-', @@ -250,7 +302,7 @@ AND dict_id = ( SELECT id FROM sys_dict WHERE dict_code = 'region' ) ) , '-', plb.project_version - ) AS project_name, + ) end AS project_name, pyni.year_name, '--' as serial_number, '--' as standard_info, @@ -265,34 +317,6 @@ process_info_detail pid where pid.process_info_id = pi.id and pid.STATUS = 'NotDone' and pid.end_time is not null and pid.user_id = #{params.currentUserId} order by pid.end_time asc limit 1 ) as end_time, - pi.STATUS, pi.prc_num, pi.prc_name, @@ -300,7 +324,8 @@ plb.target_market, plb.studio_engineer, plb.project_version, - plb.parent_id + plb.parent_id, + plb.platform FROM process_info pi LEFT JOIN project_library_base plb ON plb.id = pi.project_library_id @@ -321,7 +346,7 @@ #{item} - )temp + )temp order by temp.end_time IS NULL, @@ -467,6 +492,7 @@ #{item} + and plb.platform is null union SELECT pi.id, @@ -537,6 +563,7 @@ #{item} + and plb.platform is null union SELECT diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/service/impl/ProcessInfoEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/service/impl/ProcessInfoEOServiceImpl.java index 9992978c4..01d5e42db 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/service/impl/ProcessInfoEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/service/impl/ProcessInfoEOServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.jero.common.api.vo.Result; import com.jero.common.constant.enums.CutEnum; import com.jero.common.exception.JeroBootException; @@ -17,13 +18,28 @@ import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluation import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationFlowDetailEO; import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationEOService; import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationFlowDetailEOService; -import com.jero.modules.project.entity.*; -import com.jero.modules.project.enums.*; -import com.jero.modules.project.service.*; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import com.jero.modules.project.entity.ProjectLibraryBase; +import com.jero.modules.project.entity.ProjectTaskInventoryDetailEO; +import com.jero.modules.project.entity.ProjectTaskInventoryEO; +import com.jero.modules.project.entity.ProjectTaskInventoryFeedbackEO; +import com.jero.modules.project.enums.CertificationFlowNodeEnum; +import com.jero.modules.project.enums.DesignComplianceStatusEnum; +import com.jero.modules.project.enums.InventoryAffirmNodeEnum; +import com.jero.modules.project.enums.InventoryAffirmStatusEnum; +import com.jero.modules.project.enums.OperatorTypeEnum; +import com.jero.modules.project.enums.ProjectInventoryFieldEnum; +import com.jero.modules.project.enums.RequestSourceEnum; +import com.jero.modules.project.enums.ReviewResultEnum; +import com.jero.modules.project.enums.TaskStatusEnum; +import com.jero.modules.project.service.IProjectLawsInventoryEOService; +import com.jero.modules.project.service.IProjectLibraryBaseService; +import com.jero.modules.project.service.IProjectTaskInventoryDetailEOService; +import com.jero.modules.project.service.IProjectTaskInventoryEOService; +import com.jero.modules.project.service.IProjectTaskInventoryFeedbackEOService; import com.jero.modules.system.entity.SysCategory; import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysUser; -import com.jero.modules.system.enums.DicCodeEnum; import com.jero.modules.system.service.ISysDictService; import com.jero.modules.system.service.ISysUserService; import com.jero.modules.system.service.impl.SysCategoryServiceImpl; @@ -48,17 +64,23 @@ import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; 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.text.Collator; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - /** * @Description: 流程信息表 * @Author: jero-boot @@ -565,6 +587,9 @@ public class ProcessInfoEOServiceImpl extends ServiceImpl userIdList = new ArrayList<>(); datas.forEach(data -> { + if(StringUtils.isBlank(data.getProjectNameId())){ + data.setProjectNameId(data.getProjectName()); + } String standardInfo = data.getStandardInfo(); if(StringUtils.isNotBlank(standardInfo)){ String standardInfoTemp = standardInfo.replaceAll("、", " "); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/vo/ProcessInfoVO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/vo/ProcessInfoVO.java index 65b62c02f..9cd8b22f9 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/vo/ProcessInfoVO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/vo/ProcessInfoVO.java @@ -120,4 +120,7 @@ public class ProcessInfoVO implements Serializable { private String dutyTerritoryName; /**流程类型排序字段*/ private String flowTypeShowOrderBy; + + //该字段有值时,代表数据为平台件的数据 + private String platform; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/service/impl/ProcessHistoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/service/impl/ProcessHistoryEOServiceImpl.java index 85c46b992..25d315360 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/service/impl/ProcessHistoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/service/impl/ProcessHistoryEOServiceImpl.java @@ -2,15 +2,21 @@ package com.jero.modules.wkflow.service.impl; import com.alibaba.fastjson.JSONArray; 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.extension.service.impl.ServiceImpl; import com.jero.common.api.vo.Result; import com.jero.common.exception.JeroBootException; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; +import com.jero.modules.project.entity.LawsInventoryPlatformEO; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; import com.jero.modules.project.enums.CertificationFlowNodeEnum; import com.jero.modules.project.enums.OperatorTypeEnum; import com.jero.modules.project.enums.RequestSourceEnum; import com.jero.modules.project.enums.ReviewResultEnum; +import com.jero.modules.project.service.impl.LawsInventoryPlatformEOServiceImpl; +import com.jero.modules.project.service.impl.ProjectLawsInventoryEOServiceImpl; import com.jero.modules.system.entity.SysUser; import com.jero.modules.system.service.ISysUserService; import com.jero.modules.todoCenter.entity.ProcessInfoEO; @@ -23,18 +29,17 @@ import com.jero.modules.wkflow.enums.FlowTypeEnum; import com.jero.modules.wkflow.mapper.ProcessHistoryEOMapper; import com.jero.modules.wkflow.service.IProcessHistoryEOService; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; -import java.util.List; import java.util.Date; +import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - /** * @Description: 流程历史表 * @Author: jero-boot @@ -50,6 +55,10 @@ public class ProcessHistoryEOServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(LawsInventoryPlatformEO::getLawsInventoryId,projectLawsInventoryId); + List platformEOList = lawsInventoryPlatformEOService.list(wrapper); + + //List valueList = FlowStateEnum.getValueInfo(); + List lawsInventoryEOList = new ArrayList<>(); + if(ObjectUtils.isNotEmpty(platformEOList)){ + List lawsInventoryIdList = platformEOList.stream() + .map(LawsInventoryPlatformEO::getPlatformLawsInventoryId).distinct().collect(Collectors.toList()); + lawsInventoryEOList = projectLawsInventoryEOService.listByIds(lawsInventoryIdList); + if(ObjectUtils.isNotEmpty(lawsInventoryEOList)){ + projectLawsInventoryId = lawsInventoryEOList.get(0).getId(); + } + } + String flowType = (String) params.get("flowType"); List flowTypeList = new ArrayList<>(); flowTypeList.add(flowType); diff --git a/jero-boot/jero-boot-single-startup/src/main/java/com/jero/config/TomcatWebConfiguration.java b/jero-boot/jero-boot-single-startup/src/main/java/com/jero/config/TomcatWebConfiguration.java index 2a6e8f839..8bcf69a84 100644 --- a/jero-boot/jero-boot-single-startup/src/main/java/com/jero/config/TomcatWebConfiguration.java +++ b/jero-boot/jero-boot-single-startup/src/main/java/com/jero/config/TomcatWebConfiguration.java @@ -15,7 +15,7 @@ public class TomcatWebConfiguration extends WebMvcConfigurerAdapter { @Bean public TomcatServletWebServerFactory servletContainer(TomcatSslConnectorProperties properties) { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(); - factory.addAdditionalTomcatConnectors(createSslConnector(properties)); + //factory.addAdditionalTomcatConnectors(createSslConnector(properties)); return factory; } diff --git a/jero-boot/jero-boot-single-startup/src/main/resources/application-dev.yml b/jero-boot/jero-boot-single-startup/src/main/resources/application-dev.yml index 1fb617200..fe132998b 100644 --- a/jero-boot/jero-boot-single-startup/src/main/resources/application-dev.yml +++ b/jero-boot/jero-boot-single-startup/src/main/resources/application-dev.yml @@ -220,12 +220,12 @@ jero : staticDomain: ?? #腾讯云cos存储配置 测试桶 cos: - secretId: AKIDoTt3xbz82g4C4f05tRjlX2HGEwOZU8Xf - secretKey: uYv3vXsxnNgjW4MN9j36tPfeNp1xe5GB + secretId: AKID4vWqtgCRP6WfaFdka9QQ8acMr88qHQJv + secretKey: LQDjywd3C3cuve6HBn7AvPbW9WbPwCAr region: ap-beijing - bucketName: dd-grp-laws-test-1253431691 + bucketName: dd-grp-laws-1253431691 appId: 1253431691 - endPoint: https://dd-grp-laws-test-1253431691.cos.ap-beijing.myqcloud.com + endPoint: https://dd-grp-laws-1253431691.cos.ap-beijing.myqcloud.com # ElasticSearch 6设置 elasticsearch: cluster-name: elasticsearch diff --git a/jero-web/src/api/api.js b/jero-web/src/api/api.js index b6336bbfc..1ce851bd9 100644 --- a/jero-web/src/api/api.js +++ b/jero-web/src/api/api.js @@ -32,7 +32,7 @@ const queryTreeListForRole = (params)=>getAction("/sys/role/queryTreeList",param const queryListAsync = (params)=>getAction("/sys/permission/queryListAsync",params); const queryRolePermission = (params)=>getAction("/sys/permission/queryRolePermission",params); const saveRolePermission = (params)=>postAction("/sys/permission/saveRolePermission",params); -const queryPermissionsByUser = ()=>getAction("/sys/permission/getUserPermissionByToken"); +const queryPermissionsByUser = ()=>getAction("/home/permission/getUserPermissionByToken"); const loadAllRoleIds = (params)=>getAction("/sys/permission/loadAllRoleIds",params); const getPermissionRuleList = (params)=>getAction("/sys/permission/getPermRuleListByPermId",params); const queryPermissionRule = (params)=>getAction("/sys/permission/queryPermissionRule",params); diff --git a/jero-web/src/common/lang/en-us.js b/jero-web/src/common/lang/en-us.js index cea607c6f..93e296293 100644 --- a/jero-web/src/common/lang/en-us.js +++ b/jero-web/src/common/lang/en-us.js @@ -13,7 +13,7 @@ module.exports = { userStatues: 'User Status', normal: 'Normal', frozen: 'Frozen', - reset: 'Reset', + reset: 'Clear', putAway: 'Less', open: 'More', addUser: 'Add User', @@ -26,7 +26,7 @@ module.exports = { batchOperation: 'Batch Operation', selected: 'Selected', term: 'Item', - empty: 'Empty', + empty: 'Clear', edit: 'Edit', more: 'More', areYouSure: 'Confirm to delete?', @@ -91,7 +91,7 @@ module.exports = { roleName: 'Role Name', newRole: 'Create New Role', RoleManagement: 'Role Management', - toGrantAuthorization: 'Authorized', + toGrantAuthorization: 'Authorize', newUser: 'New User', ExistingUsers: 'Existing Users', total: 'Total', @@ -124,10 +124,10 @@ module.exports = { TreeOperation: 'Tree Operation', essentialInformation: 'General Information', DetailsPhasedImplementation: 'Phased Implementation', - Statutenumberclause: 'Statute number/clause', + Statutenumberclause: 'Regulation Number/Clause', OrganizationName: 'Organization Name', EnterOrganizationDepartment: 'Please enter organization / department name', - Typeofimplementation: 'Type of implementation', + Typeofimplementation: 'Implementation Type', ImplementationDate: 'Implementation date', SuperiorDepartment: 'Superior Department', enterOrganizationCode: 'Please enter organization code', @@ -181,7 +181,7 @@ module.exports = { MenuType: 'Menu Type', menu: 'Menu', ButtonsPermissions: 'Buttons / Permissions', - ConventionalExport: 'Conventional Export', + ConventionalExport: 'Normal Export', CustomExport: 'Custom Export', CustomTemplateName: 'Custom template name', assembly: 'Component', @@ -310,9 +310,9 @@ module.exports = { ConfirmPassword: 'Confirm Password', reenterLoginPassword: 'Please re-enter your login password', enterUserName: 'Please enter user name', - RoleAssignment: 'Role Assignment', + RoleAssignment: 'Role Config', selectUserRole: 'Please select user role', - DepartmentAllocation: 'Department Allocation', + DepartmentAllocation: 'Department Assignment', ClickSelectDepartment: 'Click to select a Department', choice: 'Select', identity: 'Identity', @@ -365,7 +365,7 @@ module.exports = { exportWithFile: 'Export With File', Push: 'Push', templateDownload: 'Download Template', - textInformation: 'Document Files', + textInformation: 'Document Information', relatedInformation: 'Relevant Information', RetrieveFiles: 'Select Stored File', SplitText: 'Split Library File', @@ -374,9 +374,9 @@ module.exports = { TemplateDownload: 'Download Template', MergerClause: 'Merge Item', BatchSetting: 'Batch Set', - BatchCancel: 'Batch Cancel Collection', + BatchCancel: 'Batch Delete Collection', SubscriptionManagement: 'Select Tech Fields', - BatchCancellation: 'Batch Cancellation', + BatchCancellation: 'Batch Delete', clickUpload: 'Click To Upload', viewUploadedFiles: 'View Uploaded Files', standardSelection: 'Standard Selection', @@ -385,12 +385,12 @@ module.exports = { deleteLib: 'Delete', subscribe: 'Subscribe', CancelSubscribe: 'Unsubscribe', - ConfirmCollection: 'Confirm Collection ?', - cancelConfirmCollection: 'Are you sure you want to cancel the collection', - ConfirmSubscribe: 'Confirm Subscribe ?', - cancelConfirmSubscribe: 'Are you sure you want to cancel the subscribe', - ConfirmDelete: 'Confirm Delete ?', - ConfirmBatchDeletion: 'Confirm Batch Deletion ? ', + ConfirmCollection: 'Confirm to collect?', + cancelConfirmCollection: 'Confirm to delete collection?', + ConfirmSubscribe: 'Confirm to subscribe? ', + cancelConfirmSubscribe: 'Confirm to cancel subscription?', + ConfirmDelete: 'Confirm to delete?', + ConfirmBatchDeletion: 'Confirm to delete in batch? ', download: 'Download', UpdateLog: 'Change Log', DocumentSplitting: 'Doc Splitting', @@ -417,14 +417,14 @@ module.exports = { InputBoxType: 'Input Box Type', DropDownType: 'Drop Down Type', ExhibitionAreaManagement: 'Display Management', - NewLabelItem: 'Newly Added Tag Item', + NewLabelItem: 'Add Tag Item', editLabelItem: 'Edit Tag Item', NodeQuickLookup: 'Node Quick Find', AreAllLabelsRead: 'Are All Mark as Read', AllLabelsRead: 'Mark as Read', SubscriptionNotification: 'Subscription Notification', - warningInformation: 'Warning Information', - ForwardPush: 'Forward Push', + warningInformation: 'Early Warning Information', + ForwardPush: 'Forward & Share', PleaseSelectData: 'Please select data first', MessageContent: 'Message Content', MessageTitle: 'Message Title', @@ -470,7 +470,7 @@ module.exports = { Search: 'Search', SelectWhetherToSearch: 'Please select whether to search', DisplayOtherModules: 'Display Of Other Modules', - RegulationsListDisplay: 'Regulations List Display', + RegulationsListDisplay: 'Regulation List Display', selectDisplayListRegulations: 'Please select whether to display the list of regulations', SearchCenterDisplay: 'Search Center Display', selectSearchCenterDisplayed: 'Please select whether the search center is displayed', @@ -513,7 +513,7 @@ module.exports = { ProcessName: 'Process Name', ProcessType: 'Process Type', AddProcess: 'Add Process', - RelatedItems: 'Project', + RelatedItems: 'Relevant Projects', Sponsor: 'Creator', CurrentProcessor: 'Current Operator', LastProcessor: 'Last Operator', @@ -525,14 +525,14 @@ module.exports = { CannotExceed100characters: 'Cannot Exceed 100 characters', cantExeed: 'Cannot Exceed ', characters: 'Characters', - Processing: 'Processing', + Processing: 'Handling', See: 'View', labelNameCannotDuplicate: 'Label name cannot be duplicate', list: 'List', paragraph: 'Paragraph', enterNumber: 'Please enter No.', enterTitle: 'Please enter title', - backDocument: 'Back To Document Library', + backDocument: 'Postback to Document Library', fileName: 'File Name', splitTime: 'Split Time', splitResult: 'Split Result', @@ -547,8 +547,8 @@ module.exports = { technicalField: 'Technical Field', informationCategory: 'Info Type', contentValidity: 'Content Validity', - TechnicalfieldSupplementCn:'Tech Field Supplement (Cn)', - TechnicalfieldSupplementEn:'Tech Field Supplement (En)', + TechnicalfieldSupplementCn:'Tech Field Supplement (CN)', + TechnicalfieldSupplementEn:'Tech Field Supplement (EN)', content: 'Content', Add: 'Add', subscriptionTime: 'Subscription Time', @@ -574,15 +574,15 @@ module.exports = { text: 'Text', picture: 'Picture', searchScope: 'Search Scope', - newNode: 'New node', + newNode: 'Add Node', modifyNode: 'Modify Node', - deleteNode: 'Delete Node', + deleteNode: 'If there is file information, it will be deleted synchronously, confirm to delete the data?', ImplementationDate: 'New Type Execution Date', ImplementationDateOne: 'New Type Execution Date', vehicleInProductionDate: 'New Vehicle Execution Date', deleteNodes: 'If there are child nodes under this node, they will be deleted synchronously. Are you sure to delete this data?', leastTwo: 'Please Select at Least two pieces of data', - mergeTerms: 'Determine Merger Terms', + mergeTerms: 'Corfirm to Merger Terms? ', documentSplitTemplate: 'Document Split Template', batSetting: 'Batch Set', batchSettingInformation:'Batch Setting Information', @@ -647,8 +647,8 @@ module.exports = { CertificationProgress: 'Homologation Progress', CurrentProjectStatusEvaluation: 'Project Status Evaluation', NiONumber: 'NIO Number', - ParameterName: 'Parameter Name', - ParameterDescription: 'Parameter Description', + ParameterName: 'Para Name', + ParameterDescription: 'Para Description', Version: 'Version', certificationProgramTime: 'Planned Homo Date', ArchitecturePlatform: 'Architecture Platform', @@ -679,7 +679,7 @@ module.exports = { addATable: 'Please add a table', pleaseUploadSplitFile: 'Please Upload Split File', release: 'Release', - confirmRelease: 'Confirm Release ?', + confirmRelease: 'Confirm to Release', UploadMost: 'You can only upload 20 at most', FileUploadFailed: 'File upload failed', FileUploadedSuccessfully: 'File uploaded Successfully', @@ -775,7 +775,7 @@ module.exports = { Correspondingstandarddeleted: 'Correspondingstandarddeleted', changeTheTitle: 'Title already exists, please change the title', resetPassword: 'Reset Password', - DepartmentAllocation: 'Department Allocation', + DepartmentAllocation: 'Department Assignment', ListTitle: 'List Title', CopyProjectCollectionparameters: 'Copy Project Collection parameters', from: 'From', @@ -802,11 +802,11 @@ module.exports = { Model: 'Model', configurationName: 'Configuration Name', historicalVersion: 'History Version', - configure: 'Configuration', + configure: 'Delete Configuration', parameter: 'Parameter', changeExtension: 'Extension', addDetailList: 'Add List', - editDetailList:'Edit DetailList', + editDetailList:'Edit List', detailedList: 'DetailedList', copyParamDetailList: 'Copy Parameter List', collectionCompletionTime: 'Collection Completion Time', @@ -820,14 +820,14 @@ module.exports = { controlAlternatives: 'Control Component', controlVerification: 'Validate Component', controlType: 'Control Component', - certificationCategory: 'Certification Category', - parameterBatch: 'Parameter Batch', + certificationCategory: 'Cert Category', + parameterBatch: 'Para Batch', releaseVersion: 'Release Version', parameterTemplate: 'Parameter Template', contentDescription: 'Description', - WhetherMergeParameters: 'Whether to merge parameters', - merge: 'Merge', - nonjoinder: 'Nonjoinder', + WhetherMergeParameters: 'Merge Parameters', + merge: 'Yes', + nonjoinder: 'No', MergeSeparator: 'Merge separator', parameterTemplateExportName: 'Parameter List', parameterDataExport: 'Parameter Export Data', @@ -882,8 +882,8 @@ module.exports = { experimentPassed: 'Test Passed', experimentFailed: 'Test Failed', toBeStarted: 'To Be Started', - inProgress: 'Ongoing', - Underway: 'Ongoing', + inProgress: 'In progress', + Underway: 'In progress', green: 'Green', red: 'Red', blue: 'Blue', @@ -905,7 +905,7 @@ module.exports = { virtualAuthenticationListDetails: 'Virtual Homo List Details', VirtualAuthenticationList: 'Virtual Homo List', maintainVirtualList: 'Maintain Market List', - certificationListMaintenance: 'Homo List Maintenance', + certificationListMaintenance: 'Market Homologation List Maintenance', reasonsForRejection: 'Reason for Rejection', inconformity: 'Non-compliance', toTrack: 'To be tracked', @@ -955,6 +955,7 @@ module.exports = { modelName: 'Model Name', modelYear: 'Model Year', NoteConfirmTheChange: 'Note: After resetting, the status of the selected items will be changed to To Be Released and the historical data will disappear. Please confirm whether to reset', + NoteConfirmTheChangeplatform:'Note: After the reset, the selected item data will be changed to the task ready state, and the historical data will disappear. Please confirm whether to reset the process', onlyDataChanged: 'Only data with task confirmation status of Accepted can be changed', inquiry: 'Inquiry', ConfirmationDeadline: 'Confirm Deadline', @@ -1027,20 +1028,20 @@ module.exports = { viewContent: 'View Content', fillInTheMonth: 'Filled in (Month)', monthSelection: 'Select Month', - bringInStandardInformation: 'Bring in standard Information', + bringInStandardInformation: 'Involve Standard Information', contentTemplate: 'Content Template', moveUp: 'Move Up', moveDown: 'Move Down', vehicleType: 'Vehicle Type', usage: 'Usage', implementationModel: 'Implementation Model', - primaryCoverageCn: 'Description (Cn)', - primaryCoverageEn: 'Description (En)', - workProgressCn: 'NIO Work Progress (Cn)', - workProgressEn: 'NIO Work Progress (En)', + primaryCoverageCn: 'Description (CN)', + primaryCoverageEn: 'Description (EN)', + workProgressCn: 'NIO Work Progress (CN)', + workProgressEn: 'NIO Work Progress (EN)', initiatingProcess: 'Process Initiation', collectResults: 'Collect Results', - dateOfInitiation: 'Date Of Initiation', + dateOfInitiation: 'Initiation Date', closingDate: 'Due Date', viewProcess: 'View Process', evaluationResults: 'Evaluation Result', @@ -1061,9 +1062,9 @@ module.exports = { standardNo: 'Standard No.', implemenDate: 'Implementation Date', // 上报库 - Enable: 'Enable', + Enable: 'Active', Latestupdatetime: 'Latest Update Time', - Exporthistory: 'Exporthistory', + Exporthistory: 'Export History', Exporttype: 'Export Type', Exporttime: 'Export Time', file: 'File', @@ -1077,14 +1078,14 @@ module.exports = { NNiONumber: 'NIO Number', ParameterNo: 'No.', NRequired: 'Required', - NParameterName: 'Parameter Name', + NParameterName: 'Para Name', NtechnicalField: 'Technical Field', - NparameterBatch: 'Params Batch', + NparameterBatch: 'Para Batch', NareaOfResponsibility: 'Responsible Field', - NParameterDescription: 'Parameter Description', + NParameterDescription: 'Para Description', NcertificationCategory: 'Cert Category', - NcontrolType: 'Control Componet', - NcontrolVerification: 'Validate Componet', + NcontrolType: 'Control Component', + NcontrolVerification: 'Validate Component', NcontrolAlternatives: 'Componet Value', DefaultValue: 'Default Value', NattachmentTemplate: 'File Template', @@ -1119,6 +1120,7 @@ module.exports = { pleaseSelectinitiatedOrRejected: 'Please select the data whose design compliance confirmation process status is List Pending Release, Regulatory Engineer Returned or Verification Compliance Confirmation Process status is List Pending Release, Regulatory Engineer Returned', TheEngineerAndCertification: 'The Homo Engineer cannot be empty', pleaseSelectTheDataverificationVerified:'Please select the data whose design compliance confirmation process status is List Pending Verification, Responsible Person Rejected, or Verification Compliance Confirmation process status is List Pending Verification, Responsible Person Rejected', + pleaseSelectTheDataverification:'Select the data whose design conformance verification process state is Task ready to start and the responsible person refuses, or verify conformance verification process state is task ready to start and the responsible person refuses', theResponsiblePersonAndDeadlineClank: 'The responsible person and deadline of cannot be blank', bringInTheProjectInterface: 'Assign to Owner', theCurrentListSaved: 'The current list data has been submitted and cannot be temporarily saved', @@ -1145,15 +1147,15 @@ module.exports = { uploadRelevantMaterials: 'Upload relevant materials', processBackground: 'Process Background', selectedStandard: 'Selected Standard', - standardDecompositionDocument: 'Standard decomposition document', + standardDecompositionDocument: 'Involve Checklist', pleaseSelectStandardFirst: 'Please select a standard first', - RelevantMaterials: 'RelevantMaterials', + RelevantMaterials: 'Supporting Doc.', evaluatorFeedback: 'Evaluator Feedback', nameTechnicalDocument: 'Technical Document', chapter: 'Chapter', problemDescription: 'Problem Description', - filingExternalOpinions: 'Filing of external opinions', - regulatoryTechnicalEvaluationResults: 'Regulatory technical evaluation results', + filingExternalOpinions: 'Comments Archive', + regulatoryTechnicalEvaluationResults: 'Technical Evaluation Result', initiateProcessForCurrentStandard: 'Initiate process for current standard', engineerFeedbackResults: 'Engineer Feedback', fileExport: 'File Export', @@ -1170,9 +1172,9 @@ module.exports = { processName: 'Process Name', feedbackResults: 'Feedback results', theDoesNotSupportPreview: 'The current file format does not support Preview', - releaseSituation: 'Release situation', - comparisonResults: 'Comparison results', - Published: 'Published', + releaseSituation: 'Release Status', + comparisonResults: 'Comparison Results', + Published: 'Released', initiateComparison: 'Initiate Comparison', translationLanguage: 'Translation language', translationResults: 'Translation results', @@ -1184,31 +1186,31 @@ module.exports = { TechnicalEvaluationResultsForReference: 'Technical Evaluation Result', ComplianceConfirmationRecord: 'Compliance Confirmation Record', complianceConfirmation: 'Compliance Confirmation', - noComparisonDocumentSelected: 'No comparison document selected', - RemarkInfo: 'Remarks Info', + noComparisonDocumentSelected: 'No document selected for comparison', + RemarkInfo: 'Remarks', initiateDocumentComparison: 'Initiate Document Comparison', comparativeComments: 'Comparative Comments', - Comparisonofarticles:'Comparison Of Articles', + Comparisonofarticles:'Item Comparison Comment', viewTheComparisonResults: 'View Results', addFullTextComment: 'Full Text Comment', - turnOffAutomaticMatching: 'Turn Off Auto Match', + turnOffAutomaticMatching: 'Close Automatic Matching', Deriveconformanceresults: 'Export Compliance Results', Regulatorycompliancekanban: 'Regulatory Compliance Kanban', exportComparisonReport: 'Export Comparison Report', comparisonDifferenceComment: 'Comparison Difference Comment', fullTextComments: 'Full Text Comment', pleaseEnterfullTextComments:'Please enter Full Text Comment', - fileDeclaration: 'File Declaration', + fileDeclaration: 'File Description', FileForDetails: 'File For Details', Converting: 'Converting', convertNetwork: 'Convert Network', convertFailed: 'Convert Failed', standardData: 'Standard Data', Theorganization: 'The Organization', - Addingfolder: 'Create New Folder', - Addingsubfolders: 'Adding Subfolders', + Addingfolder: 'Add Folder', + Addingsubfolders: 'Add Subfolder', Editfolder: 'Edit Folder', - Deletefolders: 'Delete Folders', + Deletefolders: 'Delete Folder', Foldername: 'Folder Name', Folderpermissions: 'Folder Permissions', Folderorder: 'Folder Order', @@ -1228,7 +1230,7 @@ module.exports = { Collectlist: 'Collection List', Statisticalmodels: 'Statistical Model', Inthecollection: 'Collecting', - Notatthe: 'Not started', + Notatthe: 'Not start', Thepercentage: 'Percentage', problemKnowledgeBase: 'Knowledge Sharing', recentHotSpots: 'Recent Hot Spots', @@ -1247,16 +1249,16 @@ module.exports = { documentNumber: 'Document Number', documentTitle: 'Document Title', bringInDocumentInformation: 'Bring in document information', - addStandardInformation:'Add standard information', + addStandardInformation:'Add Standard Information', thereWhichCannotDeleted: 'There are sub headings under this title, which cannot be deleted', sdt: 'Eng. Interface', dre: 'Filled by', applicableInstructionsMarketList: 'Applicable instructions of market list', pleaseSelectTheDataCompared: 'Please select the data to be compared', - problemLabel: 'classification', - personCharge: 'Person in charge', + problemLabel: 'Classification', + personCharge: 'Owner', addLabel: 'New Classification', - editLabel: 'Edit Label', + editLabel: 'Edit Tag', applicableMarket: 'Applicable Market', templateMaintenance: 'Template Maintenance', associatedWebsite: 'Associated website', @@ -1269,22 +1271,22 @@ module.exports = { share: 'Share', simplifiedChinese:'Simplified Chinese', uploadOnly:'Upload only', - turnOnAutoMatch:'Turn On Auto Match', + turnOnAutoMatch:'Open Automatic Matching', Adjustareasofresponsibility:'Adjust areas of responsibility', regulatoryTechnicalAssessment:'Regulatory Technical Assessment', punctuationmark:'You can only enter English punctuation marks except the # sign', created: 'Time of Creation', updated:'Last Updated', - OpenOne:'Open', - Privacy:'Privacy', - Paraname: 'Parameter Name', + OpenOne:'Public', + Privacy:'Private', + Paraname: 'Para Name', Parabatch: 'Para Batch', freeze:'Please select the configuration you want to freeze', optionDropDownBox:'Option drop - down box', attachmentUpload:'File', textInput:'Text Input', deleteNode:'If there is any file information, the file will be deleted. Are you sure to delete this data?', - HaveReleased:'Have released', + HaveReleased:'Released', forward:'Forward', areResponsibilityAreaInformationBatch:'Are you sure you want to modify the responsibility area information in batch', issuedBy:'Issued by', @@ -1329,14 +1331,14 @@ module.exports = { processNodesAreInconsistentPleaseSelectConsistentData:'Process nodes are inconsistent; Please select consistent data', exportFileName:'Export file name', initiateSupplementaryProcess:'Initiate supplementary process', - whetherTheDisassemblySheetIncluded:'Whether the disassembly sheet is included', + whetherTheDisassemblySheetIncluded:'Checklist Included', inRecentMonths3:'In recent 3 months', inRecentMonths6:'In recent 6 months', inRecentYear1:'In recent 1 year', inRecentYear2:'In recent 2 year', inRecentYear3:'In recent 3 year', selectAll:'Select All', - importLocalDisassemblyOrder:'Import local disassembly order', + importLocalDisassemblyOrder:'Import Checklist', notExport:'Not exported', hasBeenExport:'Exported', firstLevelDirectory:'Primary Directory', @@ -1344,7 +1346,7 @@ module.exports = { classification:'Classification', consistentAssessment:'Consistent', viewConsistentAssessment:'View Consistent', - viewVarianceAssessment:'View Variance', + viewVarianceAssessment:'View Differences', viewAll:'View All', endProcess:'End Process', thereForTheCurrentlySelectedData:'There is no standard breakdown for the currently selected data', @@ -1420,13 +1422,13 @@ module.exports = { missionRejection:'Reject', turnToDo:'Forward', initiateTask:'Initiate Task', - compliancereport:'Generate Compliance report', + compliancereport:'Generate Compliance Report', todocenter:'To-Do Center', areYouReturnToStudio:'Confirm to return to studio?', confirmLaunchTask:'Confirm to initiate a task ?', conditionsNotMet:'Conditions not met', onlyProcessStatusReturned:'Only data with process status of List to Be Checked and Rejected by Owner can be returned', - onlyProcessReturned:'Only data with a process status of list to be verified and rejected by the responsible person can be initiated, and the delivery type, engineering interface person, responsible person, and deadline cannot be empty', + onlyProcessReturned:'Only data whose process status is Task ready to be started or rejected by the responsible person can be initiated, and the deliverable type, project interface person, responsible person, and deadline cannot be left blank', confirmToAcceptTheTask:'Confirm to accept the task?', confirmRejectTask:'Confirm to reject the task ?', onlyDataStatusConfirmedSelected:'Only data with process status of Task to Be Confirmed can be selected', @@ -1438,7 +1440,7 @@ module.exports = { onlyDataStatusResultReviewedCanBeSelected:'Only data with process status of Result to Be Reviewed can be selected', confirmResetProcess:'Confirm to reset the process?', confirmUrging:'Confirm to remind?', - confirmWithdrawal:'Confirm to withdraw?', + confirmWithdrawal:'Confirm to Withdraw?', onlyListCheckedCanRecalled:'Only data with process status of List to Be Checked can be withdrawed', statusthetasistobeconfirmed:'Withdrawal can only be performed when the list status is To Be Checked or the task status is To Be Confirmed', confirmreturn:'Confirm to return ?', @@ -1456,8 +1458,8 @@ module.exports = { getStarted:'Pre-Homo Starts', certificationStartOne:'Homo Starts', verificationAndVerification:'Validation Check', - projectInterfacePersonRegulationEngineerSetting:'Project Interface Person - Regulation Engineer Setting', - projectInterfacePersonCertificationEngineerSetting:'Project Interface Person - Certification Engineer Setting', + projectInterfacePersonRegulationEngineerSetting:'Eng. Interface - Regulation Engineer Setting', + projectInterfacePersonCertificationEngineerSetting:'Eng. Interface - Homo Engineer Setting', registrationnumber:'Product registration number', noticebatch:'Notice batch', producttrademark:'Product Trademark', @@ -1506,7 +1508,7 @@ module.exports = { addcontroller:'Add controller', addsystem:'Add system', functionname:'Function name', - configuration:'configuration', + configuration:'Delete Configuration', drivingautomationlevel:'Driving automation level', functiondescription:'Function description', applicationconditions:'Application conditions', @@ -1669,7 +1671,7 @@ module.exports = { Listoftreatableregulations:'List of treatable regulations', Listofuntractableregulations:'List of untractable regulations', project:'Project', - Categoryofdeliverables:'Type of deliverables', + Categoryofdeliverables:'Deliverable Type', Taskconfirmationresult:'Task confirmation result', Compliancetaskhandling:'Compliance task handling', theDataYouSelectedContainsSkip:'The data selected contains empty deliverable; please confirm whether to skip', @@ -1690,7 +1692,7 @@ module.exports = { next:'Next', last:'Last', designComplianceReviewAdmin:'Design Compliance Review', - missionAccomplished:'Mission Accomplished', + missionAccomplished:'Task Completed', yesisselected:'If Yes is selected, enter', forwardXquantity:'For example, forward X quantity, backward X quantity, right X quantity, etc', upgraderecordnumber:'Upgrade record number', @@ -1705,7 +1707,7 @@ module.exports = { addfunction:'Add function', controllername:'Controller name', hardwaremanufacturer:'Hardware manufacturer', - softwareversion:'Software version', + softwareversion:'Software Version', returntofill:'Return to fill', thereAreCurrentlyNoRegulationsToHandle:'No regulations to be processed now', certificationSubmission:'Application Submitted', @@ -1742,9 +1744,9 @@ module.exports = { verifyConformanceConfirmation:'Validation Compliance Confirmation', designConformanceVerification:'Design Compliance Check', nomorethan:'No more than 10', - marketCertificationList:'Market Certification List', + marketCertificationList:'Market Homologation List', uploadedfilelarger:'The uploaded file is larger than', - marketCertificationListDetails:'Market Certification List Details', + marketCertificationListDetails:'Market Homologation List Details', andTheProcessStatusTheList:'And the process status cannot be the data to be checked in the list', pleasefillintherange:'Please fill in the range', databasereportingtime:'Synchronize the database reporting time', @@ -1768,7 +1770,7 @@ module.exports = { andProcessStatusIsTaskPendingConfirmation:'And the process status is Task Pending Confirmation', andPendingSubmissionReviewReturned:'And the process status is result pending submission, review returned', deliverablesFor:'Deliverables for', - dutyPersonRejected:'Duty Person Rejected', + dutyPersonRejected:'Rejected by the responsible person', theCurrentlySelectedDataContainsReviewed:'The currently selected data contains reviewed data. Are you sure to return it?', reviewTheReasonForReturn:'Review the reason for return', reasonForTaskRejection:'Reason for task rejection', @@ -1777,13 +1779,13 @@ module.exports = { theVerificationComplianceProcessCannotBeEmpty:'The delivery type of the verification compliance process cannot be empty', deadlineForConfirmationDesignComplianceResponsibility:'Deadline for Confirmation of Design Compliance Responsibility', deadlineForVerifyingComplianceResponsibilityConfirmation:'Deadline for verifying compliance responsibility confirmation', - batchTaskResponsibilityConfirmation:'Batch task responsibility confirmation', - batchComplianceConfirmation:'Batch compliance confirmation', + batchTaskResponsibilityConfirmation:'Responsibilty Confirmation in Batch', + batchComplianceConfirmation:'Compliance Confirmation in Batch', onlyDataWithApprovedCanCeSelected:'Only data with a process status of result pending review or approved can be selected', deadlineForResponsibilityConfirmation:'Deadline for Responsibility Confirmation', checkRegulatoryCompletedBefore: "Check the implementation of regulatory requirements before product design freezes. Task delivery requirements will first be input and confirmed with the engineering team in G1, and compliance confirmation and review will be completed before G3.", checkVerificationResultsBeforeMP:'Check the verification results required by regulations before mass production of the product. Task delivery requirements will first be input and confirmed with the engineering team in G1, and compliance confirmation and review will be completed before MP.', - modifyOperator:'Modify Operator', + modifyOperator:'Change Operator', onlyDesignComplianceConfirmationSelected:'Only data with a design compliance confirmation process status of task to be confirmed, result to be submitted, or verification compliance confirmation process status of task to be confirmed, result to be submitted can be selected', oneThePersonnelMustBeSelected:'One of the personnel must be selected', pleaseSelectRegulatoryCurrentLogin:'Please select Regulatory Engineer as the data for the current login', @@ -1795,7 +1797,7 @@ module.exports = { designProcessStatus:'Design Process Status', verifyProcessStatus:'Verify Process Status', design:'Design', - verify:'Verify', + verify:'Validation', inventoryVerifyEndTime:'Inventory Verify End Time', taskConfirmEndTime:'Task Confirm End Time', responsiblepersonfordesigncompliance:'Responsible person for design compliance', @@ -1810,15 +1812,15 @@ module.exports = { andTheOperatorCurrentData:' And the operator is the responsible person for the current data', upgradeInstructions:'Upgrade Instructions', upgradeOrNot:'Upgrade or not', - operationRecords:'Operation Records', + operationRecords:'Operation Record', versionUpdatedRecord:'Version Updated Record', - regulatoryComplianceManagement:'Regulatory Compliance Management', - certificationActivityManagement:'Certification Activity Management', + regulatoryComplianceManagement:'Regulation Compliance Management', + certificationActivityManagement:'Homologation Activity Management', parameterCollectionProgressManagement:'Parameter Collection Progress Management', - certificationTaskConfirmation:'Certification Task Confirmation', + certificationTaskConfirmation:'Homo Task Confirmation', selectTime:'Select Time', designCompliance:'Design Compliance', - verifyCompliance:'Verify Compliance', + verifyCompliance:'Validation Compliance', stateExport:'State Export', completeVehicle:'Complete Vehicle', components:'Components', @@ -1830,7 +1832,7 @@ module.exports = { projectProgressStatistics:'Project Progress Statistics', GRPSystemProjectProgressStatistics:'GRP system project progress statistics', statisticalNodes:'Duty Department', - proportionWithInTheAreaOfResponsibility:'Proportion within the area of responsibility', + proportionWithInTheAreaOfResponsibility:'Proportion within the Responsible Field', contentsearch:'Content Search', masterProject:'Master Project', deliveryTime:'Delivery Time', @@ -1842,7 +1844,7 @@ module.exports = { selectDesignConformanceAsConformance:'Select Design Conformance verification process state as Conformance or Verify conformance verification process state as conformance obtained data', submissionProcess:'Submission Process', localapproval1:'Local Approval1', - localapproval2:'Local Approval2', + localapproval2:'LoLocal Approved2', averageapprovalperiod:'Average approval period', day:'day', passreturntime:'Pass/return time', @@ -1871,8 +1873,8 @@ module.exports = { technicalAssessmentOfRegulations:'Regulation Technical Assessment', legalOpinionCollection:'Opinion Collection on Regulation', authenticationParameterCollectionData:'Homo Parameter Collection Data', - phoneRelatedItems:'Project', - listHeading:'List Name', + phoneRelatedItems:'Relevant Projects', + listHeading:'List Title', phoneVersionNumber:'Version', node:'Node', goToCheck:'View', @@ -1888,7 +1890,7 @@ module.exports = { send:'Send', pleaseProcessThePC:'Please handle it on the PC side', clickAndSelect:'Click and Select', - phoneCreationTime:'Create Time', + phoneCreationTime:'Time of Creation', theCurrentFormatSupportPreview:'The current format does not support preview', nearlyMonth:'In a month', nearlyThreeMonths:'In three months', @@ -1926,17 +1928,19 @@ module.exports = { processInitiationOne:'Process Initiation', taskHandlingOne:'Task Handling', taskReview:'Task Review', - softwareversion:'Software version', + softwareversion:'Software Version', softwareplatform:'Software platform', - softwarereleasetime:'Software release time', + softwarereleasetime:'Software Release Time', theme:'Theme', influencestatute:'Influence statute', - vdrste:'VDR status', + influencestatuteCN:'Impact CN Homo', + influencestatuteEU:'Impact EU Homo', + vdrste:'VDR Status', impactdescription:'Impact description', - authenticationimpact:'Authentication impact', - impactstatement:'Impact statement', - certificationdeclaration:'Certification declaration', - matchingstate:'Matching state', + authenticationimpact:'Homo Impact', + impactstatement:'Impact Statement', + certificationdeclaration:'Application Submitted', + matchingstate:'Matching State', issuenotice:'Issue notice', applyforrematch:'Apply for rematch', notificationsent:'Is a notification sent?', @@ -1955,13 +1959,13 @@ module.exports = { Reasonforreturn:'Reason for return', maintenanceTemplate:'Maintenance template', UserFeedback:'User Feedback', - Relevantlawsregulations:'Relevant laws and regulations', - Problemstate:'Problem state', + Relevantlawsregulations:'Relevant Regulations', + Problemstate:'Issue State', descriptions:'Descriptions', documents:'Documents', - examineapproveevidence:'Examine and approve evidence', + examineapproveevidence:'Approval', conculsion:'Conculsion', - progresstracking:'Progress Tracking', + progresstracking:'Progress Track', Fileupload:'File upload', Addresslink:'Address link', Problemanagement:'Problem management', @@ -1969,4 +1973,50 @@ module.exports = { Listcreationtime:'List creation time', Chinesecharacters:'The role code cannot enter Chinese characters', alreadyexistssystem:'The role encoding already exists', + releaseType:'Release Type', + by:'By', + Changeto:'Change to', + emptyc:'empty', + Exportsuccessexportlist:'Export success! Check in the export list', + Derivedlist:'Derived list', + maximum:'A maximum of 20 nodes can be added', + Nodename:'Node Name', + Nodedate:'Node Time', + Associatedplatform:'Associated platform', + associatedItem:'There are multiple matching items in the platform item. Please select the associated item', + unpublishedregulationsselected:'Only unpublished regulations can be selected', + PlatformInformation:'Platform Information', + Processdetails:'Process Details', + matchempty:'The match is empty', + onlyDataProcessStatusDeleted:'Data can only be deleted if the process status is task ready, approved, or rejected by the responsible person', + platformitemhasbeenassociated:'A platform item has been associated', + power:'power', + producer:'producer', + Nameplatelabel:'Nameplate label', + Batteryfilingrecord:'Battery filing record', + Modelinformation:'Model information', + Batterynationalcode:'Battery national code', + Recordnformation:'Record information', + Electriccellproductionenterprises:'Electric cell production enterprises', + Assemblymanufacturer:'Assembly manufacturer', + PartNumberCN:'Part Number (Domestic)', + PartNumberEU:'Part Number (Foreign)', + bitfilecode:'24-bit file code', + Vendorcode:'Vendor code', + Productclasscode:'Product class code', + Batterytypecode:'Battery type code', + Specificationcode:'Specification code', + Traceinformationcode:'Trace information code', + Productionyearmonthdateserialnumber:'Production year month date serial number', + dimension:'dimension(mm)', + Ratedcapacity:'Rated capacity(Ah)', + Nominalvoltage:'Nominal voltage(V)', + Ratedmass:'Rated mass(kg)', + Numbercontainedmodules:'Number of contained modules', + Moduleseriesparallelmode:'Module series parallel mode', + modulspecificationcodeused:'The module or monomer specification code used', + Coolingmode:'Cooling mode', + Filingcompletiontime:'Filing completion time', + Platformdevelopmentvalvepoint:'Platform development valve point', + Compliancemanagementvalvepoint:'Compliance management valve point', } \ 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 4385f38cd..653497dc2 100644 --- a/jero-web/src/common/lang/zh-cn.js +++ b/jero-web/src/common/lang/zh-cn.js @@ -591,7 +591,7 @@ module.exports = { vehicleInProductionDate: '在产车实施日期', deleteNodes: '该节点下若有子节点将同步删除,确认删除该条数据?', leastTwo: '请选择至少两条数据', - mergeTerms: '确定合并条款', + mergeTerms: '确定合并条款?', documentSplitTemplate: '文档拆分模板', batSetting: '批量设置', batchSettingInformation: '批量设置信息', @@ -968,6 +968,7 @@ module.exports = { modelName: '车型名称', modelYear: '年款', NoteConfirmTheChange: '注意:重置后所选条目数据将变为清单待发布状态,历史数据将消失,请确认是否进行流程重置', + NoteConfirmTheChangeplatform: '注意:重置后所选条目数据将变为任务待发起状态,历史数据将消失,请确认是否进行流程重置', onlyDataChanged: '只能变更任务确认状态为接受的数据', inquiry: '询问', ConfirmationDeadline: '确认截止时间', @@ -1153,7 +1154,7 @@ module.exports = { RelevantMaterials: '相关资料', processBackground: '流程背景', selectedStandard: '所选标准', - standardDecompositionDocument: '带入标准分解单', + standardDecompositionDocument: '带入标准拆解单', pleaseSelectStandardFirst: '请先选择标准', evaluatorFeedback: '评估人反馈', nameTechnicalDocument: '技术文件名称', @@ -1525,7 +1526,7 @@ module.exports = { confirmLaunchTask: '确认发起任务?', conditionsNotMet: '不满足条件', onlyProcessStatusReturned: '只能退回流程状态为清单待校核和责任人拒绝的数据', - onlyProcessReturned: '只能发起流程状态为清单待校核和责任人拒绝的数据,并且交付物类型、工程接口人、责任人、截止时间不能为空', + onlyProcessReturned: '只能发起流程状态为任务待发起和责任人拒绝的数据,并且交付物类型、工程接口人、责任人、截止时间不能为空', confirmToAcceptTheTask: '确认接受任务?', confirmRejectTask: '确认拒绝任务?', onlyDataStatusConfirmedSelected: '只能选择流程状态为任务待确认的数据', @@ -1551,6 +1552,7 @@ module.exports = { type: '类型', select: '选择', onlyDataWithProcessStatusDeleted: '只能删除流程状态为清单待发布和审查通过的数据', + onlyDataProcessStatusDeleted: '只能删除流程状态为任务待发起、审查通过和责任人拒绝的数据', complianceCertificationProgram: '合规认证计划', listPublishing: '清单发布', responsibilityConfirmation: '责任确认', @@ -1861,7 +1863,7 @@ module.exports = { NA: '不涉及', reviewAndPass: '审查通过', reviewAndReturn: '审查退回', - electroniccontrollerparameter: '电子控制器参数', + electroniccontrollerparameter: '控制器参数', marketRegulationListDetails: '市场法规清单详情', marketRegulationList: '市场法规清单', onlyDataWithTheCurrentCanBeManipulated: '仅能操作责任人为当前用户的数据', @@ -2536,7 +2538,7 @@ module.exports = { areaOfResponsibility: '责任领域', confirmationOfDesignConformity: '设计符合性确认', Deliverables: '交付物', - personLiable: '责任人', + personable: '责任人', PrehomoConfirmation: 'Pre-Homo确认', verificationAndConformityconfirmation: '验证符合性确认', StandardImplementationDate: '标准实施日期', @@ -2620,6 +2622,7 @@ module.exports = { dataConfirmation: '请选择清单确认状态为未发起或拒绝的数据,以及法规工程师、认证工程师不为空', pleaseSelectinitiatedOrRejected: '请选择设计符合性确认流程状态为清单待发布、法规工程师退回或验证符合性确认流程状态为清单待发布、法规工程师退回的数据', pleaseSelectTheDataverificationVerified: '请选择设计符合性确认流程状态为清单待校核、责任人拒绝或验证符合性确认流程状态为清单待校核、责任人拒绝的数据', + pleaseSelectTheDataverification: '请选择设计符合性确认流程状态为任务待发起、责任人拒绝或验证符合性确认流程状态为任务待发起、责任人拒绝的数据', TheEngineerAndCertification: '的法规工程师不能为空', taskDataConfirmation: '请选择清单确认状态为接受及任务确认状态为未发起或拒绝的数据,以及工程接口人不为空', theProjectContactEmpty: '的工程接口人不能为空', @@ -2961,7 +2964,7 @@ module.exports = { closingDate: '截止日期', viewProcess: '查看流程', evaluationResults: '评估结果', - regulatoryTechnicalEvaluationResults: '法规技术评估结果', + regulatoryTechnicalEvaluationResults: '技术评估结果', Assessor: '评估人', collectionOfRegulatoryOpinions: '法规意见收集', collectionOfRegulatoryOpinionsProcess: '法规意见收集流程', @@ -3430,7 +3433,7 @@ module.exports = { confirmLaunchTask: '确认发起任务?', conditionsNotMet: '不满足条件', onlyProcessStatusReturned: '只能退回流程状态为清单待校核和责任人拒绝的数据', - onlyProcessReturned: '只能发起流程状态为清单待校核和责任人拒绝的数据,并且交付物类型、工程接口人、责任人、截止时间不能为空', + onlyProcessReturned: '只能发起流程状态为任务待发起和责任人拒绝的数据,并且交付物类型、工程接口人、责任人、截止时间不能为空', confirmToAcceptTheTask: '确认接受任务?', confirmRejectTask: '确认拒绝任务?', onlyDataStatusConfirmedSelected: '只能选择流程状态为任务待确认的数据', @@ -3766,7 +3769,7 @@ module.exports = { NA: '不涉及', reviewAndPass: '审查通过', reviewAndReturn: '审查退回', - electroniccontrollerparameter: '电子控制器参数', + electroniccontrollerparameter: '控制器参数', marketRegulationListDetails: '市场法规清单详情', marketRegulationList: '市场法规清单', onlyDataWithTheCurrentCanBeManipulated: '仅能操作责任人为当前用户的数据', @@ -3888,6 +3891,8 @@ module.exports = { softwarereleasetime:'软件发布时间', theme:'主题', influencestatute:'影响法规', + influencestatuteCN:'影响法规', + influencestatuteEU:'影响法规', vdrste:'VDR状态', impactdescription:'影响描述', authenticationimpact:'认证影响', @@ -3925,4 +3930,49 @@ module.exports = { Fileupload:'文件上传', Addresslink:'地址链接', Problemanagement:'问题管理', + releaseType:'发布类型', + by:'由', + Changeto:'改为了', + emptyc:'空', + Exportsuccessexportlist:'导出成功!请在导出列表中查看', + Derivedlist:'导出列表', + maximum:'最多添加20个节点', + Nodename:'节点名称', + Nodedate:'节点时间', + Associatedplatform:'关联平台件', + associatedItem:'在平台件项目中包含多条匹配内容,请选择关联项', + unpublishedregulationsselected:'仅能选择未发布的法规', + PlatformInformation:'平台件信息', + Processdetails:'流程详情', + matchempty:'匹配项为空', + platformitemhasbeenassociated:'已关联平台件项目', + power:'功率', + producer:'生产商', + Nameplatelabel:'铭牌标签', + Batteryfilingrecord:'电池备案记录', + Modelinformation:'型号信息', + Batterynationalcode:'电池国标码', + Recordnformation:'备案信息', + Electriccellproductionenterprises:'电芯生产企业', + Assemblymanufacturer:'总成生产企业', + PartNumberCN:'零件号(国内)', + PartNumberEU:'零件号(国外)', + bitfilecode:'24位备案码', + Vendorcode:'供应商代码', + Productclasscode:'产品类型代码', + Batterytypecode:'电池类型代码', + Specificationcode:'规格代码', + Traceinformationcode:'追溯信息代码', + Productionyearmonthdateserialnumber:'生产年月日序列号', + dimension:'尺寸(mm)', + Ratedcapacity:'额定容量(Ah)', + Nominalvoltage:'标称电压(V)', + Ratedmass:'额定质量(kg)', + Numbercontainedmodules:'包含模块个数', + Moduleseriesparallelmode:'模块串并联方式', + modulspecificationcodeused:'所用模块或单体规格代码', + Coolingmode:'冷却方式', + Filingcompletiontime:'备案完成时间', + Platformdevelopmentvalvepoint:'平台件开发阀点', + Compliancemanagementvalvepoint:'合规管理阀点', } \ No newline at end of file diff --git a/jero-web/src/components/PersonnelSelection/index.vue b/jero-web/src/components/PersonnelSelection/index.vue index 24fdc6166..71e751cd3 100644 --- a/jero-web/src/components/PersonnelSelection/index.vue +++ b/jero-web/src/components/PersonnelSelection/index.vue @@ -72,6 +72,9 @@ fetching: false, selectValue: this.isSingleChoice ? '' : [] } + }, + watch:{ + }, mounted() { this.selectValue = [] @@ -137,9 +140,10 @@ let content = this.selectData.filter(res => { return res.id === selectValue }) - this.$emit('input', content[0].username) + this.$emit('input', content.length > 0 ? content[0].username:'') this.$emit('change', this.query.db_field_name, selectValue, this.query.subscript) } else { + console.log(1) Object.assign(this, { selectValue, fetching: false @@ -164,11 +168,11 @@ }, getUserAndDepart(value, callback) { let query = { - current: 1, - pageSize: 20, - username: '*' + value + '*' + // current: 1, + // pageSize: 20, + username: value } - getAction('/sys/user/page', query).then((res) => { + getAction('/sys/user/searchUser', query).then((res) => { if (res.success) { callback && callback(res.result.records || res.result) } else { diff --git a/jero-web/src/components/jero/JLoading.vue b/jero-web/src/components/jero/JLoading.vue index f6f42d096..a44392c7e 100644 --- a/jero-web/src/components/jero/JLoading.vue +++ b/jero-web/src/components/jero/JLoading.vue @@ -57,7 +57,7 @@ z-index: 1009; width: 100%; height: 100%; - background-color: rgba(255, 255, 255, 0.9); + background-color: rgba(255, 255, 255, 0.3); border-radius: 8px; user-select: none; .loading-content{ diff --git a/jero-web/src/config/router.config.js b/jero-web/src/config/router.config.js index 5f5916571..73a763b95 100644 --- a/jero-web/src/config/router.config.js +++ b/jero-web/src/config/router.config.js @@ -338,6 +338,11 @@ export const constantRouterMap = [ name: 'certificationListMaintenance', component: () => import(/* webpackChunkName: "user" */ '@/views/virtualAuthenticationList/virtualAuthenticationListDesign/certificationListMaintenance') }, + { + path: '/platformItemLibraryDetails', + name: 'platformItemLibraryDetails', + component: () => import(/* webpackChunkName: "user" */ '@/views/projectManagement/platformItemLibraryDetails/index') + }, { path: '/ProjectDetails', name: 'ProjectDetails', diff --git a/jero-web/src/views/businessSupport/collectionOfRegulatoryOpinions/index.vue b/jero-web/src/views/businessSupport/collectionOfRegulatoryOpinions/index.vue index 7779d9cba..86619097a 100644 --- a/jero-web/src/views/businessSupport/collectionOfRegulatoryOpinions/index.vue +++ b/jero-web/src/views/businessSupport/collectionOfRegulatoryOpinions/index.vue @@ -116,6 +116,7 @@ {{$t('evaluationResults')}}
-
+
{{$t('newlyAdded')}}
@@ -32,8 +32,8 @@
{{$t('moveUp')}} {{$t('moveDown')}} - {{$t('edit')}} - {{$t('deleteLib')}} + {{$t('edit')}} + {{$t('deleteLib')}}
diff --git a/jero-web/src/views/businessSupport/technologyAssessment/index.vue b/jero-web/src/views/businessSupport/technologyAssessment/index.vue index cedea358c..888a118d0 100644 --- a/jero-web/src/views/businessSupport/technologyAssessment/index.vue +++ b/jero-web/src/views/businessSupport/technologyAssessment/index.vue @@ -117,6 +117,7 @@ {{$t('evaluationResults')}}
- - {{$t('UpdateLog')}} + + {{ $t('UpdateLog') }}
@@ -37,21 +37,21 @@
- - {{$t('problemKnowledgeBase')}} + + {{ $t('problemKnowledgeBase') }}
- - {{collectFlag == '1'?$t('CancelCollection'):$t('Collection')}} + + {{ collectFlag == '1' ? $t('CancelCollection') : $t('Collection') }}
-
- - {{$t('share')}} + + {{ $t('share') }}
@@ -60,24 +60,25 @@
- {{val}} + {{ val }}
- {{ol.db_field_txt}} - {{ol.db_field_txt}} + {{ ol.db_field_txt }} + {{ ol.db_field_txt }} {{ol.value ? ol.value : '--'}} + :title="ol.value">{{ ol.value ? ol.value : '--' }} {{ol.value ? ol.value : '--'}} + :title="ol.value">{{ ol.value ? ol.value : '--' }} - {{$t('viewUploadedFiles')}} + {{ $t('viewUploadedFiles') }} -- @@ -88,18 +89,18 @@ @click="relatedClick(valItem)" v-if="ol.list && ol.list.length > 0" v-for="valItem in ol.list"> - {{valItem.title}} + {{ valItem.title }} -- - {{ol.value ? ol.value : '--'}} + {{ ol.value ? ol.value : '--' }}
- {{ol.db_field_txt}} + {{ ol.db_field_txt }}
{{valItem.fileName}} + class="leftconteTdInformation">{{ valItem.fileName }} + v-has="'bussLog:downLoad'" + type="vertical-align-bottom" /> + type="profile" />
@@ -125,15 +128,16 @@
- {{ol.db_field_txt}} - {{ol.db_field_txt}} + {{ ol.db_field_txt }} + {{ ol.db_field_txt }} {{ol.value ? ol.value : '--'}} + :title="ol.value">{{ ol.value ? ol.value : '--' }} - {{$t('viewUploadedFiles')}} + {{ $t('viewUploadedFiles') }} -- @@ -144,19 +148,19 @@ :title="valItem.title" v-if="ol.list && ol.list.length > 0" v-for="valItem in ol.list"> - {{valItem.title}} + {{ valItem.title }} -- - {{ol.value ? ol.value : '--'}} + {{ ol.value ? ol.value : '--' }}
-
+
- {{$t('DetailsPhasedImplementation')}} + {{ $t('DetailsPhasedImplementation') }}
- {{text && text.length > 18?text.slice(0,17)+'...':text}} + {{ text && text.length > 18 ? text.slice(0, 17) + '...' : text }} @@ -262,7 +266,7 @@ > - {{$t('See')}} + {{ $t('See') }} - {{$t('download')}} + {{ $t('download') }} - {{$t('StandardBreakdown')}} + {{ $t('StandardBreakdown') }} - {{$t('dataLoading')}} + {{ $t('dataLoading') }} \ No newline at end of file diff --git a/jero-web/src/views/documentManage/splitting/modules/ImportResult.vue b/jero-web/src/views/documentManage/splitting/modules/ImportResult.vue index ff4cf2878..33df79117 100644 --- a/jero-web/src/views/documentManage/splitting/modules/ImportResult.vue +++ b/jero-web/src/views/documentManage/splitting/modules/ImportResult.vue @@ -43,8 +43,7 @@ @click="cancleImports">{{$t('cancel')}} {{$t('submit')}} + :loading="loading">{{$t('submit')}}
diff --git a/jero-web/src/views/documentManage/splitting/modules/SplitText.vue b/jero-web/src/views/documentManage/splitting/modules/SplitText.vue index 3091e74c0..245591279 100644 --- a/jero-web/src/views/documentManage/splitting/modules/SplitText.vue +++ b/jero-web/src/views/documentManage/splitting/modules/SplitText.vue @@ -68,8 +68,7 @@ {{$t('cancel')}} - {{$t('submit')}} + {{$t('submit')}}
diff --git a/jero-web/src/views/documentTools/documentComparison/index.vue b/jero-web/src/views/documentTools/documentComparison/index.vue index f7e13f6ec..a914ffb2e 100644 --- a/jero-web/src/views/documentTools/documentComparison/index.vue +++ b/jero-web/src/views/documentTools/documentComparison/index.vue @@ -66,16 +66,20 @@ > - {{$t('comparisonResults')}} + {{$t('comparisonResults')}} {{!record.releaseState || record.releaseState == 'draft' ? $t('release') :$t('withdraw')}} {{$t('edit')}} {{$t('delete')}} diff --git a/jero-web/src/views/otamanagement/otaAuthentication/components/detil.vue b/jero-web/src/views/otamanagement/otaAuthentication/components/detil.vue index 13e2f30af..feb8311ff 100644 --- a/jero-web/src/views/otamanagement/otaAuthentication/components/detil.vue +++ b/jero-web/src/views/otamanagement/otaAuthentication/components/detil.vue @@ -244,7 +244,11 @@ + +