| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | 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.bo.CodeTemplateAttrSqlBO; |
| | | import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | |
| | | // 回收需要业务数据删除 |
| | | if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) { |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(baseModelDTO.getBtmname())); |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(), VciBaseUtil.toInSql(baseModelDTO.getOid())); |
| | | } else { |
| | | for (BaseModel baseModel : baseModels) { |
| | |
| | | switchDateAttrOnOrder(templateVO, orderDTO); |
| | | //9.生成编码的信息 |
| | | // ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); |
| | | BaseModel cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); |
| | | BaseModel cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmTypeId()); |
| | | // //默认的属性都不用从前端拷贝 |
| | | // //设置编码需要的默认属性的内容 |
| | | copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false); |
| | | cbo.setOid(VciBaseUtil.getPk()); |
| | | cbo.setCreateTime(new Date()); |
| | | cbo.setLastModifyTime(new Date()); |
| | | cbo.setCreator(AuthUtil.getUser().getUserName()); |
| | | cbo.setLastModifier(AuthUtil.getUser().getUserName()); |
| | | // //TODO:因为默认的属性都不拷贝,目前集团码叫name,并没有从DTO拷贝到cbo里。增加一个单独处理,以后再看要不要调整 |
| | | cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName()); |
| | | // //end -- modify by lihang @20220407 |
| | |
| | | |
| | | if (!CollectionUtils.isEmpty(conditionMap)) { |
| | | // final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "}; |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmtypeid())); |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmTypeId())); |
| | | // String referTable = VciBaseUtil.getTableName(referVO.getReferType()); |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | final String[] sql = {"select count(*) from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "}; |
| | | conditionMap.forEach((key, value) -> { |
| | | sql[0] += " and " + key + " = " + value; |
| | |
| | | // 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); |
| | | // } |
| | | // } |
| | | // }); |
| | | orderDTO.getData().forEach((key, value) -> { |
| | | if (!edit || (!checkUnAttrUnEdit(key) && |
| | | !VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(key))) { |
| | | try { |
| | | cbo.getData().put(cbo.getData().containsKey(key.toUpperCase())?key.toUpperCase():key, value); |
| | | } catch (Exception e) { |
| | | logger.error("设置属性的值错误", e); |
| | | } |
| | | } |
| | | }); |
| | | // BeanMap beanMap = BeanMap.create(cbo); |
| | | // beanMap.putAll(orderDTO.getData()); |
| | | |
| | | try { |
| | | |
| | | BeanUtilForVCI.copyPropertiesIgnoreNull(BeanUtilForVCI.convertMap(BaseModel.class, orderDTO.getData()), cbo); |
| | | Map<String, String> data = new HashMap<>(); |
| | | data.put(CODE_CLASSIFY_OID_FIELD, classifyFullInfo.getCurrentClassifyVO().getOid()); |
| | | data.put(CODE_TEMPLATE_OID_FIELD, templateVO.getOid()); |
| | | data.put(CODE_FULL_PATH_FILED, fullPath); |
| | | cbo.setData(data); |
| | | cbo.setOid(VciBaseUtil.getPk()); |
| | | cbo.setCreateTime(new Date()); |
| | | Map<String, String> data = new HashMap<>(); |
| | | data.put(cbo.getData().containsKey(CODE_CLASSIFY_OID_FIELD.toUpperCase())?CODE_CLASSIFY_OID_FIELD.toUpperCase():CODE_CLASSIFY_OID_FIELD, classifyFullInfo.getCurrentClassifyVO().getOid()); |
| | | data.put(cbo.getData().containsKey(CODE_TEMPLATE_OID_FIELD.toUpperCase())?CODE_TEMPLATE_OID_FIELD.toUpperCase():CODE_TEMPLATE_OID_FIELD, templateVO.getOid()); |
| | | data.put(cbo.getData().containsKey(CODE_FULL_PATH_FILED.toUpperCase())?CODE_FULL_PATH_FILED.toUpperCase():CODE_FULL_PATH_FILED, fullPath); |
| | | cbo.getData().putAll(data); |
| | | cbo.setLastModifyTime(new Date()); |
| | | cbo.setCreator(AuthUtil.getUser().getUserName()); |
| | | cbo.setLastModifier(AuthUtil.getUser().getUserName()); |
| | | // cbo.setCodeclsfid(classifyFullInfo.getCurrentClassifyVO().getOid()); |
| | | // cbo.setTemplateOid(templateVO.getOid()); |
| | | // cbo.setCodeclsfpath(fullPath); |
| | | cbo.setTs(new Date()); |
| | | if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) { |
| | | //先写固定,后面生命周期好了在编写 |
| | | //TODO 先写固定,后面生命周期好了在编写 |
| | | if (StringUtils.isNotBlank(cbo.getLctid())) { |
| | | // OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid()); |
| | | // if (lifeCycleVO != null) { |
| | |
| | | fieldVO.setTemplet(attrVO.getTableDisplayJs()); |
| | | } |
| | | if (StringUtils.isBlank(fieldVO.getTemplet()) && VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributeDataType())) { |
| | | fieldVO.setTemplet("function(d){return $webUtil.formateBoolean(d." + fieldVO.getField() + ");}"); |
| | | fieldVO.setTemplet("function(row,column){return row[column.property]=='true' || row[column.property]=='1'?'是':'否'}"); |
| | | // fieldVO.setTemplet("function(d){return $webUtil.formateBoolean(d." + fieldVO.getField() + ");}"); |
| | | } |
| | | fieldVO.setOptionJsMap(eventJsMap); |
| | | fieldVO.setStyle(attrVO.getTableDisplayStyle()); |
| | |
| | | conditionMap.putAll(andConditionMap); |
| | | PageHelper pageHelper = new PageHelper(-1); |
| | | pageHelper.addDefaultDesc("id"); |
| | | return queryGrid(fullInfoBO.getTopClassifyVO().getBtmtypeid(), templateVO, conditionMap, pageHelper); |
| | | return queryGrid(fullInfoBO.getTopClassifyVO().getBtmTypeId(), templateVO, conditionMap, pageHelper); |
| | | } |
| | | return new DataGrid<>(); |
| | | } |
| | |
| | | //说明已经存在 |
| | | return resembleRuleService.getObjectByOid(currentClassifyVO.getCodeResembleRuleOid()); |
| | | } |
| | | if (StringUtils.isBlank(currentClassifyVO.getParentcodeclassifyoid())) { |
| | | if (StringUtils.isBlank(currentClassifyVO.getParentCodeClassifyOid())) { |
| | | return null; |
| | | } |
| | | Map<String, CodeClassifyVO> classifyVOMap = fullInfoBO.getParentClassifyVOs().stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); |
| | | return getUseResembleRule(fullInfoBO, classifyVOMap.getOrDefault(currentClassifyVO.getParentcodeclassifyoid(), null)); |
| | | return getUseResembleRule(fullInfoBO, classifyVOMap.getOrDefault(currentClassifyVO.getParentCodeClassifyOid(), null)); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<CodeClassifyTemplateAttrVO> referAttrVOs = templateVO.getAttributes().stream().filter( |
| | | s -> StringUtils.isNotBlank(s.getReferBtmId()) || StringUtils.isNotBlank(s.getReferConfig()) |
| | | ).collect(Collectors.toList()); |
| | | Map<String/**参照的属性**/, String/**实际的字段**/> referFieldMap = new HashMap<>(); |
| | | Map<String/**参照的属性**/, String/**实际的字段**/> referFieldMap = new ConcurrentHashMap<>(); |
| | | if (!CollectionUtils.isEmpty(referAttrVOs)) { |
| | | referAttrVOs.parallelStream().forEach(attrVO -> { |
| | | UIFormReferVO referVO = null; |
| | |
| | | //使用传入的业务类型查询表 |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referVO.getReferType())); |
| | | // String referTable = VciBaseUtil.getTableName(referVO.getReferType()); |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | String referTable = listR.getData().get(0).getTableName(); |
| | | // String referTable = "pl_code_classify"; |
| | | String referTableNick = attrVO.getId() + "0"; |
| | |
| | | }); |
| | | } |
| | | R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getDefaultAttrByBtmId(btmType); |
| | | // Optional.ofNullable(allAttributeByBtmId.getData()).orElseGet(allAttributeByBtmId.getData().getAttributes()).stream().forEach(attrId -> { |
| | | // if (!selectFieldList.contains(attrId.getOid()) && !"secretgrade".equalsIgnoreCase(attrId.getOid())) { |
| | | // selectFieldList.add(attrId.getOid()); |
| | | // } |
| | | // }); |
| | | |
| | | if (allAttributeByBtmId.getData() != null) { |
| | | for (BtmTypeAttributeVO attribute : allAttributeByBtmId.getData().getAttributes()) { |
| | | if (!selectFieldList.contains(attribute.getId()) && !"secretgrade".equalsIgnoreCase(attribute.getId())) { |
| | |
| | | } |
| | | // String tableName = VciBaseUtil.getTableName(btmType); |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType)); |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | // String referTable = VciBaseUtil.getTableName(referVO.getReferType()); |
| | | String tableName = listR.getData().get(0).getTableName(); |
| | | String sql = "select " + selectFieldList.stream().map(s -> (s.contains(".") ? s : ("t." + s))).collect(Collectors.joining(",")) |
| | |
| | | return (field.contains(".") ? "" : "t.") + field + SPACE + "= '" + getStringValueInWhere(field, value, attrVOMap) + "'" + SPACE; |
| | | } |
| | | } else { |
| | | if (referFieldMap.containsKey(key)) { |
| | | //说明是参照的,我们参照的查询都认为是字符串,如果是时间格式的查询肯定有问题, |
| | | String selectKey = referFieldMap.get(key); |
| | | return getSqlByValue(selectKey, value, null, btmType); |
| | | } else { |
| | | return getSqlByValue(key, value, attrVOMap, btmType); |
| | | } |
| | | // if (referFieldMap.containsKey(key)) { |
| | | // //说明是参照的,我们参照的查询都认为是字符串,如果是时间格式的查询肯定有问题, |
| | | // String selectKey = referFieldMap.get(key); |
| | | // return getSqlByValue(selectKey, value, null, btmType); |
| | | // } else { |
| | | return getSqlByValue(key, value, attrVOMap, btmType); |
| | | // } |
| | | } |
| | | } |
| | | return ""; |
| | |
| | | } |
| | | if (field.contains(".") && attrVOMap != null && attrVOMap.containsKey(field.split("\\.")[0].toLowerCase(Locale.ROOT))) { |
| | | //是参照 |
| | | return value; |
| | | return "'" + value + "'"; |
| | | } else { |
| | | return value; |
| | | } |
| | |
| | | || VciFieldTypeEnum.VTInteger.equals(fieldTypeEnum)) { |
| | | return value; |
| | | } else { |
| | | return value; |
| | | return "'" + value + "'"; |
| | | } |
| | | } else { |
| | | if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) { |
| | | return value; |
| | | } |
| | | return value; |
| | | return "'" + value + "'"; |
| | | } |
| | | } |
| | | |
| | |
| | | // CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); |
| | | CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); |
| | | //找业务类型,然后使用主键去获取数据库里的数据 |
| | | List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), orderDTO.getOid()); |
| | | List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), orderDTO.getOid()); |
| | | |
| | | if (CollectionUtils.isEmpty(cbos)) { |
| | | throw new VciBaseException(DATA_OID_NOT_EXIST); |
| | | } |
| | | // QueryWrapper<CodeWupin> btmWrapper = new QueryWrapper<>(); |
| | | // btmWrapper.eq("OID",orderDTO.getOid()); |
| | | // CodeWupin cbo = codeWupinMapper.selectOne(btmWrapper); |
| | | BaseModel cbo = cbos.get(0); |
| | | // CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); |
| | | // CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid()); |
| | | |
| | | if (cbo != null) { |
| | | if (cbo == null) { |
| | | throw new VciBaseException(DATA_OID_NOT_EXIST); |
| | | } |
| | | // ClientBusinessObject cbo = cbos.get(0); |
| | | if (!cbo.getTs().toString().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) { |
| | | throw new VciBaseException("数据不是最新的,可能他人已经修改,请刷新后再试"); |
| | | } |
| | |
| | | |
| | | //注意模板不能使用数据存储的时候的模板,因为可能会变化 |
| | | |
| | | //1. 判断必输项 |
| | | String codeClassifyOid=cbo.getData().get(CODE_CLASSIFY_OID_FIELD.toUpperCase()); |
| | | orderDTO.setCodeClassifyOid(codeClassifyOid); |
| | | // CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); |
| | | // CodeClassifyTemplateVO templateVO= this.getUsedTemplateByClassifyOid(orderDTO.getCodeClassifyOid()); |
| | | |
| | | |
| | | CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); |
| | | checkRequiredAttrOnOrder(templateVO, orderDTO); |
| | | orderDTO.setTemplateOid(templateVO.getOid()); |
| | | //1. 判断必输项 |
| | | checkRequiredAttrOnOrder(templateVO, orderDTO); |
| | | //2.先注入,再组合,最后校验 |
| | | switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO); |
| | | //3.处理组合规则。组合规则不能使用编码的属性,因为编码的生成可能是需要属性的 |
| | |
| | | copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true); |
| | | //企业码和集团码的不修改 |
| | | cbo.setDescription(orderDTO.getDescription()); |
| | | cbo.setName(orderDTO.getName()); |
| | | // cbo.setName(orderDTO.getName()); |
| | | try { |
| | | cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription()); |
| | | cbo.setName(orderDTO.getName()); |
| | | //// cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription()); |
| | | // cbo.setAttributeValue("name", orderDTO.getName()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // cbo.getData().putAll(orderDTO.getData()); |
| | | cbo.setLastModifyTime(new Date()); |
| | | cbo.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId())); |
| | | updateBatchByBaseModel(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), Collections.singletonList(cbo)); |
| | | // codeWupinMapper.updateById(cbo); |
| | | // |
| | | // 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); |
| | | // |
| | | // |
| | | // List<String> charList = new ArrayList<>(); |
| | | // for (CodeWupinEntity wupinEntity : cboList) { |
| | | // charList.add(wupinEntity.getId()); |
| | | // } |
| | | // batchSaveSelectChar(templateVO, charList); |
| | | // return codeList.size() > 0 ? codeList.get(0) : ""; |
| | | |
| | | |
| | | //修改的时候,编码是不变的 |
| | | // BatchCBO batchCBO = new BatchCBO(); |
| | | // batchCBO.getUpdateCbos().add(cbo); |
| | | // List<ClientBusinessObject> cboList = new ArrayList<>(); |
| | | // cboList.add(cbo); |
| | | // boService.persistenceBatch(batchCBO); |
| | | updateBatchByBaseModel(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), Collections.singletonList(cbo)); |
| | | batchSaveSelectChar(templateVO, Collections.singletonList(cbo)); |
| | | // batchSaveSelectChar(templateVO, Arrays.asList(cbo.getId())); |
| | | } |
| | | |
| | | /** |
| | |
| | | oidCollection.stream().forEach(oids -> { |
| | | Map<String, String> conditionMap = new HashMap<>(); |
| | | // conditionMap.put("oid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); |
| | | List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), oids); |
| | | List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), oids); |
| | | // boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), conditionMap); |
| | | cboList.addAll(cbos); |
| | | }); |
| | |
| | | // batchCBO.getDeleteCbos().addAll(cboList); |
| | | // WebUtil.setPersistence(false); |
| | | // batchCBO.copyFromOther( |
| | | productCodeService.recycleCode(classifyFullInfo.getCurrentClassifyVO().getBtmtypeid(), deleteBatchDTO.getOidList()); |
| | | productCodeService.recycleCode(classifyFullInfo.getCurrentClassifyVO().getBtmTypeId(), deleteBatchDTO.getOidList()); |
| | | // baseMapper.deleteBatchIds(cboList); |
| | | //使用传入的业务类型查询表 |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getCurrentClassifyVO().getBtmtypeid())); |
| | | if (listR.getData().size() == 0) { |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getCurrentClassifyVO().getBtmTypeId())); |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(), |
| | |
| | | //4. 查询的时候,直接使用codeclsfpath来查询 |
| | | CodeClassifyVO topClassifyVO = classifyService.getTopClassifyVO(codeClassifyOid); |
| | | CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid); |
| | | if (topClassifyVO == null || StringUtils.isBlank(topClassifyVO.getBtmtypeid())) { |
| | | if (topClassifyVO == null || StringUtils.isBlank(topClassifyVO.getBtmTypeId())) { |
| | | throw new VciBaseException("当前主题库分类没有顶层分类,或者顶层分类没有设置业务类型"); |
| | | } |
| | | String btmTypeId = topClassifyVO.getBtmtypeid(); |
| | | String btmTypeId = topClassifyVO.getBtmTypeId(); |
| | | if (StringUtils.isBlank(btmTypeId)) { |
| | | return new DataGrid<>("这个分类所属顶层分类没有添加业务类型"); |
| | | } |
| | |
| | | throw new VciBaseException(DATA_OID_NOT_EXIST); |
| | | } |
| | | |
| | | List<BaseModel> cboList = selectByTypeAndOid(topClassifyFullInfo.getTopClassifyVO().getBtmtypeid(), VciBaseUtil.array2String(orderDTOMap.keySet().toArray(new String[0]))); |
| | | List<BaseModel> cboList = selectByTypeAndOid(topClassifyFullInfo.getTopClassifyVO().getBtmTypeId(), VciBaseUtil.array2String(orderDTOMap.keySet().toArray(new String[0]))); |
| | | // cboOidMap.put("oid",QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(orderDTOMap.keySet().toArray(new String[0])) + ")"); |
| | | // List<ClientBusinessObject> cboList = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), cboOidMap); |
| | | if (CollectionUtils.isEmpty(cboList)) { |
| | |
| | | batchSaveSelectChar(firstTemplateVO, cboList); |
| | | }); |
| | | // boService.persistenceBatch(batchCBO); |
| | | updateBatchByBaseModel(topClassifyFullInfo.getTopClassifyVO().getBtmtypeid(), updateList); |
| | | updateBatchByBaseModel(topClassifyFullInfo.getTopClassifyVO().getBtmTypeId(), updateList); |
| | | return R.success("操作成功!"); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public R markDataPassing(String oid, String btmName, Boolean pass) { |
| | | VciBaseUtil.alertNotNull(oid, "业务数据主键", btmName, "业务类型", pass, "标记类型"); |
| | | boolean flag = false; |
| | | boolean flag = true; |
| | | try { |
| | | // QueryWrapper<CodeWupinEntity> wrapper = new QueryWrapper<>(); |
| | | // wrapper.eq("oid",oid); |
| | | CodeWupin data = baseMapper.selectById(oid); |
| | | // ClientBusinessObjectOperation operation = new ClientBusinessObjectOperation(); |
| | | // ClientBusinessObject data = operation.readBusinessObjectById(oid, btmName); |
| | | if (data == null || StringUtils.isBlank(data.getOid())) { |
| | | List<BaseModel> datas = selectByTypeAndOid(btmName, oid); |
| | | if (datas.size() == 0) { |
| | | return R.fail(DATA_OID_NOT_EXIST); |
| | | } |
| | | data.setPassing(String.valueOf(pass)); |
| | | flag = SqlHelper.retBool(baseMapper.updateById(data)); |
| | | // flag = operation.updateBuinessObject(data); |
| | | datas.stream().forEach(data -> data.getData().put("PASSING", String.valueOf(pass))); |
| | | R r = updateBatchByBaseModel(btmName, datas); |
| | | if (!r.isSuccess()) { |
| | | flag = false; |
| | | } |
| | | } catch (Exception e) { |
| | | flag = false; |
| | | e.printStackTrace(); |
| | | } |
| | | if (flag) { |
| | |
| | | public CodeRuleVO getCodeRuleByClassifyOid(String codeClassifyOid) { |
| | | VciBaseUtil.alertNotNull(codeClassifyOid, "分类的主键"); |
| | | CodeClassifyVO classifyVO = classifyService.getObjectByOid(codeClassifyOid); |
| | | String codeRuleOid = classifyVO.getCoderuleoid(); |
| | | String codeRuleOid = classifyVO.getCodeRuleOid(); |
| | | if (StringUtils.isBlank(codeRuleOid)) { |
| | | //往上找 |
| | | CodeClassifyFullInfoBO fullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); |
| | |
| | | public CodeRuleVO getCodeRuleByClassifyFullInfo(CodeClassifyFullInfoBO fullInfoBO) { |
| | | //往上找 |
| | | String codeRuleOid = ""; |
| | | if (StringUtils.isNotBlank(fullInfoBO.getCurrentClassifyVO().getCoderuleoid())) { |
| | | codeRuleOid = fullInfoBO.getCurrentClassifyVO().getCoderuleoid(); |
| | | if (StringUtils.isNotBlank(fullInfoBO.getCurrentClassifyVO().getCodeRuleOid())) { |
| | | codeRuleOid = fullInfoBO.getCurrentClassifyVO().getCodeRuleOid(); |
| | | } else { |
| | | if (CollectionUtils.isEmpty(fullInfoBO.getParentClassifyVOs())) { |
| | | //说明已经是最高层级, |
| | |
| | | //从最高的level开始获取 |
| | | for (int i = 0; i < parentClassifyVOList.size(); i++) { |
| | | CodeClassifyVO record = parentClassifyVOList.get(i); |
| | | if (StringUtils.isNotBlank(record.getCoderuleoid())) { |
| | | codeRuleOid = record.getCoderuleoid(); |
| | | if (StringUtils.isNotBlank(record.getCodeRuleOid())) { |
| | | codeRuleOid = record.getCodeRuleOid(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid); |
| | | //为了防止模板上的业务类型与分类上不对应 |
| | | CodeClassifyVO topClassifyVO = classifyService.getTopClassifyVO(templateVO.getCodeclassifyoid()); |
| | | String btmId = topClassifyVO.getBtmtypeid(); |
| | | String btmId = topClassifyVO.getBtmTypeId(); |
| | | //查询数据 |
| | | Map<String, String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("t.oid", oid); |
| | |
| | | executionId = executionId.substring(0, executionId.lastIndexOf(".")); |
| | | } |
| | | String sql = "select wm_concat(distinct (t.codetempattrOidArr)) codetempattroidarr\n" + |
| | | "from pl_code_wupin t\n" + |
| | | "from pl_code_clsflowtemp t\n" + |
| | | "join PLFLOWINSTANCE plfi on t.ID = plfi.PLTEMPLATEPUID\n" + |
| | | "where plfi.PLEXECUTIONID = '" + executionId + "' and t.CLASSIFYTEMPLATEOID = '" + templateOid + "' and t.CODEPROCESSUSE = '" + processUse + "'"; |
| | | // List<ClientBusinessObject> tempAttrOidArr = boService.queryByOnlySql(sql); |
| | |
| | | if (CollectionUtils.isEmpty(tempAttrOidArr) || StringUtils.isBlank((CharSequence) tempAttrOidArr.get(0).get("codetempattroidarr"))) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return VciBaseUtil.str2List(tempAttrOidArr.get(0).get("codetempattroidarr").toString()); |
| | | return VciBaseUtil.str2List(tempAttrOidArr.get(0).get("CODETEMPATTROIDARR").toString()); |
| | | } |
| | | |
| | | /** |
| | |
| | | throw new VciBaseException("业务数据主键不能为空"); |
| | | } |
| | | List<String> oidList = VciBaseUtil.str2List(conditionMap.get("oid")); |
| | | Map<String, String> oidMap = new HashMap<>(); |
| | | QueryWrapper<CodeWupin> wrapper = new QueryWrapper(); |
| | | if (conditionMap.get("oid").contains(",")) { |
| | | // oidMap.put("oid", QueryOptionConstant.IN +"("+ VciBaseUtil.toInSql(oidList.toArray(new String[0])) + ")"); |
| | | wrapper.in("oid", oidList); |
| | | } else { |
| | | // oidMap.put("oid", conditionMap.get("oid")); |
| | | wrapper.in("oid", conditionMap.get("oid")); |
| | | } |
| | | if (CollectionUtils.isEmpty(oidMap)) { |
| | | throw new VciBaseException("业务数据主键不能为空"); |
| | | } |
| | | // List<ClientBusinessObject> cbos = boService.queryCBO(btmType, oidMap); |
| | | List<CodeWupin> cbos = baseMapper.selectList(wrapper); |
| | | |
| | | List<BaseModel> cbos = selectByTypeAndOid(btmType, conditionMap.get("oid")); |
| | | if (CollectionUtils.isEmpty(cbos)) { |
| | | throw new VciBaseException("未找到业务数据"); |
| | | } |
| | | CodeWupin cbo = cbos.get(0); |
| | | String templateOid = cbo.getCodetemplateoid(); |
| | | // Map<String, String> templateOidMap = new HashMap<>(); |
| | | // templateOidMap.put("oid", templateOid); |
| | | BaseModel cbo = cbos.get(0); |
| | | String templateOid = cbo.getData().get("CODETEMPLATEOID"); |
| | | |
| | | QueryWrapper<CodeClassifyTemplate> codeClassifyTemplateWrapper = new QueryWrapper<>(); |
| | | codeClassifyTemplateWrapper.eq("oid", templateOid); |
| | | List<CodeClassifyTemplate> templateDOList = templateService.list(codeClassifyTemplateWrapper); |
| | | |
| | | // List<CodeClassifyTemplate> templateDOList = boService.queryObject(CodeClassifyTemplate.class, templateOidMap); |
| | | QueryWrapper<CodeClassifyTemplateAttr> codeClassifyTemplateAttrWrapper = new QueryWrapper<>(); |
| | | codeClassifyTemplateAttrWrapper.eq("CLASSIFYTEMPLATEOID", templateOid); |
| | | // templateOidMap.clear(); |
| | | // templateOidMap.put("CLASSIFYTEMPLATEOID",templateOid); |
| | | |
| | | List<CodeClassifyTemplateAttr> attrDOList = codeClassifyTemplateAttrService.list(codeClassifyTemplateAttrWrapper); |
| | | // boService.queryObject(CodeClassifyTemplateAttr.class, templateOidMap); |
| | | |
| | | if (CollectionUtils.isEmpty(templateDOList)) { |
| | | logger.error("找不到业务数据关联的模板,模板主键:" + templateOid); |
| | | throw new VciBaseException("找不到业务数据关联的模板"); |
| | |
| | | uiInfoVO.setLeaf(classifyService.countChildrenByClassifyOid(codeClassifyOid) == 0); |
| | | if (StringUtils.isNotBlank(functionId) && !"~".equalsIgnoreCase(functionId)) { |
| | | List<Menu> buttonVOS = iSysClient.getMenuButtonByType(uiInfoVO.getTemplateVO().getBtmTypeId()).getData(); |
| | | // List<SmOperationVO> operationVOS = operationService.listButtonByFunctionId(functionId); |
| | | // if (operationVOS == null) { |
| | | // operationVOS = new ArrayList<>(); |
| | | // } |
| | | // //查询扩展按钮 |
| | | // List<CodeButtonVO> buttonVOS = listButtonInToolbarByClassifyOid(codeClassifyOid); |
| | | // List<SmOperationVO> operationVOS = operationService.listButtonByFunctionId(functionId); |
| | | // if (operationVOS == null) { |
| | | // operationVOS = new ArrayList<>(); |
| | | // } |
| | | // //查询扩展按钮 |
| | | // List<CodeButtonVO> buttonVOS = listButtonInToolbarByClassifyOid(codeClassifyOid); |
| | | List<SmOperationVO> operationVOS = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(buttonVOS)) { |
| | | for (int i = 0; i < buttonVOS.size(); i++) { |
| | |
| | | public Integer insertBatchByType(String btmType, List<BaseModel> baseModels) { |
| | | //使用传入的业务类型查询表 |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType)); |
| | | if (listR.getData().size() == 0) { |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | //将bean转为map,mybatis统一处理 |
| | |
| | | |
| | | //使用传入的业务类型查询表 |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType)); |
| | | if (listR.getData().size() == 0) { |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | //查询数据 |
| | |
| | | */ |
| | | public BaseModel createBaseModel(String boName) { |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(boName)); |
| | | String userName = AuthUtil.getUser().getUserName(); |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | String userName = String.valueOf(AuthUtil.getUser().getUserId()); |
| | | BaseModel bo = new BaseModel(); |
| | | // bo.setOid(VciBaseUtil.getPk()); |
| | | // bo.setRevisionid(VciBaseUtil.getPk()); |
| | |
| | | public R updateBatchByBaseModel(String btmType, List<BaseModel> baseModels) { |
| | | //使用传入的业务类型查询表 |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType)); |
| | | if (listR.getData().size() == 0) { |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | //将bean转为map,mybatis统一处理 |
| | |
| | | * @return 列表数据 |
| | | */ |
| | | @Override |
| | | public Page<BaseModel>referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) { |
| | | // checkReferConfig(referConfigVO); |
| | | public IPage<BaseModel> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) throws VciBaseException { |
| | | //checkReferConfig(referConfigVO); |
| | | //使用业务类型查询 |
| | | R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType()); |
| | | if (allAttributeByBtmId.getCode() != 200) { |
| | | throw new ServiceException("业务类型feign接口调用错误!"); |
| | | } |
| | | if (Func.isEmpty(allAttributeByBtmId.getData())) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | BtmTypeVO btmTypeVO = allAttributeByBtmId.getData(); |
| | | /** |
| | | * 加上查询最新版次 |
| | |
| | | BtmTypeLcStatusConstant.RELEASE_LIFE_CYCLE.equalsIgnoreCase(btmTypeVO.getLifeCycleId())) { |
| | | baseQueryObject.getConditionMap().put(VciQueryWrapperForDO.LC_STATUS_FIELD, CodeDefaultLC.RELEASED.getValue()); |
| | | } |
| | | |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referConfigVO.getReferType())); |
| | | if (listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | if (listR.getCode() != 200) { |
| | | throw new ServiceException(Func.isNotBlank(listR.getMsg()) ? listR.getMsg() : "业务类型feign接口调用错误!"); |
| | | } |
| | | if (listR.getData().isEmpty()) { |
| | | throw new VciBaseException(Func.isNotBlank(listR.getMsg()) ? listR.getMsg() : "传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | String namesql = ""; |
| | | if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) { |
| | |
| | | |
| | | String lcstatusSql = ""; |
| | | if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) { |
| | | lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus")); |
| | | lcstatusSql = "lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus")); |
| | | } |
| | | // String where = ""; |
| | | |
| | | // if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) { |
| | | // where = "where "; |
| | | // } |
| | | |
| | | String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + ""; |
| | | String num2 = ((baseQueryObject.getPage()) - 1) * baseQueryObject.getLimit() + 1 + ""; |
| | | |
| | | List<Map> maps = commonsMapper.selectBySql("select * from ( select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() |
| | | + " where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString()) |
| | | + "and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString()) |
| | | List<Map> maps = commonsMapper.selectBySql("select * from ( select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE |
| | | + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString()) |
| | | + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 and " |
| | | + lcstatusSql + namesql + codesql + ") t where rownum <=" + num1 + ") where rn >=" + num2 |
| | | ); |
| | | List<BaseModel> baseModels = new ArrayList<>(); |
| | |
| | | } catch (Exception e) { |
| | | throw new VciBaseException("查询失败:" + e.getMessage()); |
| | | } |
| | | int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() |
| | | + " where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString()) |
| | | + "and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString()) |
| | | int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + SPACE |
| | | + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString()) |
| | | + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 and " |
| | | + lcstatusSql + namesql + codesql |
| | | ); |
| | | Page<BaseModel>page=new Page<>(); |
| | | page.setRecords(baseModels); |
| | | page.setTotal(total); |
| | | return page; |
| | | IPage<BaseModel> objectDataGrid = new Page<>(); |
| | | objectDataGrid.setPages(baseQueryObject.getPage()); |
| | | objectDataGrid.setCurrent(baseQueryObject.getPage()); |
| | | objectDataGrid.setRecords(baseModels); |
| | | objectDataGrid.setSize(baseQueryObject.getLimit()); |
| | | objectDataGrid.setTotal(total); |
| | | return objectDataGrid; |
| | | } |
| | | |
| | | /** |
| | |
| | | toBo.setVersionRule(fromBo.getVersionRule()); |
| | | // RevisionValueObject rvObj = this.getNextRevision(fromBo.getBtmName(), fromBo.getNameoid(), item.revRuleName, item.revInput, revisionVal); |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(fromBo.getBtmname())); |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | Map<String, Object> nextRevision = commonsMapper.getNextRevision(listR.getData().get(0).getTableName(), fromBo.getNameOid()); |
| | | toBo.setRevisionSeq(Integer.parseInt(nextRevision.get("REVISIONSEQ").toString())); |
| | | toBo.setRevisionValue(nextRevision.get("REVISIONVAL").toString()); |