| | |
| | | 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.mapper.CommonsMapper; |
| | | 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.CodeClassifyTemplateAttrVO; |
| | | 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.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 javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class MdmEngineServiceImpl extends ServiceImpl<CodeAllCodeMapper, CodeAllCode> implements MdmEngineService { |
| | | |
| | | |
| | | /** |
| | | * 模板的服务 |
| | |
| | | private ICodeClassifyService classifyService; |
| | | |
| | | /** |
| | | * 公式的服务 |
| | | */ |
| | | @Autowired |
| | | private FormulaServiceImpl formulaService; |
| | | |
| | | /** |
| | | * 通用查询 |
| | | */ |
| | | @Resource |
| | | CommonsMapper commonsMapper; |
| | | /** |
| | | * 关键属性的配置 |
| | | */ |
| | | @Autowired |
| | |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | // @Autowired |
| | | // private CodeOsbtmtypeMapper codeOsbtmtypeMapper; |
| | | // @Autowired |
| | | // private CodeOsbtmtypeMapper codeOsbtmtypeMapper; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 使用分类的主键获取可以使用的模板对象 |
| | |
| | | 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 { |
| | | 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()); |
| | | } |
| | | |
| | |
| | | switchDateAttrOnOrder(templateVO, orderDTO); |
| | | //9.生成编码的信息 |
| | | // ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); |
| | | // CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); |
| | | CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); |
| | | // //默认的属性都不用从前端拷贝 |
| | | // //设置编码需要的默认属性的内容 |
| | | // copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false); |
| | | copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false); |
| | | // //TODO:因为默认的属性都不拷贝,目前集团码叫name,并没有从DTO拷贝到cbo里。增加一个单独处理,以后再看要不要调整 |
| | | // cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName()); |
| | | cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName()); |
| | | // //end -- modify by lihang @20220407 |
| | | // List<CodeWupinEntity> cboList = new ArrayList<>(); |
| | | // |
| | | // //备注 |
| | | // cbo.setDescription(orderDTO.getDescription()); |
| | | List<CodeWupinEntity> cboList = new ArrayList<>(); |
| | | |
| | | //备注 |
| | | cbo.setDescription(orderDTO.getDescription()); |
| | | cboList.add(cbo); |
| | | // |
| | | // 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; |
| | | List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList); |
| | | |
| | | |
| | | List<String> charList = new ArrayList<>(); |
| | | for (CodeWupinEntity wupinEntity : cboList) { |
| | | charList.add(wupinEntity.getId()); |
| | | } |
| | | batchSaveSelectChar(templateVO, charList); |
| | | return codeList.size() > 0 ? codeList.get(0) : ""; |
| | | // return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | dataLowMap.putAll(orderDTO.getData()); |
| | | compAttrVOMap.forEach((attrId, attrVO) -> { |
| | | // dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentrule())); |
| | | dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentRule())); |
| | | }); |
| | | dataLowMap.forEach((key, value) -> { |
| | | setValueToOrderDTO(orderDTO, key, value); |
| | |
| | | if (value == null) { |
| | | value = ""; |
| | | } |
| | | // wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); |
| | | 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 (!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); |
| | | // } |
| | | // } |
| | | if (Integer.parseInt(commonsMapper.selectById(sql[0]).get(0)) > 0) { |
| | | String ruleInfoMsg = keyRuleVO == null ? "" : "查询规则:去除空格--{0},忽略大小写--{1},忽略全半角--{2},忽略全部空格--{3}"; |
| | | String[] objs = new String[]{trim ? "是" : "否", ignoreCase ? "是" : "否", ignoreWidth ? "是" : "否", trimAll ? "是" : "否"}; |
| | | throw new VciBaseException("根据您填写的关键属性的内容,结合关键属性查询规则,发现这个数据已经在系统中存在了。请修正!。" + ruleInfoMsg, objs); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @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); |
| | | // } |
| | | // } |
| | | // } |
| | | @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); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 校验枚举的内容 |
| | |
| | | * @return CodeWupinEntity |
| | | * @throws VciBaseException 初始化出错的是会抛出异常 |
| | | */ |
| | | // @Override |
| | | // public CodeWupinEntity createCBOByBtmName(String btmName) |
| | | // throws VciBaseException { |
| | | // if(btmName!=null){ |
| | | // btmName = btmName.trim().toLowerCase(); |
| | | @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}); |
| | | // } |
| | | // } |
| | | // 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; |
| | | // } |
| | | // 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 templateVO 模板的对象 |
| | | * @param cboList 数据的内容 |
| | | */ |
| | | // @Override |
| | | // public void batchSaveSelectChar(CodeClstemplateVO templateVO, List<ClientBusinessObject> cboList) { |
| | | // if (templateVO != null && !CollectionUtils.isEmpty(cboList)) { |
| | | // //是异步的,所以直接循环 |
| | | // List<CodeClassifyTemplateAttrVO> 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<>(); |
| | | @Override |
| | | public void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/ |
| | | List<String> cboList) { |
| | | if (templateVO != null && !CollectionUtils.isEmpty(cboList)) { |
| | | //是异步的,所以直接循环 |
| | | List<CodeClassifyTemplateAttrVO> 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 = cboList; |
| | | // cboList.parallelStream().forEach(cbo -> { |
| | | // String value = cbo.getAttributeValue(attrVO.getId()); |
| | | // String value = cbo.get.getAttributeValue(attrVO.getId()); |
| | | // if (StringUtils.isNotBlank(value)) { |
| | | // valuesList.add(value); |
| | | // } |
| | | // }); |
| | | // if (!CollectionUtils.isEmpty(valuesList)) { |
| | | if (!CollectionUtils.isEmpty(valuesList)) { |
| | | for (String s : valuesList) { |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode(templateVO.getBtmTypeId()); |
| | | dictBiz.setDictKey(s); |
| | | dictBiz.setDictValue(s); |
| | | //从原来的charService(可输可选)更改为调用omd中的接口来实现 |
| | | iDictBizClient.getCheck(dictBiz); |
| | | } |
| | | // charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo); |
| | | // } |
| | | // }); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |