| | |
| | | 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.vci.ubcs.code.applyjtcodeservice.vo.BaseModelVO; |
| | | import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO; |
| | | import com.vci.ubcs.code.bo.CodeTemplateAttrSqlBO; |
| | | import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant; |
| | |
| | | import com.vci.ubcs.code.vo.pagemodel.UITableFieldVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.UITablePageVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.*; |
| | | import com.vci.ubcs.code.wrapper.BaseMdodelWrapper; |
| | | import com.vci.ubcs.flow.core.dto.FlowStatusDTO; |
| | | import com.vci.ubcs.flow.core.feign.IMDMIFlowAttrClient; |
| | | import com.vci.ubcs.flow.core.vo.ProcessStageAttrVO; |
| | |
| | | //备注 |
| | | 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 (BaseModel baseModel : cboList) { |
| | | // charList.add(baseModel.getId()); |
| | | // } |
| | | batchSaveSelectChar(templateVO, cboList); |
| | | return codeList.size() > 0 ? codeList.get(0) : ""; |
| | | // return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | return dataList; |
| | | } |
| | | |
| | | /** |
| | | /** |
| | | * 根据当前申请编码的分类,逐层往上校验是否符合属于配置的中的分类子节点的分 |
| | | * 类,如果符合,则该分类申请的编码为集团码返回true,反之则为企业编码返回false |
| | | * @param parameter 传入数据,classifyGroupCode:配置的中的分类顶节点,oid:选择节点的oid |
| | | */ |
| | | @Override |
| | | public R checkGroupCode(Map<String, String> parameter) { |
| | | List<CodeClassify> codeClassifyList = classifyService.selectAllLevelParents(parameter.get("oid")); |
| | | Set<String> configGroupCode = Arrays.stream(parameter.get("classifyGroupCode").split("#")).collect(Collectors.toSet()); |
| | | // Boolean checkGroupFlag = false;//是否查询到配置的顶层分类中 |
| | | for (int i = codeClassifyList.size()-1; i >= 0; i--) { |
| | | if(configGroupCode.contains(codeClassifyList.get(i).getId())){ |
| | | // checkGroupFlag = true; |
| | | return R.data("true"); |
| | | } |
| | | // if(checkGroupFlag && parameter.get("nowApplyCode").equals(codeClassifyList.get(i).getId())){ |
| | | // return R.data(true); |
| | | // } |
| | | } |
| | | return R.data("false"); |
| | | } |
| | | |
| | | /** |
| | | * 封装关键属性的查询语句 |
| | | * |
| | | * @param value 当前的值 |
| | |
| | | return (BaseModel) valueWrapper.get(); |
| | | } catch (Exception e) { |
| | | logger.error("创建业务类型对象", e); |
| | | throw new VciBaseException("initBtmError", new String[]{btmName}); |
| | | throw new ServiceException("initBtmError:"+"业务类型:"+btmName+":"+e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | return phaseAttrService.listAttrByTemplateOidAndPhaseId(templateVO.getOid(), phase); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 路径上包含当前分类的所有分类信息 |
| | | * |
| | |
| | | String codeRuleOid = classifyVO.getCodeRuleOid(); |
| | | if (StringUtils.isBlank(codeRuleOid)) { |
| | | //往上找 |
| | | CodeClassifyFullInfoBO fullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); |
| | | return getCodeRuleByClassifyFullInfo(fullInfo); |
| | | CodeRuleVO classifyFullInfoCodeRule = getCodeRuleByClassifyFullInfo(classifyService.getClassifyFullInfo(codeClassifyOid)); |
| | | return toCodeValueApplyStatus(classifyFullInfoCodeRule); |
| | | } |
| | | //查询编码规则 |
| | | return ruleService.getObjectHasSecByOid(codeRuleOid); |
| | | CodeRuleVO objectHasSecByOid = ruleService.getObjectHasSecByOid(codeRuleOid); |
| | | return toCodeValueApplyStatus(objectHasSecByOid); |
| | | } |
| | | |
| | | /** |
| | | * 编码申请表单,隐藏、可输、只读转换 |
| | | * @param codeRuleVO |
| | | * @return |
| | | */ |
| | | private CodeRuleVO toCodeValueApplyStatus(CodeRuleVO codeRuleVO){ |
| | | if(codeRuleVO.getSecVOList().isEmpty()){ |
| | | return codeRuleVO; |
| | | } |
| | | // 可输码段类型 |
| | | List<String> inputTypes = Arrays.asList( |
| | | CodeSecTypeEnum.CODE_FIXED_SEC.getValue(), |
| | | CodeSecTypeEnum.CODE_VARIABLE_SEC.getValue(), |
| | | CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue(), |
| | | CodeSecTypeEnum.CODE_REFER_SEC.getValue(), |
| | | CodeSecTypeEnum.CODE_DATE_SEC.getValue() |
| | | ); |
| | | // 只读码段类型 |
| | | List<String> readOnlyTypes = Arrays.asList( |
| | | CodeSecTypeEnum.CODE_LEVEL_SEC.getValue(), |
| | | CodeSecTypeEnum.CODE_ATTR_SEC.getValue() |
| | | ); |
| | | // 隐藏码段类型 |
| | | /*List<String> hideType = Arrays.asList( |
| | | CodeSecTypeEnum.CODE_SERIAL_SEC.getValue() |
| | | );*/ |
| | | // 当前规则的所有类型码段 |
| | | List<String> secTypeList = codeRuleVO.getSecVOList().stream().map(CodeBasicSecVO::getSecType).collect(Collectors.toList()); |
| | | // 情况一 全部是只读的码段类型 |
| | | boolean hasAllReadOnlyType =secTypeList.stream().allMatch(item -> readOnlyTypes.stream().anyMatch(item1-> item.equals(item1))); |
| | | // 全部是只读的码段类型 |
| | | if(hasAllReadOnlyType){ |
| | | List<CodeBasicSecVO> basicSecVOS = codeRuleVO.getSecVOList().stream().map(secVO -> { |
| | | secVO.setCodeValueApplyStatus(3); |
| | | // 日期码段设置默认值 |
| | | if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) { |
| | | try { |
| | | secVO.setCodeDateFormatStr(Func.format(new Date(),secVO.getCodeDateFormatStr())); |
| | | }catch (Exception e){ |
| | | throw new ServiceException("日期码段日期格式配置有误,导致转换出错:"+e.getMessage()); |
| | | } |
| | | } |
| | | return secVO; |
| | | }).collect(Collectors.toList()); |
| | | codeRuleVO.setSecVOList(basicSecVOS); |
| | | return codeRuleVO; |
| | | } |
| | | // 情况二 全部都是可输入类型的 |
| | | boolean hasAllInputType = secTypeList.stream().allMatch(item -> inputTypes.stream().anyMatch(item1-> item.equals(item1))); |
| | | if(hasAllInputType){ |
| | | List<CodeBasicSecVO> basicSecVOS = codeRuleVO.getSecVOList().stream().map(secVO -> { |
| | | secVO.setCodeValueApplyStatus(1); |
| | | // 日期码段设置默认值 |
| | | if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) { |
| | | try { |
| | | secVO.setCodeDateFormatStr(Func.format(new Date(),secVO.getCodeDateFormatStr())); |
| | | }catch (Exception e){ |
| | | throw new ServiceException("日期码段日期格式配置有误,导致转换出错:"+e.getMessage()); |
| | | } |
| | | } |
| | | return secVO; |
| | | }).collect(Collectors.toList()); |
| | | codeRuleVO.setSecVOList(basicSecVOS); |
| | | return codeRuleVO; |
| | | } |
| | | // 情况三包含人为选择的码段,又有只读类型码段的,所有码段都要显示出来,可输设置为1,只读设置为2,隐藏设置为3 |
| | | List<CodeBasicSecVO> basicSecVOS = codeRuleVO.getSecVOList().stream().map(secVO -> { |
| | | if(inputTypes.contains(secVO.getSecType())){ |
| | | secVO.setCodeValueApplyStatus(1); |
| | | }else if(readOnlyTypes.contains(secVO.getSecType())){ |
| | | secVO.setCodeValueApplyStatus(2); |
| | | }else{ |
| | | secVO.setCodeValueApplyStatus(3); |
| | | } |
| | | // 日期码段设置默认值 |
| | | if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) { |
| | | try { |
| | | secVO.setCodeDateFormatStr(Func.format(new Date(),secVO.getCodeDateFormatStr())); |
| | | }catch (Exception e){ |
| | | throw new ServiceException("日期码段日期格式配置有误,导致转换出错:"+e.getMessage()); |
| | | } |
| | | } |
| | | return secVO; |
| | | }).collect(Collectors.toList()); |
| | | codeRuleVO.setSecVOList(basicSecVOS); |
| | | codeRuleVO.setIsShowHideStatus(hasAllReadOnlyType ? "readOnly":(hasAllInputType ? "input":"readAndInput")); |
| | | return codeRuleVO; |
| | | } |
| | | |
| | | /** |
| | | * 使用分类的全部信息获取编码规则 |
| | |
| | | return baseModels; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据业务类型名称创建业务数据源对象 |
| | | * |
| | |
| | | * @return 列表数据 |
| | | */ |
| | | @Override |
| | | public IPage<BaseModel> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) throws VciBaseException { |
| | | public IPage<BaseModelVO> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) throws VciBaseException { |
| | | //checkReferConfig(referConfigVO); |
| | | //使用业务类型查询 |
| | | R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType()); |
| | |
| | | ZonedDateTime zdt = localDateTime.atZone(zoneId); |
| | | Date date = Date.from(zdt.toInstant()); |
| | | setter.invoke(obj, date); |
| | | map.remove(property.getName().toUpperCase()); |
| | | //map.remove(property.getName().toUpperCase()); |
| | | } //oracle的数字为BigDecimal的,需要进行转换成Integer,否则将报错 |
| | | else if (map.get(property.getName().toUpperCase()) instanceof BigDecimal |
| | | && ("Integer").equals(setter.getParameterTypes()[0].getSimpleName())) { |
| | | setter.invoke(obj, ((BigDecimal) map.get(property.getName().toUpperCase())).intValue()); |
| | | map.remove(property.getName().toUpperCase()); |
| | | //map.remove(property.getName().toUpperCase()); |
| | | } else if (map.get(property.getName().toUpperCase()) != null) { |
| | | if(setter.getParameterTypes()[0].getSimpleName().equals("String")){ |
| | | setter.invoke(obj, map.get(property.getName().toUpperCase()) == null ? null:String.valueOf(map.get(property.getName().toUpperCase()))); |
| | | }else{ |
| | | setter.invoke(obj, map.get(property.getName().toUpperCase())); |
| | | } |
| | | map.remove(property.getName().toUpperCase()); |
| | | //map.remove(property.getName().toUpperCase()); |
| | | } |
| | | } |
| | | } |
| | | for (Object key : map.keySet()) { |
| | | map.put(key, String.valueOf(map.get(key))); |
| | | } |
| | | |
| | | ((BaseModel) obj).setData(map); |
| | | Map<String, String> newMap = new HashMap<>(); |
| | | map.forEach((key, value) -> newMap.put(String.valueOf(key).toLowerCase(), String.valueOf(value))); |
| | | ((BaseModel) obj).setData(newMap); |
| | | baseModels.add((BaseModel) obj); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 " |
| | | + lcstatusSql + namesql + codesql |
| | | ); |
| | | IPage<BaseModel> objectDataGrid = new Page<>(); |
| | | IPage<BaseModelVO> objectDataGrid = new Page<>(); |
| | | objectDataGrid.setPages(baseQueryObject.getPage()); |
| | | objectDataGrid.setCurrent(baseQueryObject.getPage()); |
| | | objectDataGrid.setRecords(baseModels); |
| | | objectDataGrid.setRecords(BaseMdodelWrapper.build().listVO(baseModels)); |
| | | objectDataGrid.setSize(baseQueryObject.getLimit()); |
| | | objectDataGrid.setTotal(total); |
| | | return objectDataGrid; |
| | |
| | | treeWrapperOptions.setParentOid(queryObject.getParentOid()); |
| | | return revisionModelUtil.doList2Trees(codeClassifies, treeWrapperOptions, null); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean checkUnAttrUnEdit(String attrName) { |