| | |
| | | import com.vci.ubcs.code.vo.webserviceModel.attrmap.RowDatas; |
| | | import com.vci.ubcs.code.vo.webserviceModel.result.xml.XMLResultDataObjectDetailDO; |
| | | import com.vci.ubcs.omd.feign.IBtmTypeClient; |
| | | import com.vci.ubcs.omd.feign.IWebSecretClient; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.starter.bo.WriteExcelData; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | |
| | | */ |
| | | @Autowired |
| | | private IBtmTypeClient btmTypeClient; |
| | | /*** |
| | | * 密级服务 |
| | | */ |
| | | @Resource |
| | | private IWebSecretClient secretService; |
| | | /** |
| | | * 批量申请:选取选中分类下的所有模板关键属性,相似属性,必填属性,写入execl中 |
| | | * |
| | |
| | | if (isExport||newErrorMap.size() > 0) { |
| | | createRedisDatas(uuid + "-ok", templateVO, rowIndexCboMap, dataSet, fieldIndexMap, newErrorMap, true); |
| | | } else { |
| | | List<String> dataCBOIdList=new ArrayList<>(); |
| | | List<BaseModel> dataCBOIdList=new ArrayList<>(); |
| | | //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | List<ClientBusinessObject> finalNeedSaveCboList = needSaveCboList; |
| | | CodeClassifyTemplateVO finalTemplateVO = templateVO; |
| | |
| | | BeanUtil.convert(clientBusinessObject,baseModel); |
| | | baseModel.setData(VciBaseUtil.objectToMapString(clientBusinessObject)); |
| | | dataCBOList.add(baseModel); |
| | | dataCBOIdList.add(baseModel.getOid()); |
| | | dataCBOIdList.add(baseModel); |
| | | }); |
| | | |
| | | if (!CollectionUtils.isEmpty(thisCbos)) { |
| | |
| | | try { |
| | | codeList = productCodeService.productCodeAndSaveData(classifyFullInfo,templateVO,ruleVO, orderDTO.getSecDTOList(),dataCBOList); |
| | | //如果是编码生成失败,则直接就失败了,其他的判断出来有错误的我们都统一返回到excel里面 |
| | | engineService.batchSaveSelectChar(templateVO, dataCBOIdList); |
| | | engineService.batchSaveSelectChar(templateVO, dataCBOList); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("批了申请时失败"); |
| | |
| | | |
| | | @Override |
| | | public R batchImportData(List<CodeImprotSaveDatVO> codeImprotSaveDatVOList, String classifyAttr, boolean isImprot) { |
| | | List<String> allNeedSaveCboList=new ArrayList<>(); |
| | | List<BaseModel> dataCBOList=new ArrayList<>(); |
| | | codeImprotSaveDatVOList.stream().forEach(codeImprotSaveDatVO -> { |
| | | List<SheetRowData> rowDataList = new ArrayList<>(); |
| | | List<ClientBusinessObject>cboList=new ArrayList<>(); |
| | |
| | | |
| | | log.info("分类:"+classifyFullInfo.getCurrentClassifyVO().getName()+"数据:"+needSaveCboList.size()); |
| | | if (!CollectionUtils.isEmpty(needSaveCboList)) { |
| | | List<BaseModel> dataCBOList=new ArrayList<>(); |
| | | // List<BaseModel> dataCBOList=new ArrayList<>(); |
| | | needSaveCboList.stream().forEach(clientBusinessObject -> { |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(clientBusinessObject,baseModel); |
| | | baseModel.setData(VciBaseUtil.objectToMapString(clientBusinessObject)); |
| | | dataCBOList.add(baseModel); |
| | | allNeedSaveCboList.add(baseModel.getOid()); |
| | | // allNeedSaveCboList.add(baseModel); |
| | | }); |
| | | try { |
| | | //9.我们处理业务数据 |
| | |
| | | } |
| | | } |
| | | //如果是编码生成失败,则直接就失败了,其他的判断出来有错误的我们都统一返回到excel里面 |
| | | engineService.batchSaveSelectChar(codeClassifyTemplateVO, allNeedSaveCboList); |
| | | engineService.batchSaveSelectChar(codeClassifyTemplateVO, dataCBOList); |
| | | }); |
| | | return R.success(isImprot?"批量历史导入成功":"批量申请成功"); |
| | | } |
| | |
| | | try { |
| | | productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(), dataCBOList); |
| | | //如果是编码生成失败,则直接就失败了,其他的判断出来有错误的我们都统一返回到excel里面 |
| | | engineService.batchSaveSelectChar(templateVO, allNeedSaveCboList); |
| | | engineService.batchSaveSelectChar(templateVO, dataCBOList); |
| | | // if(!isProcess){ |
| | | needSaveCboList.stream().forEach(needSaveCbo->{ |
| | | XMLResultDataObjectDetailDO resultDataObjectDetailDO=new XMLResultDataObjectDetailDO(); |
| | |
| | | * @param dataObjectVO 数据信息 |
| | | * @param resultDataObjectDetailDOs 错误信息 |
| | | */ |
| | | @Transactional(rollbackFor = VciBaseException.class) |
| | | @Override |
| | | public void batchSyncEditDatas(CodeClassifyVO codeClassifyVO, DataObjectVO dataObjectVO, LinkedList<XMLResultDataObjectDetailDO> resultDataObjectDetailDOs) { |
| | | String errorid=""; |
| | |
| | | Map<String, CodeOrderDTO> orderDTOMap = codeOrderDTOList.stream().filter(orderDTO -> orderDTO != null && StringUtils.isNotBlank(orderDTO.getId())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getId(), t -> t)); |
| | | List<BaseModel> updateList = new ArrayList<>(); |
| | | List<CodeAllCode> codeAllCodeList = new ArrayList<>(); |
| | | List<BaseModel> deleteList = new ArrayList<>(); |
| | | List<String> deleteList = new ArrayList<>(); |
| | | |
| | | CodeClassifyTemplateVO firstTemplateVO = templateService.getObjectHasAttrByOid(orderDTOMap.values().stream().findFirst().get().getTemplateOid()); |
| | | Map<String, ClientBusinessObject> cboMap = cboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getId(), t -> t)); |
| | |
| | | } catch (VciBaseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | List<CodeAllCode>newCodeAllCodeList= codeAllCodeService.selectByWrapper(Wrappers.<CodeAllCode>query().lambda().eq(CodeAllCode::getCreateCodeOid, cbo.getOid())); |
| | | if (!CollectionUtils.isEmpty(newCodeAllCodeList)) { |
| | | CodeAllCode codeCbo = codeAllCodeList.get(0); |
| | | log.info("codeCbos code:" + codeCbo.getId()); |
| | | codeCbo.setLcStatus(status); |
| | | codeAllCodeList.add(codeCbo); |
| | | } |
| | | |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(cbo,baseModel); |
| | | baseModel.setData(VciBaseUtil.objectToMapString(cbo)); |
| | |
| | | // errorMap.put(code,errorMap.getOrDefault(code, errorMap.getOrDefault(code,"")+";数据"+code+"在流程中,不允许删除!")); |
| | | //}else { |
| | | try { |
| | | Map<String, String> condtionMap = new HashMap<>(); |
| | | condtionMap.put("createcodeoid", cbo.getOid()); |
| | | log.info("oid:" + cbo.getOid()); |
| | | List<CodeAllCode>newCodeAllCodeList= codeAllCodeService.selectByWrapper(Wrappers.<CodeAllCode>query().lambda().eq(CodeAllCode::getCreateCodeOid, cbo.getOid())); |
| | | log.info("codeCbos size:" + newCodeAllCodeList.size()); |
| | |
| | | codeCbo.setLcStatus(CodeDefaultLC.TASK_BACK.getValue()); |
| | | codeAllCodeList.add(codeCbo); |
| | | } |
| | | deleteList.add(cbo); |
| | | deleteList.add(cbo.getOid()); |
| | | }catch (VciBaseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | cbo.setAttributeValue("lcstatus", status); |
| | | |
| | | // } |
| | | |
| | | List<CodeAllCode>newCodeAllCodeList= codeAllCodeService.selectByWrapper(Wrappers.<CodeAllCode>query().lambda().eq(CodeAllCode::getCreateCodeOid, cbo.getOid())); |
| | | if (!CollectionUtils.isEmpty(newCodeAllCodeList)) { |
| | | CodeAllCode codeCbo = codeAllCodeList.get(0); |
| | | log.info("codeCbos code:" + codeCbo.getId()); |
| | | codeCbo.setLcStatus(status); |
| | | codeAllCodeList.add(codeCbo); |
| | | } |
| | | |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(cbo,baseModel); |
| | | baseModel.setData(VciBaseUtil.objectToMapString(cbo)); |
| | |
| | | try { |
| | | engineService.updateBatchByBaseModel(classifyFullInfo.getTopClassifyVO().getBtmtypeid(),updateList); |
| | | codeAllCodeService.saveBatch(codeAllCodeList); |
| | | commonsMapper.deleteByTaleAndOid("",null); |
| | | |
| | | // engineService.del(deleteList); |
| | | if(deleteList.size()>0) { |
| | | commonsMapper.deleteByTaleAndOid(tableName, VciBaseUtil.array2String(deleteList.toArray(new String[]{}))); |
| | | } |
| | | errorid="0"; |
| | | msg="更新/状态更改/删除成功!"; |
| | | }catch (Throwable e){ |
| | |
| | | |
| | | } |
| | | int secret = VciBaseUtil.getInt(cbo.getAttributeValue(SECRET_FIELD)); |
| | | /*if (secret == 0 || !secretService.checkDataSecret(secret)) { |
| | | if (secret == 0 || !secretService.checkDataSecret(secret).getData()) { |
| | | Integer userSecret = VciBaseUtil.getCurrentUserSecret(); |
| | | cbo.setAttributeValue(SECRET_FIELD, String.valueOf((userSecret == null || userSecret == 0) ? UserSecretEnum.NONE.getValue() : userSecret)); |
| | | }*/ |
| | | } |
| | | } catch (Throwable e) { |
| | | log.error("设置默认的属性的值错误", e); |
| | | } |
| | |
| | | cbo.setAttributeValue(CODE_CLASSIFY_OID_FIELD,classifyFullInfo.getCurrentClassifyVO().getOid()); |
| | | cbo.setAttributeValue(CODE_FULL_PATH_FILED,fullPath); |
| | | int secret = VciBaseUtil.getInt(cbo.getAttributeValue(SECRET_FIELD)); |
| | | /*if(secret == 0 || !secretService.checkDataSecret(secret) ){ |
| | | if(secret == 0 || !secretService.checkDataSecret(secret).getData() ){ |
| | | Integer userSecret = VciBaseUtil.getCurrentUserSecret(); |
| | | String secretValue= String.valueOf((userSecret==null || userSecret ==0)? UserSecretEnum.NONE.getValue():userSecret); |
| | | cbo.setAttributeValue(SECRET_FIELD,secretValue); |
| | | }*/ |
| | | } |
| | | if(rowData.getStatus().equals(CodeDefaultLC.DISABLE.getValue())){//停用 |
| | | cbo.setLcStatus(CodeDefaultLC.DISABLE.getValue()); |
| | | }else if(rowData.getStatus().equals(CodeDefaultLC.EDITING.getValue())){//编辑 |
| | |
| | | cbo.setAttributeValue(CODE_CLASSIFY_OID_FIELD,classifyFullInfo.getCurrentClassifyVO().getOid()); |
| | | cbo.setAttributeValue(CODE_FULL_PATH_FILED,fullPath); |
| | | //cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); |
| | | /*int secret = VciBaseUtil.getInt(cbo.getAttributeValue(SECRET_FIELD)); |
| | | if(secret == 0 || !secretService.checkDataSecret(secret) ){ |
| | | int secret = VciBaseUtil.getInt(cbo.getAttributeValue(SECRET_FIELD)); |
| | | if(secret == 0 || !secretService.checkDataSecret(secret).getData() ){ |
| | | Integer userSecret = VciBaseUtil.getCurrentUserSecret(); |
| | | cbo.setAttributeValue(SECRET_FIELD,String.valueOf((userSecret==null || userSecret ==0)? UserSecretEnum.NONE.getValue():userSecret)); |
| | | }*/ |
| | | } |
| | | }else{ |
| | | //此时还没有转换路径 |
| | | //cbo.setAttributeValue(CODE_FULL_PATH_FILED, childOidPathMap.getOrDefault(rowData.getData().getOrDefault(CODE_CLASSIFY_OID_FIELD,""),fullPath)); |
| | |
| | | cbo.setAttributeValue(CODE_FULL_PATH_FILED,fullPath); |
| | | //cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); |
| | | int secret = VciBaseUtil.getInt(cbo.getAttributeValue(SECRET_FIELD)); |
| | | /*if(secret == 0 || !secretService.checkDataSecret(secret) ){ |
| | | if(secret == 0 || !secretService.checkDataSecret(secret).getData() ){ |
| | | Integer userSecret = VciBaseUtil.getCurrentUserSecret(); |
| | | cbo.setAttributeValue(SECRET_FIELD,String.valueOf((userSecret==null || userSecret ==0)? UserSecretEnum.NONE.getValue():userSecret)); |
| | | }*/ |
| | | } |
| | | }else{ |
| | | //此时还没有转换路径 |
| | | //cbo.setAttributeValue(CODE_FULL_PATH_FILED, childOidPathMap.getOrDefault(rowData.getData().getOrDefault(CODE_CLASSIFY_OID_FIELD,""),fullPath)); |