From a6e6575bc3d668e14009ed0e931a376f1a4d86ff Mon Sep 17 00:00:00 2001
From: yuxc <653031404@qq.com>
Date: 星期六, 06 五月 2023 18:59:29 +0800
Subject: [PATCH] 编码管理代码上传
---
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciQueryWrapperForDO.java | 136 ++
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java | 23
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java | 23
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeWupinWrapper.java | 50
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeKeyattrrepeatServiceImpl.java | 72 +
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/annotation/VciBusinessLog.java | 31
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java | 7
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeWupinService.java | 43
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java | 25
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeWupinServiceImpl.java | 42
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeWupinVO.java | 35
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeWupinDTO.java | 34
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupinEntity.java | 376 +++++
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java | 83 +
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/enumpack/CodeDefaultLC.java | 141 ++
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java | 7
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeSerialValueMapper.java | 4
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeWupinController.java | 126 +
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java | 707 ++++++++++
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java | 220 ++
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java | 11
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeWupinMapper.java | 43
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/constant/RegExpConstant.java | 23
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java | 419 ++++++
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeKeyattrrepeatService.java | 15
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java | 6
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java | 47
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java | 63
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/ICodeWupinClient.java | 49
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/CodeWupinClient.java | 55
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 779 +++++++++++
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java | 32
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java | 147 ++
Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeWupinMapper.xml | 108 +
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java | 16
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java | 34
Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml | 13
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java | 8
38 files changed, 3,995 insertions(+), 58 deletions(-)
diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeWupinDTO.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeWupinDTO.java
new file mode 100644
index 0000000..5b6f264
--- /dev/null
+++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeWupinDTO.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 搴勯獮 (smallchill@163.com)
+ */
+package com.vci.ubcs.code.dto;
+
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 缂栫爜淇℃伅 鏁版嵁浼犺緭瀵硅薄瀹炰綋绫�
+ *
+ * @author yuxc
+ * @since 2023-05-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CodeWupinDTO extends CodeWupinEntity {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupinEntity.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupinEntity.java
new file mode 100644
index 0000000..82e50b4
--- /dev/null
+++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupinEntity.java
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 搴勯獮 (smallchill@163.com)
+ */
+package com.vci.ubcs.code.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.vci.ubcs.starter.revision.model.BaseModel;
+import lombok.Data;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.Date;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+/**
+ * 缂栫爜淇℃伅 瀹炰綋绫�
+ *
+ * @author yuxc
+ * @since 2023-05-05
+ */
+@Data
+@TableName("PL_CODE_WUPIN")
+@ApiModel(value = "CodeWupin瀵硅薄", description = "缂栫爜淇℃伅")
+@EqualsAndHashCode(callSuper = true)
+public class CodeWupinEntity extends BaseModel {
+
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String checkinby;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private Date checkintime;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String checkoutby;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private Date checkouttime;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String codeclsfid;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String codeclsfpath;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String codetemplateoid;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String materialclassify;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String materialid;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String tuhao;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String pinpai;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String morengongys;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xieyijiage;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String hesuanpici;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String beizhushuoming;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private Short materialtype;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String materialname;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String ruanjianbanben;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String qitachicun;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String morencaigouy;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String yumaileixing;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String chuangjiangongsi;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String caigouwl;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String wuliaoxingzhi;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xieyibianhao;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String caizhi;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String chukufangshi;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String shifoupihaoguanli;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String kucunwl;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xinghaoguige;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String duiwaiguige;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String zhibaoqi;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String caigoutiqianqi;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String hesuanfenlei;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xiaoshouwl;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String changjiaxinghao;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String zuixiaoqiding;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String jiliangdw;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String zhiliangbz;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String firstfl;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String secondfl;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String thrifl;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String oldcode;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String baozhuangguige;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String passing;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xbj;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xbxkxs;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xfjjstj;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xgzccdgcd;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xxndj;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xzjmc;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String zjxh;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String clph;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String bmcl;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String cpxs;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xbzjbmc;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String xwlwwmc;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String jjzyq;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String jsbmc;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String jsbxh;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String jsccj;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String jssxt;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String jszgl;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String jzl;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String jzrxx;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String jzxzb;
+
+ @ApiModelProperty(value = "")
+ @TableField(exist = false)
+ private String codeSecLengthField;
+
+}
diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeWupinVO.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeWupinVO.java
new file mode 100644
index 0000000..94a1859
--- /dev/null
+++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeWupinVO.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 搴勯獮 (smallchill@163.com)
+ */
+package com.vci.ubcs.code.vo;
+
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import org.springblade.core.tool.node.INode;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 缂栫爜淇℃伅 瑙嗗浘瀹炰綋绫�
+ *
+ * @author yuxc
+ * @since 2023-05-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CodeWupinVO extends CodeWupinEntity {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/annotation/VciBusinessLog.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/annotation/VciBusinessLog.java
new file mode 100644
index 0000000..c91de02
--- /dev/null
+++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/annotation/VciBusinessLog.java
@@ -0,0 +1,31 @@
+package com.vci.ubcs.starter.annotation;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface VciBusinessLog {
+ String modelName() default "";
+
+ String operateName() default "";
+
+ VciLogType logType() default VciBusinessLog.VciLogType.Operate;
+
+ String description() default "";
+
+ boolean notStore() default false;
+
+ public static enum VciLogType {
+ Login,
+ Operate,
+ Audit;
+
+ private VciLogType() {
+ }
+ }
+}
+
diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/constant/RegExpConstant.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/constant/RegExpConstant.java
new file mode 100644
index 0000000..739a741
--- /dev/null
+++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/constant/RegExpConstant.java
@@ -0,0 +1,23 @@
+package com.vci.ubcs.starter.web.constant;
+
+
+public class RegExpConstant {
+ public static final String INCLUDE_CHINESE = "[螒-锟";
+ public static final String NUMBER = "^[0-9]*$";
+ public static final String INT = "/^-?[1-9]+[0-9]*$/";
+ public static final String LONG = "/^-?[1-9]+[0-9]*$/";
+ public static final String DOUBLE = "[0-9]*(\\.[0-9]*|[eE][+-][0-9]*)$";
+ public static final String LETTER = "^[A-Za-z]+$";
+ public static final String LETTER_AND_NUMBER = "^[A-Za-z0-9]+$";
+ public static final String UP_LETTER = "^[A-Z]+$";
+ public static final String LOW_LETTER = "^[a-z]+$";
+ public static final String SPECIAL_CHARACTER = "^[` ~!@#$%^&*()_\\-+=<>?:\"{}|,.\\/;'\\[\\]路~锛丂#锟�%鈥︹��&*锛堬級鈥斺�擻\-+={}|銆娿�嬶紵锛氣�溾�濄�愩�戙�侊紱鈥樷�欙紝銆傘�乚+$";
+ public static final String HAS_LETTER = ".*[a-z][A-Z]{1,}.*";
+ public static final String HAS_UP_LETTER = ".*[A-Z]{1,}.*";
+ public static final String HAS_LOW_LETTER = ".*[a-z]{1,}.*";
+ public static final String HAS_NUMBER = ".*[0-9]{1,}.*";
+ public static final String HAS_SPECIAL_CHARACTER = ".*[` ~!@#$%^&*()_\\-+=<>?:\"{}|,.\\/;'\\[\\]路~锛丂#锟�%鈥︹��&*锛堬級鈥斺�擻\-+={}|銆娿�嬶紵锛氣�溾�濄�愩�戙�侊紱鈥樷�欙紝銆傘�乚{1,}.*";
+
+ public RegExpConstant() {
+ }
+}
diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java
index a3d65cc..4cb289a 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java
@@ -10,6 +10,7 @@
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.web.enumpck.BooleanEnum;
+import com.vci.ubcs.starter.web.enumpck.UserSecretEnum;
import com.vci.ubcs.starter.web.pagemodel.SessionInfo;
import com.vci.ubcs.starter.web.toolmodel.DateConverter;
import com.vci.ubcs.starter.web.wrapper.VciQueryWrapperForDO;
@@ -93,6 +94,11 @@
}
}
+ public static Integer getCurrentUserSecret() {
+ SessionInfo currentUserSession = getCurrentUserSessionInfoNotException();
+ return currentUserSession != null ? getInt(currentUserSession.getUserSecret()) : UserSecretEnum.NONE.getValue();
+ }
+
public static float getFloat(String s) {
float f = 0.0F;
if (s == null) {
diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciQueryWrapperForDO.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciQueryWrapperForDO.java
new file mode 100644
index 0000000..c8d4854
--- /dev/null
+++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciQueryWrapperForDO.java
@@ -0,0 +1,136 @@
+package com.vci.ubcs.starter.web.util;
+
+import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class VciQueryWrapperForDO {
+
+ public static boolean USER_TABLE_COMPATIBILITY = false;
+ public static String DATABASE_PLATFORM;
+ public static Map<String, String> USER_TABLE_COMPATIBILITY_BTM_MAP;
+ public static Map<String, String> USER_TABLE_COMPATIBILITY_FIELD_MAP;
+ public static final String USER_TABLE_COMPATIBILITY_FIELD_SEP = "${vcicomplibitysep}";
+ private Map<String, String> conditionMap;
+ private Map<String, String> customerSqlMap;
+ private String oidFieldName;
+ private static final String SPACE = " ";
+ public static final String QUERY_FIELD_SECRET = "${vciQuerySecret}";
+ public static final Boolean DEFAULT_QUERY_SECRET;
+ public static final Boolean DEFAULT_QUERY_DATARIGHT;
+ public static final String QUERY_FIELD_DATARIGHT = "${vciQueryDataRight}";
+// private VciQueryWrapperOption queryWrapperOption;
+ private Class<?> doClass;
+// private PageHelper pageHelper;
+ private Map<String, String> allFieldNameMap;
+ private List<String> xmlTypeFieldList;
+ private boolean distinct;
+ public static final Map<String, String> REVISION_MANAGE_FIELD_MAP;
+ public static final Map<String, String> BASIC_FIELD_MAP;
+ public static final Map<String, String> BASE_MODEL_COMPATIBILITY_MAP;
+ public static final String OID_FIELD = "oid";
+ public static final String ID_FIELD = "id";
+ public static final String LC_STATUS_FIELD = "lcstatus";
+ public static final String LC_STATUS_FIELD_TEXT = "lcStatus_text";
+ public static final Map<String, String> LIFECYCLE_MANAGE_FIELD_MAP;
+ public static final Map<String, String> SECRET_MANAGE_FIELD_MAP;
+ public static final Map<String, String> LINK_TYPE_FIELD_MAP;
+ private Map<String, VciFieldTypeEnum> allFieldTypeMap;
+// private List<VciReferFieldInfo> referFieldInfoList;
+ private Map<String, String> useReferMap;
+ private Map<String, String> enumFieldMap;
+ private String linkTableSql;
+ private String selectFieldSql;
+ private String selectPrefixForPage;
+ private String whereSql;
+ private String orderSql;
+ private String whereSubfixForPage;
+ private Map<String, String> valuesMap;
+ private String tableNick;
+ private Map<String, String> extendFieldMap;
+ private static final String DATETIME_FORMAT = "yyyy-mm-dd hh24:mi:ss";
+ private static final String DATE_FORMAT = "yyyy-mm-dd";
+
+
+ static {
+// DATABASE_PLATFORM = DataBaseEnum.ORACLE.getValue();
+ USER_TABLE_COMPATIBILITY_BTM_MAP = new HashMap();
+ USER_TABLE_COMPATIBILITY_FIELD_MAP = new HashMap();
+ DEFAULT_QUERY_SECRET = true;
+ DEFAULT_QUERY_DATARIGHT = false;
+ REVISION_MANAGE_FIELD_MAP = new HashMap() {
+ {
+ this.put("nameoid", "瀵硅薄涓婚敭");
+ this.put("revisionoid", "鐗堟湰涓婚敭");
+ this.put("lastr", "鏄惁鏈�鏂扮増鏈�");
+ this.put("firstr", "鏄惁鏈�鑰佺増鏈�");
+ this.put("lastv", "鏄惁鏈�鏂扮増娆�");
+ this.put("firstv", "鏄惁鏈�鑰佺増娆�");
+ this.put("revisionrule", "鐗堟湰瑙勫垯");
+ this.put("revisionseq", "鐗堟湰鎺掑簭鍙�");
+ this.put("revisionvalue", "鐗堟湰鍊�");
+ this.put("versionrule", "鐗堟瑙勫垯");
+ this.put("versionseq", "鐗堟鎺掑簭鍙�");
+ this.put("versionvalue", "鐗堟鍊�");
+ this.put("checkinby", "绛惧叆浜�");
+ this.put("checkintime", "绛惧叆鏃堕棿");
+ this.put("checkoutby", "绛惧嚭浜�");
+ this.put("checkouttime", "绛惧嚭鏃堕棿");
+ this.put("copyfromversion", "鎷疯礉鐗堟湰鏉ユ簮");
+ }
+ };
+ BASIC_FIELD_MAP = new HashMap() {
+ {
+ this.put("oid", "涓婚敭");
+ this.put("btmname", "涓氬姟绫诲瀷鐨勫悕绉�");
+ this.put("id", "缂栧彿");
+ this.put("name", "鍚嶇О");
+ this.put("description", "鎻忚堪");
+ this.put("creator", "鍒涘缓浜�");
+ this.put("createtime", "鍒涘缓鏃堕棿");
+ this.put("lastmodifier", "鏈�鍚庢椂闂翠汉");
+ this.put("lastmodifytime", "鏈�鍚庝慨鏀规椂闂�");
+ this.put("ts", "鏃堕棿鎴�");
+ this.put("owner", "鎷ユ湁鑰�");
+ }
+ };
+ BASE_MODEL_COMPATIBILITY_MAP = new HashMap() {
+ {
+ this.put("lastr", "islastr");
+ this.put("firstr", "isfirstr");
+ this.put("lastv", "islastv");
+ this.put("firstv", "isfirstv");
+ }
+ };
+ LIFECYCLE_MANAGE_FIELD_MAP = new HashMap() {
+ {
+ this.put("lcstatus", "鐢熷懡鍛ㄦ湡鍊�");
+ }
+ };
+ SECRET_MANAGE_FIELD_MAP = new HashMap() {
+ {
+ this.put("secretgrade", "瀵嗙骇鍊�");
+ }
+ };
+ LINK_TYPE_FIELD_MAP = new HashMap() {
+ {
+ this.put("oid", "涓婚敭");
+ this.put("creator", "鍒涘缓浜�");
+ this.put("createtime", "鍒涘缓鏃堕棿");
+ this.put("lastmodifier", "鏈�鍚庢椂闂翠汉");
+ this.put("lastmodifytime", "鏈�鍚庝慨鏀规椂闂�");
+ this.put("f_oid", "from绔富閿�");
+ this.put("f_revisionoid", "from绔増鏈富閿�");
+ this.put("f_nameoid", "from绔璞′富閿�");
+ this.put("f_btmname", "from绔笟鍔$被鍨�");
+ this.put("t_oid", "to绔富閿�");
+ this.put("t_revisionoid", "to绔増鏈富閿�");
+ this.put("t_nameoid", "to绔璞′富閿�");
+ this.put("t_btmname", "to绔笟鍔$被鍨�");
+ this.put("ts", "鏃堕棿鎴�");
+ }
+ };
+ }
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java
index b311f99..44d66a7 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java
@@ -119,6 +119,7 @@
/**
* 涓婚搴撳畾涔夎〃 鏂板
+ * @param
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@@ -310,6 +311,16 @@
public DataGrid<CodeOsattributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject){
return codeClassifyService.listClassifyLinkAttr(baseQueryObject);
}
+ /**
+ * 涓婚敭鑾峰彇涓婚搴撳垎绫�
+ * @param oid 涓婚敭
+ * @return 涓婚搴撳垎绫绘樉绀哄璞�
+ */
+ @GetMapping("/getObjectByOid")
+ public R<CodeClassifyVO> getObjectByOid(String oid){
+ CodeClassifyVO codeClassifyVO = codeClassifyService.getObjectByOid(oid);
+ return R.data(codeClassifyVO);
+ }
/**
* 浣跨敤缂栧彿鐨勮矾寰勮幏鍙栧璞�
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeWupinController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeWupinController.java
new file mode 100644
index 0000000..8dd1a53
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeWupinController.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 搴勯獮 (smallchill@163.com)
+ */
+package com.vci.ubcs.code.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import com.vci.ubcs.code.vo.CodeWupinVO;
+import com.vci.ubcs.code.wrapper.CodeWupinWrapper;
+import com.vci.ubcs.code.service.ICodeWupinService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 缂栫爜淇℃伅 鎺у埗鍣�
+ *
+ * @author yuxc
+ * @since 2023-05-05
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("ubcs-code/codeWupin")
+@Api(value = "缂栫爜淇℃伅", tags = "缂栫爜淇℃伅鎺ュ彛")
+public class CodeWupinController extends BladeController {
+
+ private final ICodeWupinService codeWupinService;
+
+ /**
+ * 缂栫爜淇℃伅 璇︽儏
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @ApiOperation(value = "璇︽儏", notes = "浼犲叆codeWupin")
+ public R<CodeWupinVO> detail(CodeWupinEntity codeWupin) {
+ CodeWupinEntity detail = codeWupinService.getOne(Condition.getQueryWrapper(codeWupin));
+ return R.data(CodeWupinWrapper.build().entityVO(detail));
+ }
+ /**
+ * 缂栫爜淇℃伅 鍒嗛〉
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @ApiOperation(value = "鍒嗛〉", notes = "浼犲叆codeWupin")
+ public R<IPage<CodeWupinVO>> list(CodeWupinEntity codeWupin, Query query) {
+ IPage<CodeWupinEntity> pages = codeWupinService.page(Condition.getPage(query), Condition.getQueryWrapper(codeWupin));
+ return R.data(CodeWupinWrapper.build().pageVO(pages));
+ }
+
+ /**
+ * 缂栫爜淇℃伅 鑷畾涔夊垎椤�
+ */
+ @GetMapping("/page")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "鍒嗛〉", notes = "浼犲叆codeWupin")
+ public R<IPage<CodeWupinVO>> page(CodeWupinVO codeWupin, Query query) {
+ IPage<CodeWupinVO> pages = codeWupinService.selectCodeWupinPage(Condition.getPage(query), codeWupin);
+ return R.data(pages);
+ }
+
+ /**
+ * 缂栫爜淇℃伅 鏂板
+ */
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 4)
+ @ApiOperation(value = "鏂板", notes = "浼犲叆codeWupin")
+ public R save(@Valid @RequestBody CodeWupinEntity codeWupin) {
+ return R.status(codeWupinService.save(codeWupin));
+ }
+
+ /**
+ * 缂栫爜淇℃伅 淇敼
+ */
+ @PostMapping("/update")
+ @ApiOperationSupport(order = 5)
+ @ApiOperation(value = "淇敼", notes = "浼犲叆codeWupin")
+ public R update(@Valid @RequestBody CodeWupinEntity codeWupin) {
+ return R.status(codeWupinService.updateById(codeWupin));
+ }
+
+ /**
+ * 缂栫爜淇℃伅 鏂板鎴栦慨鏀�
+ */
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 6)
+ @ApiOperation(value = "鏂板鎴栦慨鏀�", notes = "浼犲叆codeWupin")
+ public R submit(@Valid @RequestBody CodeWupinEntity codeWupin) {
+ return R.status(codeWupinService.saveOrUpdate(codeWupin));
+ }
+
+ /**
+ * 缂栫爜淇℃伅 鍒犻櫎
+ */
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 7)
+ @ApiOperation(value = "閫昏緫鍒犻櫎", notes = "浼犲叆ids")
+ public R remove(@ApiParam(value = "涓婚敭闆嗗悎", required = true) @RequestParam String ids) {
+ return R.status(codeWupinService.removeBatchByIds(Func.toLongList(ids)));
+ }
+
+
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java
new file mode 100644
index 0000000..f185863
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java
@@ -0,0 +1,147 @@
+package com.vci.ubcs.code.controller;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.nacos.common.utils.StringUtils;
+import com.vci.ubcs.code.dto.CodeOrderDTO;
+import com.vci.ubcs.code.dto.CodeOrderSecDTO;
+import com.vci.ubcs.code.dto.datapush.BaseModelDTO;
+import com.vci.ubcs.code.service.MdmEngineService;
+import com.vci.ubcs.code.service.MdmIOService;
+import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO;
+import com.vci.ubcs.starter.annotation.VciBusinessLog;
+import com.vci.ubcs.starter.util.LocalFileUtil;
+import com.vci.ubcs.starter.web.util.ControllerUtil;
+import com.vci.ubcs.starter.web.util.LangBaseUtil;
+import io.swagger.annotations.Api;
+import lombok.AllArgsConstructor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springblade.core.tool.api.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+@RestController
+//@AllArgsConstructor
+@RequestMapping("/mdmEngineController")
+@Api(value = "缂栫爜鏁版嵁绠$悊", tags = "缂栫爜鏁版嵁绠$悊")
+public class MdmEngineController {
+
+// /**
+// * 鏃ュ織
+// */
+ private Logger logger = LoggerFactory.getLogger(getClass());
+ /**
+ * 涓绘暟鎹紩鎿庢湇鍔�
+ */
+ @Autowired
+ private MdmEngineService engineService;
+ /**
+ * 涓绘暟鎹鍏ュ鍑烘湇鍔�
+ */
+ @Autowired
+ private MdmIOService mdmIOService;
+
+ /**
+ * 涓嬭浇鎵归噺鐢宠鐨勫鍏ユā鏉�
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param response 鍝嶅簲瀵硅薄
+ * @throws IOException 鎶涘嚭寮傚父
+ */
+ @GetMapping("/downloadImportExcel")
+ @VciBusinessLog(operateName = "涓嬭浇鎵归噺鐢宠缂栫爜鐨勫鍏ユā鏉�")
+ public void downloadImportExcel(String codeClassifyOid, HttpServletResponse response) throws IOException{
+ String excelName = mdmIOService.createImportExcel(codeClassifyOid,false);
+ try {
+ ControllerUtil.writeFileToResponse(response,excelName);
+ } catch (Throwable e) {
+ //濡傛灉鍑洪敊,鎶婇敊璇俊鎭啓鍒皌ext
+ String msg = LangBaseUtil.getErrorMsg(e);
+ if(StringUtils.isBlank(msg)){
+ msg = "鏈煡閿欒";
+ }
+ ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null);
+ }
+ }
+
+
+ /**
+ * 鎵归噺鐢宠缂栫爜鐨勪俊鎭�
+ * @param secDTOList 鐢宠缂栫爜鐨勪俊鎭紝蹇呴』鍖呭惈鐮佹鍜屽垎绫讳富閿殑淇℃伅
+ * @param file 鏂囦欢鐨勫唴瀹�
+ */
+ @VciBusinessLog(operateName = "鎵归噺鐢宠缂栫爜鐨勪俊鎭�")
+ @PostMapping("/batchImportCode")
+ public R batchImportCode(String secDTOList, String codeClassifyOid, MultipartFile file, HttpServletResponse response) throws Throwable {
+ CodeOrderDTO orderDTO = new CodeOrderDTO();
+ orderDTO.setCodeClassifyOid(codeClassifyOid);
+ if(StringUtils.isNotBlank(secDTOList)){
+ List<CodeOrderSecDTO> secDTOS = JSONObject.parseArray(secDTOList, CodeOrderSecDTO.class);
+ orderDTO.setSecDTOList(secDTOS);
+ }
+ String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
+ File file1 = new File(excelFileName);
+ try {
+ file.transferTo(new File(excelFileName));
+ CodeImProtRusultVO codeImProtRusultVO = mdmIOService.batchImportCode(orderDTO,file1);
+ if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())||StringUtils.isNotBlank(codeImProtRusultVO.getRedisUuid())){
+ //鏀惧埌map閲�
+ R result = R.fail("瀵煎叆澶辫触");
+ if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())) {
+ String filedUUid = ControllerUtil.putErrorFile(codeImProtRusultVO.getFilePath());
+ codeImProtRusultVO.setFileOid(filedUUid);
+ }
+ result.setData(codeImProtRusultVO);
+ return result;
+ }else {
+ return R.success("鎿嶄綔鎴愬姛锛�");
+ }
+ }catch (Throwable e) {
+ logger.error("瀵煎叆閿欒",e);
+ String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "閿欒.txt";
+ LocalFileUtil.writeContentToFile( LangBaseUtil.getErrorMsg(e),errorFile);
+ String uuid=ControllerUtil.putErrorFile(errorFile);
+ CodeImProtRusultVO codeImProtRusultVO =new CodeImProtRusultVO();
+ codeImProtRusultVO.setRedisUuid("");
+ codeImProtRusultVO.setFileOid(uuid);
+ codeImProtRusultVO.setFilePath(errorFile);
+ R result = R.fail("瀵煎叆澶辫触");
+ result.setData(codeImProtRusultVO);
+// result.setObj(codeImProtRusultVO);
+ return result;
+ }finally {
+ file1.delete();
+ }
+ }
+
+
+ /**
+ * 淇敼鐘舵��
+ * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄
+ * @return 鎵ц缁撴灉
+ */
+ @PostMapping("changeStatus")
+ public R changeStatus(BaseModelDTO baseModelDTO) {
+ engineService.changeStatus(baseModelDTO);
+ return R.success("鎿嶄綔鎴愬姛锛�");
+ }
+
+
+ /**
+ * 鐢宠缂栫爜淇濆瓨
+ * @param orderDTO 缂栫爜鐢宠鐩稿叧鐨勪俊鎭紝闇�瑕佹湁灞炴�у拰鐮佹鐩稿叧鐨勪俊鎭�
+ * @return 鎵ц缁撴灉
+ */
+ @PostMapping("/addSaveCode")
+ @VciBusinessLog(operateName = "鐢宠鍗曚釜缂栫爜")
+ public R addSaveCode(@RequestBody CodeOrderDTO orderDTO){
+ return R.success(engineService.addSaveCode(orderDTO));
+ }
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/enumpack/CodeDefaultLC.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/enumpack/CodeDefaultLC.java
new file mode 100644
index 0000000..7752cd4
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/enumpack/CodeDefaultLC.java
@@ -0,0 +1,141 @@
+package com.vci.ubcs.code.enumpack;
+import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant;
+import com.vci.ubcs.starter.web.enumpck.BaseEnum;
+
+/**
+ * 涓婚搴撴暟鎹殑榛樿鐢熷懡鍛ㄦ湡
+ * @author weidy
+ * @date 2022-3-2
+ */
+public enum CodeDefaultLC implements BaseEnum {
+
+ /**
+ * 缂栬緫涓�
+ */
+ EDITING(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_EDITING,"缂栬緫涓�"),
+
+ /**
+ * 瀹℃壒涓�
+ */
+ AUDITING(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_AUDITING,"瀹℃壒涓�"),
+
+ /**
+ * 宸插彂甯�
+ */
+ RELEASED(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_RELEASED,"宸插彂甯�"),
+
+ /**
+ * 鐮佸�煎洖鏀�
+ */
+ TASK_BACK(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_TAKEBACK,"鐮佸�煎洖鏀�"),
+ /**
+ * 鍋滅敤
+ */
+ DISABLE(FrameWorkDefaultValueConstant.FRAMEWORK_DATA_DISABLED,"鍋滅敤");
+
+
+ /**
+ * 鏋氫妇鐨勫��
+ */
+ private String value;
+
+ /**
+ * 鏋氫妇鏄剧ず鏂囨湰
+ */
+ private String text;
+
+ /**
+ * 鑾峰彇鏋氫妇鍊�
+ *
+ * @return 鏋氫妇鍊�
+ */
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * 璁剧疆鏋氫妇鍊�
+ *
+ * @param value 鏋氫妇鍊�
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * 鑾峰彇鏋氫妇鏄剧ず鏂囨湰
+ *
+ * @return 鏄剧ず鏂囨湰
+ */
+ @Override
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * 璁剧疆鏄剧ず鏂囨湰
+ *
+ * @param text 鏄剧ず鏂囨湰
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * 鏋勯�犲嚱鏁�
+ *
+ * @param value 鍊�
+ * @param text 鏄剧ず鏂囨湰
+ */
+ private CodeDefaultLC(String value, String text) {
+ this.value = value;
+ this.text = text;
+ }
+
+ /**
+ * 鏍规嵁鍚嶇О鑾峰彇瀵瑰簲鐨勬灇涓惧��
+ *
+ * @param text 鍚嶇О
+ * @return 鏋氫妇鍊�
+ */
+ public static String getValueByText(String text) {
+ for (CodeDefaultLC wenum : CodeDefaultLC.values()) {
+ if (wenum.getText().equalsIgnoreCase(text)) {
+ return wenum.getValue();
+ }
+ }
+ return "";
+ }
+
+ /**
+ * 鏍规嵁鏋氫妇鍊艰幏鍙栧悕绉�
+ *
+ * @param value 鏋氫妇鍊�
+ * @return 鍚嶇О
+ */
+ public static String getTextByValue(String value) {
+ for (CodeDefaultLC wenum : CodeDefaultLC.values()) {
+ if (wenum.getValue().equalsIgnoreCase(value)) {
+ return wenum.getText();
+ }
+ }
+ return "";
+ }
+
+ /**
+ * 鏍规嵁鏋氫妇鍊艰幏鍙栨灇涓惧璞�
+ *
+ * @param value 鏋氫妇鍊�
+ * @return 鏋氫妇瀵硅薄锛屼笉瀛樺湪鏃跺�欒繑鍥瀗ull
+ */
+ public static CodeDefaultLC forValue(String value) {
+ for (CodeDefaultLC wenum : CodeDefaultLC.values()) {
+ if (wenum.getValue().equalsIgnoreCase(value)) {
+ return wenum;
+ }
+ }
+ return null;
+ }
+}
+
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/CodeWupinClient.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/CodeWupinClient.java
new file mode 100644
index 0000000..b786560
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/CodeWupinClient.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 搴勯獮 (smallchill@163.com)
+ */
+package com.vci.ubcs.code.feign;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.vci.ubcs.code.mapper.CodeWupinMapper;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.support.BladePage;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import com.vci.ubcs.code.service.ICodeWupinService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * 缂栫爜淇℃伅 Feign瀹炵幇绫�
+ *
+ * @author yuxc
+ * @since 2023-05-05
+ */
+@ApiIgnore()
+@RestController
+@AllArgsConstructor
+public class CodeWupinClient implements ICodeWupinClient {
+
+ private final CodeWupinMapper codeWupinMapper;
+
+ @Override
+ @GetMapping(TOP)
+ public BladePage<CodeWupinEntity> top(Integer current, Integer size) {
+ Query query = new Query();
+ query.setCurrent(current);
+ query.setSize(size);
+ IPage<CodeWupinEntity> page = codeWupinMapper.selectPage(Condition.getPage(query), Wrappers.emptyWrapper());//service.page(Condition.getPage(query));
+ return BladePage.of(page);
+ }
+
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/ICodeWupinClient.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/ICodeWupinClient.java
new file mode 100644
index 0000000..45d1801
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/ICodeWupinClient.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 搴勯獮 (smallchill@163.com)
+ */
+package com.vci.ubcs.code.feign;
+
+import org.springblade.core.mp.support.BladePage;
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * 缂栫爜淇℃伅 Feign鎺ュ彛绫�
+ *
+ * @author yuxc
+ * @since 2023-05-05
+ */
+@FeignClient(
+ value = "ubcs-code"
+)
+public interface ICodeWupinClient {
+
+ String API_PREFIX = "/wuPinClient";
+ String TOP = API_PREFIX + "/top";
+
+ /**
+ * 鑾峰彇缂栫爜淇℃伅鍒楄〃
+ *
+ * @param current 椤靛彿
+ * @param size 椤垫暟
+ * @return BladePage
+ */
+ @GetMapping(TOP)
+ BladePage<CodeWupinEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size);
+
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java
index ce03874..49e31bd 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java
@@ -49,7 +49,7 @@
* @param oid
* @return
*/
- @MapKey("oid")
+ @MapKey("OID")
Map<String,String> selectAllLevelChildOid(@Param("oid") String oid);
/**
@@ -78,14 +78,14 @@
List<CodeClassify> selectAllLevelChildHasPath(@Param("oid") String oid);
- @MapKey("oid")
+ @MapKey("OID")
List<Map<String,Object>> selectAllLevelParentByOid(@Param("oid") String oid);
- @MapKey("oid")
+ @MapKey("OID")
List<Map<String,Object>> selectAllLevelParents(@Param("oid") String oid);
- @MapKey("oid")
+ @MapKey("OID")
List<Map<String,Object>> selectByFieldPath(@Param("fieldPath") String fieldPath);
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java
index 10196de..aeb97b7 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java
@@ -65,11 +65,14 @@
* @param nameoid
* @return
*/
- @MapKey("REVISIONSEQ")
+// @MapKey("REVISIONSEQ")
Map<String,Object> getNextRevision(@Param("nameoid") String nameoid);
List<CodeClstemplateEntity> selectCodeClassifyTemplateDOByTree(@Param("codeclassifyoid") String codeclassifyoid,
- @Param("lcstatus") String lcstatus);
+ @Param("lcstatus") String lcstatus);
+ List<Map<String,String>> selectChildHasReleaseTemplate(@Param("lcstatus") String lcstatus,
+ @Param("classifyoid") String classifyoid,
+ @Param("templatelcstatus") String templatelcstatus);
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeSerialValueMapper.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeSerialValueMapper.java
index 7d055ae..d885b39 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeSerialValueMapper.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeSerialValueMapper.java
@@ -1,6 +1,8 @@
package com.vci.ubcs.code.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vci.ubcs.code.entity.CodeSerialValue;
+import com.vci.ubcs.code.entity.CodeSynonymEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -11,7 +13,7 @@
* @author ludc
* @date 2022-03-01
*/
-public interface CodeSerialValueMapper {
+public interface CodeSerialValueMapper extends BaseMapper<CodeSerialValue> {
List<CodeSerialValue> selectByCodeRoleId(@Param("codeRuleOid") String codeRuleOid);
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeWupinMapper.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeWupinMapper.java
new file mode 100644
index 0000000..7376138
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeWupinMapper.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 搴勯獮 (smallchill@163.com)
+ */
+package com.vci.ubcs.code.mapper;
+
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import com.vci.ubcs.code.vo.CodeWupinVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 缂栫爜淇℃伅 Mapper 鎺ュ彛
+ *
+ * @author yuxc
+ * @since 2023-05-05
+ */
+public interface CodeWupinMapper extends BaseMapper<CodeWupinEntity> {
+
+ /**
+ * 鑷畾涔夊垎椤�
+ *
+ * @param page
+ * @param codeWupin
+ * @return
+ */
+ List<CodeWupinVO> selectCodeWupinPage(IPage page, CodeWupinVO codeWupin);
+
+
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java
index e8aeda0..6ad2c7f 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java
@@ -143,5 +143,28 @@
*/
List<String> getOidByCodeclassifysecOid(String codeClassifySecOid);
+ /**
+ * 浣跨敤瑙勫垯鐨勪富閿幏鍙栧搴旂殑鐮佹鍐呭
+ * @param oid 瑙勫垯鐨勫唴瀹�
+ * @return 鐮佹鐨勫唴瀹�
+ */
+ List<CodeBasicSecVO> listCodeBasicSecByRuleOid(String oid);
+ /**
+ * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
+ *
+ * @param codeBasicSecDOs 鏁版嵁瀵硅薄鍒楄〃
+ * @param hasFixedValue 鏄惁鏈夊浐瀹氬��
+ * @return 鏄剧ず瀵硅薄
+ * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
+ */
+ List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSec> codeBasicSecDOs, boolean hasFixedValue) throws VciBaseException;
+
+ /**
+ * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
+ * @param codeBasicSecDO 鏁版嵁瀵硅薄
+ * @return 鏄剧ず瀵硅薄
+ * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
+ */
+ CodeBasicSecVO codeBasicSecDO2VO(CodeBasicSec codeBasicSecDO) throws VciBaseException;
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java
index 9cd5583..ac972bf 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java
@@ -3,9 +3,11 @@
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.entity.CodeClassify;
import com.vci.ubcs.code.vo.CodeOsattributeVO;
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
+import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.revision.model.TreeQueryObject;
import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject;
import com.vci.ubcs.starter.web.pagemodel.DataGrid;
@@ -212,4 +214,18 @@
* @return 鏌ヨ缁撴灉
*/
List<CodeClassify> selectAllLevelParents(String oid);
+
+ /**
+ * 涓婚敭鑾峰彇涓婚搴撳垎绫�
+ * @param oid 涓婚敭
+ * @return 涓婚搴撳垎绫绘樉绀哄璞�
+ */
+ CodeClassifyVO getObjectByOid(String oid) throws VciBaseException;
+
+ /**
+ * 浣跨敤鍒嗙被涓婚敭鑾峰彇鍒嗙被鐩稿叧鐨勬墍鏈変俊鎭�
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @return 鍒嗙被涓婄骇锛屼笅绾х殑淇℃伅
+ */
+ CodeClassifyFullInfoBO getClassifyFullInfo(String codeClassifyOid);
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java
index e2c7fc4..5e287d1 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java
@@ -183,4 +183,36 @@
* @return 鎵ц缁撴灉
*/
R<CodeClstemplateVO> editSave(CodeClstemplateDTO codeClassifyTemplateDTO);
+
+ /**
+ * 鑾峰彇鎵�鏈夊瓙鍒嗙被妯℃澘
+ * @param codeClassifyOid 鐖跺垎绫荤殑涓婚敭
+ * @return true琛ㄧず鐩稿悓
+ */
+ List<CodeClstemplateVO> childTemplates(String codeClassifyOid);
+
+ /**
+ * 浣跨敤涓婚搴撶殑鍒嗙被涓婚敭锛岃幏鍙栫敓鏁堢殑妯℃澘
+ * @param codeClassifyOid 涓婚搴撳垎绫讳富閿�
+ * @param hasAttribute 鏄惁鍖呭惈灞炴��
+ * @return 妯℃澘鐨勪俊鎭�
+ */
+ List<CodeClstemplateVO> listReleaseTemplateByClassifyOid(String codeClassifyOid,boolean hasAttribute);
+
+ /**
+ * 鐢ㄦā鏉跨殑鐗堟湰鏉ユ帓搴�
+ * @param templateVOList 妯℃澘鐨勬樉绀哄璞�
+ * @return 鎺掑簭鍚庣殑鍒楄〃
+ */
+ List<CodeClstemplateVO> sortTemplateByRevision(List<CodeClstemplateVO> templateVOList);
+
+
+ /**
+ * 涓婚敭鑾峰彇鍒嗙被妯℃澘瀵硅薄(鍖呭惈灞炴�э級
+ * @param templateOid 涓婚敭
+ * @return 鍒嗙被妯℃澘瀵硅薄鏄剧ず瀵硅薄
+ */
+ CodeClstemplateVO getObjectHasAttrByOid(String templateOid);
+
+
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeKeyattrrepeatService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeKeyattrrepeatService.java
index 6587533..4df9740 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeKeyattrrepeatService.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeKeyattrrepeatService.java
@@ -16,6 +16,7 @@
*/
package com.vci.ubcs.code.service;
+import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.entity.CodeKeyattrrepeatEntity;
import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO;
import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO;
@@ -62,4 +63,18 @@
* @return 鏄剧ず瀵硅薄
*/
CodeKeyAttrRepeatRuleVO codeKeyAttrRepeatRuleDO2VO(CodeKeyattrrepeatEntity codeKeyattrrepeatEntity);
+
+ /**
+ * 浣跨敤鍒嗙被鐨勫叏閮ㄤ俊鎭潵鑾峰彇鍏抽敭灞炴�у垽鏂鍒欑殑鍐呭
+ * @param classifyFullInfo 涓婚搴撳垎绫荤殑鍏ㄩ儴淇℃伅
+ * @return 瑙勫垯鐨勬樉绀哄璞�
+ */
+ CodeKeyattrrepeatVO getRuleByClassifyFullInfo(CodeClassifyFullInfoBO classifyFullInfo);
+
+ /**
+ * 涓婚敭鑾峰彇鍏抽敭鏁版嵁鏌ラ噸瑙勫垯
+ * @param oid 涓婚敭
+ * @return 鍏抽敭鏁版嵁鏌ラ噸瑙勫垯鏄剧ず瀵硅薄
+ */
+ CodeKeyAttrRepeatRuleVO getObjectByOid(String oid);
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java
index 3459537..ac9a4ae 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java
@@ -135,4 +135,11 @@
*/
R clearAllCode(String oid);
+
+ /**
+ * 浣跨敤涓婚敭鑾峰彇缂栫爜瑙勫垯鐨勫唴瀹�
+ * @param codeRuleOid 涓婚敭
+ * @return 瑙勫垯鐨勬樉绀哄璞�
+ */
+ CodeRuleVO getObjectHasSecByOid(String codeRuleOid);
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeWupinService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeWupinService.java
new file mode 100644
index 0000000..3eb30ee
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeWupinService.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 搴勯獮 (smallchill@163.com)
+ */
+package com.vci.ubcs.code.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import com.vci.ubcs.code.vo.CodeWupinVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 缂栫爜淇℃伅 鏈嶅姟绫�
+ *
+ * @author yuxc
+ * @since 2023-05-05
+ */
+public interface ICodeWupinService extends IService<CodeWupinEntity> {
+
+ /**
+ * 鑷畾涔夊垎椤�
+ *
+ * @param page
+ * @param codeWupin
+ * @return
+ */
+ IPage<CodeWupinVO> selectCodeWupinPage(IPage<CodeWupinVO> page, CodeWupinVO codeWupin);
+
+
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java
new file mode 100644
index 0000000..55ce208
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java
@@ -0,0 +1,63 @@
+package com.vci.ubcs.code.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.vci.ubcs.code.dto.CodeOrderDTO;
+import com.vci.ubcs.code.dto.datapush.BaseModelDTO;
+import com.vci.ubcs.code.entity.CodeAllCode;
+import com.vci.ubcs.code.entity.CodeRule;
+import com.vci.ubcs.code.vo.CodeClstempattrVO;
+import com.vci.ubcs.code.vo.CodeClstemplateVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
+import com.vci.ubcs.starter.web.pagemodel.KeyValue;
+
+import java.util.List;
+
+/**
+ * 涓绘暟鎹紩鎿庢湇鍔�
+ * @author weidy
+ * @date 2022-2-21
+ */
+public interface MdmEngineService extends IService<CodeAllCode> {
+ /**
+ * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @return 妯℃澘鐨勬樉绀哄璞�
+ */
+ CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid);
+
+ /**
+ * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param hasAttr 鍖呭惈灞炴��
+ * @return 妯℃澘鐨勬樉绀哄璞�
+ */
+ CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid, boolean hasAttr);
+
+ /**
+ * 鑾峰彇鏋氫妇鐨勪笅鎷夐�夐」
+ * @param attrVO 妯℃澘灞炴�х殑瀵硅薄
+ * @return 涓嬫媺閫夐」
+ */
+ List<KeyValue> listComboboxItems(CodeClstempattrVO attrVO);
+
+ /**
+ * 淇敼鐘舵��
+ * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄
+ */
+ void changeStatus(BaseModelDTO baseModelDTO);
+
+ /**
+ * 鐢宠鍗曚竴缂栫爜
+ * @param orderDTO 鐢宠鐨勪俊鎭紝闇�瑕佸寘鍚睘鎬х殑鍐呭鍜岀爜娈电浉鍏崇殑鍐呭
+ * @return 杩斿洖缂栫爜鐨勫唴瀹�
+ */
+ String addSaveCode(CodeOrderDTO orderDTO);
+
+ /**
+ * 鍒ゆ柇缂栫爜鐨勭爜娈垫槸鍚﹁緭鍏ユ垨鑰呴�夋嫨浜嗙爜鍊�
+ * @param ruleVO 瑙勫垯鐨勬樉绀哄璞�
+ * @param orderDTO 缂栫爜鐢宠鐨勫唴瀹�
+ */
+ void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO);
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java
new file mode 100644
index 0000000..784ba90
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java
@@ -0,0 +1,25 @@
+package com.vci.ubcs.code.service;
+
+import com.vci.ubcs.code.dto.CodeOrderDTO;
+import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO;
+
+import java.io.File;
+
+public interface MdmIOService {
+
+ /**
+ * 鐢熸垚瀵煎叆鐨勬枃浠�
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param isHistory 鏄惁鍘嗗彶鏁版嵁瀵煎叆
+ * @return excel鐨勬枃浠跺湴鍧�
+ */
+ String createImportExcel(String codeClassifyOid,boolean isHistory);
+
+ /**
+ * 鎵归噺鐢宠缂栫爜鏁版嵁
+ * @param orderDTO 缂栫爜鐢宠淇℃伅锛屽繀椤诲寘鍚垎绫讳富閿拰鐮佹鐨勪俊鎭�
+ * @param file excel鏂囦欢鐨勪俊鎭�
+ * @return 鏈夐敊璇俊鎭殑excel
+ */
+ CodeImProtRusultVO batchImportCode(CodeOrderDTO orderDTO, File file);
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java
new file mode 100644
index 0000000..4136658
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java
@@ -0,0 +1,23 @@
+package com.vci.ubcs.code.service;
+
+import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
+import com.vci.ubcs.code.dto.CodeOrderSecDTO;
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import com.vci.ubcs.code.vo.CodeClstemplateVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
+
+import java.util.List;
+
+public interface MdmProductCodeService {
+ /**
+ * 鐢熸垚缂栫爜--骞朵笖淇濆瓨鏁版嵁-鏂规硶鍔犻攣锛屽洜姝や笉鑳借繑鍥瀊atchCBO
+ * @param classifyFullInfoBO 鍒嗙被鐨勫叏閮ㄤ俊鎭�
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞�
+ * @param ruleVO 缂栫爜瑙勫垯鐨勬樉绀哄璞�
+ * @param secDTOList 鍚勪釜鐮佹鐨勫��
+ * @param dataCBOList 涓氬姟鏁版嵁
+ */
+ List<String> productCodeAndSaveData(CodeClassifyFullInfoBO classifyFullInfoBO, CodeClstemplateVO templateVO,
+ CodeRuleVO ruleVO, List<CodeOrderSecDTO> secDTOList, List<CodeWupinEntity> dataCBOList);
+
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
index d6584b6..fef2e76 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
@@ -2,6 +2,7 @@
import com.alibaba.cloud.commons.lang.StringUtils;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -17,8 +18,10 @@
import com.vci.ubcs.code.mapper.CodeFixedValueMapper;
import com.vci.ubcs.code.service.ICodeBasicSecService;
import com.vci.ubcs.code.service.ICodeClassifyValueService;
+import com.vci.ubcs.code.service.ICodeFixedValueService;
import com.vci.ubcs.code.service.ICodeRuleService;
import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeFixedValueVO;
import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
import com.vci.ubcs.code.wrapper.CodeBasicSecWrapper;
import com.vci.ubcs.starter.exception.VciBaseException;
@@ -34,6 +37,7 @@
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -81,6 +85,12 @@
@Resource
private IDictBizClient iDictBizClient;
+
+ /**
+ * 鍥哄畾鐮佹鐨勭爜鍊肩殑鏈嶅姟
+ */
+ @Resource
+ private ICodeFixedValueService fixedValueService;
/**
* 涓婂眰鍒嗙被鐮佹鐨勫睘鎬у悕绉�
@@ -672,4 +682,77 @@
return codeBasicSecDO;
}
+
+ /**
+ * 浣跨敤瑙勫垯鐨勪富閿幏鍙栧搴旂殑鐮佹鍐呭
+ *
+ * @param ruleOid 瑙勫垯鐨勫唴瀹�
+ * @return 鐮佹鐨勫唴瀹�
+ */
+ @Override
+ public List<CodeBasicSecVO> listCodeBasicSecByRuleOid(String ruleOid) {
+ if(StringUtils.isBlank(ruleOid)){
+ return new ArrayList<>();
+ }
+ Map<String,String> conditionMap = new HashMap<>();
+ conditionMap.put("pkCodeRule",ruleOid);
+// PageHelper pageHelper = new PageHelper(-1);
+// pageHelper.addDefaultAsc("ordernum");
+ QueryWrapper<CodeBasicSec> wrapper = new QueryWrapper<>();
+ wrapper.orderByAsc("ordernum");
+ List<CodeBasicSec> secDOList = codeBasicSecMapper.selectList(wrapper);//.selectByCondition(conditionMap, pageHelper);
+ return codeBasicSecDO2VOs(secDOList,true);
+ }
+
+ /**
+ * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
+ *
+ * @param codeBasicSecDOs 鏁版嵁瀵硅薄鍒楄〃
+ * @param hasFixedValue 鏄惁鏈夊浐瀹氬��
+ * @return 鏄剧ず瀵硅薄
+ * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
+ */
+ @Override
+ public List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSec> codeBasicSecDOs, boolean hasFixedValue) throws VciBaseException {
+ List<CodeBasicSecVO> voList = new ArrayList<CodeBasicSecVO>();
+ if (!CollectionUtils.isEmpty(codeBasicSecDOs)) {
+ for (CodeBasicSec s : codeBasicSecDOs) {
+ CodeBasicSecVO vo = codeBasicSecDO2VO(s);
+ if (vo != null) {
+ voList.add(vo);
+ }
+ }
+ }
+ if(hasFixedValue && !CollectionUtils.isEmpty(voList)){
+ List<CodeBasicSecVO> fixedSecVOList = voList.stream().filter(s -> CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equalsIgnoreCase(s.getSecType())).collect(Collectors.toList());
+ if(!CollectionUtils.isEmpty(fixedSecVOList)){
+ //鏌ヨ鍥哄畾鐮佺殑鐮佸��
+ Map<String, List<CodeFixedValueVO>> secValueMap = fixedValueService.listCodeFixedValueBySecOids(fixedSecVOList.stream().map(CodeBasicSecVO::getOid).collect(Collectors.toList()));
+ voList.stream().forEach(vo->{
+ vo.setFixedValueVOList(secValueMap.getOrDefault(vo.getOid(),null));
+ });
+ }
+ }
+ return voList;
+ }
+
+ /**
+ * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
+ *
+ * @param codeBasicSecDO 鏁版嵁瀵硅薄
+ * @return 鏄剧ず瀵硅薄
+ * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
+ */
+ @Override
+ public CodeBasicSecVO codeBasicSecDO2VO(CodeBasicSec codeBasicSecDO) throws VciBaseException {
+ CodeBasicSecVO vo = new CodeBasicSecVO();
+ if (codeBasicSecDO != null) {
+ BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDO, vo);
+ //濡傛灉鏈塴cstatus鐨勭被鐨勮瘽
+ if (true) {
+ //vo.setLcStatusText({lcStatusFullClassName}.getTextByValue(vo.getLcStatus()));
+ }
+ }
+ return vo;
+ }
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
index 702a980..2a6a165 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
+import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.entity.CodeClassify;
import com.vci.ubcs.code.entity.CodeClstemplateEntity;
import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity;
@@ -74,6 +75,8 @@
private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
@Resource
CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper;
+ @Resource
+ ICodeRuleService ICodeRuleService;
/**
* 鏃ュ織
@@ -251,7 +254,7 @@
if(StringUtils.isBlank(oid)){
throw new ServiceException("oid涓嶈兘涓虹┖锛�");
}
- return codeClassifyMapper.checkHasChild(oid.trim());
+ return !codeClassifyMapper.checkHasChild(oid.trim());
}
@@ -297,7 +300,8 @@
//2銆佹煡璇㈣鍒犻櫎鐨勫瓙绫绘暟鎹�
List<CodeClassify> codeClassifyDOList = codeClassifyMapper.selectBatchIds(s);
deletes.addAll(codeClassifyDOList);
- codeClassifyMapper.deleteBatchIds(s);
+// codeClassifyMapper.deleteBatchIds(s);
+ baseMapper.deleteBatchIds(s);
}
}
@@ -951,6 +955,17 @@
}
/**
+ * 涓婚敭鑾峰彇涓婚搴撳垎绫�
+ * @param oid 涓婚敭
+ * @return 涓婚搴撳垎绫绘樉绀哄璞�
+ * @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪鏃朵細鎶涘嚭寮傚父
+ */
+ @Override
+ public CodeClassifyVO getObjectByOid(String oid) throws VciBaseException{
+ return codeClassifyDO2VO(selectByOid(oid));
+ }
+
+ /**
* 浣跨敤缂栧彿鐨勮矾寰勮幏鍙栧璞�
*
* @param idPath 缂栧彿鐨勮矾寰勶紝涓�瀹氳浠庢渶椤跺眰鑺傜偣寮�濮嬶紝鏍煎紡涓簒xx/yyy/zz 杩欐牱
@@ -1021,4 +1036,32 @@
}
return oidList;
}
+
+ /**
+ * 浣跨敤鍒嗙被涓婚敭鑾峰彇鍒嗙被鐩稿叧鐨勬墍鏈変俊鎭�
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @return 鍒嗙被涓婄骇锛屼笅绾х殑淇℃伅
+ */
+ @Override
+ public CodeClassifyFullInfoBO getClassifyFullInfo(String codeClassifyOid) {
+ VciBaseUtil.alertNotNull(codeClassifyOid,"鍒嗙被鐨勪富閿�");
+ CodeClassifyFullInfoBO fullInfo = new CodeClassifyFullInfoBO();
+ CodeClassify classifyDO = selectByOid(codeClassifyOid);
+ //鏌ヨ涓婄骇
+ fullInfo.setCurrentClassifyVO(codeClassifyDO2VO(classifyDO));
+ List<Map<String, Object>> maps = codeClassifyMapper.selectAllLevelParentByOid(codeClassifyOid);
+ List<CodeClassify> codeClassifyList = new ArrayList<>();
+ for (Map<String, Object> map : maps) {
+ CodeClassify codeClassify = new CodeClassify();
+ codeClassify.setOid(String.valueOf(map.get("OID")));
+ codeClassify.setOid(String.valueOf(map.get("LEVEL")));
+ codeClassifyList.add(codeClassify);
+ }
+ fullInfo.setParentClassifyVOs(codeClassifyDO2VOs(codeClassifyList));
+ if(!CollectionUtils.isEmpty(fullInfo.getParentClassifyVOs())){
+ fullInfo.setTopClassifyVO(fullInfo.getParentClassifyVOs().stream().filter(s->StringUtils.isBlank(s.getParentcodeclassifyoid())).findFirst().orElseGet(()->null));
+ }
+ return fullInfo;
+ }
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java
index ab690db..47ef341 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java
@@ -17,8 +17,10 @@
package com.vci.ubcs.code.service.impl;
import com.alibaba.nacos.api.utils.StringUtils;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant;
import com.vci.ubcs.code.dto.CodeClstemplateDTO;
import com.vci.ubcs.code.entity.*;
import com.vci.ubcs.code.enumpack.CodeClassifyTemplateLC;
@@ -87,11 +89,13 @@
@Autowired(required = false)
private CodeClsflowtempMapper codeClsflowtempMapper;
@Autowired(required = false)
- private CodeTemplatePhaseMapper codeTempphaseMapper;
+ private CodeTempphaseMapper codeTempphaseMapper;
@Autowired(required = false)
- private CodeClassifyTemplateButtonMapper codeTempbuttonMapper;
+ private CodeTempbuttonMapper codeTempbuttonMapper;
@Autowired(required = false)
- private CodePhaseAttrMapper codePhaseattrMapper;
+ private CodePhaseattrMapper codePhaseattrMapper;
+ @Autowired(required = false)
+ private CodeClassifyMapper codeClassifyMapper;
@Autowired(required = false)
private ICodeClassifyService codeClassifyService;
@Autowired(required = false)
@@ -484,34 +488,34 @@
// ClientBusinessObject clientBusinessObject_template_insert = null;
// try {
// clientBusinessObject_template_insert = clientBusinessObjectOperation.reviseBusinessObject(clientBusinessObject_template, "");
- codeCls_template_insert.setOid(VciBaseUtil.getPk());
- codeCls_template_insert.setRevisionOid(VciBaseUtil.getPk());
- codeCls_template_insert.setNameOid(codeCls_template.getNameOid());
- codeCls_template_insert.setBtmname(codeCls_template.getBtmname());
- codeCls_template_insert.setLastR(String.valueOf(1));
- codeCls_template_insert.setFirstR(String.valueOf(0));
- codeCls_template_insert.setFirstV(String.valueOf(1));
- codeCls_template_insert.setLastV(String.valueOf(1));
- codeCls_template_insert.setCreator(AuthUtil.getUser().getUserName());
- codeCls_template_insert.setCreateTime(new Date());
- codeCls_template_insert.setLastModifier(AuthUtil.getUser().getUserName());
- codeCls_template_insert.setLastModifyTime(new Date());
- codeCls_template_insert.setRevisionRule(codeCls_template.getRevisionRule());
- codeCls_template_insert.setVersionRule(codeCls_template.getVersionRule());
- Map rvObj = baseMapper.getNextRevision(codeCls_template.getNameOid());
- codeCls_template_insert.setRevisionSeq(Integer.parseInt(rvObj.get("REVISIONSEQ").toString()));
- codeCls_template_insert.setRevisionValue(rvObj.get("REVISIONVAL").toString());
+ codeCls_template_insert.setOid(VciBaseUtil.getPk());
+ codeCls_template_insert.setRevisionOid(VciBaseUtil.getPk());
+ codeCls_template_insert.setNameOid(codeCls_template.getNameOid());
+ codeCls_template_insert.setBtmname(codeCls_template.getBtmname());
+ codeCls_template_insert.setLastR(String.valueOf(1));
+ codeCls_template_insert.setFirstR(String.valueOf(0));
+ codeCls_template_insert.setFirstV(String.valueOf(1));
+ codeCls_template_insert.setLastV(String.valueOf(1));
+ codeCls_template_insert.setCreator(AuthUtil.getUser().getUserName());
+ codeCls_template_insert.setCreateTime(new Date());
+ codeCls_template_insert.setLastModifier(AuthUtil.getUser().getUserName());
+ codeCls_template_insert.setLastModifyTime(new Date());
+ codeCls_template_insert.setRevisionRule(codeCls_template.getRevisionRule());
+ codeCls_template_insert.setVersionRule(codeCls_template.getVersionRule());
+ Map rvObj = baseMapper.getNextRevision(codeCls_template.getNameOid());
+ codeCls_template_insert.setRevisionSeq(Integer.parseInt(rvObj.get("REVISIONSEQ").toString()));
+ codeCls_template_insert.setRevisionValue(rvObj.get("REVISIONVAL").toString());
// VersionValueObject versionObj = this.getVersionValue(item.verRuleName);
- codeCls_template_insert.setVersionSeq(Integer.parseInt(rvObj.get("VERSIONSEQ").toString()));
- codeCls_template_insert.setVersionValue(rvObj.get("VERSIONVAL").toString());
- codeCls_template_insert.setLctid(codeCls_template.getLctid());
- codeCls_template_insert.setLcStatus("Editing");
- codeCls_template_insert.setId(codeCls_template.getId());
- codeCls_template_insert.setName(codeCls_template.getName());
- codeCls_template_insert.setDescription(codeCls_template.getDescription());
- codeCls_template_insert.setOwner(AuthUtil.getUser().getUserName());
+ codeCls_template_insert.setVersionSeq(Integer.parseInt(rvObj.get("VERSIONSEQ").toString()));
+ codeCls_template_insert.setVersionValue(rvObj.get("VERSIONVAL").toString());
+ codeCls_template_insert.setLctid(codeCls_template.getLctid());
+ codeCls_template_insert.setLcStatus("Editing");
+ codeCls_template_insert.setId(codeCls_template.getId());
+ codeCls_template_insert.setName(codeCls_template.getName());
+ codeCls_template_insert.setDescription(codeCls_template.getDescription());
+ codeCls_template_insert.setOwner(AuthUtil.getUser().getUserName());
// codeCls_template_insert.setCheckinBy(userName);
- codeCls_template_insert.setCopyFromVersion(codeCls_template.getOid());
+ codeCls_template_insert.setCopyFromVersion(codeCls_template.getOid());
// }catch (VCIError e){
// e.printStackTrace();
// logger.error("===============>鍒嗙被妯℃澘-鍗囩増澶嶅埗鍑洪敊oid锛� "+templateOldOid+",mes"+e.error_message);
@@ -548,11 +552,11 @@
//澶嶅埗妯℃澘闃舵锛岄樁娈靛睘鎬�
Map phase_attrMap = copyTemplatePhase_attr(templateOldOid,templateNewOid);
- List<CodeTemplatePhase> codeClassifyPhaseDOList = (ArrayList<CodeTemplatePhase>)phase_attrMap.get("phase");//妯℃澘闃舵
- List<CodePhaseAttr> codePhaseAttrDOList = (ArrayList<CodePhaseAttr>)phase_attrMap.get("phaseAttr");//闃舵灞炴��
+ List<CodeTempphaseEntity> codeClassifyPhaseDOList = (ArrayList<CodeTempphaseEntity>)phase_attrMap.get("phase");//妯℃澘闃舵
+ List<CodePhaseattrEntity> codePhaseAttrDOList = (ArrayList<CodePhaseattrEntity>)phase_attrMap.get("phaseAttr");//闃舵灞炴��
//澶嶅埗妯℃澘鎸夐挳
- List<CodeClassifyTemplateButton> codeClassifyTemplateButtonDOList = copyTemplateButton(templateOldOid,templateNewOid);
+ List<CodeTempbuttonEntity> codeClassifyTemplateButtonDOList = copyTemplateButton(templateOldOid,templateNewOid);
//涓�璧蜂繚瀛樻暟鎹�
// WebUtil.setPersistence(false);//涓嶆墽琛屼繚瀛�
@@ -651,11 +655,11 @@
//澶嶅埗妯℃澘闃舵锛岄樁娈靛睘鎬�
Map phase_attrMap = copyTemplatePhase_attr(oldOid,newOid);
- List<CodeTemplatePhase> codeClassifyPhaseDOList = (ArrayList<CodeTemplatePhase>)phase_attrMap.get("phase");//妯℃澘闃舵
- List<CodePhaseAttr> codePhaseAttrDOList = (ArrayList<CodePhaseAttr>)phase_attrMap.get("phaseAttr");//闃舵灞炴��
+ List<CodeTempphaseEntity> codeClassifyPhaseDOList = (ArrayList<CodeTempphaseEntity>)phase_attrMap.get("phase");//妯℃澘闃舵
+ List<CodePhaseattrEntity> codePhaseAttrDOList = (ArrayList<CodePhaseattrEntity>)phase_attrMap.get("phaseAttr");//闃舵灞炴��
//澶嶅埗妯℃澘鎸夐挳
- List<CodeClassifyTemplateButton> codeClassifyTemplateButtonDOList = copyTemplateButton(oldOid,newOid);
+ List<CodeTempbuttonEntity> codeClassifyTemplateButtonDOList = copyTemplateButton(oldOid,newOid);
// baseMapper.insert(codeClassifyTemplateDOList);
this.saveBatch(codeClassifyTemplateDOList);
@@ -754,21 +758,21 @@
// phaseWrapper.addQueryMap("codeClassifyTemplateOid",templateOldOid);
Map<String,Object> condition = new HashMap<>(1);
condition.put("codeclassifyTemplateOid",templateOldOid);
- List<CodeTemplatePhase> codeTempphaseEntities = codeTempphaseMapper.selectByMap(condition);
+ List<CodeTempphaseEntity> codeTempphaseEntities = codeTempphaseMapper.selectByMap(condition);
// List<CodeTemplatePhaseDO> codeClassifyPhaseDOList = codeTemplatePhaseDaoI.selectByWrapper(phaseWrapper);//瑕佷繚瀛樼殑鏂扮殑妯℃澘娴佺▼
Map<String,String> phaseKeyMap = new HashMap<String,String>();//闇�瑕佸鍒剁殑妯℃澘闃舵灞炴��,key:value,妯℃澘闃舵鑰乷id:妯℃澘灞炴�ф柊oid
List<String> phaseOidList = new ArrayList<String>();
- for (CodeTemplatePhase codeTemplatePhaseDO:codeTempphaseEntities){
+ for (CodeTempphaseEntity codeTemplatePhaseDO:codeTempphaseEntities){
String oldoid = codeTemplatePhaseDO.getOid();
String newOid = VciBaseUtil.getPk();
codeTemplatePhaseDO.setOid(newOid);
- codeTemplatePhaseDO.setCodeClassifyTemplateOid(templateNewOid);
+ codeTemplatePhaseDO.setCodeclassifytemplateoid(templateNewOid);
phaseKeyMap.put(oldoid,newOid);
phaseOidList.add(oldoid);
}
//妯℃澘闃舵鐨勫睘鎬�
- List<CodePhaseAttr> codePhaseAttrDOList = new ArrayList<CodePhaseAttr>();
+ List<CodePhaseattrEntity> codePhaseAttrDOList = new ArrayList<CodePhaseattrEntity>();
if(!CollectionUtils.isEmpty(phaseOidList)){//size()==0涓嬭竟鏂规硶浼氭姤閿�
// Map<String,String> conditionMap = new HashMap<>();
@@ -776,11 +780,11 @@
// codePhaseAttrDOList = codePhaseAttrDaoI.selectByCondition(conditionMap,new PageHelper(-1));
codePhaseAttrDOList = codePhaseattrMapper.selectByPhaseaIds(VciBaseUtil.toInSql(phaseOidList.toArray(new String[0])));
}
- for (CodePhaseAttr codePhaseAttrDO:codePhaseAttrDOList){
- String oldPhaseoid = codePhaseAttrDO.getCodePhaseOid();
+ for (CodePhaseattrEntity codePhaseAttrDO:codePhaseAttrDOList){
+ String oldPhaseoid = codePhaseAttrDO.getCodephaseoid();
// String newOid = VciBaseUtil.getPk();
codePhaseAttrDO.setOid(null);
- codePhaseAttrDO.setCodePhaseOid(phaseKeyMap.get(oldPhaseoid));
+ codePhaseAttrDO.setCodephaseoid(phaseKeyMap.get(oldPhaseoid));
// codePhaseattrMapper.insert(codePhaseAttrDO);
}
Map phaseMap = new HashMap();
@@ -792,15 +796,15 @@
/**
* 澶嶅埗妯℃澘鎸夐挳
*/
- public List<CodeClassifyTemplateButton> copyTemplateButton(String templateOldOid,String templateNewOid){
+ public List<CodeTempbuttonEntity> copyTemplateButton(String templateOldOid,String templateNewOid){
Map<String,Object> condition = new HashMap<>(1);
condition.put("classifyTemplateOid",templateOldOid);
// VciQueryWrapperForDO buttonWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateButtonDO.class);
// buttonWrapper.addQueryMap("classifyTemplateOid",templateOldOid);
- List<CodeClassifyTemplateButton> codeTempbuttonEntities = codeTempbuttonMapper.selectByMap(condition);
+ List<CodeTempbuttonEntity> codeTempbuttonEntities = codeTempbuttonMapper.selectByMap(condition);
// List<CodeClassifyTemplateButtonDO> codeClassifyTemplateButtonDOList = codeClassifyTemplateButtonDaoI.selectByWrapper(buttonWrapper);
- for (CodeClassifyTemplateButton codeClassifyTemplateButtonDO:codeTempbuttonEntities){
+ for (CodeTempbuttonEntity codeClassifyTemplateButtonDO:codeTempbuttonEntities){
// String newOid = VciBaseUtil.getPk();
codeClassifyTemplateButtonDO.setOid(null);
codeClassifyTemplateButtonDO.setClassifytemplateoid(templateNewOid);
@@ -817,11 +821,13 @@
// VciQueryWrapperForDO codeClassifyTemplateAttrQuery = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class);
// codeClassifyTemplateAttrQuery.addQueryMap("classifyTemplateOid",templateOldOid);
- Map<String,Object> condition = new HashMap<>(1);
- condition.put("classifyTemplateOid",templateOldOid);
+// Map<String,Object> condition = new HashMap<>(1);
+// condition.put("classifyTemplateOid",templateOldOid);
+ QueryWrapper<CodeClstempattrEntity> wrapper=new QueryWrapper<>();
+ wrapper.eq("classifyTemplateOid",templateOldOid);
// List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = codeClassifyTemplateAttrDaoI.selectByWrapper(codeClassifyTemplateAttrQuery);
- List<CodeClstempattrEntity> codeClstempattrEntities = codeClstempattrMapper.selectByMap(condition);
+ List<CodeClstempattrEntity> codeClstempattrEntities = codeClstempattrMapper.selectList(wrapper);
for (CodeClstempattrEntity codeClassifyTemplateAttrDO :codeClstempattrEntities){
// String attrOid = VciBaseUtil.getPk();
@@ -1003,7 +1009,7 @@
// condition.put("ts",codeClassifyTemplateDOCopyFromDTO.getTs());
CodeClstemplateEntity detail = baseMapper
.selectById(codeClassifyTemplateDOCopyFromDTO.getOid());
- // boolean tsBoolean = boService.checkTs(codeClassifyTemplateAttrDOListemplateDOCopyFromDTO);
+ // boolean tsBoolean = boService.checkTs(codeClassifyTemplateAttrDOListemplateDOCopyFromDTO);
if(detail.getTs().compareTo(codeClassifyTemplateDOCopyFromDTO.getTs()) != 0){//涓嶆槸鏈�鏂扮殑涓嶈鏀�
return R.fail("褰撳墠鏁版嵁涓嶆槸鏈�鏂帮紝璇峰埛鏂板悗鍐嶄慨鏀癸紒");
}
@@ -1029,4 +1035,120 @@
return R.data(codeClassifyTemplateDO2VO(codeClassifyTemplateDO));
}
+ /**
+ *鏍规嵁鐖跺垎绫籭d鍘绘煡鎵惧彾瀛愯妭鐐圭殑妯℃澘锛屽鏋滄病鏌ュ埌鍒欒涓烘ā鏉垮湪涓婂眰寤虹珛锛屽垯鏍规嵁鍒嗙被鍘绘煡褰撳墠妯℃澘
+ * @param codeClassifyOid 鐖跺垎绫荤殑涓婚敭
+ * @return
+ */
+ @Override
+ public List<CodeClstemplateVO> childTemplates(String codeClassifyOid){
+ List<CodeClstemplateVO> codeClassifyTemplateVOList=new ArrayList<>();
+// Map<String/**妯℃澘鐨勪富閿�**/,String/**鍒嗙被鐨勪富閿�**/> childHasTemplateMap =baseMapper
+// .selectChildHasReleaseTemplate(FrameWorkDefaultValueConstant.FRAMEWORK_DATA_ENABLED,
+// codeClassifyOid,CodeClassifyTemplateLC.RELEASED.getValue());
+ List<Map<String,String>> childHasTemplateList =baseMapper
+ .selectChildHasReleaseTemplate(FrameWorkDefaultValueConstant.FRAMEWORK_DATA_ENABLED,
+ codeClassifyOid,CodeClassifyTemplateLC.RELEASED.getValue());
+ Map<String/**妯℃澘鐨勪富閿�**/,String/**鍒嗙被鐨勪富閿�**/> childHasTemplateMap = new HashMap<>();
+ if(!CollectionUtils.isEmpty(childHasTemplateList)){
+ childHasTemplateList.stream().forEach(cbo->{
+ childHasTemplateMap.put(cbo.get("OID"),cbo.get("CLSOID"));
+ });
+ }
+
+ Set<String> templateOid = childHasTemplateMap.keySet();
+ List<CodeClstemplateEntity> classifyTemplateDOS=new ArrayList<>();
+ if(!CollectionUtils.isEmpty(templateOid)) {
+ classifyTemplateDOS= this.listCodeClassifyTemplateDOByOidCollections(templateOid);
+ }else{
+ classifyTemplateDOS=selectOnlyTemplateByClassifyOid(codeClassifyOid);
+ }
+ List<CodeClstemplateVO> templateVOList = codeClassifyTemplateDO2VOs(classifyTemplateDOS, true);
+ if(!CollectionUtils.isEmpty(templateVOList)){
+ codeClassifyTemplateVOList.addAll(templateVOList);
+ }
+ return codeClassifyTemplateVOList;
+ }
+
+
+ /**
+ * 浣跨敤鍒嗙被涓婚敭閫掑綊鏌ヨ
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @return 妯℃澘鐨勬暟鎹璞�
+ */
+ private List<CodeClstemplateEntity> selectOnlyTemplateByClassifyOid(String codeClassifyOid){
+ //1.鐩存帴鏌ヨ锛岀湅鐪嬭繖涓垎绫讳笅闈㈡湁娌℃湁鍙戝竷鐘舵�佺殑妯℃澘
+ //2.濡傛灉娌℃湁锛屽垯寰�涓婃壘鍒嗙被鐨勫唴瀹癸紝杩欎釜鍒嗙被灞傜骇涓嶄細澶锛屾墍浠ョ洿鎺ラ�掑綊鍗冲彲
+ //3.濡傛灉鍒嗙被涓嬮潰娣诲姞浜嗘ā鏉匡紝浣嗘槸娌℃湁鍙戝竷锛屽垯璇存槑妯℃澘鍙兘杩樺湪缂栬緫鐨勭姸鎬侊紝渚濈劧浣跨敤涓婄骇鍒嗙被
+
+// Map<String,String> conditionMap = new HashMap<>();
+// conditionMap.put("codeClassifyOid",codeClassifyOid);
+// conditionMap.put("lcstatus",CodeClassifyTemplateLC.RELEASED.getValue());
+ QueryWrapper<CodeClstemplateEntity> wrapper=new QueryWrapper<>();
+ wrapper.eq("codeClassifyOid",codeClassifyOid)
+ .eq("lcstatus",CodeClassifyTemplateLC.RELEASED.getValue());
+
+ List<CodeClstemplateEntity> templateDOS = baseMapper.selectList(wrapper);
+ if(CollectionUtils.isEmpty(templateDOS)){
+ //閫掑綊鎵句笂绾х殑妯℃澘
+ CodeClassify classifyDO = codeClassifyMapper.selectById(codeClassifyOid);
+// codeClassifyDaoI.selectByPrimaryKey(codeClassifyOid);
+ if(StringUtils.isBlank(classifyDO.getParentCodeClassifyOid())){
+ //璇存槑宸茬粡鏄《浜嗭紝涔熸病鎵惧埌鐨勮瘽锛岄偅灏辫繑鍥炰簡
+ return null;
+ }
+ return selectOnlyTemplateByClassifyOid(classifyDO.getParentCodeClassifyOid());
+ }else{
+ return templateDOS;
+ }
+ }
+
+ /**
+ * 浣跨敤涓婚搴撶殑鍒嗙被涓婚敭锛岃幏鍙栫敓鏁堢殑妯℃澘
+ *
+ * @param codeClassifyOid 涓婚搴撳垎绫讳富閿�
+ * @param hasAttribute 鏄惁鍖呭惈灞炴��
+ * @return 妯℃澘鐨勪俊鎭�
+ */
+ @Override
+ public List<CodeClstemplateVO> listReleaseTemplateByClassifyOid(String codeClassifyOid, boolean hasAttribute) {
+ VciBaseUtil.alertNotNull(codeClassifyOid,"涓婚搴撳垎绫讳富閿�");
+ List<CodeClstemplateEntity> templateDOS = selectOnlyTemplateByClassifyOid(codeClassifyOid);
+ if(CollectionUtils.isEmpty(templateDOS)){
+ throw new VciBaseException("褰撳墠鍒嗙被锛屼互鍙婂叾涓婄骇鍒嗙被閮芥病鏈夎缃ā鏉�");
+ }
+ List<CodeClstemplateVO> templateVOList = codeClassifyTemplateDO2VOs(templateDOS, true);
+ return sortTemplateByRevision(templateVOList);
+ }
+
+ /**
+ * 鐢ㄦā鏉跨殑鐗堟湰鏉ユ帓搴�
+ * @param templateVOList 妯℃澘鐨勬樉绀哄璞�
+ * @return 鎺掑簭鍚庣殑鍒楄〃
+ */
+ @Override
+ public List<CodeClstemplateVO> sortTemplateByRevision(List<CodeClstemplateVO> templateVOList){
+ if(!CollectionUtils.isEmpty(templateVOList) && templateVOList.size() >1){
+ //鑾峰彇鐗堟湰鍙锋渶澶х殑閭d釜
+ templateVOList = templateVOList.stream().sorted((o1,o2)->
+ Integer.valueOf(o1.getRevisionSeq()).compareTo(Integer.valueOf(o2.getRevisionValue()))
+ ).collect(Collectors.toList());
+ }
+ return templateVOList;
+ }
+
+ /**
+ * 涓婚敭鑾峰彇鍒嗙被妯℃澘瀵硅薄(鍖呭惈灞炴�э級
+ *
+ * @param oid 涓婚敭
+ * @return 鍒嗙被妯℃澘瀵硅薄鏄剧ず瀵硅薄
+ * @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪鏃朵細鎶涘嚭寮傚父
+ */
+ @Override
+ public CodeClstemplateVO getObjectHasAttrByOid(String oid) throws VciBaseException {
+ List<CodeClstemplateEntity> doList = new ArrayList<>();
+ doList.add(selectByOid(oid));
+ List<CodeClstemplateVO> templateVOS = codeClassifyTemplateDO2VOs(doList, true);
+ return CollectionUtils.isEmpty(templateVOS)?null:templateVOS.get(0);
+ }
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeKeyattrrepeatServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeKeyattrrepeatServiceImpl.java
index 0d51c52..f9873af 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeKeyattrrepeatServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeKeyattrrepeatServiceImpl.java
@@ -16,14 +16,19 @@
*/
package com.vci.ubcs.code.service.impl;
+import com.alibaba.nacos.common.utils.StringUtils;
+import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.entity.CodeKeyattrrepeatEntity;
import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus;
import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO;
import com.vci.ubcs.code.mapper.CodeKeyattrrepeatMapper;
import com.vci.ubcs.code.service.ICodeKeyattrrepeatService;
+import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO;
+import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.web.util.BeanUtilForVCI;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -32,6 +37,9 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.stream.Collectors;
+
+import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.DATA_OID_NOT_EXIST;
/**
* 鍏抽敭灞炴�ф煡閲嶈鍒� 鏈嶅姟瀹炵幇绫�
@@ -117,4 +125,68 @@
}
return vo;
}
+
+ /**
+ * 浣跨敤鍒嗙被鐨勫叏閮ㄤ俊鎭潵鑾峰彇鍏抽敭灞炴�у垽鏂鍒欑殑鍐呭
+ *
+ * @param classifyFullInfo 涓婚搴撳垎绫荤殑鍏ㄩ儴淇℃伅
+ * @return 瑙勫垯鐨勬樉绀哄璞�
+ */
+ @Override
+ public CodeKeyattrrepeatVO getRuleByClassifyFullInfo(CodeClassifyFullInfoBO classifyFullInfo) {
+ VciBaseUtil.alertNotNull(classifyFullInfo,"涓婚搴撳垎绫荤殑淇℃伅");
+ String keyAttrRuleOid = classifyFullInfo.getCurrentClassifyVO().getCodekeyattrrepeatoid();
+ if(StringUtils.isBlank(keyAttrRuleOid)){
+ //鎴戜滑鏍规嵁涓婄骇鐨勫垎绫伙紝鎸夌収灞傜骇鍊掑簭鎺掑垪
+ if(!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())){
+ //鏈変笂绾у垎绫荤殑鎯呭喌涓嬫墠鍘绘煡璇�
+ List<CodeClassifyVO> sortedClassifyVO = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).collect(Collectors.toList());
+ for(int i = sortedClassifyVO.size() -1;i>=0;i--){
+ CodeClassifyVO record = sortedClassifyVO.get(i);
+
+ if(StringUtils.isNotBlank(record.getCodekeyattrrepeatoid())){
+ keyAttrRuleOid = record.getCodekeyattrrepeatoid();
+ break;
+ }
+ }
+ }
+ }
+ if(StringUtils.isNotBlank(keyAttrRuleOid)){
+ CodeKeyAttrRepeatRuleVO objectByOid = getObjectByOid(keyAttrRuleOid);
+ CodeKeyattrrepeatVO codeKeyattrrepeatVO = new CodeKeyattrrepeatVO();
+ BeanUtils.copyProperties(objectByOid,codeKeyattrrepeatVO);
+ return codeKeyattrrepeatVO;
+ }
+ //鍏抽敭灞炴�х殑瑙勫垯鍙互涓虹┖锛屼负绌虹殑鏃跺�欏氨浠h〃涓嶆帶鍒讹紝
+ return null;
+ }
+
+ /**
+ * 涓婚敭鑾峰彇鍏抽敭鏁版嵁鏌ラ噸瑙勫垯
+ * @param oid 涓婚敭
+ * @return 鍏抽敭鏁版嵁鏌ラ噸瑙勫垯鏄剧ず瀵硅薄
+ */
+ @Override
+ public CodeKeyAttrRepeatRuleVO getObjectByOid(String oid){
+ CodeKeyAttrRepeatRuleVO codeKeyAttrRepeatRuleVO = codeKeyAttrRepeatRuleDO2VO(selectByOid(oid));
+ CodeKeyattrrepeatVO codeKeyattrrepeatVO = new CodeKeyattrrepeatVO();
+ BeanUtils.copyProperties(codeKeyAttrRepeatRuleVO,codeKeyattrrepeatVO);
+ return codeKeyAttrRepeatRuleVO;
+ }
+ /**
+ * 涓婚敭鏌ヨ鏁版嵁瀵硅薄
+ * @param oid 涓婚敭
+ * @return 鏁版嵁瀵硅薄
+ * @throws VciBaseException 鍙傛暟涓虹┖锛屽苟涓旀暟鎹笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
+ */
+ private CodeKeyattrrepeatEntity selectByOid(String oid) {
+ VciBaseUtil.alertNotNull(oid,"涓婚敭");
+
+ CodeKeyattrrepeatEntity codeKeyAttrRepeatRuleDO = codeKeyattrrepeatMapper.selectById(oid.trim());
+// .selectByPrimaryKey(oid.trim());
+ if(codeKeyAttrRepeatRuleDO == null || StringUtils.isBlank(codeKeyAttrRepeatRuleDO.getOid())){
+ throw new VciBaseException(DATA_OID_NOT_EXIST);
+ }
+ return codeKeyAttrRepeatRuleDO;
+ }
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
index 3049bac..31d235c 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
@@ -430,4 +430,38 @@
}
+ /**
+ * 浣跨敤涓婚敭鑾峰彇缂栫爜瑙勫垯鐨勫唴瀹�
+ *
+ * @param oid 涓婚敭
+ * @return 瑙勫垯鐨勬樉绀哄璞�
+ */
+ @Override
+ public CodeRuleVO getObjectHasSecByOid(String oid) {
+ CodeRule ruleDO = selectByOid(oid);
+ return codeRuleDO2VO(ruleDO, true);
+ }
+
+ /**
+ * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
+ *
+ * @param codeRuleDO 瑙勫垯鐨勬暟鎹璞�
+ * @param hasSec 鏄惁鏌ヨ鐮佹
+ * @return 鏄剧ず瀵硅薄
+ * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
+ */
+ public CodeRuleVO codeRuleDO2VO(CodeRule codeRuleDO, boolean hasSec) throws VciBaseException {
+ CodeRuleVO vo = new CodeRuleVO();
+ if (codeRuleDO != null) {
+ BeanUtilForVCI.copyPropertiesIgnoreCase(codeRuleDO, vo);
+ //濡傛灉鏈塴cstatus鐨勭被鐨勮瘽
+ vo.setLcStatusText(CodeRuleLC.getTextByValue(vo.getLcStatus()));
+ if (hasSec) {
+ //鏌ヨ鐮佹
+ vo.setSecVOList(codeBasicSecService.listCodeBasicSecByRuleOid(vo.getOid()));
+ }
+ }
+ return vo;
+ }
+
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeWupinServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeWupinServiceImpl.java
new file mode 100644
index 0000000..f192429
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeWupinServiceImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 搴勯獮 (smallchill@163.com)
+ */
+package com.vci.ubcs.code.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import com.vci.ubcs.code.vo.CodeWupinVO;
+import com.vci.ubcs.code.mapper.CodeWupinMapper;
+import com.vci.ubcs.code.service.ICodeWupinService;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 缂栫爜淇℃伅 鏈嶅姟瀹炵幇绫�
+ *
+ * @author yuxc
+ * @since 2023-05-05
+ */
+@Service
+public class CodeWupinServiceImpl extends ServiceImpl<CodeWupinMapper, CodeWupinEntity> implements ICodeWupinService {
+
+ @Override
+ public IPage<CodeWupinVO> selectCodeWupinPage(IPage<CodeWupinVO> page, CodeWupinVO codeWupin) {
+ return page.setRecords(baseMapper.selectCodeWupinPage(page, codeWupin));
+ }
+
+
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
new file mode 100644
index 0000000..0f9d00c
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -0,0 +1,779 @@
+package com.vci.ubcs.code.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.nacos.common.utils.StringUtils;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.sun.corba.se.impl.orbutil.ObjectUtility;
+import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
+import com.vci.ubcs.code.dto.CodeOrderDTO;
+import com.vci.ubcs.code.dto.datapush.BaseModelDTO;
+import com.vci.ubcs.code.entity.CodeAllCode;
+import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity;
+import com.vci.ubcs.code.entity.CodeRule;
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import com.vci.ubcs.code.enumpack.CodeDefaultLC;
+import com.vci.ubcs.code.enumpack.CodeLevelTypeEnum;
+import com.vci.ubcs.code.enumpack.CodeSecTypeEnum;
+import com.vci.ubcs.code.mapper.CodeAllCodeMapper;
+import com.vci.ubcs.code.mapper.CodeOsbtmtypeMapper;
+import com.vci.ubcs.code.mapper.CodeRuleMapper;
+import com.vci.ubcs.code.service.*;
+import com.vci.ubcs.code.vo.CodeClstempattrVO;
+import com.vci.ubcs.code.vo.CodeClstemplateVO;
+import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
+import com.vci.ubcs.omd.entity.Dict;
+import com.vci.ubcs.starter.exception.VciBaseException;
+import com.vci.ubcs.starter.revision.model.BaseModel;
+import com.vci.ubcs.starter.web.enumpck.UserSecretEnum;
+import com.vci.ubcs.starter.web.pagemodel.KeyValue;
+import com.vci.ubcs.starter.web.toolmodel.DateConverter;
+import com.vci.ubcs.starter.web.util.VciBaseUtil;
+import com.vci.ubcs.starter.web.util.VciDateUtil;
+import com.vci.ubcs.starter.web.util.VciQueryWrapperForDO;
+import com.vci.ubcs.starter.web.util.WebUtil;
+import com.vci.ubcs.system.entity.DictBiz;
+import com.vci.ubcs.system.feign.IDictBizClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.stream.Collectors;
+
+/**
+ * 涓绘暟鎹紩鎿庢湇鍔�
+ *
+ * @author weidy
+ * @date 2022-2-22
+ */
+@Service
+public class MdmEngineServiceImpl extends ServiceImpl<CodeAllCodeMapper, CodeAllCode> implements MdmEngineService {
+
+
+ /**
+ * 妯℃澘鐨勬湇鍔�
+ */
+ @Resource
+ private CodeClstemplateServiceImpl templateService;
+ /**
+ * 妯℃澘鐨勬湇鍔�
+ */
+ @Resource
+ private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
+ /**
+ * 鐢熸垚缂栫爜鐨勬湇鍔�
+ */
+ @Resource
+ private MdmProductCodeService productCodeService;
+ /**
+ * 瀛楀吀鐨勬湇鍔�
+ */
+ @Resource
+ IDictBizClient iDictBizClient;
+
+ /**
+ * 缂栫爜瑙勫垯鐨勬湇鍔�
+ */
+ @Autowired
+ private ICodeRuleService ruleService;
+
+ /**
+ * 鍒嗙被鐨勬湇鍔�
+ */
+ @Resource
+ private ICodeClassifyService classifyService;
+
+ /**
+ * 鍏抽敭灞炴�х殑閰嶇疆
+ */
+ @Autowired
+ private ICodeKeyattrrepeatService keyRuleService;
+ /**
+ * 鏃ュ織
+ */
+ private Logger logger = LoggerFactory.getLogger(getClass());
+
+// @Autowired
+// private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
+
+
+
+ /**
+ * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @return 妯℃澘鐨勬樉绀哄璞�
+ */
+ @Override
+ public CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid) {
+ return getUsedTemplateByClassifyOid(codeClassifyOid, true);
+ }
+
+ /**
+ * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param hasAttr 鍖呭惈灞炴��
+ * @return 妯℃澘鐨勬樉绀哄璞�
+ */
+ @Override
+ public CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid, boolean hasAttr) {
+ List<CodeClstemplateVO> templateVOs = templateService.listReleaseTemplateByClassifyOid(codeClassifyOid, hasAttr);
+ return templateVOs.get(templateVOs.size() - 1);
+ }
+
+ /**
+ * 鑾峰彇鏋氫妇鐨勪笅鎷夐�夐」
+ *
+ * @param attrVO 妯℃澘灞炴�х殑瀵硅薄
+ * @return 涓嬫媺閫夐」
+ */
+ @Override
+ public List<KeyValue> listComboboxItems(CodeClstempattrVO attrVO) {
+ List<KeyValue> comboboxKVs = null;
+ if (StringUtils.isNotBlank(attrVO.getEnumstring())) {
+ comboboxKVs = JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class);
+ } else {
+// comboboxKVs = enumService.getEnum(attrVO.getEnumid());
+// Dict dict = new Dict();
+// dict.setParentId(Long.valueOf(attrVO.getEnumid()));
+ R<List<DictBiz>> list = iDictBizClient.getList(attrVO.getEnumid());
+ if(list.isSuccess()){
+ for (DictBiz datum : list.getData()) {
+ KeyValue keyValue = new KeyValue();
+ keyValue.setKey(datum.getDictKey());
+ keyValue.setValue(datum.getDictValue());
+ comboboxKVs.add(keyValue);
+ }
+ }
+ }
+ return comboboxKVs;
+ }
+ /**
+ * 淇敼鐘舵��
+ *
+ * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄
+ */
+ @Override
+ public void changeStatus(BaseModelDTO baseModelDTO) {
+ VciBaseUtil.alertNotNull(baseModelDTO, "鏁版嵁淇℃伅", baseModelDTO.getOid(), "涓婚敭", baseModelDTO.getBtmname(), "涓氬姟绫诲瀷", baseModelDTO.getLcStatus(), "鐩爣鐘舵��");
+ List<String> oids = VciBaseUtil.str2List(baseModelDTO.getOid());
+// List<ClientBusinessObject> cboList = boService.selectCBOByOidCollection(oids, baseModelDTO.getBtmname());
+ //鎻掍釜鐐� 涓氬姟绫诲瀷瀹屾垚鍚庨渶瑕佷慨鏀�
+ QueryWrapper<CodeOsbtmtypeEntity> wrapper = new QueryWrapper<>();
+ wrapper.eq("BTMNAME",baseModelDTO.getBtmname());
+ wrapper.in("OID",oids);
+ List<CodeOsbtmtypeEntity> cboList = codeOsbtmtypeMapper.selectList(wrapper);
+ //杩橀渶瑕佷慨鏀筧llCode鐨勭敓鍛藉懆鏈�
+// Map<String, String> conditionMap = new HashMap<>();
+ QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>();
+ allCodeWrapper.eq("createcodebtm",baseModelDTO.getBtmname());
+ allCodeWrapper.in("createcodeoid",oids);
+// conditionMap.put("createcodeoid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")");
+// conditionMap.put("createcodebtm", baseModelDTO.getBtmname());
+ List<CodeAllCode> codeCbos = baseMapper.selectList(allCodeWrapper);
+// List<ClientBusinessObject> codeCbos = boService.queryCBO(MdmBtmTypeConstant.CODE_ALL_CODE, conditionMap);
+ // 鍥炴敹闇�瑕佷笟鍔℃暟鎹垹闄�
+// if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) {
+//// BatchCBO batchCBO = new BatchCBO();
+//// batchCBO.getDeleteCbos().addAll(cboList);
+// codeOsbtmtypeMapper.deleteBatchIds(cboList);
+//// boService.persistenceBatch(batchCBO);
+// } else {
+// lifeCycleService.transCboStatus(cboList, baseModelDTO.getLcStatus());
+// }
+// lifeCycleService.transCboStatus(codeCbos, baseModelDTO.getLcStatus());
+ }
+
+
+ /**
+ * 鐢宠鍗曚竴缂栫爜
+ *
+ * @param orderDTO 鐢宠鐨勪俊鎭紝闇�瑕佸寘鍚睘鎬х殑鍐呭鍜岀爜娈电浉鍏崇殑鍐呭
+ * @return 杩斿洖缂栫爜鐨勫唴瀹�
+ */
+ @Override
+ public String addSaveCode(CodeOrderDTO orderDTO) {
+ VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭",
+ orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�", orderDTO.getCodeRuleOid(), "缂栫爜瑙勫垯鐨勪富閿�");
+ CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
+ CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
+ CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid());
+ //1.鍒ゆ柇瑙勫垯涓櫎浜嗘祦姘寸爜娈碉紝鏄惁鏈夊叾浠栫爜娈�
+ checkSecValueOnOrder(ruleVO, orderDTO);
+ //2.鍒ゆ柇蹇呰緭椤�
+ checkRequiredAttrOnOrder(templateVO, orderDTO);
+ //3.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
+ switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
+ //4.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
+ switchComponentAttrOnOrder(templateVO, orderDTO);
+ //5.鏍¢獙瑙勫垯
+ checkVerifyOnOrder(templateVO, orderDTO);
+ //6.鍏抽敭灞炴��
+ checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
+ //7.鏋氫妇杞崲
+ checkEnumOnOrder(templateVO, orderDTO);
+ //8.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
+ switchDateAttrOnOrder(templateVO, orderDTO);
+ //9.鐢熸垚缂栫爜鐨勪俊鎭�
+// ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
+// CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
+// //榛樿鐨勫睘鎬ч兘涓嶇敤浠庡墠绔嫹璐�
+// //璁剧疆缂栫爜闇�瑕佺殑榛樿灞炴�х殑鍐呭
+// copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
+// //TODO:鍥犱负榛樿鐨勫睘鎬ч兘涓嶆嫹璐濓紝鐩墠闆嗗洟鐮佸彨name锛屽苟娌℃湁浠嶥TO鎷疯礉鍒癱bo閲屻�傚鍔犱竴涓崟鐙鐞嗭紝浠ュ悗鍐嶇湅瑕佷笉瑕佽皟鏁�
+// cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
+// //end -- modify by lihang @20220407
+// List<CodeWupinEntity> cboList = new ArrayList<>();
+//
+// //澶囨敞
+// cbo.setDescription(orderDTO.getDescription());
+//
+// cboList.add(cbo);
+// List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList);
+//// batchSaveSelectChar(templateVO, cboList);
+// return codeList.size() > 0 ? codeList.get(0) : "";
+ return null;
+ }
+
+ /**
+ * 澶勭悊鍒嗙被娉ㄥ叆鐨勪俊鎭�
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝蹇呴』瑕佸悗妯℃澘鐨勫睘鎬�
+ * @param classifyFullInfoBO 鍒嗙被鐨勫叏璺緞
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ */
+ private void switchClassifyLevelOnOrder(CodeClstemplateVO templateVO, CodeClassifyFullInfoBO classifyFullInfoBO, CodeOrderDTO orderDTO) {
+ Map<String,CodeClstempattrVO> classifyAttrVOMap = templateVO.getAttributes().stream().filter(
+ s -> StringUtils.isNotBlank(s.getClassifyinvokeattr()) && StringUtils.isNotBlank(s.getClassifyinvokelevel())
+ ).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (classifyFullInfoBO.getTopClassifyVO() == null) {
+ //闇�瑕侀噸鏂版煡璇竴涓嬶紝鍥犱负杩欎釜鏄寚瀹氱殑鍒嗙被杩涙潵鐨�
+
+ }
+ if (!CollectionUtils.isEmpty(classifyAttrVOMap)) {
+ classifyAttrVOMap.forEach((attrId, attrVO) -> {
+ //鍒嗙被娉ㄥ叆鐨勭紪鍙锋垨鑰呭悕绉帮紝
+ //灞傜骇鍖呭惈鎸囧畾灞傚拰鏈�灏忓眰
+ CodeClassifyVO classifyVO = null;
+ if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyinvokelevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyinvokelevel())) {
+ //鎸囧畾浜嗗眰绾х殑
+ //娉ㄦ剰锛屽洜涓烘煡璇笂绾у垎绫诲嚭鏉ョ殑灞傜骇鏄�掑簭鐨勶紝鍗抽《灞傝妭鐐规槸鏈�澶х殑鍊�
+ List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList());
+ int level = VciBaseUtil.getInt(attrVO.getClassifyinvokelevel());
+ if (classifyVOS.size() >= level && level > 0) {
+ classifyVO = classifyVOS.get(level - 1);
+ }
+ } else {
+ //褰撳墠鐨勫垎绫�
+ classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
+ }
+ if (classifyVO == null) {
+ //璇存槑灞傜骇鏈夎
+ orderDTO.getData().put(attrId, "鍒嗙被鏍戜笂娌℃湁灞傜骇[" + attrVO.getClassifyinvokelevel() + "]");
+ // classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
+ } else {
+ Map<String, String> classifyDataMap = VciBaseUtil.objectToMapString(classifyVO);
+ String value = classifyDataMap.getOrDefault(attrVO.getClassifyinvokeattr(), "");
+ orderDTO.getData().put(attrId, value);
+ }
+ });
+ }
+ }
+
+
+ /**
+ * 鍒ゆ柇缂栫爜鐨勭爜娈垫槸鍚﹁緭鍏ユ垨鑰呴�夋嫨浜嗙爜鍊�
+ *
+ * @param ruleVO 瑙勫垯鐨勬樉绀哄璞�
+ * @param orderDTO 缂栫爜鐢宠鐨勫唴瀹�
+ */
+ @Override
+ public void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO) {
+ List<String> unSerialSecOidList = ruleVO.getSecVOList().stream().filter(
+ s -> !(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(s.getSecType())
+ || CodeSecTypeEnum.CODE_ATTR_SEC.getValue().equalsIgnoreCase(s.getSecType())
+ || CodeSecTypeEnum.CODE_DATE_SEC.getValue().equalsIgnoreCase(s.getSecType())
+ || CodeSecTypeEnum.CODE_LEVEL_SEC.getValue().equalsIgnoreCase(s.getSecType())
+ || VciBaseUtil.getBoolean(s.getNullableFlag()))
+ ).map(CodeBasicSecVO::getOid).collect(Collectors.toList());
+ if (!CollectionUtils.isEmpty(unSerialSecOidList)) {
+ if (CollectionUtils.isEmpty(orderDTO.getSecDTOList())) {
+ throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��");
+ }
+ if (orderDTO.getSecDTOList().stream().anyMatch(s -> !unSerialSecOidList.contains(s.getSecOid())
+ && StringUtils.isBlank(s.getSecValue()))) {
+ throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��");
+ }
+ }
+ }
+
+ /**
+ * 鏍¢獙灞炴�ф槸鍚︿负蹇呰緭
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬�
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ */
+ private void checkRequiredAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
+ Map<String, CodeClstempattrVO> requiredAttrMap = templateVO.getAttributes().stream().filter(
+ s -> VciBaseUtil.getBoolean(s.getRequireflag()) && StringUtils.isBlank(s.getComponentrule())
+ && StringUtils.isBlank(s.getClassifyinvokeattr()))
+ .collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (!CollectionUtils.isEmpty(requiredAttrMap)) {
+ requiredAttrMap.forEach((attrId, attrVO) -> {
+ //鍙湁浼佷笟缂栫爜锛岀姸鎬侊紝澶囨敞锛屾ā鏉夸富閿紝鍒嗙被涓婚敭杩欏嚑涓槸鍥哄畾鐨勶紝鍏朵綑閮芥槸鑷閰嶇疆鐨�
+ if (StringUtils.isBlank(getValueFromOrderDTO(orderDTO, attrId))) {
+ throw new VciBaseException("灞炴�с�恵0}銆戝繀椤昏杈撳叆(閫夋嫨)鍐呭", new String[]{attrVO.getName()});
+ }
+ });
+ }
+ }
+
+ /**
+ * 浠庣紪鐮佺敵璇蜂俊鎭璞′笂鑾峰彇鏌愪釜灞炴�х殑鍊�
+ *
+ * @param orderDTO 缂栫爜鐢宠瀵硅薄
+ * @param attrId 灞炴�х殑缂栧彿
+ * @return 鍊�
+ */
+ private String getValueFromOrderDTO(CodeOrderDTO orderDTO, String attrId) {
+ attrId = attrId.toLowerCase(Locale.ROOT);
+ String value = null;
+ if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) {
+ value = WebUtil.getStringValueFromObject(WebUtil.getValueFromField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO));
+ } else {
+ //璇存槑鏄嚜琛岄厤缃殑
+ //鍓嶇蹇呴』瑕佷紶閫掑皬鍐欑殑灞炴��
+ value = orderDTO.getData().getOrDefault(attrId, "");
+ }
+ return value;
+ }
+
+ /**
+ * 杞崲缁勫悎瑙勫垯鐨勫��
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬�
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ */
+ private void switchComponentAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
+ Map<String, CodeClstempattrVO> compAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getComponentrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (!CollectionUtils.isEmpty(compAttrVOMap)) {
+ Map<String, String> dataMap = WebUtil.objectToMapString(orderDTO);
+
+ Map<String, String> dataLowMap = new HashMap<>();
+ if (!CollectionUtils.isEmpty(dataMap)) {
+ dataMap.forEach((key, value) -> {
+ dataLowMap.put(key.toLowerCase(Locale.ROOT), value);
+ });
+ }
+ dataLowMap.putAll(orderDTO.getData());
+ compAttrVOMap.forEach((attrId, attrVO) -> {
+// dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentrule()));
+ });
+ dataLowMap.forEach((key, value) -> {
+ setValueToOrderDTO(orderDTO, key, value);
+ });
+ }
+ }
+
+
+ /**
+ * 璁剧疆鏂扮殑鍊煎埌鐢宠瀵硅薄涓�
+ *
+ * @param orderDTO 缂栫爜鐢宠瀵硅薄
+ * @param attrId 灞炴�х殑缂栧彿
+ * @param value 鍊�
+ */
+ private void setValueToOrderDTO(CodeOrderDTO orderDTO, String attrId, String value) {
+ attrId = attrId.toLowerCase(Locale.ROOT);
+ if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) {
+ WebUtil.setValueToField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO, value);
+ } else {
+ orderDTO.getData().put(attrId, value);
+ }
+ }
+
+ /**
+ * 鏍¢獙姝e垯琛ㄨ揪寮忔槸鍚︽纭�
+ *
+ * @param templateVO 妯℃澘鐨勪俊鎭紝蹇呴』鍖呭惈灞炴�х殑鍐呭
+ * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅
+ */
+ private void checkVerifyOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
+ Map<String, CodeClstempattrVO> verifyAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getVerifyrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (!CollectionUtils.isEmpty(verifyAttrVOMap)) {
+ verifyAttrVOMap.forEach((attrId, attrVO) -> {
+ String value = getValueFromOrderDTO(orderDTO, attrId);
+ if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyrule())) {
+ //鏍¢獙姝e垯琛ㄨ揪寮�
+ throw new VciBaseException("灞炴�{0}]鐨勫�间笉绗﹀悎鏍¢獙瑙勫垯鐨勮姹�", new String[]{attrVO.getName()});
+ }
+ });
+ }
+ }
+
+ /**
+ * 鏍¢獙鍏抽敭灞炴��
+ *
+ * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭�
+ * @param templateVO 妯℃澘鐨勫唴瀹癸紝蹇呴』鍖呭惈妯℃澘灞炴��
+ * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅
+ */
+ private void checkKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
+ //鍏堣幏鍙栧叧閿睘鎬х殑瑙勫垯锛屼篃鍒╃敤缁ф壙鐨勬柟寮�
+ CodeKeyattrrepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo);
+ //娉ㄦ剰鐨勬槸keyRuleVO鍙兘涓虹┖锛岃〃绀轰笉浣跨敤瑙勫垯鎺у埗
+ //鑾峰彇鎵�鏈夌殑鍏抽敭灞炴��
+ Map<String, CodeClstempattrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyattrflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ Map<String, String> conditionMap = new HashMap<>();
+ boolean trimAll = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag());
+ //鍏ㄩ儴鍘荤┖鐨勪紭鍏堢骇澶т簬鍘荤┖
+ boolean trim = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorespaceflag());
+ boolean ignoreCase = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorecaseflag());
+ boolean ignoreWidth = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorewidthflag());
+ ketAttrMap.forEach((attrId, attrVO) -> {
+ String value = getValueFromOrderDTO(orderDTO, attrId);
+ if (value == null) {
+ value = "";
+ }
+// wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
+ });
+
+ //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙�
+
+// if (!CollectionUtils.isEmpty(conditionMap)) {
+// final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
+// conditionMap.forEach((key, value) -> {
+// sql[0] += " and " + key + " = " + value;
+// });
+// if (StringUtils.isNotBlank(orderDTO.getOid())) {
+// //淇敼鐨勬椂鍊欙紝闇�瑕佹帓闄よ嚜宸�
+// sql[0] += " and oid != '" + orderDTO.getOid() + "'";
+// } else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) {
+// sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'";
+// }
+// sql[0] += " and islastR = '1' and islastV = '1' ";
+// if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) {
+// String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}";
+// String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"};
+// throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇杩欎釜鏁版嵁宸茬粡鍦ㄧ郴缁熶腑瀛樺湪浜嗐�傝淇!銆�" + ruleInfoMsg, objs);
+// }
+// }
+ }
+
+ /**
+ * 灏佽鍏抽敭灞炴�х殑鏌ヨ璇彞
+ *
+ * @param value 褰撳墠鐨勫��
+ * @param keyRuleVO 鍏抽敭灞炴�х殑鎺у埗瑙勫垯锛屽彲浠ヤ负绌�
+ * @param attrId 灞炴�х殑缂栧彿
+ * @param trim 鏄惁鍘婚櫎绌烘牸
+ * @param ignoreCase 鏄惁涓嶅尯鍒嗗ぇ灏忓啓
+ * @param ignoreWidth 鏄惁蹇界暐鍏ㄥ崐瑙�
+ * @param trimAll 鏄惁蹇界暐鍏ㄩ儴绌烘牸
+ * @param conditionMap 鏌ヨ鏉′欢
+ */
+// @Override
+// public void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId,
+// boolean trim, boolean ignoreCase, boolean ignoreWidth,
+// boolean trimAll, Map<String, String> conditionMap) {
+// boolean ignoreSpace = trim || trimAll;
+// if (StringUtils.isBlank(value)) {
+// //涓虹┖鐨勬椂鍊欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜�
+// conditionMap.put("t."+attrId, "null");
+// } else {
+// if (keyRuleVO != null) {
+// String queryKey = "";
+// String queryValue = "";
+//
+// String temp = "";
+// if (ignoreCase && ignoreSpace && ignoreWidth) {
+// //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙�
+// temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte(%s)) " + (trimAll ? ",' ','')" : ")");
+// } else if (ignoreCase && ignoreSpace && !ignoreWidth) {
+// //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
+// temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
+// } else if (ignoreCase && !ignoreSpace && ignoreWidth) {
+// //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
+// temp = "UPPER(to_single_byte(%s))";
+// } else if (!ignoreCase && ignoreSpace && ignoreWidth) {
+// //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅
+// temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte(%s) " + (trimAll ? ",' ','')" : ")");
+// } else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
+// //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
+// temp = "UPPER(%s)";
+// } else if (!ignoreCase && !ignoreCase && ignoreWidth) {
+// //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
+// temp = "to_single_byte(%s)";
+// } else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
+// //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
+// temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
+// } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
+// //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
+// temp = "%s";
+// }
+// queryKey = String.format(temp, "t."+attrId);
+// queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'");
+// conditionMap.put(queryKey, queryValue);
+// } else {
+// //涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅
+// conditionMap.put("t."+attrId, value);
+// }
+// }
+// }
+
+ /**
+ * 鏍¢獙鏋氫妇鐨勫唴瀹�
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬�
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ */
+ private void checkEnumOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
+ //濡傛灉鏋氫妇鍙互淇敼锛屽垯涓嶉渶瑕佹牎楠屾槸鍚︾鍚堟灇涓剧殑閫夐」
+
+ Map<String, CodeClstempattrVO> enumAttrVOMap = templateVO.getAttributes().stream().filter(s -> (StringUtils.isNotBlank(s.getEnumstring()) || StringUtils.isNotBlank(s.getEnumid())) && !VciBaseUtil.getBoolean(s.getEnumeditflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (!CollectionUtils.isEmpty(enumAttrVOMap)) {
+ enumAttrVOMap.forEach((attrId, attrVO) -> {
+ String value = getValueFromOrderDTO(orderDTO, attrId);
+ if (StringUtils.isNotBlank(value)) {
+ //鏈夊�兼墠鑳芥牎楠�
+ List<KeyValue> comboboxKVs = listComboboxItems(attrVO);
+ if (!comboboxKVs.stream().anyMatch(s -> value.equalsIgnoreCase(s.getKey()))) {
+ throw new VciBaseException("灞炴�с�恵0}銆戠殑鍊间笉绗﹀悎鏋氫妇鐨勮姹�", new String[]{attrVO.getName()});
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * 杞崲鏃堕棿鐨勬牸寮�
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬�
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ */
+ private void switchDateAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
+ Map<String, CodeClstempattrVO> dateAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getCodedateformat())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (!CollectionUtils.isEmpty(dateAttrVOMap)) {
+ dateAttrVOMap.forEach((attrId, attrVO) -> {
+ String value = getValueFromOrderDTO(orderDTO, attrId);
+ if (StringUtils.isNotBlank(value)) {
+ DateConverter dateConverter = new DateConverter();
+ dateConverter.setAsText(value);
+ value = VciDateUtil.date2Str(dateConverter.getValue(), VciDateUtil.DateTimeMillFormat);
+ setValueToOrderDTO(orderDTO, attrId, value);
+ }
+ });
+ }
+ }
+
+ /**
+ * 鎷疯礉鏁版嵁鍒癱bo瀵硅薄涓�
+ *
+ * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭�
+ * @param cbo 涓氬姟鏁版嵁
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞�
+ * @param edit 鏄惁涓轰慨鏀�
+ */
+ private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, CodeWupinEntity cbo,
+ CodeOrderDTO orderDTO, CodeClstemplateVO templateVO,
+ boolean edit) {
+ String fullPath = "";
+ if (!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())) {
+ fullPath = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel())))
+ .map(CodeClassifyVO::getOid).collect(Collectors.joining("##"));
+ } else {
+ fullPath = classifyFullInfo.getCurrentClassifyVO().getOid();
+ }
+
+// BeanUtils.
+ BeanUtils.copyProperties(orderDTO.getData(),cbo);
+ cbo.setMaterialtype(Short.valueOf("1001"));
+// orderDTO.getData().forEach((key, value) -> {
+// if (!edit || (!checkUnAttrUnEdit(key) &&
+// !VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(key))) {
+// try {
+// cbo.setAttributeValue(key, value);
+// } catch (Exception e) {
+// logger.error("璁剧疆灞炴�х殑鍊奸敊璇�", e);
+// }
+// }
+// });
+ try {
+
+ cbo.setCodeclsfid(classifyFullInfo.getCurrentClassifyVO().getOid());
+ cbo.setCodetemplateoid(templateVO.getOid());
+ cbo.setCodeclsfpath(fullPath);
+// cbo.setMaterialclassify("model_type");
+// cbo.setMaterialname(orderDTO.getData().get("materialname"));
+// cbo.setShifoupihaoguanli("true");
+// cbo.setKucunwl("true");
+// cbo.setXiaoshouwl("false");
+ if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) {
+ //鎵剧敓鍛藉懆鏈熺殑璧峰鐘舵�侊紝鎻掍釜鐐癸紝鐪嬬敓鍛藉懆鏈熸槸鍚﹂渶瑕佸垱寤�
+ if (StringUtils.isNotBlank(cbo.getLctid())) {
+// OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid());
+// if (lifeCycleVO != null) {
+// cbo.setLcStatus("Editing");
+//// cbo.setLcStatus(lifeCycleVO.getStartStatus());
+// } else {
+ cbo.setLcStatus(CodeDefaultLC.EDITING.getValue());
+// }
+ } else {
+ cbo.setLcStatus(CodeDefaultLC.EDITING.getValue());
+ }
+
+ }
+
+ int secret = VciBaseUtil.getInt(cbo.getSecretGrade().toString());
+ //鎻掍釜鐐癸紝鍚庣画鐪嬪瘑绾ф湇鍔℃槸鍚﹀彲鐢�
+// if (secret == 0 || !secretService.checkDataSecret(secret)) {
+ if (secret == 0 ) {
+ Integer userSecret = VciBaseUtil.getCurrentUserSecret();
+// cbo.setAttributeValue(SECRET_FIELD, String.valueOf((userSecret == null || userSecret == 0) ? UserSecretEnum.NONE.getValue() : userSecret));
+ cbo.setSecretGrade(userSecret == null || userSecret == 0 ? UserSecretEnum.NONE.getValue() : userSecret);
+ }
+ } catch (Throwable e) {
+ logger.error("璁剧疆榛樿鐨勫睘鎬х殑鍊奸敊璇�", e);
+ }
+ }
+
+
+ /**
+ * 鍒濆鍖栦笟鍔$被鍨�
+ * --鍒涘缓浜洪粯璁や负褰撳墠鐢ㄦ埛锛屽鏋滈渶瑕佷慨鏀癸紝鍙互鍦ㄨ幏鍙栧悗鑷澶勭悊
+ * @param btmName 涓氬姟绫诲瀷鐨勫悕绉帮紝浼氳嚜鍔ㄥ彉鎴愬皬鍐�
+ * @return CodeWupinEntity
+ * @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父
+ */
+// @Override
+// public CodeWupinEntity createCBOByBtmName(String btmName)
+// throws VciBaseException {
+// if(btmName!=null){
+// btmName = btmName.trim().toLowerCase();
+// }
+// String userid = AuthUtil.getUser().getUserName();
+//// if(!hasCreatedCbos.containsKey(btmName)){
+//// if(StringUtils.isEmpty(userid)){
+//// throw new VciBaseException(msgCodePrefix +"noHasUserid");
+//// }
+//// try {
+//// hasCreatedCbos.put(btmName, createBusinessObject(btmName));
+//// } catch (Exception e) {
+//// logger.error("鍒涘缓涓氬姟绫诲瀷瀵硅薄",e);
+//// throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName});
+//// }
+//// }
+//// ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName));
+//
+// QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
+// btmWrapper.eq("ID",btmName);
+// CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper);
+//// OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName);
+// String userName = AuthUtil.getUser().getUserName();
+// CodeWupinEntity wupinEntity = new CodeWupinEntity();
+// wupinEntity.setOid(null);
+//// bo.setRevisionid((new ObjectUtility()).getNewObjectID36());
+//// bo.setNameoid((new ObjectUtility()).getNewObjectID36());
+// wupinEntity.setBtmname(btmName);
+// wupinEntity.setLastR(String.valueOf(1));
+// wupinEntity.setFirstR(String.valueOf(1));
+// wupinEntity.setFirstV(String.valueOf(1));
+// wupinEntity.setLastV(String.valueOf(1));
+// wupinEntity.setCreator(userName);
+// wupinEntity.setCreateTime(new Date());
+// wupinEntity.setLastModifier(userName);
+// wupinEntity.setLastModifyTime(new Date());
+// wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid());
+// wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule()));
+// if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){
+// //鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1
+//// OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid());
+// wupinEntity.setRevisionValue("1");
+// }
+//
+// wupinEntity.setRevisionSeq(1);
+// wupinEntity.setVersionSeq(1);
+// //鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1
+// wupinEntity.setVersionValue("1");
+// wupinEntity.setLctid("wupinLC");
+// wupinEntity.setLcStatus("Editing");
+// wupinEntity.setId("");
+// wupinEntity.setName("");
+// wupinEntity.setDescription("");
+// wupinEntity.setOwner(userName);
+// wupinEntity.setCheckinby(userName);
+// wupinEntity.setCopyFromVersion("");
+// wupinEntity.setMaterialtype((short) 1001);
+// wupinEntity.setCaigouwl("true");
+// wupinEntity.setShifoupihaoguanli("true");
+// wupinEntity.setKucunwl("true");
+// wupinEntity.setXiaoshouwl("false");
+// wupinEntity.setPassing("true");
+//
+//// this.initTypeAttributeValue(wupinEntity,btmTypeVO);
+// return wupinEntity;
+//
+//
+//// return cbo;
+// }
+
+ /**
+ * 鏄惁涓轰慨鏀瑰拷鐣ョ殑灞炴��
+ * @param attrName 灞炴�х殑鍚嶅瓧
+ * @return true 琛ㄧず搴旇蹇界暐
+ */
+ boolean checkUnAttrUnEdit(String attrName){
+ return (VciQueryWrapperForDO.OID_FIELD.equalsIgnoreCase(attrName)
+ ||"ts".equalsIgnoreCase(attrName)
+ || "lastmodifier".equalsIgnoreCase(attrName)
+ || "lastmodifytime".equalsIgnoreCase(attrName)
+ || "createtime".equalsIgnoreCase(attrName)
+ || "checkintime".equalsIgnoreCase(attrName)
+ ||"checkouttime".equalsIgnoreCase(attrName));
+ }
+
+ /**
+ * 淇濆瓨鍙緭鍙�夌殑淇℃伅
+ *
+ * @param templateVO 妯℃澘鐨勫璞�
+ * @param cboList 鏁版嵁鐨勫唴瀹�
+ */
+// @Override
+// public void batchSaveSelectChar(CodeClstemplateVO templateVO, List<ClientBusinessObject> cboList) {
+// if (templateVO != null && !CollectionUtils.isEmpty(cboList)) {
+// //鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜�
+// List<CodeClstempattrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryidentification())).collect(Collectors.toList());
+//
+// if (!CollectionUtils.isEmpty(selectAttrVOs)) {
+//// SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
+// selectAttrVOs.parallelStream().forEach(attrVO -> {
+// List<String> valuesList = new CopyOnWriteArrayList<>();
+// cboList.parallelStream().forEach(cbo -> {
+// String value = cbo.getAttributeValue(attrVO.getId());
+// if (StringUtils.isNotBlank(value)) {
+// valuesList.add(value);
+// }
+// });
+// if (!CollectionUtils.isEmpty(valuesList)) {
+// charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo);
+// }
+// });
+// }
+// }
+// }
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
new file mode 100644
index 0000000..df1c12d
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
@@ -0,0 +1,419 @@
+package com.vci.ubcs.code.service.impl;
+
+import com.alibaba.nacos.common.utils.StringUtils;
+import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
+import com.vci.ubcs.code.dto.CodeOrderDTO;
+import com.vci.ubcs.code.service.ICodeClassifyService;
+import com.vci.ubcs.code.service.MdmEngineService;
+import com.vci.ubcs.code.service.MdmIOService;
+import com.vci.ubcs.code.vo.CodeClstempattrVO;
+import com.vci.ubcs.code.vo.CodeClstemplateVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO;
+import com.vci.ubcs.starter.bo.WriteExcelData;
+import com.vci.ubcs.starter.exception.VciBaseException;
+import com.vci.ubcs.starter.poi.bo.ReadExcelOption;
+import com.vci.ubcs.starter.poi.bo.SheetDataSet;
+import com.vci.ubcs.starter.poi.bo.SheetRowData;
+import com.vci.ubcs.starter.poi.bo.WriteExcelOption;
+import com.vci.ubcs.starter.poi.util.ExcelUtil;
+import com.vci.ubcs.starter.util.LocalFileUtil;
+import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum;
+import com.vci.ubcs.starter.web.pagemodel.KeyValue;
+import com.vci.ubcs.starter.web.util.VciBaseUtil;
+import com.vci.ubcs.starter.web.util.VciDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFRichTextString;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.RichTextString;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.alibaba.druid.util.FnvHash.Constants.LIMIT;
+import static com.vci.ubcs.code.constant.MdmEngineConstant.CODE_FIELD;
+import static com.vci.ubcs.code.constant.MdmEngineConstant.DEFAULT_ATTR_LIST;
+import static com.vci.ubcs.starter.poi.util.ExcelUtil.KEY_ATTR_CHAR;
+import static com.vci.ubcs.starter.poi.util.ExcelUtil.REQUIRED_CHAR;
+
+@Service
+public class MdmIOServiceImpl implements MdmIOService {
+
+
+ /**
+ * 涓婚搴撳垎绫荤殑鏈嶅姟
+ */
+ @Resource
+ private ICodeClassifyService classifyService;
+
+ /**
+ * 妯℃澘鐨勬湇鍔�
+ */
+ @Resource
+ private CodeClstemplateServiceImpl templateService;
+
+ /**
+ * 涓绘暟鎹紩鎿庣殑鏈嶅姟
+ */
+ @Resource
+ private MdmEngineService engineService;
+
+ /**
+ * 鐢熸垚瀵煎叆鐨勬枃浠�
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param isHistory 鏄惁鍘嗗彶鏁版嵁瀵煎叆
+ * @return excel鐨勬枃浠跺湴鍧�
+ */
+ @Override
+ public String createImportExcel(String codeClassifyOid, boolean isHistory) {
+ List<CodeClstemplateVO> templateVOList=new ArrayList<>();
+
+ VciBaseUtil.alertNotNull("瀵煎嚭妯℃澘","瀵煎嚭鐨勯厤缃�",codeClassifyOid,"涓婚搴撳垎绫荤殑涓婚敭");
+
+ CodeClassifyVO codeClassifyVO = classifyService.getObjectByOid(codeClassifyOid);
+
+ if(isHistory){
+ templateVOList= templateService.childTemplates(codeClassifyOid);
+ }else{
+ //鎵炬ā鏉�
+ CodeClstemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyOid);
+ templateVOList.add(templateVO);
+ }
+
+ WriteExcelOption eo = new WriteExcelOption();
+ eo.setAppend(true);
+ //澧炲姞妯℃澘鐨勪俊鎭鍏�
+ LinkedList<WriteExcelData> tempEDList = new LinkedList<>();
+ tempEDList.add(new WriteExcelData(0,0,"妯℃澘涓婚敭"));
+ tempEDList.add(new WriteExcelData(0,1,"妯℃澘浠e彿"));
+ tempEDList.add(new WriteExcelData(0,2,"妯℃澘鍚嶇О"));
+ for(int j=0;j<templateVOList.size();j++){
+ CodeClstemplateVO templateVO=templateVOList.get(j);
+
+ //缁勫悎鏍煎紡鐨勪笉瀵煎叆锛�
+ // 鏋氫妇鐨勬彁渚涘簭鍒楃殑閫夋嫨
+ //鏃堕棿鍏ㄩ儴缁熶竴涓簓yyy-MM-dd HH:mm:ss
+ //鍙傜収鐨勮嚜琛岃緭鍏ュ悕绉�
+ //鍒嗙被娉ㄥ叆鐨勪笉鐢紝閮芥槸瀵煎叆鍚庤嚜鍔ㄥ鐞嗙殑
+ //缂栫爜锛岀姸鎬佺瓑瀛楁涓嶅鍏�
+ List<CodeClstempattrVO> templateAttrVOS = templateVO.getAttributes().stream().filter(s ->
+ !DEFAULT_ATTR_LIST.contains(s.getId())
+ && StringUtils.isBlank(s.getComponentrule())
+ && StringUtils.isBlank(s.getClassifyinvokeattr())
+ && (isHistory || VciBaseUtil.getBoolean(s.getFormdisplayflag()))
+ ).collect(Collectors.toList());
+
+ if(CollectionUtils.isEmpty(templateAttrVOS)){
+ throw new VciBaseException("妯℃澘娌℃湁閰嶇疆浠讳綍銆愯〃鍗曟樉绀恒�戜负銆愭槸銆戠殑灞炴��");
+ }
+ List<CodeClstempattrVO> idAttrVOList = templateVO.getAttributes().stream().filter(s -> s.getId().equalsIgnoreCase(CODE_FIELD)).collect(Collectors.toList());
+ LinkedList<WriteExcelData> excelDataList = new LinkedList<>();
+ Workbook workbook = new HSSFWorkbook();
+ if(isHistory){
+ excelDataList.add(new WriteExcelData(0,0,"鍒嗙被璺緞"));
+ excelDataList.add(new WriteExcelData(0,1,"鐮佹瀹藉害"));
+ excelDataList.add(new WriteExcelData(0,2,!CollectionUtils.isEmpty(idAttrVOList)?idAttrVOList.get(0).getName():"浼佷笟缂栫爜"));
+ }
+ for (int i = 0; i < templateAttrVOS.size(); i++) {
+ CodeClstempattrVO attrVO = templateAttrVOS.get(i);
+
+ Object text = attrVO.getName();
+ text = exportKeyAndRequired(workbook,attrVO,text);
+ int colIndex = (isHistory?3:0) + i;
+ WriteExcelData excelData = new WriteExcelData(0, colIndex, text);
+ if(StringUtils.isNotBlank(attrVO.getCodedateformat())
+ || VciFieldTypeEnum.VTDateTime.name().equalsIgnoreCase(attrVO.getAttributedatatype())
+ || VciFieldTypeEnum.VTDate.name().equalsIgnoreCase(attrVO.getAttributedatatype())
+ ||VciFieldTypeEnum.VTTime.name().equalsIgnoreCase(attrVO.getAttributedatatype())){
+ excelData.setDateFormat(VciDateUtil.DateTimeFormat);
+ }
+ if(text instanceof RichTextString){
+ excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex()));
+ }
+ excelDataList.add(excelData);
+ if(StringUtils.isNotBlank(attrVO.getEnumstring()) || StringUtils.isNotBlank(attrVO.getEnumid())){
+ //娣诲姞鏁版嵁鏈夋晥鎬�
+ List<String> enumValueList = new ArrayList<>();
+ enumValueList.add("");
+ List<KeyValue> valueList = engineService.listComboboxItems(attrVO);
+ if(!CollectionUtils.isEmpty(valueList)){
+ valueList.stream().forEach(kv->{
+ enumValueList.add(kv.getValue());
+ });
+ }
+ //榛樿鍔�1涓囨潯
+ WriteExcelData ed = new WriteExcelData(1,colIndex,"");
+ ed.setRowTo(100);
+ ed.setColTo(colIndex);
+ ed.setValidation(true);
+ ed.setValidationDataList(enumValueList);
+ ed.setValidationErrorMsg("璇峰湪搴忓垪涓�夋嫨姝g‘鐨勫��");
+ excelDataList.add(ed);
+ }
+ if(VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributedatatype())){
+ List<String> booleanList = new ArrayList<>();
+
+ booleanList.add("鏄�");
+ booleanList.add("鍚�");
+ //榛樿鍔�1涓囨潯
+ WriteExcelData ed = new WriteExcelData(1,colIndex,"");
+ ed.setRowTo(100);
+ ed.setColTo(colIndex);
+ ed.setValidation(true);
+ ed.setValidationDataList(booleanList);
+ ed.setValidationErrorMsg("璇峰湪搴忓垪涓�夋嫨姝g‘鐨勫��");
+ excelDataList.add(ed);
+ }
+ }
+ eo.addSheetDataList(j+templateVO.getName(),excelDataList);
+ tempEDList.add(new WriteExcelData(j+1,0,templateVO.getOid()));
+ tempEDList.add(new WriteExcelData(j+1,1,templateVO.getId()));
+ tempEDList.add(new WriteExcelData(j+1,2,templateVO.getName()));
+ }
+ String excelName = LocalFileUtil.getDefaultTempFolder() + File.separator + codeClassifyVO.getName() + (isHistory?"_鍘嗗彶鏁版嵁瀵煎叆妯℃澘.xls": "_瀵煎叆妯℃澘.xls");
+ eo.addSheetDataList(templateVOList.size()+"妯℃澘淇℃伅銆愯鍕垮垹闄ゆ垨绉诲姩銆�",tempEDList);
+ ExcelUtil.writeDataToFile(excelName,eo);
+ return excelName;
+ }
+
+ /**
+ * 瀵煎嚭鐨勬椂鍊欏皝瑁呭繀杈撳拰鍏抽敭灞炴��
+ * @param attrVO 灞炴�х殑鏄剧ず瀵硅薄
+ * @param text 鍗曞厓鏍肩殑鍊�
+ */
+ private Object exportKeyAndRequired(Workbook workbook,CodeClstempattrVO attrVO,Object text){
+ //蹇呰緭鍔�*锛屽叧閿睘鎬т负钃濊壊
+ if (VciBaseUtil.getBoolean(attrVO.getRequireflag()) || VciBaseUtil.getBoolean(attrVO.getKeyattrflag())) {
+ String value = text.toString();
+ if(VciBaseUtil.getBoolean(attrVO.getRequireflag())) {
+ value += REQUIRED_CHAR;
+ }
+ if(VciBaseUtil.getBoolean(attrVO.getKeyattrflag())){
+ value += KEY_ATTR_CHAR;
+ }
+ RichTextString ts = new HSSFRichTextString(value);
+ if(VciBaseUtil.getBoolean(attrVO.getRequireflag())){
+ Font font = workbook.createFont();
+ font.setColor(HSSFColor.HSSFColorPredefined.RED.getIndex());
+ ts.applyFont(font);
+ }
+
+ if(VciBaseUtil.getBoolean(attrVO.getKeyattrflag())){
+ Font font = workbook.createFont();
+ font.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex());
+ ts.applyFont(font);
+ }
+ return ts;
+ }
+ return text;
+ }
+
+
+ /**
+ * 鎵归噺鐢宠缂栫爜鏁版嵁
+ *
+ * @param orderDTO 缂栫爜鐢宠淇℃伅锛屽繀椤诲寘鍚垎绫讳富閿拰鐮佹鐨勪俊鎭�
+ * @param file excel鏂囦欢鐨勪俊鎭�
+ * @return 鏈夐敊璇俊鎭殑excel鐨勬枃浠�
+ */
+ @Override
+ public CodeImProtRusultVO batchImportCode(CodeOrderDTO orderDTO, File file) {
+ VciBaseUtil.alertNotNull(orderDTO,"缂栫爜鐢宠鐩稿叧鐨勬暟鎹�",orderDTO.getCodeClassifyOid(),"涓婚搴撳垎绫讳富閿�");
+ ReadExcelOption reo = new ReadExcelOption();
+ reo.setReadAllSheet(true);
+ List<SheetDataSet> sheetDataSetList = ExcelUtil.readDataObjectFromExcel(file,null,reo);
+ if(CollectionUtils.isEmpty(sheetDataSetList) || CollectionUtils.isEmpty(sheetDataSetList.get(0).getRowData())
+ ||sheetDataSetList.get(0).getRowData().size()<1){
+ throw new VciBaseException("娌℃湁璇诲彇鍒颁换浣曠殑鏁版嵁");
+ }
+ if(sheetDataSetList.size()>LIMIT+1){
+ throw new VciBaseException("涓轰簡淇濊瘉绯荤粺鐨勭ǔ瀹氭�э紝璇蜂竴娆′笉瑕佸鍏ヨ秴杩�1涓囨潯鐨勬暟鎹�");
+ }
+ //鍏堟壘鍒版瘡涓�琛岀殑鏍囬锛岀劧鍚庢牴鎹爣棰樻潵鑾峰彇瀵瑰簲鐨勫睘鎬�
+ SheetDataSet dataSet = sheetDataSetList.get(0);
+ //鎵剧涓�琛岋紝涓轰簡鎵炬爣棰�
+ CodeClstemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(orderDTO.getCodeClassifyOid());
+
+ //鏍¢獙妯℃澘鏄笉鏄渶鏂扮殑
+ checkTemplateSync(sheetDataSetList,templateVO,0);
+ //鍏堜笉鐢ㄧ灞炴�ф槸鍚﹂兘瀛樺湪锛屽厛杞崲涓�涓嬫暟鎹�
+ Map<String,String> errorMap = new HashMap<>();
+ String redisUUid=batchImportCodes(orderDTO,templateVO,dataSet,errorMap,true);
+ CodeImProtRusultVO codeImProtRusultVO = new CodeImProtRusultVO();
+ List<String> needRowIndexList = new ArrayList<>();
+// String filePath = returnErrorToExcel(dataSet.getRowData(), errorMap, needRowIndexList, dataSet.getColName());
+// if(StringUtils.isNotBlank(filePath)) {
+// codeImProtRusultVO.setFilePath(filePath);
+// }
+// if(StringUtils.isNotBlank(redisUUid)){
+// codeImProtRusultVO.setRedisUuid(redisUUid);
+// }
+ return null;
+// return codeImProtRusultVO;
+ }
+
+ /**
+ * 鏍¢獙妯℃澘鏄惁涓哄悓姝ョ殑
+ * @param sheetDataSetList excel閲岀殑鍐呭
+ * @param templateVO 妯℃澘鐨勪俊鎭�
+ */
+ private void checkTemplateSync(List<SheetDataSet> sheetDataSetList,CodeClstemplateVO templateVO,int i){
+ String templateOidInExcel = "";
+ String templateName="";
+ if(!CollectionUtils.isEmpty(sheetDataSetList)
+ && sheetDataSetList.size()>1 && !CollectionUtils.isEmpty(sheetDataSetList.get(sheetDataSetList.size()-1).getColName())){
+ List<SheetRowData> rowData= sheetDataSetList.get(sheetDataSetList.size()-1).getRowData();
+ templateName=rowData.get(i).getData().get(2);
+ templateOidInExcel=rowData.get(i).getData().get(0);
+ //templateOidInExcel = sheetDataSetList.get(sheetDataSetList.size()-1).getColName().get(sheetDataSetList.size()-i);
+ }
+ /* if(!CollectionUtils.isEmpty(sheetDataSetList)
+ && sheetDataSetList.size()>1 && !CollectionUtils.isEmpty(sheetDataSetList.get(sheetDataSetList.size()-1).getColName())){
+ List<SheetRowData> rowData= sheetDataSetList.get(sheetDataSetList.size()-1).getRowData();
+ templateOidInExcel=rowData.get(i).getData().get(0);
+ //templateOidInExcel = sheetDataSetList.get(sheetDataSetList.size()-1).getColName().get(sheetDataSetList.size()-i);
+ }*/
+ if(StringUtils.isBlank(templateOidInExcel) || !templateOidInExcel.equalsIgnoreCase(templateVO.getOid())){
+ throw new VciBaseException("妯℃澘銆�"+templateName+"銆戜腑鐨勬暟鎹幏鍙栫殑妯$増淇℃伅涓庡綋鍓嶆ā鏉夸笉鍖归厤锛岃纭繚excel鏂囦欢閲屾湁銆愭ā鏉夸俊鎭�-璇峰嬁绉诲姩鎴栧垹闄ゃ�戠殑宸ヤ綔琛紝涓旂‘淇濇瘡娆″鍏ラ兘鏄厛涓嬭浇鐨勫鍏ユā鏉垮悗娣诲姞鐨勬暟鎹�");
+ }
+
+ }
+
+
+ /***
+ * 鎵归噺澶勭悊鐢宠鏁版嵁
+ * @param orderDTO
+ * @param templateVO
+ * @param dataSet
+ * @return
+ */
+ private String batchImportCodes(CodeOrderDTO orderDTO,CodeClstemplateVO templateVO,SheetDataSet dataSet,Map<String,String> errorMap,boolean isEnumType){
+ List<String> codeList=new ArrayList<>();
+// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
+ //瑙勫垯鐨勪富閿渶瑕佸幓鑾峰彇
+// CodeRuleVO ruleVO = engineService.getCodeRuleByClassifyFullInfo(classifyFullInfo);
+// //1.鍒ゆ柇瑙勫垯涓櫎浜嗘祦姘寸爜娈碉紝鏄惁鏈夊叾浠栫爜娈�
+// engineService.checkSecValueOnOrder(ruleVO,orderDTO);
+// List<SheetRowData> rowDataList = dataSet.getRowData();
+//
+// //闄ゅ幓榛樿鐨勫睘鎬�.杩樻湁鍙湁琛ㄥ崟鏄剧ず鐨勫瓧娈垫墠瀵煎叆
+// List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s ->
+// !DEFAULT_ATTR_LIST.contains(s.getId()) && VciBaseUtil.getBoolean(s.getFormdisplayflag())
+// ).collect(Collectors.toList());
+// Map<Integer/**鍒楀彿**/,String/**瀛楁鐨勫悕绉�**/> fieldIndexMap = new HashMap<>();
+// List<String> titleRowData = dataSet.getColName();
+// Map<String/**涓枃鍚嶇О**/, String/**鑻辨枃鍚嶇О**/> attrNameIdMap = attrVOS.stream().collect(Collectors.toMap(s -> s.getName(), t -> t.getId().toLowerCase(Locale.ROOT),(o1, o2)->o2));
+// getFieldIndexMap(titleRowData,attrNameIdMap,fieldIndexMap);
+//
+// //闇�瑕佸垽鏂槸鍚︽墍鏈夌殑灞炴�ч兘鍦ㄦā鏉夸笂浜�
+// List<CodeClassifyTemplateAttrVO> unExistAttrVOs = attrVOS.stream().filter(s -> !fieldIndexMap.containsValue(s.getId().toLowerCase(Locale.ROOT))
+// && StringUtils.isBlank(s.getComponentrule()) && StringUtils.isBlank(s.getClassifyinvokeattr())//缁勫悎瑙勫垯鍜屽垎绫绘敞鍏ョ‘瀹炴病缁欑敤鎴峰鍑哄幓
+// ).collect(Collectors.toList());
+// if(!CollectionUtils.isEmpty(unExistAttrVOs)){
+// throw new VciBaseException("銆�" + unExistAttrVOs.stream().map(CodeClassifyTemplateAttrVO::getName) + "銆戣繖浜涘睘鎬у湪鍒楄〃涓病鏈夋壘鍒�");
+// }
+// List<ClientBusinessObject> cboList = new ArrayList<>();
+// String fullPath = getFullPath(classifyFullInfo);
+// excelToCbo(classifyFullInfo,fieldIndexMap,rowDataList,templateVO,cboList,fullPath,true);
+//
+// //閮借浆鎹㈠畬浜嗐�傞渶瑕佹壒閲忔鏌�
+// //濡傛灉鍑洪敊浜嗭紝鎴戜滑渚濈劧鎵ц鏈夋晥鐨勬暟鎹紝鏃犳晥鐨勬暟鎹啓鍥炲埌excel涓�
+// //2.鍒ゆ柇蹇呰緭椤广�傘�傞渶瑕佸叏閮ㄧ殑灞炴�э紝濡傛灉鏄繀杈擄紝浣嗘槸琛ㄥ崟閲岄潰涓嶆樉绀虹殑锛屽彧鑳芥槸鍒嗙被娉ㄥ叆鎴栬�呯粍鍚堣鍒�
+// batchCheckRequiredAttrOnOrder(templateVO,cboList,errorMap);
+// //3.鍒ゆ柇鍏抽敭灞炴��
+// CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList);
+// Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList();
+// Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList();
+// if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){
+// selfRepeatRowIndexList.stream().forEach(rowIndex->{
+// errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";鍦ㄥ綋鍓嶅鐞嗙殑鏁版嵁鏂囦欢涓叧閿睘鎬ч噸澶�" );
+// });
+// }
+// if(!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)){
+// keyAttrRepeatRowIndexList.stream().forEach(rowIndex->{
+// errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";鍏抽敭灞炴�т笌绯荤粺涓殑閲嶅" );
+// });
+// }
+// //鍒嗙被娉ㄥ叆
+// batchSwitchClassifyAttrOnOrder(attrVOS,cboList,classifyFullInfo,false);
+// //boolean
+// reSwitchBooleanAttrOnOrder(attrVOS,cboList);
+// //4.鏍¢獙瑙勫垯
+// batchCheckVerifyOnOrder(attrVOS, cboList,errorMap);
+// if(isEnumType) {//鏄惁闇�瑕佹牎楠屾灇涓�/鍙傜収
+// //5.鏍¢獙鏋氫妇鏄惁姝g‘
+// batchSwitchEnumAttrOnOrder(attrVOS, cboList, errorMap);
+// //7.澶勭悊鍙傜収鐨勬儏鍐�
+// batchSwitchReferAttrOnOrder(attrVOS,cboList,errorMap);
+// }
+// //6.鏃堕棿鏍煎紡鐨勯獙璇�
+// //6.鏃堕棿鐨勶紝蹇呴』缁熶竴涓簓yyy-MM-dd HH:mm:ss
+// batchSwitchDateAttrOnOrder(attrVOS,cboList,errorMap);
+// //鏈�鍚庡紕缁勫悎瑙勫垯
+// batchSwitchComponentAttrOnOrder(attrVOS,cboList);
+// String uuid=redisService.getUUIDEveryDay();
+// Map<String, ClientBusinessObject> rowIndexCboMap = cboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getAttributeValue((IMPORT_ROW_INDEX)), t -> t));
+//
+// if(errorMap.size()>0) {
+// createRedisDatas(uuid + "-error",templateVO, rowIndexCboMap, dataSet, fieldIndexMap, errorMap,false);
+// }
+// boolean isCreateUUid=false;
+// List<ClientBusinessObject> needSaveCboList = cboList.stream().filter(cbo -> {
+// String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX);
+// return !errorMap.containsKey(rowIndex);
+// }).collect(Collectors.toList());
+// //鐩镐技鏍¢獙
+// Map<String,String>resembleMap=new HashMap<>();
+// List<DataResembleVO> dataResembleVOS=new ArrayList<>();
+// String btmtypeid= classifyFullInfo.getTopClassifyVO().getBtmtypeid();
+// bathcResembleQuery(orderDTO.getCodeClassifyOid(),templateVO,needSaveCboList,resembleMap,btmtypeid,dataResembleVOS);
+// if(resembleMap.size()>0) {
+// isCreateUUid=true;
+// if(!CollectionUtils.isEmpty(dataResembleVOS)) {
+// redisService.setCacheList(uuid + "-resemble-data", dataResembleVOS);
+// createRedisDatas(uuid + "-resemble",templateVO, rowIndexCboMap, dataSet, fieldIndexMap, resembleMap, false);
+// }
+// }
+// //鎺掗櫎閿欒鐨勶紝鍓╀笅姝g‘鐨�
+// Map<String,String> newErrorMap=new HashMap<>();
+// newErrorMap.putAll(resembleMap);
+// newErrorMap.putAll(errorMap);
+// needSaveCboList = cboList.stream().filter(cbo -> {
+// String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX);
+// return !newErrorMap.containsKey(rowIndex);
+// }).collect(Collectors.toList());
+// if((errorMap.size()>0&&needSaveCboList.size()>0)||resembleMap.size()>0){
+// isCreateUUid=true;
+// }
+// createRedisByCodeClassify(uuid + "-class",templateVO,dataSet,fieldIndexMap,false);
+// if(newErrorMap.size()>0) {
+// createRedisDatas(uuid + "-ok",templateVO, rowIndexCboMap, dataSet, fieldIndexMap, newErrorMap,true);
+// }else {
+// uuid="";
+// //瑕佹妸浠ヤ笂鐨勯敊璇殑閮芥姏鍑哄悗锛屽啀缁х画澶勭悊鏃堕棿鍜岀粍鍚堣鍒�
+// needSaveCboList = cboList.stream().filter(cbo -> {
+// String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX);
+// return !newErrorMap.containsKey(rowIndex);
+// }).collect(Collectors.toList());
+// if (!CollectionUtils.isEmpty(needSaveCboList)) {
+// //9.鎴戜滑澶勭悊涓氬姟鏁版嵁
+// //鐢熸垚缂栫爜鐨勫唴瀹�
+// codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(), needSaveCboList);
+// //濡傛灉鏄紪鐮佺敓鎴愬け璐ワ紝鍒欑洿鎺ュ氨澶辫触浜嗭紝鍏朵粬鐨勫垽鏂嚭鏉ユ湁閿欒鐨勬垜浠兘缁熶竴杩斿洖鍒癳xcel閲岄潰
+// engineService.batchSaveSelectChar(templateVO, needSaveCboList);
+// }
+// }
+// if(!isCreateUUid){
+// return uuid="";
+// }
+// return uuid;
+ return null;
+ }
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java
new file mode 100644
index 0000000..8908602
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java
@@ -0,0 +1,707 @@
+package com.vci.ubcs.code.service.impl;
+
+import com.alibaba.nacos.common.utils.StringUtils;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
+import com.vci.ubcs.code.dto.CodeOrderSecDTO;
+import com.vci.ubcs.code.entity.CodeAllCode;
+import com.vci.ubcs.code.entity.CodeSerialValue;
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import com.vci.ubcs.code.enumpack.CodeCutTypeEnum;
+import com.vci.ubcs.code.enumpack.CodeGetValueTypeEnum;
+import com.vci.ubcs.code.enumpack.CodeLevelTypeEnum;
+import com.vci.ubcs.code.enumpack.CodeSecTypeEnum;
+import com.vci.ubcs.code.mapper.CodeAllCodeMapper;
+import com.vci.ubcs.code.mapper.CodeSerialValueMapper;
+import com.vci.ubcs.code.service.ICodeWupinService;
+import com.vci.ubcs.code.service.MdmProductCodeService;
+import com.vci.ubcs.code.vo.CodeClstemplateVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
+import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
+import com.vci.ubcs.starter.exception.VciBaseException;
+import com.vci.ubcs.starter.web.constant.QueryOptionConstant;
+import com.vci.ubcs.starter.web.constant.RegExpConstant;
+import com.vci.ubcs.starter.web.enumpck.OsCodeFillTypeEnum;
+import com.vci.ubcs.starter.web.pagemodel.PageHelper;
+import com.vci.ubcs.starter.web.util.VciBaseUtil;
+import com.vci.ubcs.starter.web.util.VciDateUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.vci.ubcs.code.constant.MdmEngineConstant.*;
+
+public class MdmProductCodeServiceImpl implements MdmProductCodeService {
+
+ /**
+ * 娴佹按鍙风殑鐩稿叧鐨勪俊鎭�
+ */
+ @Resource
+ private CodeSerialValueMapper serialValueMapper;
+
+ /**
+ * 鎵�鏈夌殑缂栫爜鐨勫唴瀹�
+ */
+ @Resource
+ private CodeAllCodeServiceImpl codeAllCodeService;
+
+ /**
+ * 鎵�鏈夌殑缂栫爜鐨勫唴瀹�
+ */
+ @Resource
+ private ICodeWupinService iCodeWupinService;
+
+ @Override
+ public List<String> productCodeAndSaveData(CodeClassifyFullInfoBO classifyFullInfoBO, CodeClstemplateVO templateVO, CodeRuleVO ruleVO, List<CodeOrderSecDTO> secDTOList, List<CodeWupinEntity> dataCBOList) {
+// BatchCBO batchCBO = new BatchCBO();
+// WebUtil.setPersistence(false);
+// dataCBOList = dataCBOList.stream().sorted(((o1, o2) -> o1.getCreateTime().compareTo(o2.getCreateTime()))).collect(Collectors.toList());
+// batchCBO.getCreateCbos().addAll(dataCBOList);
+ List<String> codeList = new ArrayList<>();
+
+ /*****
+ * 淇濊瘉骞跺彂鐨勬椂鍊欙紝鏈�澶ф祦姘村彿閮藉鐨勶紝浣嗘槸杩欑鍔犻攣鏈夊紛绔�
+ *
+ */
+
+ if(dataCBOList.stream().anyMatch(cbo-> StringUtils.isNotBlank(cbo.getId()))
+// && StringUtils.isNotBlank(cbo.getAttributeValue(CODE_SEC_LENGTH_FIELD))
+ ){
+ //鏄巻鍙叉暟鎹鍏�
+ //鍘嗗彶鏁版嵁鎵ц鐨勬椂鍊欙紝杩欎釜绯荤粺浼氬緢鍗�
+ //涓昏鏄负浜嗗綍鍏ユ渶澶ф祦姘村彿鍜宎llcode
+// SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
+ List<CodeAllCode> allCodeDOList = new ArrayList<>();
+ Map<String/**娴佹按渚濇嵁**/, Map<String/**鐮佹鐨勪富閿�**/,Double/**鏈�澶ф祦姘村彿**/>> maxSerialMap = new HashMap<>();
+ dataCBOList.parallelStream().forEach(cbo->{
+// VciBaseUtil.setCurrentUserSessionInfo(sessionInfo);
+ String code = cbo.getId();
+ List<String> serialUnitList = new ArrayList<>();
+ String[] secLengths = cbo.getCodeSecLengthField().split("#");
+ List<CodeBasicSecVO> secVOList = ruleVO.getSecVOList().stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).collect(Collectors.toList());
+ Map<String/**鐮佹鐨勪富閿�**/,String/**鐮佹鐨勫��**/> serialValueMap = new HashMap<>();
+ Map<String, CodeBasicSecVO> secVOMap = secVOList.stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
+ for (int i = 0; i < secLengths.length; i++) {
+ CodeBasicSecVO secVO = secVOList.get(i);
+ String thisSecValue = "";
+ if(i == 0){
+ thisSecValue = code.contains("#")?code.substring(0,code.indexOf("#")):code;
+ } else if(i == secLengths.length-1){
+ //鏈�鍚�
+ thisSecValue = code.contains("#")?code.substring(code.lastIndexOf("#")):code;
+ }else {
+ int start = 0;
+ for (int j = 0; j < i; j++) {
+ start += VciBaseUtil.getInt(secLengths[j]) + 1;
+ }
+ thisSecValue = code.substring(start,start+VciBaseUtil.getInt(secLengths[1]));
+ }
+ if(VciBaseUtil.getBoolean(secVO.getSerialDependFlag())){
+ serialUnitList.add(thisSecValue);
+ }
+ if(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(secVO.getSecType())){
+ serialValueMap.put(secVO.getOid(),thisSecValue);
+ }
+ }
+ String serialUnitString = serialUnitList.size() == 0 ? EMPTY_SERIAL_UNIT : serialUnitList.stream().collect(Collectors.joining(SERIAL_UNIT_SPACE));
+ List<String> serialUnFileStringList = new ArrayList<>();
+ if(!CollectionUtils.isEmpty(serialValueMap)){
+ serialValueMap.forEach((secOid,secValue)->{
+ //瑕佺湅鏄笉鏄ˉ浣嶇殑
+ CodeBasicSecVO secVO = secVOMap.get(secOid);
+ Double serialDb = null;
+ if(OsCodeFillTypeEnum.NONE.getValue().equalsIgnoreCase(secVO.getCodeFillType())){
+ //涓嶈ˉ鐮�
+ //鎶婃墍鏈変笉鏄暟瀛楃殑鍘绘帀锛屽洜涓哄彲鑳戒細鏄�佹暟鎹紝鏂拌鍒�
+ serialDb = VciBaseUtil.getDouble(killUnNumberChar(secValue));
+ }else {
+ //宸﹀彸濉厖鐨勶紝鎴戜滑闇�瑕�
+ serialDb = VciBaseUtil.getDouble(killUnNumberChar(killFillChar(secValue,secVO.getCodeFillSeparator(),
+ OsCodeFillTypeEnum.LEFT.getValue().equalsIgnoreCase(secVO.getCodeFillType()))));
+ }
+ Map<String, Double> thisUnitMaxMap = maxSerialMap.getOrDefault(serialUnitString, new HashMap<>());
+ thisUnitMaxMap.put(secOid,serialDb);
+ maxSerialMap.put(serialUnitString,thisUnitMaxMap);
+ serialUnFileStringList.add(String.valueOf(serialDb));
+ });
+ }
+ CodeAllCode allCodeDO = new CodeAllCode();
+ allCodeDO.setCodeClassifyOid(classifyFullInfoBO.getCurrentClassifyVO().getOid());
+ allCodeDO.setCodeRuleOid(ruleVO.getOid());
+ allCodeDO.setId(cbo.getId());
+ allCodeDO.setCodeClassifyTemplateOid(templateVO.getOid());
+ allCodeDO.setCreateCodeBtm(cbo.getBtmname());
+ allCodeDO.setCreateCodeOid(cbo.getOid());
+ allCodeDO.setSerialUnit(serialUnitString);
+ allCodeDO.setUnFillSerial(serialUnFileStringList.stream().collect(Collectors.joining(SERIAL_VALUE_SPACE)));
+ allCodeDO.setLcStatus(cbo.getLcStatus());
+ allCodeDOList.add(allCodeDO);
+ });
+ //澶勭悊鏈�澶х殑娴佹按鍙�
+ List<CodeSerialValue> addSerialValueList = new ArrayList<>();
+ List<CodeSerialValue> editSerialValueList = new ArrayList<>();
+ maxSerialMap.forEach((serialUnit,secOidMaxMap)->{
+ secOidMaxMap.forEach((secOid,maxSerial)->{
+// Map<String, String> conditionMap = new HashMap<>();
+// conditionMap.put("codeRuleOid", ruleVO.getOid());
+// conditionMap.put("serialUnit", serialUnit);
+// //杩欎釜瀛楁鏄负浜嗚В鍐冲涓祦姘寸殑闂
+// conditionMap.put("codeSecOid", secOid);
+ QueryWrapper<CodeSerialValue> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("codeRuleOid", ruleVO.getOid());
+ queryWrapper.eq("serialUnit", serialUnit);
+ queryWrapper.eq("codeSecOid", secOid);
+
+ List<CodeSerialValue> serialValueDOS = serialValueMapper.selectList(queryWrapper);
+// .selectByCondition(conditionMap, new PageHelper(-1));
+ if (!CollectionUtils.isEmpty(serialValueDOS)) {
+ CodeSerialValue serialValueDO = serialValueDOS.get(0);
+ if(VciBaseUtil.getDouble(serialValueDO.getMaxSerial())<maxSerial){
+ serialValueDO.setMaxSerial(String.valueOf(maxSerial));
+ editSerialValueList.add(serialValueDO);
+ }
+ }else{
+ //娌℃湁
+ CodeSerialValue serialValueDO = new CodeSerialValue();
+ serialValueDO.setCodeRuleOid(ruleVO.getOid());
+ serialValueDO.setSerialUnit(serialUnit);
+ serialValueDO.setCodeSecOid(secOid);
+ serialValueDO.setMaxSerial(maxSerial.toString());
+ addSerialValueList.add(serialValueDO);
+ }
+ });
+ });
+ if(!CollectionUtils.isEmpty(addSerialValueList)){
+// batchCBO.copyFromOther(serialValueMapper.batchInsert(addSerialValueList));
+ for (CodeSerialValue codeSerialValue : addSerialValueList) {
+ serialValueMapper.insert(codeSerialValue);
+ }
+// serialValueMapper.ba
+
+ }
+ if(!CollectionUtils.isEmpty(editSerialValueList)){
+ for (CodeSerialValue codeSerialValue : editSerialValueList) {
+ serialValueMapper.updateById(codeSerialValue);
+ }
+
+// batchCBO.copyFromOther(serialValueMapper.batchUpdate(editSerialValueList));
+ }
+ //澶勭悊allCode
+ if(!CollectionUtils.isEmpty(allCodeDOList)){
+ Map<String, List<CodeAllCode>> ruleGroup = allCodeDOList.stream().collect(Collectors.groupingBy(s -> s.getCodeRuleOid()));
+ Map<String, CodeAllCode> codeDOMap = allCodeDOList.stream().collect(Collectors.toMap(s -> s.getCodeRuleOid() + "${SEP}" + s.getId(), t -> t));
+ List<CodeAllCode> addCodeDOs = new ArrayList<>();
+ List<CodeAllCode> editCodeDOs = new ArrayList<>();
+ ruleGroup.forEach((ruleOid,allCodeDOS)->{
+ VciBaseUtil.switchCollectionForOracleIn(allCodeDOS).stream().forEach(codeDOs->{
+// Map<String,String> conditionMap = new HashMap<>();
+// conditionMap.put("coderuleoid",ruleOid);
+// conditionMap.put("id",QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(codeDOs.stream().map(s->s.getId()).collect(Collectors.toList()).toArray(new String[0])) + ")");
+ QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>();
+ allCodeWrapper.eq("coderuleoid",ruleOid);
+ allCodeWrapper.in("id", QueryOptionConstant.IN + "(" +
+ VciBaseUtil.toInSql(codeDOs.stream().map(s->s.getId()).collect(Collectors.toList()).toArray(new String[0])) + ")");
+ List<CodeAllCode> existCodes = codeAllCodeService.selectByWrapper(allCodeWrapper);
+
+
+ if(!CollectionUtils.isEmpty(existCodes)){
+ existCodes.stream().forEach(existCode->{
+ String rule_id = existCode.getCodeRuleOid() + "${SEP}" + existCode.getId();
+ if(codeDOMap.containsKey(rule_id)){
+ CodeAllCode newCodeDO = codeDOMap.get(rule_id);
+ existCode.setCreateCodeOid(newCodeDO.getOid());
+ existCode.setCreateCodeBtm(newCodeDO.getCreateCodeBtm());
+ existCode.setCodeClassifyTemplateOid(newCodeDO.getCodeClassifyTemplateOid());
+ existCode.setCodeClassifyOid(newCodeDO.getCodeClassifyOid());
+ existCode.setLcStatus(newCodeDO.getLcStatus());
+ editCodeDOs.add(existCode);
+ }
+ });
+ }
+ });
+ });
+ if(!CollectionUtils.isEmpty(editCodeDOs)){
+ Set<String> exitIds = editCodeDOs.stream().map(s -> s.getCodeRuleOid() + "${SEP}" + s.getId()).collect(Collectors.toSet());
+ addCodeDOs = allCodeDOList.stream().filter(s -> !exitIds.contains(s.getCodeRuleOid() + "${SEP}" + s.getId())).collect(Collectors.toList());
+ }else{
+ addCodeDOs = allCodeDOList;
+ }
+ if(!CollectionUtils.isEmpty(editCodeDOs)){
+// batchCBO.copyFromOther(allCodeMapper.batchUpdate(editCodeDOs));
+ codeAllCodeService.updateBatchById(editCodeDOs);
+ }
+ if(!CollectionUtils.isEmpty(addCodeDOs)){
+// batchCBO.copyFromOther(allCodeMapper.batchInsert(addCodeDOs));
+ Map<String, String> statusMap = addCodeDOs.stream().collect(Collectors.toMap(s -> s.getOid(), s -> s.getLcStatus()));
+ addCodeDOs.stream().filter(s -> StringUtils.equalsIgnoreCase("codeallcode",s.getBtmname())).forEach(s -> {
+ s.setLcStatus(statusMap.get(s.getOid()));
+ });
+ codeAllCodeService.saveBatch(addCodeDOs);
+ }
+ }
+// WebUtil.setPersistence(true);
+// boService.persistenceBatch(batchCBO);
+ return codeList;
+ }else {
+ List<CodeBasicSecVO> secVOList = ruleVO.getSecVOList().stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).collect(Collectors.toList());
+ List<String> serialUnitList = new LinkedList<>();
+ List<String> secValueList = new ArrayList<>();
+ Map<String, String> secValueMap = secDTOList.stream().collect(Collectors.toMap(s -> s.getSecOid(), s -> s.getSecValue()));
+ List<CodeBasicSecVO> serialSecVOList = new ArrayList<>();
+ List<CodeBasicSecVO> attrSecVOList = new ArrayList<>();
+ for (int i = 0; i < secVOList.size(); i++) {
+ CodeBasicSecVO secVO = secVOList.get(i);
+ switchSecValue(secVO, secValueMap, classifyFullInfoBO, serialSecVOList, attrSecVOList, serialUnitList, secValueList);
+ }
+ //澶勭悊灞炴�х爜娈靛拰娴佹按鐮佹
+ Map<String/**娴佹按鐮佹鐨勪富閿�**/, Map<String/**娴佹按渚濇嵁**/, Double>> lastMaxSerialValueMap = new HashMap<>();
+ List<CodeAllCode> allCodeDOList = new ArrayList<>();
+
+ //宸茬粡瀛樺偍鐨勬渶澶ф祦姘村彿鐨勫唴瀹�
+ Map<String/**鐮佹鐨勪富閿�**/, Map<String, CodeSerialValue>> maxSerialValueMap = new HashMap<>();
+
+ for (int i = 0; i < dataCBOList.size(); i++) {
+ CodeWupinEntity cbo = dataCBOList.get(i);
+ List<String> thisSecValueList = new LinkedList<>();
+ for (int j = 0; j < secValueList.size(); j++) {
+ thisSecValueList.add(secValueList.get(j));
+ }
+ List<String> thisSerialUnitList = new LinkedList<>();
+ //鍥犱负娴佹按渚濇嵁姣忔鍙兘涓嶄竴鏍凤紝鎵�浠ユ瘡娆¢兘鎷疯礉涓�浠�
+ for (int j = 0; j < serialUnitList.size(); j++) {
+ thisSerialUnitList.add(serialUnitList.get(j));
+ }
+ //鍏堢湅鐪嬫湁娌℃湁灞炴�х殑鐮佹
+ boolean attrSevIsSerialDepend = CollectionUtils.isEmpty(attrSecVOList) ? false : (attrSecVOList.stream().anyMatch(s -> VciBaseUtil.getBoolean(s.getSerialDependFlag())));
+ switchAttrSecValue(attrSecVOList, cbo, thisSecValueList, attrSevIsSerialDepend, thisSerialUnitList);
+
+ String serialUnitString = thisSerialUnitList.size() == 0 ? EMPTY_SERIAL_UNIT : thisSerialUnitList.stream().collect(Collectors.joining(SERIAL_UNIT_SPACE));
+ switchSerialSecValue(serialSecVOList, attrSevIsSerialDepend, ruleVO, serialUnitString, maxSerialValueMap, thisSecValueList, lastMaxSerialValueMap, i == 0);
+
+ //缁勮缂栫爜鐨勫��
+ cbo.setId(thisSecValueList.stream().collect(Collectors.joining()));
+ codeList.add(cbo.getId());
+ StringBuilder sb = new StringBuilder();
+ //鎶婄爜娈甸噷闈㈤兘鎵句竴涓嬫祦姘村彿
+ for (int j = 0; j < serialSecVOList.size(); j++) {
+ CodeBasicSecVO secVO = serialSecVOList.get(j);
+ Double serialValue = lastMaxSerialValueMap.getOrDefault(secVO.getOid(), new HashMap<>()).getOrDefault(serialUnitString, 0d);
+ if (serialValue != null) {
+ sb.append(String.valueOf(serialValue.longValue())).append(SERIAL_VALUE_SPACE);
+ }
+ }
+ //瑕佸瓨鍌ㄦ渶鍚庣殑鍏ㄩ儴allcode
+ wrapperAllCode(classifyFullInfoBO, ruleVO, cbo, templateVO, allCodeDOList, serialUnitString, sb.toString());
+ }
+ saveSerialValue( ruleVO, lastMaxSerialValueMap, maxSerialValueMap);
+
+ Map<String, String> statusMap = allCodeDOList.stream().collect(Collectors.toMap(s -> s.getOid(), s -> s.getLcStatus()));
+ allCodeDOList.stream().filter(s -> StringUtils.equalsIgnoreCase("codeallcode",s.getBtmname())).forEach(s -> {
+ s.setLcStatus(statusMap.get(s.getOid()));
+
+ });
+ codeAllCodeService.saveBatch(allCodeDOList);
+ iCodeWupinService.saveBatch(dataCBOList);
+// batchCBO.getCreateCbos().stream().filter(s -> StringUtils.equalsIgnoreCase("codeallcode",s.getBtmName())).forEach(s -> {
+// s.setLcStatus(statusMap.get(s.getOid()));
+// try {
+// s.setAttributeValue("lcstatus",statusMap.get(s.getOid()));
+// } catch (VCIError e) {
+// e.printStackTrace();
+// }
+// });
+ }
+// WebUtil.setPersistence(true);
+// boService.persistenceBatch(batchCBO);
+ return codeList;
+ }
+ /**
+ * 杞崲灞炴�х爜娈电殑鍊�
+ * @param attrSecVOList 灞炴�х爜娈电殑鏄剧ず瀵硅薄
+ * @param cbo 涓氬姟鏁版嵁锛岀敤浜庤幏鍙栫爜娈电殑鍊�
+ * @param thisSecValueList 鐮佸�肩殑鍒楄〃
+ * @param attrSevIsSerialDepend 鏄惁鏈変綔涓烘祦姘翠緷鎹�
+ * @param serialUnitList 娴佹按渚濇嵁鐨勫唴瀹�
+ * 杩橀渶瑕佸悗缁殑涓�涓Щ妞嶅皢浼氭秹鍙婂埌鍏朵粬鐨勬湇鍔�
+ */
+ private void switchAttrSecValue(List<CodeBasicSecVO> attrSecVOList,CodeWupinEntity cbo,
+ List<String> thisSecValueList,boolean attrSevIsSerialDepend,
+ List<String> serialUnitList){
+ if (!CollectionUtils.isEmpty(attrSecVOList)) {
+ attrSecVOList.stream().forEach(attrSevVO -> {
+ String value = "";
+ if (StringUtils.isNotBlank(attrSevVO.getGetValueClass())) {
+ //浣跨敤缁勫悎瑙勫垯鏉ュ鐞嗙殑
+// value = getValueByFormulaForCBO(cbo, attrSevVO.getGetValueClass());
+ } else {
+// value = cbo.getAttributeValue(attrSevVO.getReferAttributeId());
+ }
+ if (value == null) {
+ value = "";
+ }
+ //鏇挎崲secValueList閲岄潰鐨勫唴瀹�
+ for (int j = 0; j < thisSecValueList.size(); j++) {
+ String secValue = thisSecValueList.get(j);
+ if (secValue.equalsIgnoreCase("${attr_" + attrSevVO.getOid() + "}")) {
+ thisSecValueList.set(j, value);
+ }
+ }
+ if (attrSevIsSerialDepend) {
+ //鏄祦姘翠緷璧栫殑璇濓紝闇�瑕佸幓鏇挎崲涓�涓�
+ for (int j = 0; j < serialUnitList.size(); j++) {
+ String secValue = serialUnitList.get(j);
+ if (secValue.equalsIgnoreCase("${attr_" + attrSevVO.getOid() + "}")) {
+ serialUnitList.set(j, value);
+ }
+ }
+ }
+ });
+ }
+ }
+
+
+ /**
+ * 杞崲娴佹按鐮佹鐨勫��
+ * @param serialSecVOList 娴佹按鐮佹
+ * @param attrSevIsSerialDepend 鏄惁鏈夊睘鎬х爜娈靛弬涓庢祦姘�
+ * @param ruleVO 瑙勫垯鐨勫唴瀹�
+ * @param serialUnitString 娴佹按渚濇嵁
+ * @param maxSerialValueMap 鏈�澶х殑娴佹按鍙�
+ * @param thisSecValueList 鏈鐨勭爜鍊�
+ * @param lastMaxSerialValueMap 灏佽鍚�
+ * @param firstData 鏄惁涓虹涓�鏉℃暟鎹�
+ */
+ private void switchSerialSecValue(List<CodeBasicSecVO> serialSecVOList,boolean attrSevIsSerialDepend,
+ CodeRuleVO ruleVO,String serialUnitString,
+ Map<String/**鐮佹鐨勪富閿�**/,Map<String/**娴佹按渚濇嵁**/,CodeSerialValue>> maxSerialValueMap,List<String> thisSecValueList,
+ Map<String/**鐮佹鐨勪富閿�**/,Map<String/**娴佹按渚濇嵁**/, Double>> lastMaxSerialValueMap,boolean firstData){
+ if (!CollectionUtils.isEmpty(serialSecVOList)) {
+ for (int j = 0; j < serialSecVOList.size(); j++) {
+ CodeBasicSecVO secVO = serialSecVOList.get(j);
+ if (attrSevIsSerialDepend || firstData) {
+ //濡傛灉灞炴�х爜娈典篃鏄緷璧栵紝鍒欐瘡娆¢兘瑕佹煡璇紝濡傛灉灞炴�х爜娈典笉鏄緷璧栵紝鍒欏彧鏌ヨ涓�娆�
+// Map<String, String> conditionMap = new HashMap<>();
+// conditionMap.put("codeRuleOid", ruleVO.getOid());
+// conditionMap.put("serialUnit", serialUnitString);
+// //杩欎釜瀛楁鏄负浜嗚В鍐冲涓祦姘寸殑闂
+// conditionMap.put("codeSecOid", secVO.getOid());
+ QueryWrapper<CodeSerialValue> codeSerialWrapper = new QueryWrapper<>();
+ codeSerialWrapper.eq("codeRuleOid", ruleVO.getOid());
+ codeSerialWrapper.eq("serialUnit", serialUnitString);
+ codeSerialWrapper.eq("codeSecOid", secVO.getOid());
+ List<CodeSerialValue> serialValueDOS = serialValueMapper.selectList(codeSerialWrapper);
+ if (!CollectionUtils.isEmpty(serialValueDOS)) {
+ Map<String, CodeSerialValue> unitSerialMap = maxSerialValueMap.getOrDefault(secVO.getOid(), new HashMap<>());
+ CodeSerialValue serialValueDO = serialValueDOS.get(0);
+ unitSerialMap.put(serialValueDO.getSerialUnit(),serialValueDO);
+ maxSerialValueMap.put(secVO.getOid(), unitSerialMap);
+ }
+ }
+ Double startValue = null;
+ if(maxSerialValueMap.containsKey(secVO.getOid()) && maxSerialValueMap.get(secVO.getOid()).containsKey(serialUnitString)){
+ startValue = VciBaseUtil.getDouble(maxSerialValueMap.get(secVO.getOid()).get(serialUnitString).getMaxSerial());
+ }
+ if(lastMaxSerialValueMap.containsKey(secVO.getOid()) && lastMaxSerialValueMap.get(secVO.getOid()).containsKey(serialUnitString)){
+ //璇存槑澶氫釜鐢宠锛屼箣鍓嶅凡缁忓姞浜嗘祦姘村彿浜�
+ startValue = lastMaxSerialValueMap.get(secVO.getOid()).get(serialUnitString);
+ }
+ Double thisSerialValue = 0d;
+ if (startValue == null) {
+ //绗竴涓紪鐮�
+ thisSerialValue = VciBaseUtil.getDouble(secVO.getSerialStart());
+ } else {
+ //娴佹按鍙疯偗瀹氭槸鏁板瓧
+ thisSerialValue = startValue + (j + 1) * secVO.getSerialStep();
+ }
+ //瑕佺湅鏄惁瓒呰繃鏈�澶х殑娴佹按鍊�
+ if (thisSerialValue >= secVO.getCodeFillLimit()) {
+ throw new VciBaseException("娴佹按鍙峰凡缁忚秴杩囧厑璁哥殑鏈�澶ф祦姘村�納0}",new String[]{secVO.getCodeFillLimit().toString()});
+ }
+ //瑕佺湅琛ヤ綅鐨勫唴瀹�
+ Integer fillLength = VciBaseUtil.getInt(secVO.getCodeFillLength());
+ if (fillLength == 0 || fillLength > VciBaseUtil.getInt(secVO.getCodeSecLength())) {
+ //闃叉鍦ㄦ坊鍔犵殑鍦版柟娌℃湁鎺у埗姝g‘
+ fillLength = VciBaseUtil.getInt(secVO.getCodeSecLength());
+ }
+ String serialString = String.valueOf(thisSerialValue.longValue());
+ serialString = fillString(fillLength, OsCodeFillTypeEnum.forValue(secVO.getCodeFillType()), serialString, secVO.getCodeFillSeparator());
+ for (int z = 0; z < thisSecValueList.size(); z++) {
+ String secValue = thisSecValueList.get(z);
+ if (secValue.equalsIgnoreCase("${" + secVO.getOid() + "}")) {
+ thisSecValueList.set(z, serialString);
+ }
+ }
+ Map<String, Double> unitSerialMap = lastMaxSerialValueMap.getOrDefault(secVO.getOid(), new HashMap<>());
+ unitSerialMap.put(serialUnitString, thisSerialValue);
+ lastMaxSerialValueMap.put(secVO.getOid(),unitSerialMap);
+ }
+ }
+ }
+
+ /**
+ * 杞崲鐮佸�肩殑鍐呭
+ * @param secVO 鐮佹鐨勫唴瀹�
+ * @param secValueMap 鐮佸�肩殑鍐呭锛宬ey鏄爜娈电殑涓婚敭锛寁alue鏄爜鍊�
+ * @param classifyFullInfoBO 鍒嗙被鐨勫叏閮ㄤ俊鎭�
+ * @param serialSecVOList 娴佹按鐮佹
+ * @param attrSecVOList 灞炴�х爜娈�
+ * @param serialUnitList 娴佹按渚濇嵁
+ * @param secValueList 鐮佸�煎垪琛�
+ */
+ private void switchSecValue(CodeBasicSecVO secVO,Map<String,String> secValueMap,
+ CodeClassifyFullInfoBO classifyFullInfoBO,List<CodeBasicSecVO> serialSecVOList,
+ List<CodeBasicSecVO> attrSecVOList, List<String> serialUnitList,
+ List<String> secValueList ){
+ CodeSecTypeEnum secType = CodeSecTypeEnum.forValue(secVO.getSecType());
+ String secValue = secValueMap.getOrDefault(secVO.getOid(), "");
+ switch (secType) {
+ case CODE_FIXED_SEC:
+ //鍥哄畾鐮佹鐨勶紝鐩存帴鐢ㄧ爜鍊�,涓嶈鐮佸�肩殑闀垮害鏄灏戯紝鍥犱负鍙彉闀垮害鍜屽浐瀹氶暱搴︽槸鎺у埗鍦ㄧ爜娈电鐞嗛噷闈㈢殑鐮佸�煎畾涔夌殑
+ break;
+ case CODE_DATE_SEC:
+ //鏃堕棿鐮佹锛岄渶瑕佸皢褰撳墠鏃堕棿渚濇嵁鏃堕棿鏍煎紡杩涜杞崲.
+ //鏃堕棿鐮佹涓嶆秹鍙婂埌鏄惁琛ヤ綅
+ secValue = VciDateUtil.date2Str(new Date(), secVO.getCodeDateFormatStr());
+ break;
+ case CODE_CLASSIFY_SEC:
+ //鍒嗙被鐮佹鐨勶紝涔熸槸浠庡墠绔�夋嫨浜嗙爜鍊煎嵆鍙紝涓嶈鐮佸�肩殑闀垮害鏄灏�
+ break;
+ case CODE_LEVEL_SEC:
+ //灞傜骇鐮佹锛岄渶瑕佷粠鍒嗙被涓婅幏鍙栫浉搴旂殑淇℃伅
+ if (CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(secVO.getCodeLevelType())) {
+ //鏈�灏忓眰锛屽洜涓烘垜浠彧鑳藉湪鍙跺瓙鑺傜偣涓婄敵璇风紪鐮侊紝鎵�浠ヨ繖涓氨鏄綋鍓嶅垎绫荤殑
+ if (CodeGetValueTypeEnum.CURRENT.getValue().equalsIgnoreCase(secVO.getCodeGetValueType()) || CollectionUtils.isEmpty(classifyFullInfoBO.getParentClassifyVOs())) {
+ //灏辨槸褰撳墠鍒嗙被鐨�
+ secValue = classifyFullInfoBO.getCurrentClassifyVO().getId();
+ } else {
+ //鎴戜滑闇�瑕佷粠椤跺眰寮�濮嬫壘鍒板綋鍓嶅垎绫讳负姝�
+ secValue = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).map(CodeClassifyVO::getId).collect(Collectors.joining()) + classifyFullInfoBO.getCurrentClassifyVO().getId();
+ }
+ } else {
+ //鎸囧畾灞傦紝鎴戜滑闇�瑕侀�氳繃涓婄骇鐨勬潵鑾峰彇
+ if (CollectionUtils.isEmpty(classifyFullInfoBO.getParentClassifyVOs())) {
+ //璇存槑褰撳墠宸茬粡鏄渶楂樼殑浜�
+ secValue = classifyFullInfoBO.getCurrentClassifyVO().getId();
+ } else {
+ //杩欎釜鎴戜滑闇�瑕佺湅鐪�,灞傜骇鏄笉鏄ぇ浜庝簡鏈�澶у眰绾х殑鏁�
+ List<CodeClassifyVO> parentClassifyVOList = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).collect(Collectors.toList());
+ if (secVO.getCodeLevelValue() > (parentClassifyVOList.size() + 1)) {
+ //鎸囧畾鐨勫眰绾ф瘮褰撳墠鐨勫眰绾ц繕澶т簡锛屾墍浠ュ彧鑳借幏鍙栧綋鍓嶅眰绾т簡
+ if (CodeGetValueTypeEnum.CURRENT.getValue().equalsIgnoreCase(secVO.getCodeGetValueType())) {
+ secValue = classifyFullInfoBO.getCurrentClassifyVO().getId();
+ } else {
+ secValue = parentClassifyVOList.stream().map(CodeClassifyVO::getId).collect(Collectors.joining()) + classifyFullInfoBO.getCurrentClassifyVO().getId();
+ }
+ } else {
+ //鎴戜滑鑾峰彇鍏朵腑鎸囧畾灞傜殑鍐呭
+ if (CodeGetValueTypeEnum.CURRENT.getValue().equalsIgnoreCase(secVO.getCodeGetValueType())) {
+ CodeClassifyVO classifyVO = parentClassifyVOList.stream().filter(s -> s.getDataLevel().intValue() == secVO.getCodeLevelValue().intValue()).findFirst().orElseGet(() -> null);
+ if (classifyVO != null) {
+ secValue = classifyVO.getId();
+ }
+ } else {
+ //灏忎簬绛変簬鐨勫叏閮ㄦ嬁鍑烘潵
+ secValue = parentClassifyVOList.stream().filter(s -> s.getDataLevel().intValue() <= secVO.getCodeLevelValue().intValue()).sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).map(CodeClassifyVO::getId).collect(Collectors.joining());
+ }
+ }
+ }
+ }
+ //鐪嬬湅闀垮害鏄惁闇�瑕佹埅鏂�
+ if (!CodeCutTypeEnum.NONE.getValue().equalsIgnoreCase(secVO.getValueCutType()) &&
+ secVO.getValueCutLength() != null && secVO.getValueCutLength() > 0 && secValue.length() > secVO.getValueCutLength()) {
+ if (CodeCutTypeEnum.RIGHT.getValue().equalsIgnoreCase(secVO.getValueCutType())) {
+ //宸︽埅鍙栨槸浠庡乏杈瑰壀鎺夛紝鍙虫埅鍙栨槸浠庡彸杈瑰壀鎺�--淇濈暀宸﹁竟
+ secValue = secValue.substring(0, secVO.getValueCutLength());
+ } else {
+ secValue = secValue.substring(secValue.length() - secVO.getValueCutLength());
+ }
+ }
+ break;
+ case CODE_REFER_SEC:
+ //寮曠敤鐨勫湪椤甸潰涓婂凡缁忛�夋嫨浜嗭紝鎵�浠ョ洿鎺ヤ娇鐢ㄥ墠绔笂浼犻�掔殑鍊�
+ //寮曠敤灏辨槸鍙傜収锛屽彲鑳芥槸鍏朵粬鐨勫垎绫伙紙涓氬姟绫诲瀷锛変笅鐨勬暟鎹紝鎵�浠ュ彧鍦ㄩ〉闈笂閫夋嫨
+ break;
+ case CODE_ATTR_SEC:
+ //灞炴�т笌寮曠敤鐨勫尯鍒槸锛屽睘鎬ф槸褰撳墠鏁版嵁閲岀殑灞炴�э紝鑰屽紩鐢ㄥ彲鑳芥槸寮曠敤鍏朵粬鐨勫垎绫荤殑锛堜笟鍔$被鍨嬶級
+ //鍥犱负鍙兘鏄壒閲忕殑鏁版嵁鐨勬搷浣滐紝鎵�浠ユ垜浠繖閲屼笉鑳界洿鎺ュ鐞嗗睘鎬э紝闇�瑕佸悗杈逛竴杈瑰鐞�
+ secValue = "${attr_" + secVO.getOid() + "}";
+ attrSecVOList.add(secVO);
+ break;
+ case CODE_VARIABLE_SEC:
+ //鍙彉鐮佹锛屾槸鍦ㄩ〉闈笂杈撳叆鍐呭
+ if (secValue.length() > VciBaseUtil.getInt(secVO.getCodeSecLength())) {
+ throw new VciBaseException("銆恵0}銆戣繖涓爜娈垫槸鍙彉鐮佹锛屼絾鏄幇鍦ㄨ緭鍏ョ殑鐮佸�肩殑闀垮害({1})瓒呰繃浜嗚瀹氱殑闀垮害{2}", new String[]{secVO.getName(), String.valueOf(secValue.length()), secVO.getCodeSecLength()});
+ }
+ OsCodeFillTypeEnum fillTypeEnum = OsCodeFillTypeEnum.forValue(secVO.getCodeFillType());
+ secValue = fillString(VciBaseUtil.getInt(secVO.getCodeSecLength()), fillTypeEnum, secValue, secVO.getCodeFillSeparator());
+ break;
+ case CODE_SERIAL_SEC:
+ //娴佹按鐮佹
+ serialSecVOList.add(secVO);
+ secValue = "${" + secVO.getOid() + "}";
+ default:
+ break;
+ }
+ if (VciBaseUtil.getBoolean(secVO.getSerialDependFlag())) {
+ serialUnitList.add(secValue);
+ }
+ secValueList.add(secValue);
+ }
+
+ /**
+ * 琛ヤ綅
+ * @param totalLength 鎬婚暱搴�
+ * @param fillTypeEnum 琛ヤ綅鏂瑰紡
+ * @param text 褰撳墠鐨勫唴瀹�
+ * @param fillChar 琛ヤ綅鐨勫瓧绗�
+ * @return 涓嶅~鍏呬綅缃拰闀垮害宸茬粡杈惧埌/瓒呰繃鐨勬椂鍊欎笉浼氬~鍏�
+ */
+ private String fillString(int totalLength,OsCodeFillTypeEnum fillTypeEnum,String text,String fillChar){
+ if(text.length() >= totalLength || OsCodeFillTypeEnum.NONE.equals(fillTypeEnum)){
+ //涓嶇敤琛ヤ綅浜�
+ return text;
+ }
+ int balance = totalLength - text.length();
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < balance; i++) {
+ sb.append(fillChar);
+ }
+ if(OsCodeFillTypeEnum.LEFT.equals(fillTypeEnum)) {
+ text = sb.toString() + text;
+ }else {
+ text = text + sb.toString();
+ }
+ return text;
+ }
+
+ /**
+ * 灏佽瀛樺偍鐮佸�肩殑瀵硅薄
+ * @param classifyFullInfoBO 鍒嗙被鍏ㄩ儴鐨勪俊鎭�
+ * @param ruleVO 瑙勫垯鐨勫唴瀹�
+ * @param cbo 涓氬姟鏁版嵁
+ * @param templateVO 妯℃澘鐨勪俊鎭�
+ * @param allCodeDOList 鎵�鏈夌殑鐮佸�肩殑瀵硅薄鍒楄〃
+ */
+ private void wrapperAllCode(CodeClassifyFullInfoBO classifyFullInfoBO,CodeRuleVO ruleVO,
+ CodeWupinEntity cbo,CodeClstemplateVO templateVO,
+ List<CodeAllCode> allCodeDOList,String serialUnitString,String serialValueString){
+ CodeAllCode allCodeDO = new CodeAllCode();
+ allCodeDO.setCodeClassifyOid(classifyFullInfoBO.getCurrentClassifyVO().getOid());
+ allCodeDO.setCodeRuleOid(ruleVO.getOid());
+ allCodeDO.setId(cbo.getId());
+ allCodeDO.setCodeClassifyTemplateOid(templateVO.getOid());
+ allCodeDO.setCreateCodeBtm(cbo.getBtmname());
+ allCodeDO.setCreateCodeOid(cbo.getOid());
+ allCodeDO.setSerialUnit(serialUnitString);
+ allCodeDO.setUnFillSerial(serialValueString);
+ allCodeDO.setLcStatus(cbo.getLcStatus());
+ allCodeDOList.add(allCodeDO);
+ }
+
+
+
+
+ /**
+ * 淇濆瓨娴佹按鐨勪俊鎭�
+ * @param ruleVO 瑙勫垯鐨勬樉绀哄璞�
+ * @param lastMaxSerialValueMap 鏈�澶х殑娴佹按鍊兼槧灏�
+ * @param maxSerialValueMap 渚濇嵁瀛樺偍鐨勬渶澶ф祦姘寸殑鍐呭
+ */
+ private void saveSerialValue(CodeRuleVO ruleVO,
+ Map<String/**鐮佹鐨勪富閿�**/,Map<String, Double>> lastMaxSerialValueMap,
+ Map<String/**鐮佹鐨勪富閿�**/,Map<String, CodeSerialValue>> maxSerialValueMap){
+ List<CodeSerialValue> editSerialValueDOList = new ArrayList<>();
+ List<CodeSerialValue> addSerialValueDOList = new ArrayList<>();
+ //瀛樺偍鏈�澶ф祦姘村彿
+ lastMaxSerialValueMap.forEach((secOid,maxSerialMap)->{
+ maxSerialMap.forEach((unit,maxSerial)->{
+ CodeSerialValue serialValueDO = null;
+ if(maxSerialValueMap.containsKey(secOid) && maxSerialValueMap.get(secOid).containsKey(unit)){
+ //璇存槑鏈�
+ serialValueDO = maxSerialValueMap.get(secOid).get(unit);
+ serialValueDO.setMaxSerial(maxSerial.toString());
+ editSerialValueDOList.add(serialValueDO);
+ }else{
+ serialValueDO = new CodeSerialValue();
+ serialValueDO.setCodeRuleOid(ruleVO.getOid());
+ serialValueDO.setSerialUnit(unit);
+ serialValueDO.setCodeSecOid(secOid);
+ serialValueDO.setMaxSerial(maxSerial.toString());
+ addSerialValueDOList.add(serialValueDO);
+ }
+ });
+ });
+ if(!CollectionUtils.isEmpty(editSerialValueDOList)){
+// batchCBO.copyFromOther(serialValueMapper.batchUpdate(editSerialValueDOList));
+ for (CodeSerialValue codeSerialValue : editSerialValueDOList) {
+ serialValueMapper.updateById(codeSerialValue);
+ }
+ }
+ if(!CollectionUtils.isEmpty(addSerialValueDOList)){
+ for (CodeSerialValue codeSerialValue : addSerialValueDOList) {
+ serialValueMapper.insert(codeSerialValue);
+ }
+// batchCBO.copyFromOther(serialValueMapper.batchInsert(addSerialValueDOList));
+ }
+ }
+
+ /**
+ * 鍘绘帀涓嶆槸鏁板瓧鐨勫瓧绗�
+ * @param s 瀛楃
+ * @return 鏇挎崲鍚庣殑鍊�
+ */
+ private String killUnNumberChar(String s){
+ Integer lastUnNumberIndex = 0;
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ if(!(new String(new char[]{c})).matches(RegExpConstant.NUMBER)){
+ lastUnNumberIndex = i;
+ }
+ }
+ String value = s;
+ if(lastUnNumberIndex >0){
+ value = value.substring(lastUnNumberIndex);
+ }
+ return value;
+ }
+
+ /**
+ * 鍘婚櫎琛ヤ綅瀛楃
+ * @param s 瀛楃
+ * @param fillString 琛ヤ綅瀛楃
+ * @param left 鏄惁宸﹁ˉ浣�
+ * @return 鏇挎崲鍚庣殑鍊�
+ */
+ private String killFillChar(String s, String fillString,boolean left){
+ Integer index = 0;
+ String value = s;
+ if(left){
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ if((new String(new char[]{c})).equalsIgnoreCase(fillString)){
+ index = i;
+ }
+ }
+ if(index >0){
+ value = value.substring(index);
+ }
+ }else{
+ //浠庡彸寰�宸︽壘
+ for (int i = s.length()-1; i >=0; i++) {
+ char c = s.charAt(i);
+ if((new String(new char[]{c})).equalsIgnoreCase(fillString)){
+ index = i;
+ }
+ }
+ if(index >0){
+ value = value.substring(0,index);
+ }
+ }
+ return value;
+
+ }
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeWupinWrapper.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeWupinWrapper.java
new file mode 100644
index 0000000..e40a0dc
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeWupinWrapper.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 搴勯獮 (smallchill@163.com)
+ */
+package com.vci.ubcs.code.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import com.vci.ubcs.code.entity.CodeWupinEntity;
+import com.vci.ubcs.code.vo.CodeWupinVO;
+import java.util.Objects;
+
+/**
+ * 缂栫爜淇℃伅 鍖呰绫�,杩斿洖瑙嗗浘灞傛墍闇�鐨勫瓧娈�
+ *
+ * @author yuxc
+ * @since 2023-05-05
+ */
+public class CodeWupinWrapper extends BaseEntityWrapper<CodeWupinEntity, CodeWupinVO> {
+
+ public static CodeWupinWrapper build() {
+ return new CodeWupinWrapper();
+ }
+
+ @Override
+ public CodeWupinVO entityVO(CodeWupinEntity codeWupin) {
+ CodeWupinVO codeWupinVO = Objects.requireNonNull(BeanUtil.copy(codeWupin, CodeWupinVO.class));
+
+ //User createUser = UserCache.getUser(codeWupin.getCreateUser());
+ //User updateUser = UserCache.getUser(codeWupin.getUpdateUser());
+ //codeWupinVO.setCreateUserName(createUser.getName());
+ //codeWupinVO.setUpdateUserName(updateUser.getName());
+
+ return codeWupinVO;
+ }
+
+
+}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml
index a29bde1..f3c03fa 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml
@@ -100,4 +100,17 @@
+ <select id="selectChildHasReleaseTemplate" resultType="list">
+ select t.oid as oid, cls.oid as clsoid
+ from platformbtm_codeclstemplate t
+ left join (select oid
+ from platformbtm_codeclassify
+ where lcstatus = #{lcstatus}
+ start with oid = #{classifyoid}
+ connect by prior oid = parentcodeclassifyoid) cls
+ on t.codeclassifyoid = cls.oid
+ where t.lcstatus = #{templatelcstatus}
+ and cls.oid is not null
+ </select>
+
</mapper>
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeWupinMapper.xml b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeWupinMapper.xml
new file mode 100644
index 0000000..c7e7714
--- /dev/null
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeWupinMapper.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.vci.ubcs.code.mapper.CodeWupinMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="codeWupinResultMap" type="com.vci.ubcs.code.entity.CodeWupinEntity">
+ <result column="OID" property="oid"/>
+ <result column="REVISIONOID" property="revisionOid"/>
+ <result column="NAMEOID" property="nameOid"/>
+ <result column="BTMNAME" property="btmname"/>
+ <result column="ISLASTR" property="lastR"/>
+ <result column="ISFIRSTR" property="firstR"/>
+ <result column="ISLASTV" property="lastV"/>
+ <result column="ISFIRSTV" property="firstV"/>
+ <result column="CREATOR" property="creator"/>
+ <result column="CREATETIME" property="createTime"/>
+ <result column="LASTMODIFIER" property="lastModifier"/>
+ <result column="LASTMODIFYTIME" property="lastModifyTime"/>
+ <result column="REVISIONRULE" property="revisionRule"/>
+ <result column="VERSIONRULE" property="versionRule"/>
+ <result column="REVISIONSEQ" property="revisionSeq"/>
+ <result column="REVISIONVALUE" property="revisionValue"/>
+ <result column="VERSIONSEQ" property="versionSeq"/>
+ <result column="VERSIONVALUE" property="versionValue"/>
+ <result column="LCTID" property="lctid"/>
+ <result column="LCSTATUS" property="lcStatus"/>
+ <result column="TS" property="ts"/>
+ <result column="ID" property="id"/>
+ <result column="NAME" property="name"/>
+ <result column="DESCRIPTION" property="description"/>
+ <result column="OWNER" property="owner"/>
+ <result column="CHECKINBY" property="checkinby"/>
+ <result column="CHECKINTIME" property="checkintime"/>
+ <result column="CHECKOUTBY" property="checkoutby"/>
+ <result column="CHECKOUTTIME" property="checkouttime"/>
+ <result column="COPYFROMVERSION" property="copyFromVersion"/>
+ <result column="CODECLSFID" property="codeclsfid"/>
+ <result column="CODECLSFPATH" property="codeclsfpath"/>
+ <result column="CODETEMPLATEOID" property="codetemplateoid"/>
+ <result column="MATERIALCLASSIFY" property="materialclassify"/>
+ <result column="MATERIALID" property="materialid"/>
+ <result column="TUHAO" property="tuhao"/>
+ <result column="PINPAI" property="pinpai"/>
+ <result column="MORENGONGYS" property="morengongys"/>
+ <result column="XIEYIJIAGE" property="xieyijiage"/>
+ <result column="HESUANPICI" property="hesuanpici"/>
+ <result column="BEIZHUSHUOMING" property="beizhushuoming"/>
+ <result column="MATERIALTYPE" property="materialtype"/>
+ <result column="MATERIALNAME" property="materialname"/>
+ <result column="RUANJIANBANBEN" property="ruanjianbanben"/>
+ <result column="QITACHICUN" property="qitachicun"/>
+ <result column="MORENCAIGOUY" property="morencaigouy"/>
+ <result column="YUMAILEIXING" property="yumaileixing"/>
+ <result column="CHUANGJIANGONGSI" property="chuangjiangongsi"/>
+ <result column="CAIGOUWL" property="caigouwl"/>
+ <result column="WULIAOXINGZHI" property="wuliaoxingzhi"/>
+ <result column="XIEYIBIANHAO" property="xieyibianhao"/>
+ <result column="CAIZHI" property="caizhi"/>
+ <result column="CHUKUFANGSHI" property="chukufangshi"/>
+ <result column="SHIFOUPIHAOGUANLI" property="shifoupihaoguanli"/>
+ <result column="KUCUNWL" property="kucunwl"/>
+ <result column="XINGHAOGUIGE" property="xinghaoguige"/>
+ <result column="DUIWAIGUIGE" property="duiwaiguige"/>
+ <result column="ZHIBAOQI" property="zhibaoqi"/>
+ <result column="CAIGOUTIQIANQI" property="caigoutiqianqi"/>
+ <result column="HESUANFENLEI" property="hesuanfenlei"/>
+ <result column="XIAOSHOUWL" property="xiaoshouwl"/>
+ <result column="CHANGJIAXINGHAO" property="changjiaxinghao"/>
+ <result column="ZUIXIAOQIDING" property="zuixiaoqiding"/>
+ <result column="JILIANGDW" property="jiliangdw"/>
+ <result column="ZHILIANGBZ" property="zhiliangbz"/>
+ <result column="FIRSTFL" property="firstfl"/>
+ <result column="SECONDFL" property="secondfl"/>
+ <result column="THRIFL" property="thrifl"/>
+ <result column="OLDCODE" property="oldcode"/>
+ <result column="SECRETGRADE" property="secretGrade"/>
+ <result column="BAOZHUANGGUIGE" property="baozhuangguige"/>
+ <result column="PASSING" property="passing"/>
+ <result column="XBJ" property="xbj"/>
+ <result column="XBXKXS" property="xbxkxs"/>
+ <result column="XFJJSTJ" property="xfjjstj"/>
+ <result column="XGZCCDGCD" property="xgzccdgcd"/>
+ <result column="XXNDJ" property="xxndj"/>
+ <result column="XZJMC" property="xzjmc"/>
+ <result column="ZJXH" property="zjxh"/>
+ <result column="CLPH" property="clph"/>
+ <result column="BMCL" property="bmcl"/>
+ <result column="CPXS" property="cpxs"/>
+ <result column="XBZJBMC" property="xbzjbmc"/>
+ <result column="XWLWWMC" property="xwlwwmc"/>
+ <result column="JJZYQ" property="jjzyq"/>
+ <result column="JSBMC" property="jsbmc"/>
+ <result column="JSBXH" property="jsbxh"/>
+ <result column="JSCCJ" property="jsccj"/>
+ <result column="JSSXT" property="jssxt"/>
+ <result column="JSZGL" property="jszgl"/>
+ <result column="JZL" property="jzl"/>
+ <result column="JZRXX" property="jzrxx"/>
+ <result column="JZXZB" property="jzxzb"/>
+ </resultMap>
+
+
+ <select id="selectCodeWupinPage" resultMap="codeWupinResultMap">
+ select * from PL_CODE_WUPIN where is_deleted = 0
+ </select>
+
+
+</mapper>
--
Gitblit v1.9.3