| | |
| | | import com.vci.ubcs.code.dto.datapush.BaseModelDTO; |
| | | import com.vci.ubcs.code.entity.*; |
| | | import com.vci.ubcs.code.enumpack.*; |
| | | import com.vci.ubcs.code.mapper.CodeOsbtmtypeMapper; |
| | | import com.vci.ubcs.code.mapper.CodeWupinMapper; |
| | | import com.vci.ubcs.code.mapper.CommonsMapper; |
| | | import com.vci.ubcs.code.service.*; |
| | |
| | | import com.vci.ubcs.code.vo.pagemodel.UITableFieldVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.UITablePageVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.*; |
| | | import com.vci.ubcs.omd.feign.IAttributeClient; |
| | | import com.vci.ubcs.omd.feign.IBtmTypeClient; |
| | | import com.vci.ubcs.omd.feign.IEnumClient; |
| | | import com.vci.ubcs.omd.feign.IRevisionRuleClient; |
| | |
| | | */ |
| | | @Resource |
| | | private CodeClstemplateServiceImpl templateService; |
| | | /** |
| | | * 模板的服务 |
| | | */ |
| | | |
| | | @Resource |
| | | private CodeOsbtmtypeMapper codeOsbtmtypeMapper; |
| | | @Resource |
| | | private CodeOsattributeServiceImpl attributeService; |
| | | private IAttributeClient attributeClient; |
| | | |
| | | /** |
| | | * 生成编码的服务 |
| | | */ |
| | | @Resource |
| | | private MdmProductCodeService productCodeService; |
| | | |
| | | /** |
| | | * 可输可选的服务 |
| | | */ |
| | | @Resource |
| | | IDictBizClient iDictBizClient; |
| | | |
| | | /** |
| | | * 字典的服务 |
| | | */ |
| | | @Resource |
| | | IEnumClient enumClient; |
| | | |
| | | /** |
| | | * 公式的服务 |
| | | */ |
| | |
| | | List<String> oids = VciBaseUtil.str2List(baseModelDTO.getOid()); |
| | | // List<ClientBusinessObject> cboList = boService.selectCBOByOidCollection(oids, baseModelDTO.getBtmname()); |
| | | //插个点 业务类型完成后需要修改 |
| | | QueryWrapper<CodeOsbtmtypeEntity> wrapper = new QueryWrapper<>(); |
| | | QueryWrapper<BtmTypeVO> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("BTMNAME",baseModelDTO.getBtmname()); |
| | | wrapper.in("OID",oids); |
| | | List<CodeOsbtmtypeEntity> cboList = codeOsbtmtypeMapper.selectList(wrapper); |
| | | // 待完善 |
| | | List<BtmTypeVO> cboList = null; // btmTypeClient.selectList(wrapper); |
| | | //还需要修改allCode的生命周期 |
| | | // Map<String, String> conditionMap = new HashMap<>(); |
| | | QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>(); |
| | |
| | | // List<ClientBusinessObject> codeCbos = boService.queryCBO(MdmBtmTypeConstant.CODE_ALL_CODE, conditionMap); |
| | | // 回收需要业务数据删除 |
| | | if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) { |
| | | // BatchCBO batchCBO = new BatchCBO(); |
| | | // batchCBO.getDeleteCbos().addAll(cboList); |
| | | codeOsbtmtypeMapper.deleteBatchIds(cboList); |
| | | // boService.persistenceBatch(batchCBO); |
| | | } else { |
| | | // lifeCycleService.transCboStatus(cboList, baseModelDTO.getLcStatus()); |
| | | } |
| | | // lifeCycleService.transCboStatus(codeCbos, baseModelDTO.getLcStatus()); |
| | | } |
| | | // BatchCBO batchCBO = new BatchCBO(); |
| | | // batchCBO.getDeleteCbos().addAll(cboList); |
| | | |
| | | // 待完善 |
| | | //btmTypeClient.deleteBatchIds(cboList); |
| | | |
| | | //boService.persistenceBatch(batchCBO); |
| | | } else { |
| | | // lifeCycleService.transCboStatus(cboList, baseModelDTO.getLcStatus()); |
| | | } |
| | | // lifeCycleService.transCboStatus(codeCbos, baseModelDTO.getLcStatus()); |
| | | } |
| | | |
| | | /** |
| | | * 申请单一编码 |
| | |
| | | itemVO.setPrefix(attrVO.getPrefixValue()); |
| | | itemVO.setSuffix(attrVO.getSuffixValue()); |
| | | itemVO.setTooltips(attrVO.getExplain()); |
| | | itemVO.setInputTip(attrVO.getInputTip()); |
| | | itemVO.setSelectLibFlag(attrVO.getLibraryIdentification()); |
| | | //看看是否有枚举 |
| | | if ((StringUtils.isNotBlank(attrVO.getEnumString()) |
| | |
| | | selectFieldList.add(referTableNick + "." + showFieldInSource + " as " + referShowField); |
| | | }); |
| | | } |
| | | Optional.ofNullable(attributeService.getDefaultAttributeVOMap()).orElseGet(() -> new HashMap<>()).keySet().stream().forEach(attrId -> { |
| | | if (!selectFieldList.contains(attrId) && !"secretgrade".equalsIgnoreCase(attrId)) { |
| | | selectFieldList.add(attrId); |
| | | } |
| | | }); |
| | | // 待完善 |
| | | // Optional.ofNullable(attributeService.getDefaultAttributeVOMap()).orElseGet(() -> new HashMap<>()).keySet().stream().forEach(attrId -> { |
| | | // if (!selectFieldList.contains(attrId) && !"secretgrade".equalsIgnoreCase(attrId)) { |
| | | // selectFieldList.add(attrId); |
| | | // } |
| | | // }); |
| | | if (!selectFieldList.contains(CODE_FIELD)) { |
| | | selectFieldList.add(CODE_FIELD); |
| | | } |
| | |
| | | */ |
| | | private String getSqlByValue(String selectKey, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) { |
| | | StringBuilder sql = new StringBuilder(); |
| | | if (!selectKey.contains(".") && (attrVOMap.containsKey(selectKey.toLowerCase(Locale.ROOT)) || attributeService.isDefaultAttr(selectKey) || selectKey.matches(RegExpConstant.LETTER))) { |
| | | sql.append("t."); |
| | | } |
| | | // 待完善 |
| | | // if (!selectKey.contains(".") && (attrVOMap.containsKey(selectKey.toLowerCase(Locale.ROOT)) || attributeService.isDefaultAttr(selectKey) || selectKey.matches(RegExpConstant.LETTER))) { |
| | | // sql.append("t."); |
| | | // } |
| | | if (value.startsWith(QueryOptionConstant.IN)) { |
| | | sql.append(selectKey) |
| | | .append(SPACE) |
| | |
| | | } |
| | | } |
| | | } |
| | | for (Object key : map.keySet()) { |
| | | map.put(key,String.valueOf(map.get(key))); |
| | | } |
| | | |
| | | ((BaseModel) obj).setData(map); |
| | | baseModels.add((BaseModel) obj); |
| | | } |
| | |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 传入业务类型以及相关数据进行批量更新操作 |
| | | * |
| | | * @param btmType 业务类型 |
| | | * @param baseModels 处理数据 |
| | | * @return 处理状态 |
| | | */ |
| | | @Override |
| | | public R updateBatchByBaseModel(String btmType, List<BaseModel> baseModels) throws Exception { |
| | | //使用传入的业务类型查询表 |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType)); |
| | | if(listR.getData().size() == 0){ |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | //将bean转为map,mybatis统一处理 |
| | | List<Map<String,String>> maps = new ArrayList<>(); |
| | | |
| | | baseModels.stream().forEach(model-> { |
| | | try { |
| | | maps.add(VciBaseUtil.convertBean2Map(model)); |
| | | } catch (Exception e) { |
| | | throw new VciBaseException("类型转换错误:" + e.getMessage()); |
| | | } |
| | | }); |
| | | try { |
| | | //注意此处更新成功是返回的-1 |
| | | commonsMapper.updateBatchByBaseModel(listR.getData().get(0).getTableName(), maps); |
| | | }catch (Exception e){ |
| | | return R.fail("更新失败!"+e.getMessage()); |
| | | } |
| | | |
| | | return R.success("更新成功!"); |
| | | } |
| | | } |