From 04a019b5ce5371eaa1aa47462e887b51e1df9b0e Mon Sep 17 00:00:00 2001 From: "youhong.ai" Date: Tue, 23 May 2023 14:45:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../youhong.ai/pcn/workflow_code_block.js | 33 +- src/main/java/aiyh/utils/Util.java | 26 + .../aiyh/utils/action/SafeCusBaseAction.java | 1 + .../java/aiyh/utils/fileUtil/pdf/PdfUtil.java | 2 +- .../orgchart/service/OrgChartService.java | 514 +- .../openbill/service/OpenTheBillService.java | 67 +- .../controller/SingleSignOnController.java | 7 +- .../impl/DeleteModeDataServiceImp.java | 156 + .../config/service/DealWithMapping.java | 30 +- .../submitfirst/AutoSubmitFirstAction.java | 61 + .../mapper/AutoSubmitFirstMapper.java | 22 + .../action/CaElectronicSignatureAction.java | 5 +- .../cusgetvalue/GetOfdKeywordPageValue.java | 55 + .../intellectualproperty/util/OFDReader.java | 146 + .../formmode/action/ContractExpandAction.java | 109 + .../formmode/action/CostIncomeUpdate.java | 101 + .../action/HumanCostExpandAction.java | 122 + .../prop/prop2map/JituMultilingual.properties | 2 +- .../esteeLauderExcelExport.properties | 180 +- src/main/resources/cus_getlog/css/index.css | 91 + src/main/resources/cus_getlog/downlog.jsp | 138 + src/main/resources/cus_getlog/getlog.jsp | 481 + src/main/resources/cus_getlog/img/loading.gif | Bin 0 -> 1787 bytes src/main/resources/cus_getlog/index.jsp | 469 + .../js/My97DatePicker/WdatePicker.js | 56 + .../cus_getlog/js/My97DatePicker/calendar.js | 5 + .../cus_getlog/js/My97DatePicker/lang/en.js | 14 + .../js/My97DatePicker/lang/zh-cn.js | 14 + .../js/My97DatePicker/lang/zh-tw.js | 14 + .../js/My97DatePicker/skin/WdatePicker.css | 11 + .../js/My97DatePicker/skin/datePicker.gif | Bin 0 -> 1043 bytes .../skin/default/datepicker.css | 246 + .../js/My97DatePicker/skin/default/img.gif | Bin 0 -> 1578 bytes .../js/My97DatePicker/skin/whyGreen/bg.jpg | Bin 0 -> 307 bytes .../skin/whyGreen/datepicker.css | 256 + .../js/My97DatePicker/skin/whyGreen/img.gif | Bin 0 -> 1679 bytes src/main/resources/cus_getlog/js/data.js | 19 + src/main/resources/cus_getlog/js/jquery.js | 10995 ++++++++++++++++ src/main/resources/cus_getlog/sendUrl.jsp | 38 + .../hrmNew/JobTitleMultilingualUtil.java | 14 +- .../pdf_water/PdfMultipleWaterAction.java | 7 - .../java/youhong/ai/utiltest/FileCleanup.java | 66 + .../java/youhong/ai/utiltest/GenericTest.java | 15 +- .../ai/utiltest/OFDKeywordSearchTest.java | 151 + .../java/youhong/ai/utiltest/OFDReader.java | 165 + .../java/youhong/ai/utiltest/PDFODFTest.java | 63 + 46 files changed, 14554 insertions(+), 413 deletions(-) create mode 100644 src/main/java/com/engine/yunjinshan/modeDelete/service/impl/DeleteModeDataServiceImp.java create mode 100644 src/main/java/weaver/youhong/ai/geerde/action/submitfirst/AutoSubmitFirstAction.java create mode 100644 src/main/java/weaver/youhong/ai/geerde/action/submitfirst/mapper/AutoSubmitFirstMapper.java create mode 100644 src/main/java/weaver/youhong/ai/intellectualproperty/cusgetvalue/GetOfdKeywordPageValue.java create mode 100644 src/main/java/weaver/youhong/ai/intellectualproperty/util/OFDReader.java create mode 100644 src/main/java/weaver/yunjinshan/formmode/action/ContractExpandAction.java create mode 100644 src/main/java/weaver/yunjinshan/formmode/action/CostIncomeUpdate.java create mode 100644 src/main/java/weaver/yunjinshan/formmode/action/HumanCostExpandAction.java create mode 100755 src/main/resources/cus_getlog/css/index.css create mode 100755 src/main/resources/cus_getlog/downlog.jsp create mode 100755 src/main/resources/cus_getlog/getlog.jsp create mode 100755 src/main/resources/cus_getlog/img/loading.gif create mode 100755 src/main/resources/cus_getlog/index.jsp create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/WdatePicker.js create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/calendar.js create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/lang/en.js create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/lang/zh-cn.js create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/lang/zh-tw.js create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/skin/WdatePicker.css create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/skin/datePicker.gif create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/skin/default/datepicker.css create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/skin/default/img.gif create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/skin/whyGreen/bg.jpg create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/skin/whyGreen/datepicker.css create mode 100755 src/main/resources/cus_getlog/js/My97DatePicker/skin/whyGreen/img.gif create mode 100755 src/main/resources/cus_getlog/js/data.js create mode 100755 src/main/resources/cus_getlog/js/jquery.js create mode 100755 src/main/resources/cus_getlog/sendUrl.jsp create mode 100644 src/test/java/youhong/ai/utiltest/FileCleanup.java create mode 100644 src/test/java/youhong/ai/utiltest/OFDKeywordSearchTest.java create mode 100644 src/test/java/youhong/ai/utiltest/OFDReader.java create mode 100644 src/test/java/youhong/ai/utiltest/PDFODFTest.java diff --git a/javascript/youhong.ai/pcn/workflow_code_block.js b/javascript/youhong.ai/pcn/workflow_code_block.js index f99dbcc..cfa92e8 100644 --- a/javascript/youhong.ai/pcn/workflow_code_block.js +++ b/javascript/youhong.ai/pcn/workflow_code_block.js @@ -688,15 +688,15 @@ $(() => { $(() => { const config = [{ // 源字段 - sourceField: '', + sourceField: 'htksrq', // 目标字段 - targetField: '', + targetField: 'htjsrq', // 日期加月份字段 - numberField: '' + numberField: 'contractperiod' }, { - sourceField: '', - targetField: '', - numberField: '' + sourceField: 'syqksrq', + targetField: 'syqjsrq', + numberField: 'probationperiod' }] runJs(); @@ -711,22 +711,25 @@ $(() => { let fieldId = WfForm.convertFieldNameToId(configItem.numberField) WfForm.bindFieldChangeEvent(fieldId, (obj, id, value) => { if ("" == value) { - WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField, {value: ""})) + WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField), {value: ""}) return } let sourceValue = WfForm.getFieldValue(WfForm.convertFieldNameToId(configItem.sourceField)); + if ("" == sourceValue) { + setTimeout(() => { + WfForm.changeFieldValue(fieldId, {value: ""}) + }, 10) + } let date = new Date(sourceValue) date.setMonth(date.getMonth() + +value) - let objectDate = new Date(); - - - let day = objectDate.getDate(); - let month = objectDate.getMonth() + 1; - let year = objectDate.getFullYear(); - WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField, { + let day = date.getDate(); + let month = date.getMonth() + 1; + let year = date.getFullYear(); + WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField), { value: `${year}-${fullNum(month)}-${fullNum(day)}` - })) + }) }) + } function fullNum(i) { diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java index fd7046e..3034c62 100644 --- a/src/main/java/aiyh/utils/Util.java +++ b/src/main/java/aiyh/utils/Util.java @@ -4020,4 +4020,30 @@ public class Util extends weaver.general.Util { return filePath; } + public static String createTempFile(InputStream inputStream, String imageFileName) { + String filePath = getTempFilePath("ofd", imageFileName); + try { + writeToFile(inputStream, filePath); + } catch (IOException e) { + throw new CustomerException("create temp file error!", e); + } + return filePath; + } + + public static void writeToFile(InputStream inputStream, String filePath) throws IOException { + Path path = Paths.get(filePath); + Path parentDir = path.getParent(); + if (parentDir != null) { + Files.createDirectories(parentDir); + } + Files.createFile(path); + + try (FileOutputStream outputStream = new FileOutputStream(filePath)) { + byte[] buffer = new byte[8192]; + int bytesRead; + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + } + } } diff --git a/src/main/java/aiyh/utils/action/SafeCusBaseAction.java b/src/main/java/aiyh/utils/action/SafeCusBaseAction.java index dbf0b05..92cdf9f 100644 --- a/src/main/java/aiyh/utils/action/SafeCusBaseAction.java +++ b/src/main/java/aiyh/utils/action/SafeCusBaseAction.java @@ -64,6 +64,7 @@ public abstract class SafeCusBaseAction implements Action { } try { Util.verifyRequiredField(this); + log.info("action trigger by " + src); if (!Strings.isNullOrEmpty(src)) { src = "submit"; } diff --git a/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java b/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java index b6d62af..02180af 100644 --- a/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java +++ b/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java @@ -140,7 +140,7 @@ public class PdfUtil { FileOutputStream outputStreamTem; try { outputStreamTem = new FileOutputStream(tempPath); - } catch (FileNotFoundException e) { + } catch (Exception e) { throw new CustomerException("创建临时文件流和路径转换失败!", e); } PdfStamper pdfStamper = null; diff --git a/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java b/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java index 8fdbd6f..e4f79e7 100644 --- a/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java +++ b/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java @@ -27,258 +27,266 @@ import java.util.stream.Collectors; */ public class OrgChartService { - - private final OrgChartMapper mapper = Util.getMapper(OrgChartMapper.class); - - private final OrgChartMapStruct struct = OrgChartMapStruct.INSTANCE; - - /** - *

获取人员组织架构图数据

- * - * @param logInUser 当前登陆对象 - * @return 组织架构图数据 - * @author youHong.ai - */ - public List getOrgChartTree(User logInUser) { - int userId = logInUser.getUID(); - AtomicReference currentUser = new AtomicReference<>(); - List hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser); - /* ******************* 系统管理员默认全部展开哦 ******************* */ - if (userId == 1) { - return systemAdminTree(hrmResourceDtoList); - } - filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser); - /* ******************* 查询当前用户的是否全部展示或显示小红点的配置信息 ******************* */ - ShowPointOrAll showPointOrAll = mapper.selectShowPointOrAll(userId); - List orgChartNodeVoList = null; - if (Objects.isNull(showPointOrAll)) { - /* ******************* 转换dto为Vo并且设置根节点标识 ******************* */ - orgChartNodeVoList = hrmResourceDtoList.stream() - .map(struct::hrmResourceDtoToVo) - .peek(item -> item.setType(-1)) - .collect(Collectors.toList()); - } else { - /* ******************* 转换dto为Vo并且设置根节点标识 ******************* */ - orgChartNodeVoList = hrmResourceDtoList.stream() - .map(struct::hrmResourceDtoToVo) - .peek(item -> { - if (showPointOrAll.isShowAll()) { - Builder.startSet(item) - .with(OrgChartNodeVo::setShow, 1) - .with(OrgChartNodeVo::setShowBrother, 1) - .with(OrgChartNodeVo::setShowChildren, 1) - .endSet(); - } - if (!showPointOrAll.isShowType()) { - item.setType(-1); - } - }).collect(Collectors.toList()); - - } - return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId, - OrgChartNodeVo::getManagerId, OrgChartNodeVo::getChildren, - OrgChartNodeVo::setChildren, - parentId -> parentId == null || parentId <= 0) - .stream() - .peek(item -> item.setIsRoot(true)) - .peek(item -> recursionChildrenNums(item, 0)) - .collect(Collectors.toList()); - } - - - /** - *

getOrgChartTreeAll 获取所有的数据并默认展开

- * 2022/12/16 17:21 - * ************************************************************ - * - * @param logInUser 当前登陆id - * @return List 最终树 - * @author youHong.ai ****************************************** - */ - public List getOrgChartTreeAll(User logInUser) { - int userId = logInUser.getUID(); - AtomicReference currentUser = new AtomicReference<>(); - List hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser); - /* ******************* 系统管理员默认全部展开哦 ******************* */ - if (userId == 1) { - return systemAdminTree(hrmResourceDtoList); - } - filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser); - List orgChartNodeVoList = null; - /* ******************* 转换dto为Vo并且设置根节点标识 ******************* */ - orgChartNodeVoList = hrmResourceDtoList.stream() - .map(struct::hrmResourceDtoToVo) - .peek(item -> - Builder.startSet(item) - .with(OrgChartNodeVo::setShow, 1) - .with(OrgChartNodeVo::setShowBrother, 1) - .with(OrgChartNodeVo::setShowChildren, 1) - .endSet() - ).collect(Collectors.toList()); - - return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId, - OrgChartNodeVo::getManagerId, OrgChartNodeVo::getChildren, - OrgChartNodeVo::setChildren, - parentId -> parentId == null || parentId <= 0) - .stream() - .peek(item -> item.setIsRoot(true)) - .peek(item -> recursionChildrenNums(item, 0)) - .collect(Collectors.toList()); - } - - - /** - *

filterCurrentSubCom 过滤当前分部的人员,并且设置用户上级标识

- * 2022/12/16 17:16 - * ************************************************************ - * - * @param hrmResourceDtoList 人力资源dtolist - * @param currentUser 当前用户 - * @param logInUser 当前登陆用户 - * @author youHong.ai ****************************************** - */ - private void filterCurrentSubCom(List hrmResourceDtoList, - AtomicReference currentUser, - User logInUser) { - Assert.notNull(currentUser.get(), "not find current login user info!"); - /* ******************* 根据当前登陆人的分部来过滤 ******************* */ - hrmResourceDtoList = hrmResourceDtoList.stream() - .filter(item -> logInUser.getUserSubCompany1() == item.getSubCompanyId()) - .collect(Collectors.toList()); - /* ******************* 查找当前登陆人员的所有上级 ******************* */ - String currentUserManagerStr = currentUser.get().getManagerStr(); - if (Objects.isNull(currentUserManagerStr) || "".equals(currentUserManagerStr)) { - currentUserManagerStr = "0"; - } - currentUserManagerStr = Util.removeSeparator(currentUserManagerStr, ","); - List currentUserManagerList = Arrays.stream(currentUserManagerStr.split(",")) - .map(Integer::parseInt) - .collect(Collectors.toList()); - /* ******************* 对当前用户的所有直接上级设置标识 ******************* */ - hrmResourceDtoList.stream() - .filter(item -> currentUserManagerList.contains(item.getId())) - .forEach(item -> Builder.startSet(item) - .with(HrmResourceDto::setShowChildren, 1) - .with(HrmResourceDto::setCurrentParent, true) - .endSet()); - - } - - - /** - *

systemAdminTree 系统管理员返回全部展开的数据

- * 2022/12/16 17:15 - * ************************************************************ - * - * @param hrmResourceDtoList 人力资源dtolist - * @return List 树型list - * @author youHong.ai ****************************************** - */ - private List systemAdminTree(List hrmResourceDtoList) { - List collect = hrmResourceDtoList.stream() - .map(struct::hrmResourceDtoToVo) - .peek(item -> Builder.startSet(item) - .with(OrgChartNodeVo::setShow, 1) - .with(OrgChartNodeVo::setShowBrother, 1) - .with(OrgChartNodeVo::setShowChildren, 1) - .with(OrgChartNodeVo::setCurrent, true) - .endSet()) - .collect(Collectors.toList()); - return Util.listToTree(collect, OrgChartNodeVo::getId, OrgChartNodeVo::getManagerId, - OrgChartNodeVo::getChildren, OrgChartNodeVo::setChildren, - parentId -> parentId == null || parentId <= 0) - .stream().peek(item -> Builder.startSet(item) - .with(OrgChartNodeVo::setIsRoot, true) - .with(OrgChartNodeVo::setCurrent, true) - .endSet()) - .peek(item -> recursionChildrenNums(item, 0)) - .collect(Collectors.toList()); - } - - /** - *

getHrmResourceDtoList 获取人力资源dto对象list

- * 2022/12/16 17:09 - * ************************************************************ - * - * @param userId 当前登陆用户ID - * @param currentUser 当前登陆用户对象 - * @return List 人力资源dto对象list - * @author youHong.ai ****************************************** - */ - private List getHrmResourceDtoList(Integer userId, AtomicReference currentUser) { - // 人员类型自定义字段 - String typeOfEmploymentField = Util.getCusConfigValue("typeOfEmploymentField"); - Assert.notBlank(typeOfEmploymentField, "config [typeOfEmploymentField] is null or blank!"); - // 英文自定义名称字段 - String lastNameEnField = Util.getCusConfigValue("lastNameEnField"); - Assert.notBlank(lastNameEnField, "config [lastNameEnField] is null or blank!"); - // 人员类型id字段 建模表 - String typeOfEmploymentIdField = Util.getCusConfigValue("typeOfEmploymentIdField"); - Assert.notBlank(typeOfEmploymentIdField, "config [typeOfEmploymentIdField] is null or blank!"); - // 人员类型父级字段 建模表 - String parentField = Util.getCusConfigValue("parentField"); - Assert.notBlank(parentField, "config [parentField] is null or blank!"); - // 人员类型建模表表名 - String typeOfEmploymentTable = Util.getCusConfigValue("typeOfEmploymentTable"); - Assert.notBlank(typeOfEmploymentTable, "config [typeOfEmploymentTable] is null or blank!"); - // 查询所有人员信息 - List hrmResourceList = mapper.selectAll(typeOfEmploymentField, lastNameEnField, - typeOfEmploymentTable, parentField, typeOfEmploymentIdField); - if (Objects.isNull(hrmResourceList) || hrmResourceList.isEmpty()) { - throw new CustomerException("查询不到相关人员!"); - } - //List hrmResourceDtoList = new ArrayList(); - /* ******************* 将pojo转换为Dto对象,对节点属性默认值赋值,找出当前用户并设置显示 ******************* */ - List hrmResourceDtoList = hrmResourceList.stream() - .map(struct::hrmResourceToDto) - .peek(item -> Builder.startSet(item) - .with(HrmResourceDto::setShow, 0) - .with(HrmResourceDto::setShowBrother, 0) - .with(HrmResourceDto::setShowChildren, 0) - .endSet()) - .collect(Collectors.toList()); - hrmResourceDtoList.stream() - .peek(item -> { - if (Objects.equals(item.getManagerId(), userId)) { - item.setShow(1); - } - }) - .filter(item -> Objects.equals(item.getId(), userId)) - .forEach(item -> { - Builder.startSet(item) - .with(HrmResourceDto::setShow, 1) - .with(HrmResourceDto::setShowBrother, 1) - .with(HrmResourceDto::setShowChildren, 1) - .with(HrmResourceDto::setCurrent, true) - .endSet(); - currentUser.set(item); - }); - return hrmResourceDtoList; - } - - /** - *

计算节点所有子节点的数量

- * 2022/12/3 17:55 - * ****************************************** - * - * @param chartNodeVo 节点对象 - * @return Integer 对应节点的所有子节点的数量 - * @author youHong.ai ****************************************** - */ - private Integer recursionChildrenNums(OrgChartNodeVo chartNodeVo, int n) { - List children = chartNodeVo.getChildren(); - if (Objects.isNull(children) || children.size() == 0) { - chartNodeVo.setChildrenNum(0); - return 0; - } - n += children.size(); - for (OrgChartNodeVo child : children) { - child.setChildrenNum(recursionChildrenNums(child, 0)); - n += child.getChildrenNum(); - } - chartNodeVo.setChildrenNum(n); - return n; - } - + + private final OrgChartMapper mapper = Util.getMapper(OrgChartMapper.class); + + private final OrgChartMapStruct struct = OrgChartMapStruct.INSTANCE; + + /** + *

获取人员组织架构图数据

+ * + * @param logInUser 当前登陆对象 + * @return 组织架构图数据 + * @author youHong.ai + */ + public List getOrgChartTree(User logInUser) { + int userId = logInUser.getUID(); + AtomicReference currentUser = new AtomicReference<>(); + List hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser); + /* ******************* 系统管理员默认全部展开哦 ******************* */ + if (userId == 1) { + return systemAdminTree(hrmResourceDtoList); + } + filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser); + /* ******************* 查询当前用户的是否全部展示或显示小红点的配置信息 ******************* */ + ShowPointOrAll showPointOrAll = mapper.selectShowPointOrAll(userId); + List orgChartNodeVoList = null; + if (Objects.isNull(showPointOrAll)) { + /* ******************* 转换dto为Vo并且设置根节点标识 ******************* */ + orgChartNodeVoList = hrmResourceDtoList.stream() + .map(struct::hrmResourceDtoToVo) + .peek(item -> item.setType(-1)) + .collect(Collectors.toList()); + } else { + /* ******************* 转换dto为Vo并且设置根节点标识 ******************* */ + orgChartNodeVoList = hrmResourceDtoList.stream() + .map(struct::hrmResourceDtoToVo) + .peek(item -> { + if (showPointOrAll.isShowAll()) { + Builder.startSet(item) + .with(OrgChartNodeVo::setShow, 1) + .with(OrgChartNodeVo::setShowBrother, 1) + .with(OrgChartNodeVo::setShowChildren, 1) + .endSet(); + } + if (!showPointOrAll.isShowType()) { + item.setType(-1); + } + }).collect(Collectors.toList()); + + } + sortByNameFirstLetter(orgChartNodeVoList); + return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId, + OrgChartNodeVo::getManagerId, OrgChartNodeVo::getChildren, + OrgChartNodeVo::setChildren, + parentId -> parentId == null || parentId <= 0) + .stream() + .peek(item -> item.setIsRoot(true)) + .peek(item -> recursionChildrenNums(item, 0)) + .collect(Collectors.toList()); + } + + public static void sortByNameFirstLetter(List nodeList) { + nodeList.sort((node1, node2) -> { + String name1 = node1.getName(); + String name2 = node2.getName(); + return name1.compareToIgnoreCase(name2); + }); + } + + /** + *

getOrgChartTreeAll 获取所有的数据并默认展开

+ * 2022/12/16 17:21 + * ************************************************************ + * + * @param logInUser 当前登陆id + * @return List 最终树 + * @author youHong.ai ****************************************** + */ + public List getOrgChartTreeAll(User logInUser) { + int userId = logInUser.getUID(); + AtomicReference currentUser = new AtomicReference<>(); + List hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser); + /* ******************* 系统管理员默认全部展开哦 ******************* */ + if (userId == 1) { + return systemAdminTree(hrmResourceDtoList); + } + filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser); + List orgChartNodeVoList = null; + /* ******************* 转换dto为Vo并且设置根节点标识 ******************* */ + orgChartNodeVoList = hrmResourceDtoList.stream() + .map(struct::hrmResourceDtoToVo) + .peek(item -> + Builder.startSet(item) + .with(OrgChartNodeVo::setShow, 1) + .with(OrgChartNodeVo::setShowBrother, 1) + .with(OrgChartNodeVo::setShowChildren, 1) + .endSet() + ).collect(Collectors.toList()); + + return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId, + OrgChartNodeVo::getManagerId, OrgChartNodeVo::getChildren, + OrgChartNodeVo::setChildren, + parentId -> parentId == null || parentId <= 0) + .stream() + .peek(item -> item.setIsRoot(true)) + .peek(item -> recursionChildrenNums(item, 0)) + .collect(Collectors.toList()); + } + + + /** + *

filterCurrentSubCom 过滤当前分部的人员,并且设置用户上级标识

+ * 2022/12/16 17:16 + * ************************************************************ + * + * @param hrmResourceDtoList 人力资源dtolist + * @param currentUser 当前用户 + * @param logInUser 当前登陆用户 + * @author youHong.ai ****************************************** + */ + private void filterCurrentSubCom(List hrmResourceDtoList, + AtomicReference currentUser, + User logInUser) { + Assert.notNull(currentUser.get(), "not find current login user info!"); + /* ******************* 根据当前登陆人的分部来过滤 ******************* */ + hrmResourceDtoList = hrmResourceDtoList.stream() + .filter(item -> logInUser.getUserSubCompany1() == item.getSubCompanyId()) + .collect(Collectors.toList()); + /* ******************* 查找当前登陆人员的所有上级 ******************* */ + String currentUserManagerStr = currentUser.get().getManagerStr(); + if (Objects.isNull(currentUserManagerStr) || "".equals(currentUserManagerStr)) { + currentUserManagerStr = "0"; + } + currentUserManagerStr = Util.removeSeparator(currentUserManagerStr, ","); + List currentUserManagerList = Arrays.stream(currentUserManagerStr.split(",")) + .map(Integer::parseInt) + .collect(Collectors.toList()); + /* ******************* 对当前用户的所有直接上级设置标识 ******************* */ + hrmResourceDtoList.stream() + .filter(item -> currentUserManagerList.contains(item.getId())) + .forEach(item -> Builder.startSet(item) + .with(HrmResourceDto::setShowChildren, 1) + .with(HrmResourceDto::setCurrentParent, true) + .endSet()); + + } + + + /** + *

systemAdminTree 系统管理员返回全部展开的数据

+ * 2022/12/16 17:15 + * ************************************************************ + * + * @param hrmResourceDtoList 人力资源dtolist + * @return List 树型list + * @author youHong.ai ****************************************** + */ + private List systemAdminTree(List hrmResourceDtoList) { + List collect = hrmResourceDtoList.stream() + .map(struct::hrmResourceDtoToVo) + .peek(item -> Builder.startSet(item) + .with(OrgChartNodeVo::setShow, 1) + .with(OrgChartNodeVo::setShowBrother, 1) + .with(OrgChartNodeVo::setShowChildren, 1) + .with(OrgChartNodeVo::setCurrent, true) + .endSet()) + .collect(Collectors.toList()); + return Util.listToTree(collect, OrgChartNodeVo::getId, OrgChartNodeVo::getManagerId, + OrgChartNodeVo::getChildren, OrgChartNodeVo::setChildren, + parentId -> parentId == null || parentId <= 0) + .stream().peek(item -> Builder.startSet(item) + .with(OrgChartNodeVo::setIsRoot, true) + .with(OrgChartNodeVo::setCurrent, true) + .endSet()) + .peek(item -> recursionChildrenNums(item, 0)) + .collect(Collectors.toList()); + } + + /** + *

getHrmResourceDtoList 获取人力资源dto对象list

+ * 2022/12/16 17:09 + * ************************************************************ + * + * @param userId 当前登陆用户ID + * @param currentUser 当前登陆用户对象 + * @return List 人力资源dto对象list + * @author youHong.ai ****************************************** + */ + private List getHrmResourceDtoList(Integer userId, AtomicReference currentUser) { + // 人员类型自定义字段 + String typeOfEmploymentField = Util.getCusConfigValue("typeOfEmploymentField"); + Assert.notBlank(typeOfEmploymentField, "config [typeOfEmploymentField] is null or blank!"); + // 英文自定义名称字段 + String lastNameEnField = Util.getCusConfigValue("lastNameEnField"); + Assert.notBlank(lastNameEnField, "config [lastNameEnField] is null or blank!"); + // 人员类型id字段 建模表 + String typeOfEmploymentIdField = Util.getCusConfigValue("typeOfEmploymentIdField"); + Assert.notBlank(typeOfEmploymentIdField, "config [typeOfEmploymentIdField] is null or blank!"); + // 人员类型父级字段 建模表 + String parentField = Util.getCusConfigValue("parentField"); + Assert.notBlank(parentField, "config [parentField] is null or blank!"); + // 人员类型建模表表名 + String typeOfEmploymentTable = Util.getCusConfigValue("typeOfEmploymentTable"); + Assert.notBlank(typeOfEmploymentTable, "config [typeOfEmploymentTable] is null or blank!"); + // 查询所有人员信息 + List hrmResourceList = mapper.selectAll(typeOfEmploymentField, lastNameEnField, + typeOfEmploymentTable, parentField, typeOfEmploymentIdField); + if (Objects.isNull(hrmResourceList) || hrmResourceList.isEmpty()) { + throw new CustomerException("查询不到相关人员!"); + } + // List hrmResourceDtoList = new ArrayList(); + /* ******************* 将pojo转换为Dto对象,对节点属性默认值赋值,找出当前用户并设置显示 ******************* */ + List hrmResourceDtoList = hrmResourceList.stream() + .map(struct::hrmResourceToDto) + .peek(item -> Builder.startSet(item) + .with(HrmResourceDto::setShow, 0) + .with(HrmResourceDto::setShowBrother, 0) + .with(HrmResourceDto::setShowChildren, 0) + .endSet()) + .collect(Collectors.toList()); + hrmResourceDtoList.stream() + .peek(item -> { + if (Objects.equals(item.getManagerId(), userId)) { + item.setShow(1); + } + }) + .filter(item -> Objects.equals(item.getId(), userId)) + .forEach(item -> { + Builder.startSet(item) + .with(HrmResourceDto::setShow, 1) + .with(HrmResourceDto::setShowBrother, 1) + .with(HrmResourceDto::setShowChildren, 1) + .with(HrmResourceDto::setCurrent, true) + .endSet(); + currentUser.set(item); + }); + return hrmResourceDtoList; + } + + /** + *

计算节点所有子节点的数量

+ * 2022/12/3 17:55 + * ****************************************** + * + * @param chartNodeVo 节点对象 + * @return Integer 对应节点的所有子节点的数量 + * @author youHong.ai ****************************************** + */ + private Integer recursionChildrenNums(OrgChartNodeVo chartNodeVo, int n) { + List children = chartNodeVo.getChildren(); + if (Objects.isNull(children) || children.size() == 0) { + chartNodeVo.setChildrenNum(0); + return 0; + } + n += children.size(); + for (OrgChartNodeVo child : children) { + child.setChildrenNum(recursionChildrenNums(child, 0)); + n += child.getChildrenNum(); + } + chartNodeVo.setChildrenNum(n); + return n; + } + } diff --git a/src/main/java/com/api/youhong/ai/yashilandai/openbill/service/OpenTheBillService.java b/src/main/java/com/api/youhong/ai/yashilandai/openbill/service/OpenTheBillService.java index f4720c2..b03a78f 100644 --- a/src/main/java/com/api/youhong/ai/yashilandai/openbill/service/OpenTheBillService.java +++ b/src/main/java/com/api/youhong/ai/yashilandai/openbill/service/OpenTheBillService.java @@ -21,6 +21,7 @@ import org.apache.poi.xssf.streaming.SXSSFCell; import org.apache.poi.xssf.streaming.SXSSFRow; import org.apache.poi.xssf.streaming.SXSSFSheet; import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import weaver.conn.RecordSet; import java.io.OutputStream; import java.text.DateFormat; @@ -46,6 +47,8 @@ public class OpenTheBillService { private final Logger log = Util.getLogger(); + private final RecordSet res = new RecordSet(); + public Map getOpenBillListData(String startDate, String endDate, String orderNo) { return getData(startDate, endDate, orderNo); } @@ -150,6 +153,7 @@ public class OpenTheBillService { SXSSFCell cell, SXSSFSheet sheet, Map singularLine, Map evenNumberLine) { + int columnWidth = sheet.getColumnWidth(colIndex); String value = cell.getStringCellValue(); /** 计算字符串中中文字符的数量 */ @@ -160,27 +164,17 @@ public class OpenTheBillService { if (length >= columnWidth && length < 256 * 256) { sheet.setColumnWidth(colIndex, length); } - if (rowIndex % 2 == 1) { - if (singularLine.containsKey(colIndex)) { - return singularLine.get(colIndex); - } - CellStyle cellStyle = getCellStyle(workbook, rowIndex, colIndex, cell, sheet); - singularLine.put(colIndex, cellStyle); - return cellStyle; - } else { - if (evenNumberLine.containsKey(colIndex)) { - return evenNumberLine.get(colIndex); - } - CellStyle cellStyle = getCellStyle(workbook, rowIndex, colIndex, cell, sheet); - // 设置字体格式 - Font font = workbook.createFont(); - font.setFontName("微软雅黑"); - font.setFontHeightInPoints((short) 10); - - cellStyle.setFont(font); - evenNumberLine.put(colIndex, cellStyle); - return cellStyle; + if (singularLine.containsKey(-1)) { + return singularLine.get(-1); } + // 设置字体格式 + Font font = workbook.createFont(); + font.setFontName("微软雅黑"); + font.setFontHeightInPoints((short) 10); + CellStyle cellStyle = getCellStyle(workbook, rowIndex, colIndex, cell, sheet); + cellStyle.setFont(font); + singularLine.put(-1, cellStyle); + return cellStyle; } private CellStyle getCellStyle(SXSSFWorkbook workbook, Integer rowIndex, Integer colIndex, SXSSFCell cell, SXSSFSheet sheet) { @@ -232,6 +226,16 @@ public class OpenTheBillService { return count; } + public Map findMapByField(String filterString, List> list) { + for (Map map : list) { + if (map.containsKey("field") && map.get("field").equals(filterString)) { + return map; + } + } + // 如果找不到匹配的 Map,则返回 null + return null; + } + public Map getData(String startDate, String endDate, String orderNo) { Map config = Util.readProperties2Map("esteeLauderExcelExport", "export"); Assert.notEmpty(config, "esteeLauderExcelExport.properties文件读取配置为空,请检查配置信息"); @@ -246,7 +250,8 @@ public class OpenTheBillService { Util.null2String(config.get("createDate")), condition); } else { - dataList = mapper.selectList(Util.null2String(config.get("tableName"))); + // dataList = mapper.selectList(Util.null2String(config.get("tableName"))); + dataList = Collections.emptyList(); } Object head = config.get("head"); Map result = new HashMap<>(16); @@ -309,6 +314,7 @@ public class OpenTheBillService { if (finalBgm.equals("Y")) { // 都过了bgm for (Map item : list) { + item.put(Util.null2String(config.get("additional")), ""); item.put(Util.null2String(config.get("openBillKey")), ""); } } else { @@ -319,6 +325,7 @@ public class OpenTheBillService { // 不全部都是y或者n for (Map item : list) { item.put(Util.null2String(config.get("openBillKey")), "全部订单总金额达到GM审批标准,拆分后无法到达GM审批节点。"); + item.put(Util.null2String(config.get("additional")), "此单为系统判定疑似拆单"); } } @@ -400,10 +407,12 @@ public class OpenTheBillService { if (flag) { for (Map item : list) { item.put(Util.null2String(config.get("openBillKey")), "全部订单总金额达到GM审批标准,拆分后无法到达GM审批节点。"); + item.put(Util.null2String(config.get("additional")), "此单为系统判定疑似拆单"); } } else { for (Map item : list) { item.put(Util.null2String(config.get("openBillKey")), ""); + item.put(Util.null2String(config.get("additional")), ""); } } } @@ -468,6 +477,7 @@ public class OpenTheBillService { private void calculationCondition(List> dataList, Map config) { + Map convert = (Map) config.get("convert"); for (Map map : dataList) { // 订单分类 String orderType = Util.null2String(map.get(Util.null2String(config.get("orderType")))); @@ -500,7 +510,22 @@ public class OpenTheBillService { default: break; } + map.put(Util.null2String(config.get("additional")), ""); map.put(Util.null2String(config.get("conditionKey")), condition); + if (Objects.nonNull(convert)) { + for (Map.Entry entry : map.entrySet()) { + if (convert.containsKey(entry.getKey())) { + String sql = Util.null2String(convert.get(entry.getKey())); + if (StrUtil.isNotBlank(sql)) { + res.executeQuery(sql, entry.getValue()); + if (res.next()) { + entry.setValue(res.getInt(1)); + } else { + } + } + } + } + } } } diff --git a/src/main/java/com/api/youhong/ai/zhishichanquan/ssocaiwu/controller/SingleSignOnController.java b/src/main/java/com/api/youhong/ai/zhishichanquan/ssocaiwu/controller/SingleSignOnController.java index 02db8c1..480e5f3 100644 --- a/src/main/java/com/api/youhong/ai/zhishichanquan/ssocaiwu/controller/SingleSignOnController.java +++ b/src/main/java/com/api/youhong/ai/zhishichanquan/ssocaiwu/controller/SingleSignOnController.java @@ -15,6 +15,7 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Context; import java.lang.reflect.Method; +import java.net.URLEncoder; import java.util.HashMap; import java.util.Map; @@ -47,8 +48,10 @@ public class SingleSignOnController { Map param = new HashMap<>(8); param.put("user", value); param.put("ts", System.currentTimeMillis()); - String encrypt = AES.encrypt(key, initVector, JSON.toJSONString(param)); - response.sendRedirect(url + "?params=" + encrypt); + String json = JSON.toJSONString(param); + String encrypt = AES.encrypt(key, initVector, json); + Util.getLogger().info("加密内容: " + json + " 加密结果: " + encrypt); + response.sendRedirect(url + "?params=" + URLEncoder.encode(encrypt, "UTF-8")); } catch (Exception e) { log.error("单点登录路径处理失败!" + e.getMessage() + "\n" + Util.getErrString(e)); } diff --git a/src/main/java/com/engine/yunjinshan/modeDelete/service/impl/DeleteModeDataServiceImp.java b/src/main/java/com/engine/yunjinshan/modeDelete/service/impl/DeleteModeDataServiceImp.java new file mode 100644 index 0000000..a72934f --- /dev/null +++ b/src/main/java/com/engine/yunjinshan/modeDelete/service/impl/DeleteModeDataServiceImp.java @@ -0,0 +1,156 @@ +package com.engine.yunjinshan.modeDelete.service.impl; + +import com.alibaba.fastjson.JSON; +import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent; +import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter; +import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceBefore; +import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam; +import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaBeforeReplaceParam; +import weaver.conn.RecordSet; +import weaver.file.Prop; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.yunjinshan.formmode.action.CostIncomeUpdate; + +import java.util.*; + +/** + * 云锦山 + * 建模记录删除方法拦截方法 + */ +@WeaIocReplaceComponent("CubeExpandService") +public class DeleteModeDataServiceImp { + + /** + * 定义一个当前线程 + */ + private static final ThreadLocal>> threadLocal = new ThreadLocal<>(); + + private final static BaseBean bean = new BaseBean(); + + + /** + * 调用删除前 进行方法拦截 + * 人员成本管理、合同管理建模进行处理 + * + * @param weaBeforeReplaceParam 拦截参数 + */ + @WeaReplaceBefore(value = "/api/cube/expand/deleteData", order = 1, description = "删除建模数据,在数据删除前进行拦截") + public void before(WeaBeforeReplaceParam weaBeforeReplaceParam) { + // 获取请求参数 + Map param = weaBeforeReplaceParam.getParamMap(); + + bean.writeLog("进入删除拦截:" + JSON.toJSONString(param)); + // 模块ID + String modeId = Util.null2String(param.get("modeId")); + // 具体的数据ID + String billids = Util.null2String(param.get("billids")); + + // 人力成本管理模块ID + String humanCostModeId = Util.null2String(Prop.getPropValue("DeleteModeData", "HumanCostModeId"), "4"); + // 合同管理模块ID + String contractManagementModeId = Util.null2String(Prop.getPropValue("DeleteModeData", "ContractManagementModeId"), "3"); + + if ("".equals(humanCostModeId)) { + humanCostModeId = "4"; + } + + if ("".equals(contractManagementModeId)) { + contractManagementModeId = "3"; + } + // 人员成本管理、合同管理 建模模块 + if (contractManagementModeId.equals(modeId) || humanCostModeId.equals(modeId)) { + // 将待删除的记录写入临时表 + String selectData = ""; + + bean.writeLog("删除建模数据!模块id: " + modeId); + bean.writeLog("删除的数据id: " + billids); + + if (contractManagementModeId.equals(modeId)) { + selectData = "select qdny,yjbm,khmc from uf_hetongguanli where id in (" + billids + ")"; + } + + if (humanCostModeId.equals(modeId)) { + selectData = "select ny,yjbm,kh from uf_renlichengben where id in (" + billids + ")"; + } + + RecordSet rs = new RecordSet(); + + // 从当前线程中获取已删除的记录 + List> dataList = new ArrayList<>(); + + if (rs.executeQuery(selectData)) { + while (rs.next()) { + // 年月 + String yearMonth = Util.null2String(rs.getString(1)); + // 一级部门 + String superiorDepartment = Util.null2String(rs.getString(2)); + // 客户 + String customer = Util.null2String(rs.getString(3)); + + Map detailMap = new HashMap<>(8); + detailMap.put("yearMonth", yearMonth); + detailMap.put("superiorDepartment", superiorDepartment); + detailMap.put("customer", customer); + detailMap.put("modeId", modeId); + dataList.add(detailMap); + } + } + + threadLocal.set(dataList); + } + } + + /** + * 调用删除后 进行方法拦截 + * 人员成本管理、合同管理建模进行处理 + * + * @param weaAfterReplaceParam 拦截参数 + */ + @WeaReplaceAfter(value = "/api/cube/expand/deleteData", order = 1, description = "删除建模数据,在数据删除后进行拦截,处理特殊业务") + public void after(WeaAfterReplaceParam weaAfterReplaceParam) { + + bean.writeLog("----------------删除拦截后!"); + try { + // 从当前线程中获取已删除的记录 + List> dataList = threadLocal.get(); + + if (Objects.nonNull(dataList) && dataList.size() > 0) { + bean.writeLog("删除的数据信息: " + JSON.toJSONString(dataList)); + // 人力成本管理模块ID + String humanCostModeId = Util.null2String(Prop.getPropValue("DeleteModeData", "HumanCostModeId"), "4"); + // 合同管理模块ID + String contractManagementModeId = Util.null2String(Prop.getPropValue("DeleteModeData", "ContractManagementModeId"), "3"); + if ("".equals(humanCostModeId)) { + humanCostModeId = "4"; + } + if ("".equals(contractManagementModeId)) { + contractManagementModeId = "3"; + } + CostIncomeUpdate incomeUpdate = new CostIncomeUpdate(); + for (Map detailMap : dataList) { + // 年月 + String yearMonth = Util.null2String(detailMap.get("yearMonth")); + // 一级部门 + String superiorDepartment = Util.null2String(detailMap.get("superiorDepartment")); + // 客户 + String customer = Util.null2String(detailMap.get("customer")); + + String modeId = Util.null2String(detailMap.get("modeId")); + + if (humanCostModeId.equals(modeId)) { + incomeUpdate.updateByHumanCost(yearMonth, superiorDepartment, customer); + } + if (contractManagementModeId.equals(modeId)) { + incomeUpdate.updateByContract(yearMonth, superiorDepartment, customer); + } + } + } + + } catch (Exception e) { + bean.writeLog("处理删除数据信息异常!异常信息:" + e.getMessage()); + } finally { + threadLocal.remove(); + } + } +} diff --git a/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java b/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java index e9b168e..4430fe4 100644 --- a/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java +++ b/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java @@ -5,7 +5,6 @@ import com.google.common.base.Strings; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import weaver.conn.RecordSet; @@ -61,7 +60,7 @@ public class DealWithMapping extends ToolUtil { private RecordSet tempRs; private DealWithMapper mapper = null; - + private final Logger logger = aiyh.utils.Util.getLogger("json-util"); { @@ -1521,33 +1520,6 @@ public class DealWithMapping extends ToolUtil { if (split.length > 1) { paramStr = Arrays.stream(split).skip(1).collect(Collectors.joining("?")); } -/* 获取?后的参数:"weaver.aiyh_jitu.pushdata.service.toones.GetRequestValueCusGetValueImpl?" + - "requestType=get&apiOnlyMark=getAssign&valueKey=data&assign=#{main.zd2}&" + - "#processorClass=weaver.aiyh_jitu.pushdata.service.toones.GetAssignProcessorProcessorImpl" + - "&afterProcessor.hrmId=#{main.zd2}&beforeProcessor.hrmId=#{main.zd2}&高=udh高殿下g" + - "&assignValue=#sql{select workcode from hrmresource where id = #{main.zd1} and test = #{h-hah} and a in (${hrmids})}&hah=haode"; - 最终获取到的map,如下 - key:requestType - value:get - key:apiOnlyMark - value:getAssign - key:valueKey - value:data - key:assign - value:#{main.zd2} - key:#processorClass - value:weaver.aiyh_jitu.pushdata.service.toones.GetAssignProcessorProcessorImpl - key:afterProcessor.hrmId - value:#{main.zd2} - key:beforeProcessor.hrmId - value:#{main.zd2} - key:高 - value:udh高殿下g - key:assignValue - value:#sql{select workcode from hrmresource where id = #{main.zd1} and test = #{h-hah} and a in (${hrmids})} - key:hah - value:haode*/ - // 最终通过反射调用weaver.aiyh_jitu.pushdata.service.GetAssignProcessorProcessorImpl类,将参数传递给这个类, 使用``包裹的字符串会被解析为一个字符串 String pattern = "&?(?([#.\\w\\u4E00-\\u9FA5]+))=" + "(?((`([^`]*)`)|" + "((#(\\{|sql\\{))?([():/\\-$_#={ }.\\w\\u4E00-\\u9FA5?]+)?}?)))&?"; diff --git a/src/main/java/weaver/youhong/ai/geerde/action/submitfirst/AutoSubmitFirstAction.java b/src/main/java/weaver/youhong/ai/geerde/action/submitfirst/AutoSubmitFirstAction.java new file mode 100644 index 0000000..1092996 --- /dev/null +++ b/src/main/java/weaver/youhong/ai/geerde/action/submitfirst/AutoSubmitFirstAction.java @@ -0,0 +1,61 @@ +package weaver.youhong.ai.geerde.action.submitfirst; + +import aiyh.utils.Util; +import aiyh.utils.action.SafeCusBaseAction; +import aiyh.utils.annotation.ActionDesc; +import aiyh.utils.annotation.ActionOptionalParam; +import aiyh.utils.annotation.PrintParamMark; +import aiyh.utils.annotation.RequiredMark; +import aiyh.utils.tool.cn.hutool.core.util.StrUtil; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import weaver.hrm.User; +import weaver.soa.workflow.request.RequestInfo; +import weaver.youhong.ai.geerde.action.submitfirst.mapper.AutoSubmitFirstMapper; + +import java.util.Map; + +/** + *

自动提交第一次经过节点的流程

+ * + *

create: 2023/5/17 18:52

+ * + * @author youHong.ai + */ +@Getter +@Setter +@ToString +@ActionDesc(author = "youhong.ai", value = "自动流程提交,需要挂在需要提交的流程节点的节点前或者前一个节点的节点后或者两个节点的流转出口线上") +public class AutoSubmitFirstAction extends SafeCusBaseAction { + + private final AutoSubmitFirstMapper mapper = Util.getMapper(AutoSubmitFirstMapper.class); + + @RequiredMark(value = "account", desc = "主表流程经过标识字段,整数或单行文本字段名都可以") + @PrintParamMark + private String accountField; + + @ActionOptionalParam(value = "1", desc = "流程操作人id,默认为1-系统管理员") + @PrintParamMark + private String operator = "1"; + + @Override + + public void doSubmit(String requestId, String billTable, + int workflowId, User user, + RequestInfo requestInfo) { + Map mainTableValue = getMainTableValue(requestInfo); + log.info("do submit action!"); + if (mainTableValue.containsKey(accountField)) { + if (StrUtil.isNotBlank(mainTableValue.get(accountField))) { + return; + } + String creatorId = requestInfo.getCreatorid(); + mapper.updateMark(billTable, accountField, "1", + mainTableValue.get("id")); + Util.submitWorkflowThread(Integer.parseInt(requestId), Integer.parseInt(creatorId), + ""); + + } + } +} diff --git a/src/main/java/weaver/youhong/ai/geerde/action/submitfirst/mapper/AutoSubmitFirstMapper.java b/src/main/java/weaver/youhong/ai/geerde/action/submitfirst/mapper/AutoSubmitFirstMapper.java new file mode 100644 index 0000000..199c825 --- /dev/null +++ b/src/main/java/weaver/youhong/ai/geerde/action/submitfirst/mapper/AutoSubmitFirstMapper.java @@ -0,0 +1,22 @@ +package weaver.youhong.ai.geerde.action.submitfirst.mapper; + +import aiyh.utils.annotation.recordset.ParamMapper; +import aiyh.utils.annotation.recordset.SqlMapper; +import aiyh.utils.annotation.recordset.Update; + +/** + *

自动提交流程标识更新

+ * + *

create: 2023/5/17 18:56

+ * + * @author youHong.ai + */ +@SqlMapper +public interface AutoSubmitFirstMapper { + + @Update("update $t{tableName} set $t{fieldName} = #{value} where id = #{id}") + boolean updateMark(@ParamMapper("tableName") String tableName, + @ParamMapper("fieldName") String fieldName, + @ParamMapper("value") String value, + @ParamMapper("id") String id); +} diff --git a/src/main/java/weaver/youhong/ai/intellectualproperty/action/CaElectronicSignatureAction.java b/src/main/java/weaver/youhong/ai/intellectualproperty/action/CaElectronicSignatureAction.java index c9d1abb..941e75a 100644 --- a/src/main/java/weaver/youhong/ai/intellectualproperty/action/CaElectronicSignatureAction.java +++ b/src/main/java/weaver/youhong/ai/intellectualproperty/action/CaElectronicSignatureAction.java @@ -87,8 +87,9 @@ public class CaElectronicSignatureAction extends SafeCusBaseAction { throw new CustomerException(responeVo.getCode() + ", fetch ca sign fail! "); } Map responseMap = responeVo.getResponseMap(); - String documentNo = Util.null2String(responseMap.get("document_no")); - String pdf = Util.null2String(responseMap.get("ofd")); + Map data = (Map) responseMap.get("data"); + String documentNo = Util.null2String(data.get("document_no")); + String pdf = Util.null2String(data.get("ofd")); InputStream inputStream = base64ContentToFile(pdf); String docCategorys = Util.getDocCategorysByTable(String.valueOf(workflowId), signFileField, billTable); String[] docCategoryArr = docCategorys.split(","); diff --git a/src/main/java/weaver/youhong/ai/intellectualproperty/cusgetvalue/GetOfdKeywordPageValue.java b/src/main/java/weaver/youhong/ai/intellectualproperty/cusgetvalue/GetOfdKeywordPageValue.java new file mode 100644 index 0000000..0ec283d --- /dev/null +++ b/src/main/java/weaver/youhong/ai/intellectualproperty/cusgetvalue/GetOfdKeywordPageValue.java @@ -0,0 +1,55 @@ +package weaver.youhong.ai.intellectualproperty.cusgetvalue; + +import aiyh.utils.Util; +import aiyh.utils.entity.DocImageInfo; +import aiyh.utils.excention.CustomerException; +import aiyh.utils.tool.cn.hutool.core.util.StrUtil; +import org.apache.log4j.Logger; +import weaver.file.ImageFileManager; +import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue; +import weaver.youhong.ai.intellectualproperty.util.OFDReader; + +import java.io.InputStream; +import java.util.List; +import java.util.Map; + +/** + *

获取关键字页码

+ * + *

create: 2023/5/18 16:56

+ * + * @author youHong.ai + */ +public class GetOfdKeywordPageValue implements CusInterfaceGetValue { + private final Logger log = Util.getLogger(); + + @Override + public Object execute(Map mainMap, Map detailMap, String currentValue, Map pathParam) { + try { + + DocImageInfo docImageInfo = Util.selectImageInfoByDocId(currentValue); + InputStream inputStream = ImageFileManager.getInputStreamById(docImageInfo.getImageFileId()); + String filePath = Util.createTempFile(inputStream, docImageInfo.getImageFileName()); + String keywordType = pathParam.get("keywordType"); + String keywordValue = ""; + String keyword = pathParam.get("keyword"); + if (StrUtil.isNotBlank(keywordType)) { + if ("1".equals(keywordType)) { + keywordValue = Util.null2String(mainMap.get(keyword)); + } + } else { + keywordValue = keyword; + } + OFDReader reader = new OFDReader(filePath, keywordValue); + List keywordInfos = reader.findKeywords(); + if (keywordInfos.isEmpty()) { + throw new CustomerException("关键字定位异常!未找到关键字"); + } else { + return keywordInfos.get(0).getPageNumber(); + } + } catch (Exception e) { + log.error("关键字定位异常: " + Util.getErrString(e)); + throw new CustomerException("关键字定位异常!", e); + } + } +} diff --git a/src/main/java/weaver/youhong/ai/intellectualproperty/util/OFDReader.java b/src/main/java/weaver/youhong/ai/intellectualproperty/util/OFDReader.java new file mode 100644 index 0000000..fda40c4 --- /dev/null +++ b/src/main/java/weaver/youhong/ai/intellectualproperty/util/OFDReader.java @@ -0,0 +1,146 @@ +package weaver.youhong.ai.intellectualproperty.util; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +/** + *

ofd读区关键字

+ */ +public class OFDReader { + + private final String ofdFilePath; + private final String keyword; + + public OFDReader(String ofdFilePath, String keyword) { + this.ofdFilePath = ofdFilePath; + this.keyword = keyword; + } + + public List findKeywords() throws Exception { + // 解析OFD.xml文件,获取OFD的根目录路径 + String rootDirPath = parseOFDXmlAndGetRootDirPath(); + if (rootDirPath == null) { + throw new Exception("Failed to parse OFD.xml file!"); + } + + // 打开OFD文件并获取ZipFile对象 + ZipFile zipFile = new ZipFile(ofdFilePath); + + // 获取Pages目录下的所有页面文件夹 + List pageFolders = getPageFolders(zipFile, rootDirPath); + if (pageFolders == null || pageFolders.isEmpty()) { + throw new Exception("No page found in the OFD file!"); + } + + // 查找所有关键字的位置信息 + List result = new ArrayList<>(); + for (String pageFolder : pageFolders) { + KeywordInfo keywordInfo = findKeywordInPage(zipFile, pageFolder); + if (keywordInfo != null) { + result.add(keywordInfo); + } + } + + zipFile.close(); + return result; + } + + // 解析OFD.xml文件并获取OFD的根目录路径 + private String parseOFDXmlAndGetRootDirPath() throws Exception { + ZipFile zipFile = new ZipFile(ofdFilePath); + ZipEntry ofdXmlEntry = zipFile.getEntry("OFD.xml"); + InputStream inputStream = zipFile.getInputStream(ofdXmlEntry); + + Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream); + NodeList docRootNodes = doc.getElementsByTagName("ofd:DocRoot"); + if (docRootNodes.getLength() == 0) { + return null; + } + + String docRootPath = docRootNodes.item(0).getTextContent(); + String[] docRootPathSegments = docRootPath.split("/"); + if (docRootPathSegments.length == 0) { + return null; + } + + return docRootPathSegments[0]; + } + + // 获取Pages目录下的所有页面文件夹 + private List getPageFolders(ZipFile zipFile, String rootDirPath) { + List pageFolders = new ArrayList<>(); + String pagesDirPath = rootDirPath + "/Pages/"; + + // 遍历OFD文件中所有的ZipEntry对象,查找所有页面文件夹 + zipFile.stream().forEach(entry -> { + if (entry.getName().startsWith(pagesDirPath) && entry.isDirectory() && !entry.getName().equals(pagesDirPath)) { + pageFolders.add(entry.getName()); + } + }); + + return pageFolders; + } + + // 在指定页面中查找关键字 + private KeywordInfo findKeywordInPage(ZipFile zipFile, String pageFolder) throws Exception { + ZipEntry contentXmlEntry = zipFile.getEntry(pageFolder + "Content.xml"); + InputStream inputStream = zipFile.getInputStream(contentXmlEntry); + + Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream); + NodeList textNodes = doc.getElementsByTagName("ofd:TextObject"); + + for (int i = 0; i < textNodes.getLength(); i++) { + Node textNode = textNodes.item(i); + String textContent = textNode.getTextContent(); + + if (textContent.contains(keyword)) { + Node boundaryNode = textNode.getAttributes().getNamedItem("Boundary"); + String boundary = boundaryNode.getNodeValue(); + String[] boundarySegments = boundary.split(" "); + + double x = Double.parseDouble(boundarySegments[0]); + double y = Double.parseDouble(boundarySegments[1]); + double width = Double.parseDouble(boundarySegments[2]); + double height = Double.parseDouble(boundarySegments[3]); + + KeywordInfo keywordInfo = new KeywordInfo(pageFolder, x, y, width, height); + return keywordInfo; + } + } + + return null; + } + + public static class KeywordInfo { + private final String pageFolder; + private final double x; + private final double y; + private final double width; + private final double height; + + public KeywordInfo(String pageFolder, double x, double y, double width, double height) { + this.pageFolder = pageFolder; + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + + public String getPageNumber() { + int pageNumber = Integer.parseInt(pageFolder.substring(pageFolder.lastIndexOf('_') + 1, pageFolder.length() - 1)); + return String.valueOf(pageNumber); + } + + public String getBoundingBox() { + return "(" + x + ", " + y + ", " + width + ", " + height + ")"; + } + } +} diff --git a/src/main/java/weaver/yunjinshan/formmode/action/ContractExpandAction.java b/src/main/java/weaver/yunjinshan/formmode/action/ContractExpandAction.java new file mode 100644 index 0000000..5bf9464 --- /dev/null +++ b/src/main/java/weaver/yunjinshan/formmode/action/ContractExpandAction.java @@ -0,0 +1,109 @@ +package weaver.yunjinshan.formmode.action; + +import weaver.conn.RecordSet; +import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.soa.workflow.request.MainTableInfo; +import weaver.soa.workflow.request.Property; +import weaver.soa.workflow.request.RequestInfo; + +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.Map; + +/** + * 云锦山 + * 合同管理模块 新建、编辑保存和导入时,自定义扩展功能 + */ +public class ContractExpandAction extends AbstractModeExpandJavaCodeNew { + + /** + * 模块主表名称 + */ + private final static String modeTableName = "uf_hetongguanli"; + + /** + * 浮点数格式化 + */ + private final DecimalFormat df = new DecimalFormat("##############################0.0000"); + + /** + * 执行模块扩展动作 + * @param param + * param包含(但不限于)以下数据 + * user 当前用户 + * importtype 导入方式(仅在批量导入的接口动作会传输) 1 追加,2覆盖,3更新,获取方式(int)param.get("importtype") + * 导入链接中拼接的特殊参数(仅在批量导入的接口动作会传输),比如a=1,可通过param.get("a")获取参数值 + * 页面链接拼接的参数,比如b=2,可以通过param.get("b")来获取参数 + * @return 返回执行结果 + */ + public Map doModeExpand(Map param) { + Map result = new HashMap<>(); + try { + BaseBean bean = new BaseBean(); + + bean.writeLog("-------------ContractExpandAction Begin----------------"); + + bean.writeLog("param:[" + param.toString() + "]"); + + int billid;//数据id + int modeid;//模块id + RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo"); + if (requestInfo != null) { + billid = Util.getIntValue(requestInfo.getRequestid()); + modeid = Util.getIntValue(requestInfo.getWorkflowid()); + + bean.writeLog("billid:[" + billid + "],modeid:[" + modeid + "]"); + + if (billid > 0 && modeid > 0) { + //String selectData = "select * from " + modeTableName + " where id = ?"; + + //年月 + String yearMonth = ""; + //一级部门 + String superiorDepartment = ""; + //客户 + String customer = ""; + + MainTableInfo mainTableInfo = requestInfo.getMainTableInfo(); + + for(Property p : mainTableInfo.getProperty()){ + if("qdny".equalsIgnoreCase(p.getName())) { + yearMonth = p.getValue(); + } + + if("yjbm".equalsIgnoreCase(p.getName())){ + superiorDepartment = p.getValue(); + } + if("khmc".equalsIgnoreCase(p.getName())){ + customer = p.getValue(); + } + } + + /* + RecordSet rs = new RecordSet(); + if(rs.executeQuery(selectData,billid)){ + if(rs.next()){ + yearMonth = Util.null2String(rs.getString("qdny")); + superiorDepartment = Util.null2String(rs.getString("yjbm")); + customer = Util.null2String(rs.getString("khmc")); + } + } + */ + + CostIncomeUpdate incomeUpdate = new CostIncomeUpdate(); + incomeUpdate.updateByContract(yearMonth,superiorDepartment,customer); + } + } + bean.writeLog("-------------ContractExpandAction End----------------"); + result.put("flag", "true"); + } catch (Exception e) { + result.put("errmsg",e.getMessage()); + result.put("flag", "false"); + e.printStackTrace(); + } + + return result; + } +} diff --git a/src/main/java/weaver/yunjinshan/formmode/action/CostIncomeUpdate.java b/src/main/java/weaver/yunjinshan/formmode/action/CostIncomeUpdate.java new file mode 100644 index 0000000..9c33db7 --- /dev/null +++ b/src/main/java/weaver/yunjinshan/formmode/action/CostIncomeUpdate.java @@ -0,0 +1,101 @@ +package weaver.yunjinshan.formmode.action; + +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; + +import java.text.DecimalFormat; + +/** + * 云锦山 + * 成本收入更新操作 + */ +public class CostIncomeUpdate { + + private final static String contractModeTableName = "uf_hetongguanli"; + + private final static BaseBean bean = new BaseBean(); + + private final static RecordSet rs = new RecordSet(); + + /** + * 浮点数格式化 + */ + private final DecimalFormat df = new DecimalFormat("##############################0.0000"); + + /** + * 根据合同管理 变更成本收入 + * + * @param yearMonth 年月 + * @param superiorDepartment 一级部门 + * @param customer 客户 + */ + public void updateByContract(String yearMonth, String superiorDepartment, String customer) { + bean.writeLog("yearMonth:[" + yearMonth + "],superiorDepartment:[" + superiorDepartment + "],customer:[" + customer + "]"); + + // 合同金额合计 + double contractAmount = 0.0; + // 收款金额合计 + double receivableAmount = 0.0; + // 开票金额合计 + double invoiceAmount = 0.0; + // 获取该模块相同年月、一级部门、客户的合同金额合计 + String selectData = "select sum(isnull(htje,0.0)) from " + contractModeTableName + " where qdny = ? and yjbm = ? and khmc = ?"; + + if (rs.executeQuery(selectData, yearMonth, superiorDepartment, customer)) { + if (rs.next()) { + contractAmount = Util.getDoubleValue(rs.getString(1), 0.0); + } + } + + + selectData = "select sum(isnull(dt.ysje,0.0)) from " + contractModeTableName + "_dt1 dt inner join " + contractModeTableName + " m on dt.mainId = m.id " + + "where m.yjbm = ? and m.khmc = ? and (dt.skrq is not null and substring(dt.skrq,1,7) = ?)"; + + if (rs.executeQuery(selectData, superiorDepartment, customer, yearMonth) && rs.next()) { + receivableAmount = Util.getDoubleValue(rs.getString(1), 0.0); + } + + selectData = "select sum(isnull(dt.jshjje,0.0)) from " + contractModeTableName + "_dt2 dt inner join " + contractModeTableName + " m on dt.mainId = m.id " + + "where m.yjbm = ? and m.khmc = ? and (dt.kprq is not null and substring(dt.kprq,1,7) = ?)"; + + if (rs.executeQuery(selectData, superiorDepartment, customer, yearMonth) && rs.next()) { + invoiceAmount = Util.getDoubleValue(rs.getString(1), 0.0); + } + + String updateSQL = "update uf_chengbenshouru set yqhtjekkpje = " + df.format(contractAmount) + "," + + "yskje = " + df.format(receivableAmount) + "," + + "ykpjehs = " + df.format(invoiceAmount) + + " where ny = ? and yjbm = ? and kh = ?"; + + boolean isSuccess = rs.executeUpdate(updateSQL, yearMonth, superiorDepartment, customer); + + bean.writeLog("updateSQL:[" + updateSQL + "],执行结果:[" + isSuccess + "]"); + } + + /** + * 根据人力成本更新成本收入 + * + * @param yearMonth 年月 + * @param superiorDepartment 一级部门 + * @param customer 客户名称 + */ + public void updateByHumanCost(String yearMonth, String superiorDepartment, String customer) { + bean.writeLog("yearMonth:[" + yearMonth + "],superiorDepartment:[" + superiorDepartment + "],customer:[" + customer + "]"); + + double totalAmount = 0.0; + String selectData = "select sum(isnull(gszzffy,0.0)) from uf_renlichengben where ny = ? and yjbm = ? and kh = ?"; + + if (rs.executeQuery(selectData, yearMonth, superiorDepartment, customer)) { + if (rs.next()) { + totalAmount = Util.getDoubleValue(rs.getString(1), 0.0); + } + } + + String updateSQL = "update uf_chengbenshouru set rycb = " + df.format(totalAmount) + " where ny = ? and yjbm = ? and kh = ?"; + + boolean isSuccess = rs.executeUpdate(updateSQL, yearMonth, superiorDepartment, customer); + + bean.writeLog("updateSQL:[" + updateSQL + "],执行结果:[" + isSuccess + "]"); + } +} diff --git a/src/main/java/weaver/yunjinshan/formmode/action/HumanCostExpandAction.java b/src/main/java/weaver/yunjinshan/formmode/action/HumanCostExpandAction.java new file mode 100644 index 0000000..56565eb --- /dev/null +++ b/src/main/java/weaver/yunjinshan/formmode/action/HumanCostExpandAction.java @@ -0,0 +1,122 @@ +package weaver.yunjinshan.formmode.action; + +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.Map; + +import weaver.conn.RecordSet; +import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.soa.workflow.request.MainTableInfo; +import weaver.soa.workflow.request.Property; +import weaver.soa.workflow.request.RequestInfo; + + +/** + * 云锦山 + * 人力成本建模 新建、编辑保存和导入数据时,自定义扩展操作 + */ +public class HumanCostExpandAction extends AbstractModeExpandJavaCodeNew { + + private final DecimalFormat df = new DecimalFormat("##############################0.0000"); + + /** + * 执行模块扩展动作 + * @param param + * param包含(但不限于)以下数据 + * user 当前用户 + * importtype 导入方式(仅在批量导入的接口动作会传输) 1 追加,2覆盖,3更新,获取方式(int)param.get("importtype") + * 导入链接中拼接的特殊参数(仅在批量导入的接口动作会传输),比如a=1,可通过param.get("a")获取参数值 + * 页面链接拼接的参数,比如b=2,可以通过param.get("b")来获取参数 + * @return + */ + public Map doModeExpand(Map param) { + Map result = new HashMap(); + try { + BaseBean bean = new BaseBean(); + + bean.writeLog("-------------HumanCostExpandAction Begin----------------"); + + bean.writeLog("param:[" + param.toString() + "]"); + + int billid = -1;//数据id + int modeid = -1;//模块id + RequestInfo requestInfo = (RequestInfo)param.get("RequestInfo"); + if(requestInfo!=null){ + billid = Util.getIntValue(requestInfo.getRequestid()); + modeid = Util.getIntValue(requestInfo.getWorkflowid()); + + bean.writeLog("billid:[" + billid + "],modeid:[" + modeid + "]"); + if(billid>0&&modeid>0){ + //年月 + String yearMonth = ""; + //一级部门 + String superiorDepartment = ""; + //客户 + String customer = ""; + + MainTableInfo mainTableInfo = requestInfo.getMainTableInfo(); + + for(Property p : mainTableInfo.getProperty()){ + if("ny".equalsIgnoreCase(p.getName())) { + yearMonth = p.getValue(); + } + + if("yjbm".equalsIgnoreCase(p.getName())){ + superiorDepartment = p.getValue(); + } + if("kh".equalsIgnoreCase(p.getName())){ + customer = p.getValue(); + } + } + + /* + //查询该记录对应的信息 + String selectData = "select * from uf_renlichengben where id = ?"; + + if(rs.executeQuery(selectData,billid)){ + if(rs.next()){ + yearMonth = Util.null2String(rs.getString("ny")); + superiorDepartment = Util.null2String(rs.getString("yjbm")); + customer = Util.null2String(rs.getString("kh")); + } + } + + + bean.writeLog("yearMonth:[" + yearMonth + "],superiorDepartment:[" + superiorDepartment + "],customer:[" + customer + "]"); + + RecordSet rs = new RecordSet(); + + double totalAmount = 0.0; + String selectData = "select sum(isnull(gszzffy,0.0)) from uf_renlichengben where ny = ? and yjbm = ? and kh = ?"; + + if(rs.executeQuery(selectData,yearMonth,superiorDepartment,customer)){ + if(rs.next()){ + totalAmount = Util.getDoubleValue(rs.getString(1),0.0); + } + } + + String updateSQL = "update uf_chengbenshouru set rycb = " + df.format(totalAmount) + " where ny = ? and yjbm = ? and kh = ?"; + + boolean isSuccess = rs.executeUpdate(updateSQL,yearMonth,superiorDepartment,customer); + + bean.writeLog("updateSQL:[" + updateSQL + "],执行结果:[" + isSuccess + "]"); + */ + + CostIncomeUpdate incomeUpdate = new CostIncomeUpdate(); + incomeUpdate.updateByHumanCost(yearMonth,superiorDepartment,customer); + } + } + + result.put("flag", "true"); + + bean.writeLog("-------------HumanCostExpandAction End----------------"); + } catch (Exception e) { + result.put("errmsg","自定义出错信息"); + result.put("flag", "false"); + } + return result; + } + +} \ No newline at end of file diff --git a/src/main/resources/WEB-INF/prop/prop2map/JituMultilingual.properties b/src/main/resources/WEB-INF/prop/prop2map/JituMultilingual.properties index 4d44973..e90c747 100644 --- a/src/main/resources/WEB-INF/prop/prop2map/JituMultilingual.properties +++ b/src/main/resources/WEB-INF/prop/prop2map/JituMultilingual.properties @@ -1,7 +1,7 @@ #修改当前配置文件后需要重启, you must restart service at change the config file after # # 当前需要同步的语言, current active language -cus.multilingual.active=ZHS,IDN +cus.multilingual.active="ZHS,IDN" #中文 cus.multilingual.ZHS=7 #印尼 diff --git a/src/main/resources/WEB-INF/prop/prop2map/esteeLauderExcelExport.properties b/src/main/resources/WEB-INF/prop/prop2map/esteeLauderExcelExport.properties index 05ab7ad..2b972cf 100644 --- a/src/main/resources/WEB-INF/prop/prop2map/esteeLauderExcelExport.properties +++ b/src/main/resources/WEB-INF/prop/prop2map/esteeLauderExcelExport.properties @@ -18,6 +18,8 @@ export.createType=yyyy-MM-dd export.costCenter=cbzxyh # 条件key export.conditionKey=condition +#附加信息 +export.additional=ddsm #流水号-requestId export.requestId=lcid # bgm字段 @@ -41,72 +43,114 @@ export.sku=sku #导出表头设置 export.head.title[0]=序号 export.head.field[0]=no -export.head.title[1]=分组编号 -export.head.field[1]=groupId -export.head.title[2]=ID -export.head.field[2]=id -export.head.title[3]=条件 -export.head.field[3]=condition -export.head.title[4]=疑似拆单 -export.head.field[4]=openBill -export.head.title[5]=流水号 -export.head.field[5]=lcid -export.head.title[6]=shipTo -export.head.field[6]=shipto -export.head.title[7]=推送时间 -export.head.field[7]=insertTime -export.head.title[8]=审批开始时间 -export.head.field[8]=createdate -export.head.title[9]=申请提交时间 -export.head.field[9]=sqtjrq -export.head.title[10]=审批开始时间 -export.head.field[10]=LASTOPERATEDATE -export.head.title[11]=收方限制 -export.head.field[11]=ddlxms -export.head.title[12]=部门团队 -export.head.field[12]=SPART -export.head.title[13]=品牌部门 -export.head.field[13]=yjpp -export.head.title[14]=订单编号 -export.head.field[14]=ddbh -export.head.title[15]=订单说明 -export.head.field[15]=ddsm -export.head.title[16]=备注 -export.head.field[16]=bz -export.head.title[17]=成本中心-sap -export.head.field[17]=KOSTL -export.head.title[18]=成本中心-用户 -export.head.field[18]=cbzxyh -export.head.title[19]=财务科目 -export.head.field[19]=cwkm -export.head.title[20]=审批开始时间 -export.head.field[20]=LASTOPERATEDATE -export.head.title[21]=活动编号 -export.head.field[21]=hdbh -export.head.title[22]=businessKey -export.head.field[22]=businesskey -export.head.title[23]=申请人 -export.head.field[23]=SQRRLZY -export.head.title[24]=订单类型 -export.head.field[24]=AUART -export.head.title[25]=订单用途 -export.head.field[25]=VKAUS -export.head.title[26]=收货人 -export.head.field[26]=KUNNRSHIPTO -export.head.title[27]=收货人地址 -export.head.field[27]=shdz -export.head.title[28]=收货编号 -export.head.field[28]=hwbh -export.head.title[29]=收货类型 -export.head.field[29]=fl -export.head.title[30]=收货中文名 -export.head.field[30]=ZWMS -export.head.title[31]=数量 -export.head.field[31]=SL -export.head.title[32]=零售总额 -export.head.field[32]=kxpmxzlsj -export.head.title[33]=订单分类 -export.head.field[33]=ddlx -export.head.title[34]=gbm -export.head.field[34]=bgm +#export.head.title[1]=分组编号 +#export.head.field[1]=groupId +#export.head.title[2]=ID +#export.head.field[2]=id +export.head.title[1]=条件 +export.head.field[1]=condition +#export.head.title[4]=疑似拆单 +export.head.title[2]=拆单方式 +export.head.field[2]=openBill +export.head.title[3]=月份 +export.head.field[3]=sqtjrq +export.head.title[4]=SKU +export.head.field[4]=ZWMS +export.head.title[5]=部门 +export.head.field[5]=SPART +export.head.title[6]=订单编号 +export.head.field[6]=ddbh +export.head.title[7]=备注信息 +export.head.field[7]=bz +export.head.title[8]=附加信息 +export.head.field[8]=ddsm +export.head.title[9]=成本中心 +export.head.field[9]=KOSTL +export.head.title[10]=活动编号 +export.head.field[10]=hdbh +export.head.title[11]=流水号 +export.head.field[11]=lcid +export.head.title[12]=用户 +export.head.field[12]=cbzxyh +export.head.title[13]=订单类型 +export.head.field[13]=AUART +export.head.title[14]=订单用途 +export.head.field[14]=ddyt +export.head.title[15]=shipTo +export.head.field[15]=shipto +export.head.title[16]=办公室员工 +export.head.field[16]=KUNNRSHIPTO +export.head.title[17]=提交时间 +export.head.field[17]=LASTOPERATEDATE +export.head.title[18]=总数 +export.head.field[18]=SL +export.head.title[19]=成本总额 +export.head.field[19]=kxpmxzlsj +export.head.title[20]=总税额 +export.head.field[20]= +export.head.title[21]=总价格 +export.head.field[21]= +export.head.title[22]=订单时间 +export.head.field[22]=LASTOPERATEDATE +export.head.title[23]=到货方 +export.head.field[23]= +#export.head.title[5]=流水号 +#export.head.field[5]=lcid +#export.head.title[6]=shipTo +#export.head.field[6]=shipto +#export.head.title[7]=推送时间 +#export.head.field[7]=insertTime +#export.head.title[8]=审批开始时间 +#export.head.field[8]=createdate +#export.head.title[9]=申请提交时间 +#export.head.field[9]=sqtjrq +#export.head.title[10]=审批开始时间 +#export.head.field[10]=LASTOPERATEDATE +#export.head.title[11]=收方限制 +#export.head.field[11]=ddlxms +#export.head.title[12]=部门团队 +#export.head.field[12]=SPART +#export.head.title[13]=品牌部门 +#export.head.field[13]=yjpp +#export.head.title[14]=订单编号 +#export.head.field[14]=ddbh +#export.head.title[15]=订单说明 +#export.head.field[15]=ddsm +#export.head.title[16]=备注 +#export.head.field[16]=bz +#export.head.title[17]=成本中心-sap +#export.head.field[17]=KOSTL +#export.head.title[18]=成本中心-用户 +#export.head.field[18]=cbzxyh +#export.head.title[19]=财务科目 +#export.head.field[19]=cwkm +#export.head.title[20]=审批开始时间 +#export.head.field[20]=LASTOPERATEDATE +#export.head.title[21]=活动编号 +#export.head.field[21]=hdbh +#export.head.title[22]=businessKey +#export.head.field[22]=businesskey +#export.head.title[23]=申请人 +#export.head.field[23]=SQRRLZY +#export.head.title[24]=订单类型 +#export.head.field[24]=AUART +#export.head.title[25]=订单用途 +#export.head.field[25]=VKAUS +#export.head.title[26]=收货人 +#export.head.field[26]=KUNNRSHIPTO +#export.head.title[27]=收货人地址 +#export.head.field[27]=shdz +#export.head.title[28]=收货编号 +#export.head.field[28]=hwbh +#export.head.title[29]=收货类型 +#export.head.field[29]=fl +#export.head.title[30]=收货中文名 +#export.head.field[30]=ZWMS +#export.head.title[31]=数量 +#export.head.field[31]=SL +#export.head.title[32]=零售总额 +#export.head.field[32]=kxpmxzlsj +#export.head.title[33]=订单分类 +##xport.head.title[34]=gbm +#export.head.field[34]=bgm diff --git a/src/main/resources/cus_getlog/css/index.css b/src/main/resources/cus_getlog/css/index.css new file mode 100755 index 0000000..676061b --- /dev/null +++ b/src/main/resources/cus_getlog/css/index.css @@ -0,0 +1,91 @@ +body{ + background-color: rgb(241, 241, 241); + font-family: PingFangSC-Regular; + color: #333333 ; + } + .box{ + width: 1000px; + margin:0 auto; + margin-top: 100px; + background-color: #ffffff; + font-size: 14px; + + } + .mytitle{ + width: 100%; + background-color: #F6F6F6 ; + height: 40px; + font-size: 14px; + background: #F6F6F6; + border: 1px solid #E2E2E2; + + } + .clusterIp{ + display: inline-block; + width: 120px; + + } + input[type='checkbox']{ + } + + .cluster{ + border-bottom: 1px solid #E2E2E2; + width: 80%; + margin-left: 39px; + height: 100px; + padding-top: 26px; + } + .Button{ + color: #fff; + background-color: #2DB7F5; + border-color: #4cae4c; + + display: inline-block; + margin-bottom: 0; + font-size: 14px; + font-weight: 300; + line-height: 1.42857143; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + border: 1px solid transparent; + width:70px; + height:30px; + border-radius: 3px; + } + + .Wdate{ + width: 150px; + height: 30px !important; + padding-left: 5px; + padding-right: 5px; + } + + .clusterPlan{ + margin-top: 20px; + margin-left:30px; + font-size: 12px; + } + + .contend{ + background: #FFFFFF; + border-left: 1px solid #E2E2E2; + border-right: 1px solid #E2E2E2; + border-bottom: 1px solid #E2E2E2; + width: 100%; + } + .messages{ + color:red; + } + + #start[disabled]{ + background-color: #A9A9A9; + } diff --git a/src/main/resources/cus_getlog/downlog.jsp b/src/main/resources/cus_getlog/downlog.jsp new file mode 100755 index 0000000..aa682b8 --- /dev/null +++ b/src/main/resources/cus_getlog/downlog.jsp @@ -0,0 +1,138 @@ +<%@ page language="java" %> +<%@ page import="org.apache.commons.httpclient.HttpClient" %> +<%@ page import="org.apache.commons.httpclient.methods.GetMethod" %> +<%@ page import="javax.servlet.http.HttpServletRequest" %> +<%@ page import="javax.servlet.http.HttpServletResponse" %> +<%@ page import="java.io.File" %> +<%@ page import="java.io.FileInputStream" %> +<%@ page import="java.io.InputStream" %> +<%@ page import="java.io.OutputStream" %> +<%@ page import="java.util.regex.Matcher" %> +<%@ page import="java.util.regex.Pattern" %> +<% + + String logName = request.getParameter("logName"); + String otherIp = request.getParameter("otherIp"); + + weaver.hrm.User user = (weaver.hrm.User) request.getSession(true).getAttribute("weaver_user@bean"); + String ip = getIpAddress(request); + if (user == null || !"sysadmin".equals(user.getLoginid())) { + return; + } + + if (otherIp != null) { + otherIp = otherIp.replace("-", ":"); + downotherlog(logName, otherIp, response); + } else { + deal(request, response); + } +%><%! + public static boolean innerIP(String ip) { + String pattern = "((192\\.168|172\\.([1][6-9]|[2]\\d|3[01]))" + + "(\\.([2][0-4]\\d|[2][5][0-5]|[01]?\\d?\\d)){2}|" + + "^(\\D)*10(\\.([2][0-4]\\d|[2][5][0-5]|[01]?\\d?\\d)){3})"; + Pattern reg = Pattern.compile(pattern); + Matcher match = reg.matcher(ip); + return match.find() || ip.equals("127.0.0.1"); + + } + + public String getIpAddress(HttpServletRequest request) { + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + if (ip.contains(",")) { + return ip.split(",")[0]; + } else { + return ip; + } + } + + private void deal(HttpServletRequest request, HttpServletResponse response) { + response.reset(); + String logName = request.getParameter("logName"); + if (!logName.endsWith(".zip") || logName.indexOf("/") != -1 || logName.indexOf("\\") != -1 || logName.indexOf("..") != -1) { + + return; + } + FileInputStream in = null; + OutputStream outs = null; + try { + response.setContentType("application/octet-stream"); + response.setHeader("content-disposition", "attachment;filename=" + logName); + response.setCharacterEncoding("ISO8859-1"); + String ecologyPathtmp = request.getRealPath("/"); + if (!ecologyPathtmp.endsWith(File.separator)) { + ecologyPathtmp = ecologyPathtmp + File.separator; + } + if (logName.indexOf("..") != -1 || logName.indexOf("\0") != -1) { + return; + } + in = new FileInputStream(ecologyPathtmp + "cus_getlog" + File.separator + "log" + File.separator + logName); + outs = response.getOutputStream(); + outs.flush(); + byte[] buffer = new byte[1024]; + int len = 0; + while ((len = in.read(buffer)) > 0) { + outs.write(buffer, 0, len); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (in != null) { + in.close(); + } + if (outs != null) { + outs.flush(); + outs.close(); + } + } catch (Exception e) { + } + } + } + + private void downotherlog(String logName, String otherIp, HttpServletResponse response) { + response.reset(); + + InputStream in = null; + OutputStream outs = null; + try { + response.setContentType("application/octet-stream"); + response.setHeader("content-disposition", "attachment;filename=" + logName); + response.setCharacterEncoding("ISO8859-1"); + HttpClient client = new HttpClient(); + GetMethod httpget = new GetMethod("http://" + otherIp + "/cus_getlog/downlog.jsp?logName=" + logName); + client.executeMethod(httpget); + in = httpget.getResponseBodyAsStream(); + outs = response.getOutputStream(); + outs.flush(); + byte[] buffer = new byte[1024]; + int len = 0; + while ((len = in.read(buffer)) > 0) { + outs.write(buffer, 0, len); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (in != null) { + in.close(); + } + if (outs != null) { + outs.flush(); + outs.close(); + } + } catch (Exception e) { + } + } + } + +%> \ No newline at end of file diff --git a/src/main/resources/cus_getlog/getlog.jsp b/src/main/resources/cus_getlog/getlog.jsp new file mode 100755 index 0000000..c4a1be6 --- /dev/null +++ b/src/main/resources/cus_getlog/getlog.jsp @@ -0,0 +1,481 @@ +<%@ page language="java" contentType="text/html; charset=utf-8" %> +<%@ page import="java.io.*" %> +<%@ page import="java.math.BigDecimal" %> +<%@ page import="java.math.RoundingMode" %> +<%@ page import="java.net.InetAddress" %> +<%@ page import="java.net.NetworkInterface" %> +<%@ page import="java.text.SimpleDateFormat" %> +<%@ page import="java.util.*" %> +<%@ page import="java.util.regex.Matcher" %> +<%@ page import="java.util.regex.Pattern" %> +<%@ page import="java.util.zip.ZipEntry" %> +<%@ page import="java.util.zip.ZipOutputStream" %> + +<% + + weaver.hrm.User user = (weaver.hrm.User) request.getSession(true).getAttribute("weaver_user@bean"); + String ip = getIpAddress(request); + if (user == null || !"sysadmin".equals(user.getLoginid())) { + return; + } + + + String startStr = request.getParameter("startDate"); + String endStr = request.getParameter("endDate"); + String logTypeStr = request.getParameter("loytype"); + messageStr = new StringBuilder(); + + + String ecologyPathtmp = request.getRealPath("/"); + if (!ecologyPathtmp.endsWith(File.separator)) { + ecologyPathtmp = ecologyPathtmp + File.separator; + } + final String ecologyPath = ecologyPathtmp; + final String ResinPath = System.getProperty("user.dir") + File.separator; + //out.println(ResinPath+"
"); + String outPath = ecologyPath + File.separator + "getlog" + File.separator + "log"; // 日志输出目录 + List dates = getDateList(startStr, endStr); + File outFile = null; + try { + outFile = new File(outPath); + if (!outFile.exists()) { + outFile.mkdirs(); + } + } catch (Exception e) { + e.printStackTrace(); + } + String outLogPath = outFile + File.separator + getInnerIp() + "downLog.zip"; + Map logtype = new HashMap() { // 日志类型路径 + { + put("thread", ecologyPath + "log" + File.separator + "thread"); + put("mem", ecologyPath + "log" + File.separator + "mem"); + put("ecology", ecologyPath + "log"); + put("sql", ecologyPath + "log" + File.separator + "sql"); + + put("sqllog", ecologyPath + "sqllog"); + + put("security", ecologyPath + "WEB-INF" + File.separator + "securitylog"); + put("Resin", ResinPath + "log"); + put("integration", ecologyPath + "log" + File.separator + "integration"); + + put("monitorevent", ResinPath + "monitor" + File.separator + "resin" + File.separator + "app" + File.separator + "data" + File.separator + "event"); //运维平台的事件日志 + put("monitorPool", ResinPath + "monitor" + File.separator + "resin" + File.separator + "app" + File.separator + "data" + File.separator + "pool"); + put("monitorcpu", ResinPath + "monitor" + File.separator + "resin" + File.separator + "app" + File.separator + "data" + File.separator + "cpu"); + put("resinconf", ResinPath + "conf" + File.separator + "resin.conf"); + put("ecoloyweaver", ecologyPath + "WEB-INF" + File.separator + "prop" + File.separator); + put("monitorlog", ResinPath + "monitor" + File.separator + "resin" + File.separator + "log"); + put("monitorconcurrent", ResinPath + "monitor" + File.separator + "resin" + File.separator + "app" + File.separator + "data" + File.separator + "concurrent"); + + put("cus", ecologyPath + "log" + File.separator + "cus"); + put("util_cus", ecologyPath + "log" + File.separator + "cus" + File.separator + "util_cus"); + put("sql_log", ecologyPath + "log" + File.separator + "cus" + File.separator + "sql_log"); + put("http_util", ecologyPath + "log" + File.separator + "cus" + File.separator + "http_util"); + + } + }; + + + Map logMap = getLogType(logTypeStr, logtype); + Set keys = logMap.keySet(); + FileOutputStream fos = null; + try { + fos = new FileOutputStream(outLogPath); + ZipOutputStream zos = new ZipOutputStream(fos); + zos.setLevel(1); + Iterator it = keys.iterator(); + + while (it.hasNext()) { + String key = (String) it.next(); + for (int i = 0; i < dates.size(); i++) { + String date = (String) dates.get(i); + boolean isToDay = isToDay(date); + List fileNames = transition(key, (String) logtype.get(key), date, isToDay); + for (int j = 0; j < fileNames.size(); j++) { + String fileName = (String) fileNames.get(j); + //out.println(fileName+"
"); + String basePath = date + File.separator; + if ("sqllog".equals(key)) { + basePath += ("sqllog" + File.separator); + } + if ("monitorevent".equals(key)) { + basePath += ("event" + File.separator); + } + if ("monitorlog".equals(key)) { + basePath += ("monitorlog" + File.separator); + } + if (key.equals("cus")) { + basePath += ("cus" + File.separator); + } + if (key.equals("util_cus")) { + basePath += ("util_cus" + File.separator); + } + if (key.equals("sql_log")) { + basePath += ("sql_log" + File.separator); + } + if (key.equals("http_util")) { + basePath += ("http_util" + File.separator); + } + compressbyType(fileName, zos, basePath); + } + } + } + + try { + zos.close(); + } catch (Exception es) { + } + if (fos != null) + fos.close(); + File outLog = new File(outLogPath); + String fileSize = getFileSize(outLog); + out.println(fileSize + "," + messageStr); + } catch (Exception e) { + e.printStackTrace(); + } + long end = System.currentTimeMillis(); + // out.println(end - start); +%> +<%! + + public static boolean innerIP(String ip) { + String pattern = "((192\\.168|172\\.([1][6-9]|[2]\\d|3[01]))" + + "(\\.([2][0-4]\\d|[2][5][0-5]|[01]?\\d?\\d)){2}|" + + "^(\\D)*10(\\.([2][0-4]\\d|[2][5][0-5]|[01]?\\d?\\d)){3})"; + Pattern reg = Pattern.compile(pattern); + Matcher match = reg.matcher(ip); + return match.find() || ip.equals("127.0.0.1"); + } + + public String getIpAddress(HttpServletRequest request) { + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + if (ip.contains(",")) { + return ip.split(",")[0]; + } else { + return ip; + } + } + + + private StringBuilder messageStr = new StringBuilder(); + + private Map getLogType(String logTypeStr, Map logtype) { + Map resultmap = new HashMap(); + String[] strs = logTypeStr.split(","); + for (int i = 0; i < strs.length; i++) { + String str = strs[i]; + if (str.equals("monitor")) { + resultmap.put("thread", logtype.get("thread")); + resultmap.put("mem", logtype.get("mem")); + resultmap.put("sql", logtype.get("sql")); + resultmap.put("monitorevent", logtype.get("monitorevent")); + resultmap.put("monitorPool", logtype.get("monitorPool")); + resultmap.put("monitorcpu", logtype.get("monitorcpu")); + resultmap.put("resinconf", logtype.get("resinconf")); + resultmap.put("ecoloyweaver", logtype.get("ecoloyweaver")); + resultmap.put("monitorconcurrent", logtype.get("monitorconcurrent")); + resultmap.put("monitorlog", logtype.get("monitorlog")); + } + if (str.equals("Resin")) { + resultmap.put("Resin", logtype.get("Resin")); + } + if (str.equals("security")) { + resultmap.put("security", logtype.get("security")); + } + if (str.equals("ecology")) { + resultmap.put("ecology", logtype.get("ecology")); + } + if (str.equals("sql")) { + resultmap.put("sql", logtype.get("sql")); + } + if (str.equals("integration")) { + resultmap.put("integration", logtype.get("integration")); + } + if (str.equals("cus")) { + resultmap.put("cus", logtype.get("cus")); + } + if (str.equals("util_cus")) { + resultmap.put("util_cus", logtype.get("util_cus")); + } + if (str.equals("sql_log")) { + resultmap.put("sql_log", logtype.get("sql_log")); + } + if (str.equals("http_util")) { + resultmap.put("http_util", logtype.get("http_util")); + } + } + return resultmap; + } + + private List getDateList(String startDate, String endDate) { + ArrayList list = new ArrayList(); + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date start = sdf.parse(startDate); + Date end = sdf.parse(endDate); + Calendar tempStart = Calendar.getInstance(); + tempStart.setTime(start); + while (start.getTime() <= end.getTime()) { + list.add(sdf.format(tempStart.getTime())); + tempStart.add(Calendar.DAY_OF_YEAR, 1); + start = tempStart.getTime(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return list; + } + + private boolean isToDay(String date) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String toDay = sdf.format(new Date()); + return date.equals(toDay); + } + + public List transition(String key, String path, String date, boolean isToDay) {//转换真实的日志文件 + List list = new ArrayList(); + if ("thread".equals(key)) { + list.add(path + File.separator + date); + } else if ("mem".equals(key)) { + list.add(path + File.separator + "memory_" + date + ".log"); + } else if ("ecology".equals(key)) { + if (isToDay) { + list.add(path + File.separator + "ecology"); + } else { + list.add(path + File.separator + "ecology_" + getDateStr(date) + ".log"); + } + } else if ("sql".equals(key)) { + list.add(path + File.separator + "sqlcount_" + date + ".log"); + list.add(path + File.separator + "sqltime_" + date + ".log"); + } else if ("integration".equals(key)) { + if (isToDay) { + list.add(path + File.separator + "integration.log"); + } else { + list.add(path + File.separator + "integration.log_" + getDateStr(date) + ".log"); + } + } else if ("security".equals(key)) { + list.add(path + File.separator + "systemRunInfo" + date + ".log"); + list.add(path + File.separator + "systemSecurity" + date + ".log"); + } else if ("Resin".equals(key)) { + if (isToDay) { + list.add(path + File.separator + "stdout.log"); + list.add(path + File.separator + "stderr.log"); + } else { + list.add(path + File.separator + "stdout-" + getDateStr(date) + ".log.gz"); + list.add(path + File.separator + "stderr-" + getDateStr(date) + ".log.gz"); + } + list.add(path + File.separator + "watchdog-manager.log"); + list.add(path + File.separator + "jvm-default.log"); + } else if ("sqllog".equals(key)) { + list.add(path + File.separator + getSqlPathByDate(date)); + list.add(path + File.separator); + } else if ("monitorevent".equals(key)) { + list.addAll(eventLog(path, date)); + } else if ("monitorPool".equals(key)) { + list.add(path + File.separator + "pool_" + getDateStr(date) + "_ecology.log"); + list.add(path + File.separator + "pool_" + getDateStr(date) + "_ecology.zip"); + } else if ("monitorlog".equals(key)) { + if (isToDay) { + list.add(path + File.separator + "stdout.log"); + list.add(path + File.separator + "stderr-log"); + } else { + list.add(path + File.separator + "stdout-" + getDateStr(date) + ".log.gz"); + list.add(path + File.separator + "stderr-" + getDateStr(date) + ".log.gz"); + } + } else if ("monitorconcurrent".equals(key)) { + list.add(path + File.separator + "concurrent_" + getDateStr(date) + ".log"); + list.add(path + File.separator + "concurrent_" + getDateStr(date) + ".zip"); + } else if ("monitorcpu".equals(key)) { + list.add(path + File.separator + "cpu_" + getDateStr(date) + ".log"); + list.add(path + File.separator + "cpu_" + getDateStr(date) + ".zip"); + } else if ("resinconf".equals(key)) { + list.add(path); + } else if ("ecoloyweaver".equals(key)) { + dealWidthWeaverProp(path + "weaver.properties", new File(path + "weaversecurity.properties")); + list.add(path + "weaversecurity.properties"); + } else if ("cus".equals(key) || "util_cus".equals(key) || "sql_log".equals(key) || "http_util".equals(key)) { + if (isToDay) { + list.add(path + File.separator + "cus.log"); + } else { + list.add(path + File.separator + "cus.log_" + getDateStr(date) + ".log"); + } + } + return list; + } + + private void dealWidthWeaverProp(String path, File outFile) {//处理weaver.prop密码问题 + File file = new File(path); + if (!file.exists()) { + return; + } + InputStreamReader reader = null; + java.io.Writer outWriter = null; + try { + if (!file.exists()) { + file.createNewFile(); + } + Properties registerProp = new Properties(); + reader = new InputStreamReader(new FileInputStream(file)); + registerProp.load(reader); + reader.close(); + outWriter = new FileWriter(outFile); + registerProp.put("ecology.password", "***********"); + registerProp.store(outWriter, ""); + outWriter.close(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (reader != null) { + reader.close(); + } + if (outWriter != null) { + outWriter.close(); + } + } catch (Exception e) { + } + } + } + + + private List eventLog(String path, String date) { + List list = new ArrayList(); + File file = new File(path); + if (!file.exists()) { + return list; + } + File[] filelists = new File(path).listFiles(); + date = getDateStr(date); + for (int i = 0; i < filelists.length; i++) { + File filelist = filelists[i]; + if (filelist.getName().indexOf(date) != -1) { + list.add(filelist.getAbsolutePath()); + } + } + return list; + } + + private String getSqlPathByDate(String date) { + return date.replace("-", File.separator); + } + + public String getFileSize(File file) { + if (!file.exists()) { + return "0KB"; + } + long length = file.length(); + + BigDecimal b1 = new BigDecimal(Double.toString(length)); + BigDecimal b2 = new BigDecimal(Double.toString(1024)); + BigDecimal b3 = b1.divide(b2, 2, RoundingMode.HALF_UP); + b3.floatValue(); + if (b3.floatValue() > 1024) { + return b3.divide(b2, 2, RoundingMode.HALF_UP).floatValue() + "M"; + } else { + return b3.floatValue() + "KB"; + } + } + + private String getInnerIp() { + try { + Enumeration netInterfaces = NetworkInterface.getNetworkInterfaces(); + while (netInterfaces.hasMoreElements()) { + NetworkInterface ni = (NetworkInterface) netInterfaces.nextElement(); + Enumeration nii = ni.getInetAddresses(); + while (nii.hasMoreElements()) { + InetAddress inetAddress = (InetAddress) nii.nextElement(); + if (inetAddress.getHostAddress().indexOf(":") == -1) { + String ip = inetAddress.getHostAddress(); + if (ip.startsWith("10.") || ip.startsWith("192.168.")) {// || + return ip; + } else { + if (ip.startsWith("172.")) { + + return ip; + + } + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return "127.0.0.1"; + } + + private String getDateStr(String date) { + date = date.replaceAll("-", ""); + return date; + } + + /** + * 按照原路径的类型就行压缩。文件路径直接把文件压缩 + * @param src + * @param zos + * @param baseDir + */ + private void compressbyType(String src, ZipOutputStream zos, String baseDir) { + File srcFile = new File(src); + if (!srcFile.exists()) { + return; + } + //判断文件是否是文件,如果是文件调用compressFile方法,如果是路径,则调用compressDir方法; + if (srcFile.isFile()) { + //src是文件,调用此方法 + compressFile(srcFile, zos, baseDir); + } else if (srcFile.isDirectory()) { + compressDir(srcFile, zos, baseDir); + } + } + + /** + * 压缩文件,取后面的80M内容 + */ + private void compressFile(File file, ZipOutputStream zos, String baseDir) { + if (!file.exists()) + return; + try { + RandomAccessFile fileRead = new RandomAccessFile(file, "r"); //用读模式 + long fileLength = fileRead.length();//获得文件长度 + if (file.getName().endsWith(".log") && fileLength > 1073741820) {//如果文件超过80M,则只取文件倒数80M内容 + messageStr.append("、").append(file.getName()); + fileRead.seek(fileLength - 1073741820); + } else { + fileRead.seek(0); + } + ZipEntry entry = new ZipEntry(baseDir + file.getName()); + zos.putNextEntry(entry); + int hasRead; + byte[] buf = new byte[1024]; + while ((hasRead = fileRead.read(buf)) != -1) { + zos.write(buf, 0, hasRead); + } + fileRead.close(); + } catch (Exception e) { + + } + } + + /** + * 压缩文件夹 + */ + private void compressDir(File dir, ZipOutputStream zos, String baseDir) { + if (!dir.exists()) + return; + File[] files = dir.listFiles(); + for (int i = 0; i < files.length; i++) { + File file = files[i]; + compressFile(file, zos, baseDir + dir.getName() + File.separator); + } + } + +%> \ No newline at end of file diff --git a/src/main/resources/cus_getlog/img/loading.gif b/src/main/resources/cus_getlog/img/loading.gif new file mode 100755 index 0000000000000000000000000000000000000000..5bb90fd6a49107a321c35b9cee4a7b810314b51f GIT binary patch literal 1787 zcmZXTYfw{X9>&iJhvXcHF*h)T1OnEW1i^?zgDfop1p?usL*#PMGT;HQkSO{q6FlJyb$PWkPf|h*eTST}7h8z$}MF(XD(aQ)ZLZ zM?v0rT<1C4XHn<6PbNA{XL@>1^)apdD_@tcYDrW#m`k#MmslI7p^P;Az74wGs`!SI zLs$GEZHsafXsu1i-WleMzAL(yw$-LK{0hv;6hrx8kx!!4$``dAyBnY9Jz&DqJo2$A z!(L$H=KqBeY~CF_viHPz^tTglc?D97CqEBjzUwH}7GI zapg8YZM~>2Wk%E$d&r@9ly9b4Q zJpM7T@}r63I(OExUlG%Xcjz3MU+9U^r!SkpjNThDtaP)7>j6L5z%o5|^hlVOyI*uY zt^UU6NTuY?(Lb4ZIU2Zb5Vz}Pb7KF%ivf&j^CL>$cDz?rMNTQQ|NqDVD7mhghUp%h zhIA{gi{S8y9YhIIbSv$`B!JiPi!0#4#Jge0)p&YVPHchWcyAn zQhvb8ggXGXs9;k`u9Uq*YB>O+Q3Rq=2hlLFcG{Q3ORH_}JnY8C+r%@}6|%ySP%bWG zV~mA;?P`Q2L_Ss})nrJ{$TmeA9Tt*4=}X5x%RioM@_?ZsKSEST-f+GBv~Ya)xX3O{ z8!d=YthI-13OI;RN~`>|6u5L{z20oBp%9MIj)n$!Aw{Wpq&Rtr4~*_74Gjo@3el>B zz(Rk;;>2lp73<2;d=r*8z%WkdsG=vRuG_fvxO#uN^El|+5Qoz^X!2MfxJ3m}vyi?> zMLLDi8+${Z6YbUg?8GNR>-+SwHKdFyr%HqWcs|X_l*-DAC^bG&KCqWg7-_`UlwQ`EdOp_LJkr`L$mHHs75uP?fSgVfsDjuE#ft2b8HDt0yFt!+;C zEgL=)G9ZFt4wa+N3Xg7FGc0~`&EEt6_%7tyzmnb9B_h1~7~GD4V-Bhx7~QKRkF>&aT>(-!Us@aJxAY@8E?HW$G8g zSz@7Jcp>iCp;lU1ieF6n7!oAa-1E!rS0 zF1lBFVS%G#ZO}b@*+bIk+7@Q|iG60vIDVpV%4tW8rKyzwRo_<25;8*Ky@n z-sX>W*b;M){5lB_Edc@m1`VHy0@dg$PTR9uE$O2&a?KAe?xRlCj&Z$iZYw +<%@ page import="org.apache.commons.io.IOUtils" %> +<%@ page import="java.io.*" %> +<%@ page import="java.net.InetAddress" %> +<%@ page import="java.net.NetworkInterface" %> +<%@ page import="java.util.Enumeration" %> +<%@ page import="java.util.HashSet" %> +<%@ page import="java.util.Properties" %> +<%@ page import="java.util.Set" %> +<% + + final String ecologyPath = request.getRealPath("/"); + weaver.hrm.User user = (weaver.hrm.User) request.getSession(true).getAttribute("weaver_user@bean"); + if (user == null || !"sysadmin".equals(user.getLoginid())) { + response.sendRedirect("/"); + return; + } + final String ResinPath = System.getProperty("user.dir") + File.separator; + boolean isResin = ResinPath.toLowerCase().indexOf("resin") != -1; + String ecologyWeaverPath = ""; + if (ecologyPath.endsWith(File.separator)) { + ecologyWeaverPath = ecologyPath + "WEB-INF" + File.separator + "prop" + File.separator + "weaver.properties"; + } else { + ecologyWeaverPath = ecologyPath + File.separator + "WEB-INF" + File.separator + "prop" + File.separator + "weaver.properties"; + } + + File ecolpogyProp = new File(ecologyWeaverPath); + File resinProp = new File(ResinPath + "bin" + File.separator + "startresin.sh"); + + Set ipList = readEcologyProp(ecolpogyProp); + String localIp = getInnerIp(); + if (ipList.size() == 0) { + ipList.addAll(readResinProp(resinProp)); + } + boolean isCluster = true; + if (ipList.size() == 0) {//没有集群的时候 + //ipList.add(localIp); + isCluster = false; + } else { + boolean status = false; + java.util.Iterator it = ipList.iterator(); + while (it.hasNext()) { + String ip = (String) it.next(); + if (ip.indexOf(localIp) != -1 || "127.0.0.1".equals(ip) || "127.0.0.1".equals(localIp)) { + status = true; + } + } + if (!status) { + ipList.add(localIp); + } + } + + +%> + +<%! + /** + * 当前机器内网ip + * + * @return + */ + private String getInnerIp() { + try { + Enumeration netInterfaces = NetworkInterface.getNetworkInterfaces(); + while (netInterfaces.hasMoreElements()) { + NetworkInterface ni = (NetworkInterface) netInterfaces.nextElement(); + Enumeration nii = ni.getInetAddresses(); + while (nii.hasMoreElements()) { + InetAddress inetAddress = (InetAddress) nii.nextElement(); + if (inetAddress.getHostAddress().indexOf(":") == -1) { + String ip = inetAddress.getHostAddress(); + if (ip.startsWith("10.") || ip.startsWith("192.168.")) {// || + return ip; + } else { + if (ip.startsWith("172.")) { + return ip; + } + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return "127.0.0.1"; + } + + private Set readResinProp(File startResinFile) { + Set liststr = new HashSet(); + if (!startResinFile.exists()) { + return liststr; + } + if (startResinFile.isFile() && startResinFile.length() > 0) { + FileInputStream fileInput = null; + BufferedReader bufferedReader = null; + try { + fileInput = new FileInputStream(startResinFile); + bufferedReader = new BufferedReader(new InputStreamReader(fileInput)); + String str = null; + while ((str = bufferedReader.readLine()) != null) { + if (str.indexOf("-Dinitial_hosts") != -1 || str.indexOf("-J-Dinitial_hosts") != -1) { + if (str.indexOf("-J-Dinitial_hosts") != -1) { + str = str.substring(str.indexOf("-J-Dinitial_hosts") + 17); + } + if (str.indexOf("-Dinitial_hosts") != -1) { + str = str.substring(str.indexOf("-Dinitial_hosts") + 15); + } + str = str.indexOf("=") != -1 ? str.substring(str.indexOf("=") + 1) : str; + str = str.indexOf("-") != -1 ? str.substring(0, str.indexOf("-")) : str; + str = str.indexOf(" ") != -1 ? str.substring(0, str.indexOf(" ")) : str; + String[] ips = str.split(","); + for (int i = 0; i < ips.length; i++) { + String ip = ips[i]; + try { + String tmpip = ip.replace(".", "").replace(":", ""); + Long.parseLong(tmpip.trim()); + liststr.add(ip.trim()); + } catch (Exception e) { + } + } + } + } + } catch (Throwable t) { + t.printStackTrace(); + } finally { + IOUtils.closeQuietly(fileInput); + IOUtils.closeQuietly(bufferedReader); + } + } + return liststr; + } + + + private Set readEcologyProp(File file) { + Set liststr = new HashSet(); + try { + if (!file.exists()) { + return liststr; + } + Properties registerProp = new Properties(); + InputStreamReader reader = new InputStreamReader(new FileInputStream(file)); + registerProp.load(reader); + String initial_host = registerProp.getProperty("initial_hosts"); + if (initial_host != null && !"".equals(initial_host)) { + String[] initial_hosts = initial_host.split(","); + for (int i = 0; i < initial_hosts.length; i++) { + String initial_hostStr = initial_hosts[i]; + if (!initial_hostStr.isEmpty()) { + liststr.add(initial_hostStr); + } + } + } + IOUtils.closeQuietly(reader); + } catch (IOException e) { + e.printStackTrace(); + } + return liststr; + } +%> + + + + + + + + + + + +
+
+
+ ecology日志下载 +
+
+ +
+ <%if (isCluster) { %> +
+
服务器节点
+
+ <% + java.util.Iterator it = ipList.iterator(); + while (it.hasNext()) { + String ip = (String) it.next(); + %> +
+ +
+ <%}%> +
+
+ <%}%> + + +
+
日志类型
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
时间范围
+
+
+ 开始时间 + + - + 结束时间 + + + +
+
+
+ +
+
下载列表
+
+ <% + java.util.Iterator it = ipList.iterator(); + while (it.hasNext()) { + String ip = (String) it.next(); + ip = ip.replaceAll("\\.", ""); + ip = ip.replaceAll(":", ""); + %> +
+
+
+ <%}%> + + <%if (!isCluster) { %> +
+
+ <%} %> + +
+
+ + +
+ +
+ + \ No newline at end of file diff --git a/src/main/resources/cus_getlog/js/My97DatePicker/WdatePicker.js b/src/main/resources/cus_getlog/js/My97DatePicker/WdatePicker.js new file mode 100755 index 0000000..eef6cdc --- /dev/null +++ b/src/main/resources/cus_getlog/js/My97DatePicker/WdatePicker.js @@ -0,0 +1,56 @@ +/* + * My97 DatePicker 4.8 + * License: http://www.my97.net/dp/license.asp + */ +var $dp,WdatePicker;(function(){var l={ +$langList:[{name:"en",charset:"UTF-8"}, +{name:"zh-cn",charset:"gb2312"}, +{name:"zh-tw",charset:"GBK"}], +$skinList:[{name:"default",charset:"gb2312"}, +{name:"whyGreen",charset:"gb2312"}, +{name:"blue",charset:"gb2312"}, +{name:"green",charset:"gb2312"}, +{name:"simple",charset:"gb2312"}, +{name:"ext",charset:"gb2312"}, +{name:"blueFresh",charset:"gb2312"}, +{name:"twoer",charset:"gb2312"}, +{name:"YcloudRed",charset:"gb2312"}], +$wdate:true, +$crossFrame:false, +$preLoad:false, +$dpPath:"", +doubleCalendar:false, +enableKeyboard:true, +enableInputMask:true, +autoUpdateOnChanged:null, +weekMethod:"MSExcel", +position:{}, +lang:"auto", +skin:"default", +dateFmt:"yyyy-MM-dd", +realDateFmt:"yyyy-MM-dd", +realTimeFmt:"HH:mm:ss", +realFullFmt:"%Date %Time", +minDate:"0001-01-01 00:00:00", +maxDate:"9999-12-31 23:59:59", +minTime:"00:00:00", +maxTime:"23:59:59", +startDate:"", +alwaysUseStartDate:false, +yearOffset:1911, +firstDayOfWeek:0, +isShowWeek:false, +highLineWeekDay:true, +isShowClear:true, +isShowToday:true, +isShowOK:true, +isShowOthers:true, +readOnly:false, +errDealMode:0, +autoPickDate:null, +qsEnabled:true, +autoShowQS:false, +hmsMenuCfg:{H:[1,6],m:[5,6],s:[15,4]}, +opposite:false, + +specialDates:null,specialDays:null,disabledDates:null,disabledDays:null,onpicking:null,onpicked:null,onclearing:null,oncleared:null,ychanging:null,ychanged:null,Mchanging:null,Mchanged:null,dchanging:null,dchanged:null,Hchanging:null,Hchanged:null,mchanging:null,mchanged:null,schanging:null,schanged:null,eCont:null,vel:null,elProp:"",errMsg:"",quickSel:[],has:{},getRealLang:function(){var d=l.$langList;for(var e=0;e0?1:0;var K=new Date(this.dt.y,this.dt.M,0).getDate();this.dt.d=Math.min(K+M,this.dt.d)}}}}if(this.dt.refresh()){return this.dt}}return""},show:function(){var K=E[z].getElementsByTagName("div"),J=100000;for(var e=0;eJ){J=L}}this.dd.style.zIndex=J+2;r(this.dd,"block");r(this.dd.firstChild,"")},unbind:function(e){e=this.$(e);if(e.initcfg){t(e,"onclick",function(){g(e.initcfg)});t(e,"onfocus",function(){g(e.initcfg)})}},hide:function(){r(this.dd,"none")},attachEvent:k};for(var d in w){E.$dp[d]=w[d]}$dp=E.$dp}function k(I,J,w,d){if(I.addEventListener){var e=J.replace(/on/,"");w._ieEmuEventHandler=function(K){return w(K)};I.addEventListener(e,w._ieEmuEventHandler,d)}else{I.attachEvent(J,w)}}function t(w,I,e){if(w.removeEventListener){var d=I.replace(/on/,"");e._ieEmuEventHandler=function(J){return e(J)};w.removeEventListener(d,e._ieEmuEventHandler,false)}else{w.detachEvent(I,e)}}function C(w,e,d){if(typeof w!=typeof e){return false}if(typeof w=="object"){if(!d){for(var I in w){if(typeof e[I]=="undefined"){return false}if(!C(w[I],e[I],true)){return false}}}return true}else{if(typeof w=="function"&&typeof e=="function"){return w.toString()==e.toString()}else{return w==e}}}function q(){var I,w,d=n[z][H]("script");for(var e=0;e0){I=I.substring(0,w+1)}if(I){break}}return I}function m(w,I,J){var d=n[z][H]("HEAD").item(0),e=n[z].createElement("link");if(d){e.href=w;e.rel="stylesheet";e.type="text/css";if(I){e.title=I}if(J){e.charset=J}d.appendChild(e)}}function p(I){I=I||E;var L=0,d=0;while(I!=E){var N=I.parent[z][H]("iframe");for(var J=0;JI.scrollTop||d.scrollLeft>I.scrollLeft))?d:I;return{top:J.scrollTop,left:J.scrollLeft}}function s(d){try{var w=d?(d.srcElement||d.target):null;if($dp.cal&&!$dp.eCont&&$dp.dd&&w!=$dp.el&&$dp.dd.style.display=="block"){$dp.cal.close()}}catch(d){}}function A(){$dp.status=2}var G,j;function g(M,d){if(!$dp){return}b();var J={};for(var L in M){J[L]=M[L]}for(var L in l){if(L.substring(0,1)!="$"&&J[L]===undefined){J[L]=l[L]}}if(d){if(!w()){j=j||setInterval(function(){if(E[z].readyState=="complete"){clearInterval(j)}g(null,true)},50);return}if($dp.status==0){$dp.status=1;J.el=i;a(J,true)}else{return}}else{if(J.eCont){J.eCont=$dp.$(J.eCont);J.el=i;J.autoPickDate=true;J.qsEnabled=false;a(J)}else{if(l.$preLoad&&$dp.status!=2){return}var I=N();if(n.event===I||I){J.srcEl=I.srcElement||I.target;I.cancelBubble=true}J.el=J.el=$dp.$(J.el||J.srcEl);if(J.el==null){alert("WdatePicker:el is null")}try{if(!J.el||J.el.My97Mark===true||J.el.disabled||($dp.dd&&r($dp.dd)!="none"&&$dp.dd.style.left!="-970px")){if(J.el.My97Mark){J.el.My97Mark=false}return}}catch(K){}if(I&&J.el.nodeType==1&&!C(J.el.initcfg,M)){$dp.unbind(J.el);J.el.initcfg=M}a(J)}}function w(){if(h&&E!=n&&E[z].readyState!="complete"){return false}return true}function N(){if(f){try{func=N.caller;while(func!=null){var O=func.arguments[0];if(O&&(O+"").indexOf("Event")>=0){return O}func=func.caller}}catch(P){}return null}return event}}function c(e,d){return e.currentStyle?e.currentStyle[d]:document.defaultView.getComputedStyle(e,false)[d]}function r(e,d){if(e){if(d!=null){e.style.display=d}else{return c(e,"display")}}}function a(e,d){var K=e.el?e.el.nodeName:"INPUT";if(d||e.eCont||new RegExp(/input|textarea|div|span|p|a/ig).test(K)){e.elProp=K=="INPUT"?"value":"innerHTML"}else{return}if(e.lang=="auto"){e.lang=h?navigator.browserLanguage.toLowerCase():navigator.language.toLowerCase()}if(!e.eCont){for(var J in e){$dp[J]=e[J]}}if(!$dp.dd||e.eCont||($dp.dd&&(e.getRealLang().name!=$dp.dd.lang||e.skin!=$dp.dd.skin))){if(e.eCont){w(e.eCont,e)}else{$dp.dd=E[z].createElement("DIV");$dp.dd.style.cssText="position:absolute";E[z].body.appendChild($dp.dd);w($dp.dd,e);if(d){$dp.dd.style.left=$dp.dd.style.top="-970px"}else{$dp.show();I($dp)}}}else{if($dp.cal){$dp.show();$dp.cal.init();if(!$dp.eCont){I($dp)}}}function w(V,P){var O=E[z].domain,S=false,M='';V.innerHTML=M;var L=l.$langList,U=l.$skinList,T;try{T=V.lastChild.contentWindow[z]}catch(Q){S=true;V.removeChild(V.lastChild);var N=E[z].createElement("iframe");N.hideFocus=true;N.frameBorder=0;N.scrolling="no";N.src="javascript:(function(){var d=document;d.open();d.domain='"+O+"';})()";V.appendChild(N);setTimeout(function(){T=V.lastChild.contentWindow[z];R()},97);return}R();function R(){var Y=P.getRealLang();V.lang=Y.name;V.skin=P.skin;var X=["