| | |
| | | */ |
| | | package com.vci.ubcs.code.service.impl; |
| | | |
| | | import com.alibaba.nacos.api.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | 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 net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; |
| | | 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.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cglib.beans.BeanMap; |
| | | import org.springframework.context.annotation.Lazy; |
| | |
| | | CodeClassifyTemplate codeClassifyTemplateDO = baseMapper.selectById(oid); |
| | | //停用的时候,验证模板是否为已发布 |
| | | if(CodeClassifyTemplateLC.DISABLED.getValue().equals(lcStatus)){ |
| | | // CodeClstemplateEntity codeClassifyTemplateDO = baseMapper.selectById(oid); |
| | | if(!CodeClassifyTemplateLC.RELEASED.getValue().equals(codeClassifyTemplateDO.getLcStatus())){ |
| | | return R.fail("模板未启用,不能停用!"); |
| | | } |
| | | } |
| | | |
| | | if(lcStatus.equals(CodeClassifyTemplateLC.RELEASED.getValue())){ |
| | | QueryWrapper<CodeClassify> classifyQueryWrapper = new QueryWrapper<>(); |
| | | classifyQueryWrapper.eq("oid",codeClassifyTemplateDO.getCodeClassifyOid()); |
| | | classifyQueryWrapper.eq("lcstatus","Enabled"); |
| | | List<CodeClassify> codeClassifyList = codeClassifyService.selectByWrapper(classifyQueryWrapper); |
| | | if(codeClassifyList.size()==0){ |
| | | return R.fail("查询到所属分类未启用,请先进行启用!!!"); |
| | | } |
| | | } |
| | | |
| | | //启用、停用 |
| | | codeClassifyTemplateDO.setLcStatus(lcStatus); |
| | | int u = baseMapper.updateById(codeClassifyTemplateDO); |
| | | // codeClassifyTemplateMapper.updateLcStatus(oid,lcStatus); |
| | | |
| | | return u==0?R.fail("修改失败!"):R.success("修改成功"); |
| | | } |
| | | |
| | |
| | | if(pageHelper.getLimit() != -1){ |
| | | query.setSize(pageHelper.getLimit()); |
| | | query.setCurrent(pageHelper.getPage()); |
| | | query.setDescs("versionValue"); |
| | | } |
| | | |
| | | // List<CodeClstemplateVO> doList = codeClstemplateMapper.selectPlCodeClstemplatePage(Condition.getPage(query), codeClstemplateVO); |
| | |
| | | |
| | | //所有分类都没有业务类型,返回提示 |
| | | if(codeClassifyDOList.size()==0){ |
| | | return R.fail("添加模板添加失败,分类和上级分类都没有关联业务类型!"); |
| | | return R.fail(DATA_OID_NOT_EXIST); |
| | | } |
| | | |
| | | //设置btmtypeid和name |
| | | CodeClassify codeClassifyDO = codeClassifyDOList.get(0); |
| | | CodeClassify codeClassifyDO = codeClassifyDOList.stream().filter(s -> StringUtils.isNotBlank(s.getBtmTypeId())).findFirst().get(); |
| | | codeClassifyTemplateDO.setBtmTypeId(codeClassifyDO.getBtmTypeId()); |
| | | codeClassifyTemplateDO.setNameOid(VciBaseUtil.getPk()); |
| | | codeClassifyTemplateDO.setBtmTypeName(codeClassifyDO.getBtmTypeName()); |
| | |
| | | //递归找上级的模板 |
| | | CodeClassify classifyDO = codeClassifyMapper.selectById(codeClassifyOid); |
| | | // codeClassifyDaoI.selectByPrimaryKey(codeClassifyOid); |
| | | if(StringUtils.isBlank(classifyDO.getParentCodeClassifyOid())){ |
| | | if(Func.isEmpty(classifyDO)&&StringUtils.isBlank(classifyDO.getParentCodeClassifyOid())){ |
| | | //说明已经是顶了,也没找到的话,那就返回了 |
| | | return null; |
| | | return new ArrayList<>(); |
| | | } |
| | | return selectOnlyTemplateByClassifyOid(classifyDO.getParentCodeClassifyOid()); |
| | | if(StringUtils.isNotBlank(classifyDO.getParentCodeClassifyOid())) { |
| | | return selectOnlyTemplateByClassifyOid(classifyDO.getParentCodeClassifyOid()); |
| | | }else{ |
| | | return new ArrayList<>(); |
| | | } |
| | | }else{ |
| | | return templateDOS; |
| | | } |