| | |
| | | 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.code.wrapper.CodeAllcodeWrapper; |
| | | import com.vci.ubcs.flow.core.dto.FlowStatusDTO; |
| | | import com.vci.ubcs.flow.core.feign.IMDMIFlowAttrClient; |
| | | import com.vci.ubcs.flow.core.vo.ProcessStageAttrVO; |
| | |
| | | import com.vci.ubcs.starter.revision.model.TreeQueryObject; |
| | | import com.vci.ubcs.starter.revision.model.TreeWrapperOptions; |
| | | import com.vci.ubcs.starter.revision.service.RevisionModelUtil; |
| | | import com.vci.ubcs.starter.util.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.starter.util.SaveLogUtil; |
| | | import com.vci.ubcs.starter.util.SpecialCharacterConverter; |
| | | import com.vci.ubcs.starter.util.UBCSSqlKeyword; |
| | | import com.vci.ubcs.starter.util.*; |
| | | import com.vci.ubcs.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.ubcs.starter.web.constant.RegExpConstant; |
| | | import com.vci.ubcs.starter.web.enumpck.BooleanEnum; |
| | |
| | | import com.vci.ubcs.system.feign.ISysClient; |
| | | import com.vci.ubcs.system.user.entity.User; |
| | | import com.vci.ubcs.system.user.feign.IUserClient; |
| | | import io.swagger.models.auth.In; |
| | | import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; |
| | | import oracle.sql.TIMESTAMP; |
| | | import org.hibernate.validator.constraints.NotEmpty; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.log.annotation.OperateLog; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | |
| | | * 空格 |
| | | */ |
| | | public static final String SPACE = " "; |
| | | |
| | | /** |
| | | * 缓存key |
| | | */ |
| | |
| | | throw new VciBaseException("更新数据出错,重试!"+r.getMsg()); |
| | | } |
| | | } |
| | | // 刚好顺序是一致的,所以直接按照codeallcode的顺序来拿业务数据 |
| | | int i = -1; |
| | | for (CodeAllCode codeCbo : codeCbos) { |
| | | codeCbo.setLcStatus(baseModelDTO.getLcStatus()); |
| | | // 如果是回收,就需要将业务数据存储到码值表中 |
| | | if(baseModelDTO.getLcStatus().equals(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_TAKEBACK)){ |
| | | codeCbo.setBusinessData(JSON.toJSONString(baseModels.get(++i))); |
| | | } |
| | | } |
| | | codeAllCodeService.updateBatchById(codeCbos); |
| | | |
| | |
| | | "order by to_char(CREATETIME, 'mm')"; |
| | | //查询出需要处理的数据 |
| | | List<Map> maps = commonsMapper.selectBySql(sql); |
| | | if(maps.size() == 0){ |
| | | throw new ServiceException("传入类型["+ datum.getName() + ":" + |
| | | datum.getId() +"]未查到相关统计数据,请确认!!!!"); |
| | | } |
| | | |
| | | //当年每月月份之前之和 |
| | | List<Integer> monthCount = new ArrayList<>(12); |
| | | //当年每月的月份数据 |
| | |
| | | //获取当前月的数字 |
| | | Calendar instance = Calendar.getInstance(); |
| | | int nowmonth = instance.get(Calendar.MONTH) + 1; |
| | | if(maps.size() == 0){ |
| | | nowmonth = 0; |
| | | } |
| | | //从1到12月进行处理 |
| | | for (Integer i = 1; i <= 12; i++) { |
| | | //当前月后所有数据设置为0 |
| | | if(i>nowmonth){ |
| | | monthCount.add(0); |
| | | month.add(0); |
| | | continue; |
| | | } |
| | | //当前月份之前之和 |
| | | Integer count = 0; |
| | |
| | | } else { |
| | | return (field.contains(".") ? "" : "t.") + field + SPACE + "= " + getStringValueInWhere(field, value, attrVOMap) + "" + SPACE; |
| | | } |
| | | |
| | | }else { |
| | | // if (referFieldMap.containsKey(key)) { |
| | | // //说明是参照的,我们参照的查询都认为是字符串,如果是时间格式的查询肯定有问题, |
| | |
| | | } |
| | | DateConverter dateConverter = new DateConverter(); |
| | | if (VciFieldTypeEnum.VTDateTime.equals(fieldTypeEnum)) { |
| | | //实际上,数据库都是timestamp的类型. |
| | | dateConverter.setAsText(value); |
| | | return "to_date('" + dateConverter.getAsText(VciDateUtil.DateTimeFormat) + "','" + DATETIME_FORMAT + "')"; |
| | | //实际上,数据库都是timestamp的类型. TODO:虽然没能解决查询日期的问题,但是能暂时解决报错问题 |
| | | if(value.contains("*")){ |
| | | value = value.replace("*","%"); |
| | | return "'" + value + "'"; |
| | | }else{ |
| | | value = value.replace("*",""); |
| | | dateConverter.setAsText(value); |
| | | return "to_date('" + dateConverter.getAsText(VciDateUtil.DateTimeFormat) + "','" + DATETIME_FORMAT + "')"; |
| | | } |
| | | } else if (VciFieldTypeEnum.VTDate.equals(fieldTypeEnum)) { |
| | | dateConverter.setAsText(value); |
| | | return "to_date('" + dateConverter.getAsText(VciDateUtil.DateFormat) + "','" + DATE_FORMAT + "')"; |
| | | if(value.contains("*")){ |
| | | value = value.replace("*","%"); |
| | | return "'" + value + "'"; |
| | | }else { |
| | | value = value.replace("*",""); |
| | | dateConverter.setAsText(value); |
| | | return "to_date('" + dateConverter.getAsText(VciDateUtil.DateFormat) + "','" + DATE_FORMAT + "')"; |
| | | } |
| | | } else if (VciFieldTypeEnum.VTDouble.equals(fieldTypeEnum) |
| | | || VciFieldTypeEnum.VTLong.equals(fieldTypeEnum) |
| | | || VciFieldTypeEnum.VTInteger.equals(fieldTypeEnum)) { |
| | |
| | | } |
| | | conditionMap.put("t.lastr", "1"); |
| | | conditionMap.put("t.lastv", "1"); |
| | | return queryGrid(btmTypeId, templateVO, conditionMap, pageHelper); |
| | | DataGrid<Map<String, String>> mapDataGrid = queryGrid(btmTypeId, templateVO, conditionMap, pageHelper); |
| | | //处理返回数据与模板数据配置的字段不一样问题 |
| | | templateVO.getAttributes().stream().forEach(e->{ |
| | | for (Map<String, String> datum : mapDataGrid.getData()) { |
| | | if(datum.containsKey(e.getId().toLowerCase()) && !datum.containsKey(e.getId())){ |
| | | datum.put(e.getId(),datum.get(e.getId().toLowerCase())); |
| | | datum.remove(e.getId().toLowerCase()); |
| | | } |
| | | } |
| | | }); |
| | | return mapDataGrid; |
| | | // List<String> selectFieldList = templateVO.getAttributes().stream().map(CodeClassifyTemplateAttrVO::getId).collect(Collectors.toList()); |
| | | // //参照让平台直接查询就行 |
| | | // List<String> finalSelectFieldList = selectFieldList; |
| | |
| | | dataList.add(cbo); |
| | | wrapperData(dataList, templateVO, sqlBO.getSelectFieldList(), true); |
| | | R<List<Map<String, String>>> result = R.data(Collections.singletonList(cbo)); |
| | | //处理返回数据与模板数据配置的字段不一样问题 |
| | | templateVO.getAttributes().stream().forEach(e->{ |
| | | for (Map<String, String> datum : result.getData()) { |
| | | if(datum.containsKey(e.getId().toLowerCase()) && !datum.containsKey(e.getId())){ |
| | | datum.put(e.getId(),datum.get(e.getId().toLowerCase())); |
| | | datum.remove(e.getId().toLowerCase()); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | //我们要看是否不是升版的,升版的话,需要对比不相等的属性 |
| | | /* String copy = cbo.get("copyfromversion"); |
| | | // if (StringUtils.isBlank(copy)) { |
| | |
| | | @Override |
| | | public MdmUIInfoVO getUIInfoByClassifyOid(String codeClassifyOid, String functionId) { |
| | | VciBaseUtil.alertNotNull(codeClassifyOid, "主题库分类主键"); |
| | | |
| | | MdmUIInfoVO uiInfoVO = getTableDefineByTemplateVO(getUsedTemplateByClassifyOid(codeClassifyOid)); |
| | | uiInfoVO.setLeaf(classifyService.countChildrenByClassifyOid(codeClassifyOid) == 0); |
| | | if (StringUtils.isNotBlank(functionId) && !"~".equalsIgnoreCase(functionId)) { |
| | | List<Menu> buttonVOS = iSysClient.getMenuButtonByType(uiInfoVO.getTemplateVO().getBtmTypeId()).getData(); |
| | | List<Menu> buttonVOS = iSysClient.getMenuButtonByType(codeClassifyOid,uiInfoVO.getTemplateVO().getBtmTypeId(),"data_auth").getData(); |
| | | // List<SmOperationVO> operationVOS = operationService.listButtonByFunctionId(functionId); |
| | | // if (operationVOS == null) { |
| | | // operationVOS = new ArrayList<>(); |
| | |
| | | bo.setFirstV("1"); |
| | | bo.setLastV("1"); |
| | | bo.setRevisionRule(listR.getData().get(0).getRevisionRuleId()); |
| | | bo.setVersionRule("".equals(listR.getData().get(0).getVersionRule())?"0":listR.getData().get(0).getVersionRule()); |
| | | bo.setVersionRule("".equals(listR.getData().get(0).getVersionRule())?"1":listR.getData().get(0).getVersionRule()); |
| | | if (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId())) { |
| | | R<List<RevisionRuleVO>> revisionRuleVO = revisionRuleClient |
| | | .selectByIdCollection(Collections.singletonList(listR.getData().get(0).getRevisionRuleId().toLowerCase())); |
| | |
| | | bo.setId(""); |
| | | bo.setName(""); |
| | | bo.setDescription(""); |
| | | bo.setOwner("1"); |
| | | bo.setOwner(AuthUtil.getUser().getUserId().toString()); |
| | | // bo.setCheckinby(userName); |
| | | bo.setCopyFromVersion(""); |
| | | // this.initTypeAttributeValue(bo,btmTypeVO); |
| | |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | // TODO:参照配置的模糊查询过滤条件暂未处理 |
| | | 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 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 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 where = ""; |
| | | String lcstatusSql = ""; |
| | | if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) { |
| | | lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus")); |
| | | }*/ |
| | | // String where = ""; |
| | | |
| | | // if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) { |
| | | // where = "where "; |
| | | // } |
| | | // if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) { |
| | | // where = "where "; |
| | | // } |
| | | String whereSqlByMap = UBCSCondition.getWhereSqlByMap(baseQueryObject.getConditionMap()); |
| | | |
| | | String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + ""; |
| | | 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() + SPACE |
| | | 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 " |
| | | + lcstatusSql + namesql + codesql + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2) |
| | | + (Func.isNotBlank(whereSqlByMap) ? "and "+whereSqlByMap:"") + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2) |
| | | )); |
| | | List<BaseModel> baseModels = new ArrayList<>(); |
| | | //将查询到的数据转换为basemodel,使用的反射方式来进行创建的 |
| | |
| | | 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 " |
| | | + lcstatusSql + namesql + codesql |
| | | + (Func.isNotBlank(whereSqlByMap) ? "and "+whereSqlByMap:"") |
| | | ); |
| | | IPage<BaseModelVO> objectDataGrid = new Page<>(); |
| | | objectDataGrid.setPages(baseQueryObject.getPage()); |