| | |
| | | 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 com.vci.ubcs.core.log.exception.ServiceException; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | |
| | | */ |
| | | @Autowired |
| | | ICodeReferBtmTypeService codeReferBtmTypeService; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | public static final String SPECIAL_CHAR = "VCI"; |
| | | // @Autowired |
| | | // private CodeOsbtmtypeMapper codeOsbtmtypeMapper;---- |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | // 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) { |
| | |
| | | /** |
| | | * 初始化业务类型 |
| | | * --创建人默认为当前用户,如果需要修改,可以在获取后自行处理 |
| | | * |
| | | * @param btmName 业务类型的名称,会自动变成小写 |
| | | * @return CodeWupinEntity |
| | | * @throws VciBaseException 初始化出错的是会抛出异常 |
| | |
| | | throw new VciBaseException("initBtmError",new String[]{btmName}); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | //查询是否有分类注入的 |
| | | return formDefineVO; |
| | | } |
| | | |
| | | /** |
| | | * 属性类型与js中的字段类型的映射 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查看是否默认属性 |
| | | * |
| | | * @param selectKey |
| | | * @param btmType |
| | | * @return |
| | |
| | | .append(SPACE) |
| | | .append(QueryOptionConstant.EQUAL) |
| | | .append(SPACE) |
| | | .append(value); |
| | | .append("'") |
| | | .append(value) |
| | | .append("'"); |
| | | } |
| | | sql.append(SPACE); |
| | | return sql.toString(); |
| | |
| | | @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) { |
| | |
| | | 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("找不到业务数据关联的模板"); |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 使用分类的主键获取表格的定义 |
| | | * |
| | |
| | | |
| | | /** |
| | | * 加载成参照的修改配置 |
| | | * |
| | | * @param vo 表格字段显示对象 |
| | | */ |
| | | private void setReferConfig2EditConfig(UITableFieldVO vo) { |
| | |
| | | |
| | | /** |
| | | * 加载成下拉框的修改配置 |
| | | * |
| | | * @param vo 表格字段显示对象 |
| | | */ |
| | | private void setComboxConfig2EditConfig(UITableFieldVO vo) { |
| | |
| | | |
| | | /** |
| | | * 根据业务类型名称创建业务数据源对象 |
| | | * |
| | | * @param boName 业务类型名称 |
| | | * @return 业务数据对象 |
| | | */ |
| | | public BaseModel createBaseModel(String boName) { |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(boName)); |
| | | String userName = AuthUtil.getUser().getUserName(); |
| | | String userName = String.valueOf(AuthUtil.getUser().getUserId()); |
| | | BaseModel bo = new BaseModel(); |
| | | // bo.setOid(VciBaseUtil.getPk()); |
| | | // bo.setRevisionid(VciBaseUtil.getPk()); |
| | |
| | | |
| | | /** |
| | | * 获取版次的值 |
| | | * |
| | | * @param verRuleName 版次的规则 |
| | | * @return 版次的值,没有规则则为空 |
| | | */ |
| | |
| | | * @return 列表数据 |
| | | */ |
| | | @Override |
| | | public Page<BtmTypeVO> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) { |
| | | public Page<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接口调用错误"); |
| | | 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 |
| | | ); |
| | | Page<BaseModel>page=new Page<>(); |
| | | page.setRecords(baseModels); |
| | | page.setTotal(total); |
| | | return page; |
| | | } |
| | | |
| | | /** |