| | |
| | | package com.vci.ubcs.code.service.impl; |
| | | |
| | | import com.alibaba.cloud.commons.lang.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import com.vci.ubcs.starter.web.util.WebUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Resource |
| | | private RevisionModelUtil revisionModelUtil; |
| | | |
| | | @Value("${user-info.tenant-id}") |
| | | private String tenantId; |
| | | @Value("${user-info.id}") |
| | | private String userId; |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param query |
| | |
| | | */ |
| | | @Override |
| | | public IPage<CodeRuleVO> gridCodeRule(Query query, Map<String,Object> conidtionMap) { |
| | | //如果等于自己配置的管理组租户id和管理组超管账号,就不需要按照规则所有者来进行查询 |
| | | if(!(AuthUtil.getTenantId().equals(this.tenantId) && AuthUtil.getUserId().toString().equals(this.userId))){ |
| | | // 按照规则所有者来查询 |
| | | conidtionMap.put("owner",AuthUtil.getUserId()); |
| | | } |
| | | IPage<CodeRule> codeRuleIPage = this.codeRuleMapper.selectPage(Condition.getPage(query), UBCSCondition.getQueryWrapper(conidtionMap, CodeRule.class)); |
| | | //do转vo同时setLcStatusText生命周期值,并包装成分页对象返回 |
| | | return CodeRuleWrapper.build().pageVO(codeRuleIPage); |
| | |
| | | //将DTO转换为DO |
| | | CodeRule codeRule = selectByOid(codeRuleDTO.getOid()); |
| | | revisionModelUtil.copyFromDTOIgnore(codeRuleDTO, codeRule); |
| | | if(!codeRule.getOwner().equals(codeRuleDTO.getOwner())){ |
| | | codeRule.setOwner(codeRuleDTO.getOwner()); |
| | | } |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeRule); |
| | | return R.status(codeRuleMapper.updateById(codeRule)>0); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public R checkLikeCodeRule(String oid) throws VciBaseException { |
| | | CodeRuleVO codeRuleVO = getObjectByOid(oid); |
| | | // 1、去掉流水码段,计算出其他码段值长度,在已发布的规则中比对出长度一致的编码规则 |
| | | HashMap<String, Object> condtionMap = new HashMap<>(); |
| | | condtionMap.put("pkCodeRule_equal",codeRuleVO.getOid()); |
| | | condtionMap.put("secType_notequal", CodeSecTypeEnum.CODE_SERIAL_SEC); |
| | | codeRuleVO.setSecVOList(codeBasicSecService.listCodeBasicSecByRuleOid(condtionMap)); |
| | | // 1、查询出当前要发布的规则 |
| | | CodeRuleVO codeRuleVO = getObjectHasSecByOid(oid); |
| | | // 2、找出与当前发布的规则码段顺序一致的规则 |
| | | if(Func.isNotEmpty(codeRuleVO.getSecVOList())){ |
| | | String secType = codeRuleVO.getSecVOList().stream().map(CodeBasicSecVO::getSecType).collect(Collectors.joining(",")); |
| | | |
| | | } |
| | | |
| | | // TODO 待完善 |
| | | |
| | | |
| | |
| | | //如果有lcstatus的类的话 |
| | | vo.setLcStatusText(CodeRuleLC.getTextByValue(vo.getLcStatus())); |
| | | if (hasSec) { |
| | | Map<String, Object> condtionMap = new HashMap<>(); |
| | | condtionMap.put("pkCodeRule",vo.getOid()); |
| | | List<CodeBasicSecVO> codeBasicSecVOS = codeBasicSecService.listCodeBasicSecByRuleOid(condtionMap); |
| | | List<CodeBasicSecVO> codeBasicSecVOS = codeBasicSecService.listCodeBasicSecByRuleOid(vo.getOid()); |
| | | //查询码段 |
| | | vo.setSecVOList(codeBasicSecVOS); |
| | | } |