| | |
| | | * @return 有错误信息的excel |
| | | */ |
| | | @Override |
| | | public CodeImProtRusultVO batchImportHistoryData(String codeClassifyOid, String classifyAttr,File file) { |
| | | public CodeImProtRusultVO batchImportHistoryData(String codeClassifyOid, String classifyAttr,File file) throws Throwable{ |
| | | VciBaseUtil.alertNotNull(codeClassifyOid,"分类的主键"); |
| | | ReadExcelOption reo = new ReadExcelOption(); |
| | | reo.setReadAllSheet(true); |
| | |
| | | getFieldIndexMap(titleRowData, attrNameIdMap, fieldIndexMap); |
| | | Map<String, String> cboOidMap = new HashMap<>(); |
| | | cboOidMap.put("id", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(codeDataMap.keySet().toArray(new String[0])) + ")"); |
| | | R<BtmTypeVO> r= btmTypeClient.getDetail(templateVO.getBtmTypeId()); |
| | | BtmTypeVO btmTypeVO =r.getData(); |
| | | String tableName=btmTypeVO.getTableName(); |
| | | String tableName =""; |
| | | try { |
| | | R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId()); |
| | | if(r.getCode()!=200) { |
| | | throw new Throwable(r.getMsg()); |
| | | } |
| | | BtmTypeVO btmTypeVO = r.getData(); |
| | | if (btmTypeVO == null) { |
| | | throw new Throwable("根据业务类型未查询到业务类型对象!"); |
| | | } |
| | | tableName = btmTypeVO.getTableName(); |
| | | if (StringUtils.isBlank(tableName)) { |
| | | throw new Throwable("根据业务类型未查询到业务类型相关联的表"); |
| | | } |
| | | }catch (Throwable e){ |
| | | log.error("查询业务对象表"+e); |
| | | XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO=new XMLResultDataObjectDetailDO(); |
| | | xmlResultDataObjectDetailDO.setErrorid("103"); |
| | | xmlResultDataObjectDetailDO.setMsg("查询业务对象表"+e); |
| | | xmlResultDataObjectDetailDO.setId(""); |
| | | xmlResultDataObjectDetailDO.setCode(""); |
| | | resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO); |
| | | return; |
| | | } |
| | | |
| | | StringBuffer sb=new StringBuffer(); |
| | | sb.append(" select * from "); |
| | |
| | | * @param cboList 数据的列表 |
| | | * @param errorMap 错误的信息 |
| | | */ |
| | | private void batchCheckIdExistOnOrder(CodeClassifyTemplateVO templateVO,List<ClientBusinessObject> cboList,Map<String ,String> errorMap){ |
| | | private void batchCheckIdExistOnOrder(CodeClassifyTemplateVO templateVO,List<ClientBusinessObject> cboList,Map<String ,String> errorMap) throws Throwable{ |
| | | List<String> existIds = new ArrayList<>(); |
| | | String tableName =""; |
| | | try { |
| | | R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId()); |
| | | if(r.getCode()!=200) { |
| | | throw new Throwable(r.getMsg()); |
| | | } |
| | | BtmTypeVO btmTypeVO = r.getData(); |
| | | if (btmTypeVO == null) { |
| | | throw new Throwable("根据业务类型未查询到业务类型对象!"); |
| | | } |
| | | tableName = btmTypeVO.getTableName(); |
| | | if (StringUtils.isBlank(tableName)) { |
| | | throw new Throwable("根据业务类型未查询到业务类型相关联的表"); |
| | | } |
| | | }catch (Throwable e){ |
| | | throw e; |
| | | } |
| | | String finalTableName = tableName; |
| | | VciBaseUtil.switchCollectionForOracleIn(cboList).stream().forEach(cbos -> { |
| | | Map<String, String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("id", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0])) + ")"); |
| | | |
| | | R<BtmTypeVO> r= btmTypeClient.getDetail(templateVO.getBtmTypeId()); |
| | | BtmTypeVO btmTypeVO =r.getData(); |
| | | String tableName=btmTypeVO.getTableName(); |
| | | |
| | | StringBuffer sb=new StringBuffer(); |
| | | sb.append(" select id from "); |
| | | sb.append(tableName); |
| | | sb.append(finalTableName); |
| | | sb.append(" where 1=1 "); |
| | | sb.append(" id in ("); |
| | | sb.append(" and id in ("); |
| | | sb.append(VciBaseUtil.toInSql(cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0]))); |
| | | sb.append(")"); |
| | | List<String> idList= commonsMapper.selectById(sb.toString()); |
| | |
| | | }else{ |
| | | if (!CollectionUtils.isEmpty(conditionMap)) { |
| | | Map<String, String> andConditionMap = new HashMap<>(); |
| | | andConditionMap.put("islastr", "1"); |
| | | andConditionMap.put("islastv", "1"); |
| | | andConditionMap.put("lastr", "1"); |
| | | andConditionMap.put("lastv", "1"); |
| | | conditionMap.putAll(andConditionMap); |
| | | PageHelper pageHelper = new PageHelper(-1); |
| | | pageHelper.addDefaultDesc("id"); |