| | |
| | | ICodeReferBtmTypeService codeReferBtmTypeService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 相似项查询规则 |
| | | */ |
| | |
| | | public static final String SPECIAL_CHAR = "VCI"; |
| | | // @Autowired |
| | | // private CodeOsbtmtypeMapper codeOsbtmtypeMapper;---- |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 初始化业务类型 |
| | | * --创建人默认为当前用户,如果需要修改,可以在获取后自行处理 |
| | | * |
| | | * @param btmName 业务类型的名称,会自动变成小写 |
| | | * @return CodeWupinEntity |
| | | * @throws VciBaseException 初始化出错的是会抛出异常 |
| | |
| | | throw new VciBaseException("initBtmError",new String[]{btmName}); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | //查询是否有分类注入的 |
| | | return formDefineVO; |
| | | } |
| | | |
| | | /** |
| | | * 属性类型与js中的字段类型的映射 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查看是否默认属性 |
| | | * |
| | | * @param selectKey |
| | | * @param btmType |
| | | * @return |
| | |
| | | } |
| | | return VciBaseUtil.str2List(tempAttrOidArr.get(0).get("codetempattroidarr").toString()); |
| | | } |
| | | |
| | | /** |
| | | * 使用分类的主键获取业务数据 |
| | | * |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 使用分类的主键获取表格的定义 |
| | | * |
| | |
| | | |
| | | /** |
| | | * 加载成参照的修改配置 |
| | | * |
| | | * @param vo 表格字段显示对象 |
| | | */ |
| | | private void setReferConfig2EditConfig(UITableFieldVO vo) { |
| | |
| | | |
| | | /** |
| | | * 加载成下拉框的修改配置 |
| | | * |
| | | * @param vo 表格字段显示对象 |
| | | */ |
| | | private void setComboxConfig2EditConfig(UITableFieldVO vo) { |
| | |
| | | |
| | | /** |
| | | * 根据业务类型名称创建业务数据源对象 |
| | | * |
| | | * @param boName 业务类型名称 |
| | | * @return 业务数据对象 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取版次的值 |
| | | * |
| | | * @param verRuleName 版次的规则 |
| | | * @return 版次的值,没有规则则为空 |
| | | */ |
| | |
| | | * @return 列表数据 |
| | | */ |
| | | @Override |
| | | public Page<BtmTypeVO> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) { |
| | | public DataGrid<BaseModel> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) { |
| | | // checkReferConfig(referConfigVO); |
| | | //使用业务类型查询 |
| | | R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType()); |
| | |
| | | BtmTypeLcStatusConstant.RELEASE_LIFE_CYCLE.equalsIgnoreCase(btmTypeVO.getLifeCycleId())) { |
| | | baseQueryObject.getConditionMap().put(VciQueryWrapperForDO.LC_STATUS_FIELD, CodeDefaultLC.RELEASED.getValue()); |
| | | } |
| | | baseQueryObject.getConditionMap().put("domain", AppConstant.APPLICATION_NAME_CODE); |
| | | R<Page<BtmTypeVO>> refPage = btmTypeClient.getRefPage(baseQueryObject); |
| | | if(refPage.getCode() != 200){ |
| | | throw new ServiceException("业务类型feign接口调用错误"); |
| | | // baseQueryObject.getConditionMap().put("domain", AppConstant.APPLICATION_NAME_CODE); |
| | | // R<Page<BtmTypeVO>> refPage = btmTypeClient.getRefPage(baseQueryObject); |
| | | // |
| | | // if (refPage.getCode() != 200) { |
| | | // throw new ServiceException("业务类型feign接口调用错误"); |
| | | // } |
| | | |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referConfigVO.getReferType())); |
| | | if (listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | return refPage.getData(); |
| | | String namesql = ""; |
| | | if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) { |
| | | String s = baseQueryObject.getConditionMap().get("name"); |
| | | s = "%" + s + "%"; |
| | | namesql = "and name like" + VciBaseUtil.toInSql(s); |
| | | } |
| | | |
| | | String codesql = ""; |
| | | if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("id"))) { |
| | | String s = baseQueryObject.getConditionMap().get("id"); |
| | | s = "%" + s + "%"; |
| | | codesql = "and id like" + VciBaseUtil.toInSql(s); |
| | | } |
| | | |
| | | String lcstatusSql = ""; |
| | | if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) { |
| | | lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus")); |
| | | } |
| | | |
| | | 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()) |
| | | + lcstatusSql + namesql + codesql + ") t where rownum <=" + num1 + ") where rn >=" + num2 |
| | | ); |
| | | List<BaseModel> baseModels = new ArrayList<>(); |
| | | //将查询到的数据转换为basemodel,使用的反射方式来进行创建的 |
| | | try { |
| | | for (Map map : maps) { |
| | | Object obj = BaseModel.class.newInstance(); |
| | | BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); |
| | | PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); |
| | | for (PropertyDescriptor property : propertyDescriptors) { |
| | | Method setter = property.getWriteMethod(); |
| | | if (setter != null) { |
| | | //oracle的时间为TIMESTAMP的,需要进行转换成data,否则将报错 |
| | | if (map.get(property.getName().toUpperCase()) instanceof TIMESTAMP) { |
| | | LocalDateTime localDateTime = ((TIMESTAMP) map.get(property.getName().toUpperCase())).toLocalDateTime(); |
| | | ZoneId zoneId = ZoneId.systemDefault(); |
| | | ZonedDateTime zdt = localDateTime.atZone(zoneId); |
| | | Date date = Date.from(zdt.toInstant()); |
| | | setter.invoke(obj, date); |
| | | 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()); |
| | | } else if (map.get(property.getName().toUpperCase()) != null) { |
| | | setter.invoke(obj, map.get(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); |
| | | baseModels.add((BaseModel) obj); |
| | | } |
| | | } 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()) |
| | | + lcstatusSql + namesql + codesql |
| | | ); |
| | | |
| | | DataGrid<BaseModel> objectDataGrid = new DataGrid<>(); |
| | | objectDataGrid.setPage(baseQueryObject.getPage()); |
| | | objectDataGrid.setData(baseModels); |
| | | objectDataGrid.setLimit(baseQueryObject.getLimit()); |
| | | objectDataGrid.setTotal(total); |
| | | return objectDataGrid; |
| | | } |
| | | |
| | | /** |