| | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vci.ubcs.code.constant.MdmBtmTypeConstant; |
| | | |
| | | import com.vci.ubcs.code.dto.CodeClassifyValueDTO; |
| | | import com.vci.ubcs.code.entity.CodeBasicSec; |
| | | import com.vci.ubcs.code.entity.CodeClassifyValue; |
| | |
| | | import com.vci.ubcs.starter.revision.model.TreeWrapperOptions; |
| | | import com.vci.ubcs.starter.revision.service.RevisionModelUtil; |
| | | import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil; |
| | | import com.vci.ubcs.starter.util.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.starter.web.pagemodel.Tree; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.ResponseEntity; |
| | |
| | | private static final String PARENT_FIELD_NAME = "parentClassifyValueOid"; |
| | | |
| | | /** |
| | | * 克隆分类码值 |
| | | * @param codeClassifyValues |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean cloneCodeClassifyVaue(List<CodeClassifyValue> codeClassifyValues) { |
| | | // 创建Map对象,用于存储原始oid和新oid的映射关系 |
| | | Map<String, String> oidMap = new HashMap<>(); |
| | | // 遍历对象数组,为每个对象生成新的oid,并将原始oid和新oid的映射关系存储到Map中 |
| | | for (CodeClassifyValue obj : codeClassifyValues) { |
| | | String originalOid = obj.getOid(); |
| | | String newOid = VciBaseUtil.getPk(); |
| | | oidMap.put(originalOid, newOid); |
| | | } |
| | | // 遍历对象数组,更新每个对象的oid和codeClassifySecOid属性值 |
| | | for (CodeClassifyValue obj : codeClassifyValues) { |
| | | String originalOid = obj.getOid(); |
| | | String newOid = oidMap.get(originalOid); |
| | | obj.setOid(newOid); |
| | | String originalParentClassifyValueOid = obj.getParentClassifyValueOid(); |
| | | String newParentClassifyValueOid = oidMap.get(originalParentClassifyValueOid); |
| | | obj.setParentClassifyValueOid(newParentClassifyValueOid); |
| | | } |
| | | return this.saveBatch(codeClassifyValues); |
| | | } |
| | | |
| | | /** |
| | | * 查询分类码段的码值 树 |
| | | * @param treeQueryObject 树查询对象 |
| | | * @return 分类码段的码值 显示树 |
| | |
| | | */ |
| | | @Override |
| | | public List<Tree> treeCodeClassifyValue(TreeQueryObject treeQueryObject) throws VciBaseException { |
| | | // List<CodeClassifyValueDO> doList =selectCodeClassifyValueDOByTree(treeQueryObject); |
| | | List<CodeClassifyValue> doList = selectCodeClassifyValueDO4Tree(treeQueryObject); |
| | | List<CodeClassifyValueVO> voList = CodeClassifyValueWrapper.build().listVO(doList); |
| | | TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_FIELD_NAME); |
| | |
| | | CodeClassifyValue codeClassifyValueDO = new CodeClassifyValue(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyValueDTO,codeClassifyValueDO); |
| | | //填充一些默认值 |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeClassifyValueDO,MdmBtmTypeConstant.CODE_CLASSIFY_VALUE); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeClassifyValueDO, MdmBtmTypeConstant.CODE_CLASSIFY_VALUE); |
| | | //查询 |
| | | List<CodeClassifyValue> existList = codeClassifyValueMapper.selectList(Wrappers.<CodeClassifyValue>query() |
| | | .lambda().eq(CodeClassifyValue::getCodeClassifySecOid, codeClassifyValueDO.getCodeClassifySecOid()) |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据主键获取码值字符串 |
| | | * @param oid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getClassifyValueStr(String oid){ |
| | | if(Func.isEmpty(oid)){ |
| | | return ""; |
| | | } |
| | | String classifyValueStr = this.codeClassifyValueMapper.getClassifyValueStr(oid); |
| | | return Func.isEmpty(classifyValueStr) ? "":classifyValueStr; |
| | | } |
| | | |
| | | /** |
| | | * 批量数据对象转换为显示对象 |
| | | * @param codeClassifyValueDOs 数据对象列表 |
| | | * @return 显示对象 |