¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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() { |
| | | } |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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() { |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | } |
| | | } |
| | | |
| | | 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) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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", "æ¶é´æ³"); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 主é¢åºå®ä¹è¡¨ æ°å¢ |
| | | * @param |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨ç¼å·çè·¯å¾è·å对象 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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))); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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) { |
| | | //妿åºé,æé误信æ¯åå°text |
| | | 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)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 æä¸¾å¯¹è±¡ï¼ä¸å卿¶åè¿ånull |
| | | */ |
| | | public static CodeDefaultLC forValue(String value) { |
| | | for (CodeDefaultLC wenum : CodeDefaultLC.values()) { |
| | | if (wenum.getValue().equalsIgnoreCase(value)) { |
| | | return wenum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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); |
| | | |
| | | } |
| | |
| | | * @param oid |
| | | * @return |
| | | */ |
| | | @MapKey("oid") |
| | | @MapKey("OID") |
| | | Map<String,String> selectAllLevelChildOid(@Param("oid") String oid); |
| | | |
| | | /** |
| | |
| | | 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); |
| | | |
| | | } |
| | |
| | | * @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); |
| | | } |
| | |
| | | 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; |
| | |
| | | * @author ludc |
| | | * @date 2022-03-01 |
| | | */ |
| | | public interface CodeSerialValueMapper { |
| | | public interface CodeSerialValueMapper extends BaseMapper<CodeSerialValue> { |
| | | |
| | | |
| | | List<CodeSerialValue> selectByCodeRoleId(@Param("codeRuleOid") String codeRuleOid); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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); |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | * @return æ¥è¯¢ç»æ |
| | | */ |
| | | List<CodeClassify> selectAllLevelParents(String oid); |
| | | |
| | | /** |
| | | * 主é®è·å主é¢åºåç±» |
| | | * @param oid ä¸»é® |
| | | * @return 主é¢åºåç±»æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | CodeClassifyVO getObjectByOid(String oid) throws VciBaseException; |
| | | |
| | | /** |
| | | * 使ç¨å类主é®è·ååç±»ç¸å
³çææä¿¡æ¯ |
| | | * @param codeClassifyOid åç±»çä¸»é® |
| | | * @return åç±»ä¸çº§ï¼ä¸çº§çä¿¡æ¯ |
| | | */ |
| | | CodeClassifyFullInfoBO getClassifyFullInfo(String codeClassifyOid); |
| | | } |
| | |
| | | * @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); |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | 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; |
| | |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | CodeKeyAttrRepeatRuleVO codeKeyAttrRepeatRuleDO2VO(CodeKeyattrrepeatEntity codeKeyattrrepeatEntity); |
| | | |
| | | /** |
| | | * 使ç¨åç±»çå
¨é¨ä¿¡æ¯æ¥è·åå
³é®å±æ§å¤æè§åçå
容 |
| | | * @param classifyFullInfo 主é¢åºåç±»çå
¨é¨ä¿¡æ¯ |
| | | * @return è§åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | CodeKeyattrrepeatVO getRuleByClassifyFullInfo(CodeClassifyFullInfoBO classifyFullInfo); |
| | | |
| | | /** |
| | | * 主é®è·åå
³é®æ°æ®æ¥éè§å |
| | | * @param oid ä¸»é® |
| | | * @return å
³é®æ°æ®æ¥éè§åæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | CodeKeyAttrRepeatRuleVO getObjectByOid(String oid); |
| | | } |
| | |
| | | */ |
| | | R clearAllCode(String oid); |
| | | |
| | | |
| | | /** |
| | | * 使ç¨ä¸»é®è·åç¼ç è§åçå
容 |
| | | * @param codeRuleOid ä¸»é® |
| | | * @return è§åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | CodeRuleVO getObjectHasSecByOid(String codeRuleOid); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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); |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 { |
| | | /** |
| | | * çæç¼ç --å¹¶ä¸ä¿åæ°æ®-æ¹æ³å éï¼å æ¤ä¸è½è¿åbatchCBO |
| | | * @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); |
| | | |
| | | } |
| | |
| | | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private IDictBizClient iDictBizClient; |
| | | |
| | | /** |
| | | * åºå®ç 段çç å¼çæå¡ |
| | | */ |
| | | @Resource |
| | | private ICodeFixedValueService fixedValueService; |
| | | |
| | | /** |
| | | * ä¸å±åç±»ç æ®µç屿§åç§° |
| | |
| | | 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); |
| | | //妿ælcstatusçç±»çè¯ |
| | | if (true) { |
| | | //vo.setLcStatusText({lcStatusFullClassName}.getTextByValue(vo.getLcStatus())); |
| | | } |
| | | } |
| | | return vo; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | private CodeOsbtmtypeMapper codeOsbtmtypeMapper; |
| | | @Resource |
| | | CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper; |
| | | @Resource |
| | | ICodeRuleService ICodeRuleService; |
| | | |
| | | /** |
| | | * æ¥å¿ |
| | |
| | | if(StringUtils.isBlank(oid)){ |
| | | throw new ServiceException("oidä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | return codeClassifyMapper.checkHasChild(oid.trim()); |
| | | return !codeClassifyMapper.checkHasChild(oid.trim()); |
| | | } |
| | | |
| | | |
| | |
| | | //2ãæ¥è¯¢è¦å é¤çåç±»æ°æ® |
| | | List<CodeClassify> codeClassifyDOList = codeClassifyMapper.selectBatchIds(s); |
| | | deletes.addAll(codeClassifyDOList); |
| | | codeClassifyMapper.deleteBatchIds(s); |
| | | // codeClassifyMapper.deleteBatchIds(s); |
| | | baseMapper.deleteBatchIds(s); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 主é®è·å主é¢åºåç±» |
| | | * @param oid ä¸»é® |
| | | * @return 主é¢åºåç±»æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼æ°æ®ä¸å卿¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public CodeClassifyVO getObjectByOid(String oid) throws VciBaseException{ |
| | | return codeClassifyDO2VO(selectByOid(oid)); |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨ç¼å·çè·¯å¾è·å对象 |
| | | * |
| | | * @param idPath ç¼å·çè·¯å¾ï¼ä¸å®è¦ä»æé¡¶å±èç¹å¼å§ï¼æ ¼å¼ä¸ºxxx/yyy/zz è¿æ · |
| | |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | @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) |
| | |
| | | // 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); |
| | |
| | | //å¤å¶æ¨¡æ¿é¶æ®µï¼é¶æ®µå±æ§ |
| | | 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);//䏿§è¡ä¿å |
| | |
| | | //å¤å¶æ¨¡æ¿é¶æ®µï¼é¶æ®µå±æ§ |
| | | 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); |
| | |
| | | // 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,模æ¿é¶æ®µèoid:模æ¿å±æ§æ°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<>(); |
| | |
| | | // 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(); |
| | |
| | | /** |
| | | * å¤å¶æ¨¡æ¿æé® |
| | | */ |
| | | 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); |
| | |
| | | // 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(); |
| | |
| | | // 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("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
| | |
| | | return R.data(codeClassifyTemplateDO2VO(codeClassifyTemplateDO)); |
| | | } |
| | | |
| | | /** |
| | | *æ ¹æ®ç¶åç±»id廿¥æ¾å¶åèç¹ç模æ¿ï¼å¦ææ²¡æ¥å°å认为模æ¿å¨ä¸å±å»ºç«ï¼åæ ¹æ®åç±»å»æ¥å½åæ¨¡æ¿ |
| | | * @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){ |
| | | //è·åçæ¬å·æå¤§çé£ä¸ª |
| | | 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); |
| | | } |
| | | } |
| | |
| | | */ |
| | | 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; |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * å
³é®å±æ§æ¥éè§å æå¡å®ç°ç±» |
| | |
| | | } |
| | | 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; |
| | | } |
| | | //å
³é®å±æ§çè§åå¯ä»¥ä¸ºç©ºï¼ä¸ºç©ºçæ¶åå°±ä»£è¡¨ä¸æ§å¶ï¼ |
| | | 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; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使ç¨ä¸»é®è·åç¼ç è§åçå
容 |
| | | * |
| | | * @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); |
| | | //妿ælcstatusçç±»çè¯ |
| | | vo.setLcStatusText(CodeRuleLC.getTextByValue(vo.getLcStatus())); |
| | | if (hasSec) { |
| | | //æ¥è¯¢ç 段 |
| | | vo.setSecVOList(codeBasicSecService.listCodeBasicSecByRuleOid(vo.getOid())); |
| | | } |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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)); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | //è¿éè¦ä¿®æ¹allCodeççå½å¨æ |
| | | // 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ï¼å¹¶æ²¡æä»DTOæ·è´å°cboéãå¢å ä¸ä¸ªåç¬å¤çï¼ä»¥ååçè¦ä¸è¦è°æ´ |
| | | // 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); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ£åè¡¨è¾¾å¼æ¯å¦æ£ç¡® |
| | | * |
| | | * @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())) { |
| | | //æ ¡éªæ£åè¡¨è¾¾å¼ |
| | | 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)) { |
| | | // //ä¸ºç©ºçæ¶åï¼ä¸è½ç¨QueryOperation.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 { |
| | | // //ä¸ºç©ºçæ¶åä¸ä»£è¡¨ä¸æ ¡éªï¼åªæ¯ä¸å»é¤ç¸å
³çä¿¡æ¯ |
| | | // 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); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ·è´æ°æ®å°cboå¯¹è±¡ä¸ |
| | | * |
| | | * @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); |
| | | // } |
| | | // }); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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,"模æ¿ä»£å·")); |
| | | tempEDList.add(new WriteExcelData(0,2,"模æ¿åç§°")); |
| | | for(int j=0;j<templateVOList.size();j++){ |
| | | CodeClstemplateVO templateVO=templateVOList.get(j); |
| | | |
| | | //ç»åæ ¼å¼çä¸å¯¼å
¥ï¼ |
| | | // æä¸¾çæä¾åºåçéæ© |
| | | //æ¶é´å
¨é¨ç»ä¸ä¸ºyyyy-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("请å¨åºåä¸éæ©æ£ç¡®çå¼"); |
| | | 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("请å¨åºåä¸éæ©æ£ç¡®çå¼"); |
| | | 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.æ ¡éªæä¸¾æ¯å¦æ£ç¡® |
| | | // batchSwitchEnumAttrOnOrder(attrVOS, cboList, errorMap); |
| | | // //7.å¤çåç
§çæ
åµ |
| | | // batchSwitchReferAttrOnOrder(attrVOS,cboList,errorMap); |
| | | // } |
| | | // //6.æ¶é´æ ¼å¼çéªè¯ |
| | | // //6.æ¶é´çï¼å¿
é¡»ç»ä¸ä¸ºyyyy-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); |
| | | // } |
| | | // } |
| | | // //æé¤é误çï¼å©ä¸æ£ç¡®ç |
| | | // 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); |
| | | // //妿æ¯ç¼ç çæå¤±è´¥ï¼åç´æ¥å°±å¤±è´¥äºï¼å
¶ä»çå¤æåºæ¥æé误çæä»¬é½ç»ä¸è¿åå°exceléé¢ |
| | | // engineService.batchSaveSelectChar(templateVO, needSaveCboList); |
| | | // } |
| | | // } |
| | | // if(!isCreateUUid){ |
| | | // return uuid=""; |
| | | // } |
| | | // return uuid; |
| | | return null; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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)) |
| | | ){ |
| | | //æ¯å岿°æ®å¯¼å
¥ |
| | | //å岿°æ®æ§è¡çæ¶åï¼è¿ä¸ªç³»ç»ä¼å¾å¡ |
| | | //ä¸»è¦æ¯ä¸ºäºå½å
¥æå¤§æµæ°´å·åallcode |
| | | // 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())) { |
| | | //鲿¢å¨æ·»å çå°æ¹æ²¡ææ§å¶æ£ç¡® |
| | | 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 ç å¼çå
容ï¼keyæ¯ç 段ç主é®ï¼valueæ¯ç å¼ |
| | | * @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; |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | <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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |