|
|
|
@ -19,19 +19,26 @@ package com.logpm.basic.service.impl;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.logpm.basic.entity.BasicTenantCodeEntity; |
|
|
|
|
import com.logpm.basic.excel.BasicTenantCodeExcel; |
|
|
|
|
import com.logpm.basic.mapper.BasicTenantCodeMapper; |
|
|
|
|
import com.logpm.basic.service.IBasicTenantCodeService; |
|
|
|
|
import com.logpm.basic.vo.BasicTenantCodeVO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springblade.common.constant.RedisKeyConstant; |
|
|
|
|
import org.springblade.common.constant.basiccode.BasicCodeTypeConstant; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.redis.cache.BladeRedis; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 租户设置编码 服务实现类 |
|
|
|
@ -43,6 +50,7 @@ import java.util.Map;
|
|
|
|
|
@AllArgsConstructor |
|
|
|
|
public class BasicTenantCodeServiceImpl extends BaseServiceImpl<BasicTenantCodeMapper, BasicTenantCodeEntity> implements IBasicTenantCodeService { |
|
|
|
|
|
|
|
|
|
private final BladeRedis redis; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<BasicTenantCodeEntity> list(Map<String, Object> basicTenantCode, IPage<BasicTenantCodeEntity> page) { |
|
|
|
@ -92,6 +100,36 @@ public class BasicTenantCodeServiceImpl extends BaseServiceImpl<BasicTenantCodeM
|
|
|
|
|
return basicTenantCodeEntity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean BasicTenantCodeEntity(BasicTenantCodeEntity basicTenantCode) { |
|
|
|
|
//删除此编码Redis存在的KEY
|
|
|
|
|
if (basicTenantCode.getCodeType().equals(BasicCodeTypeConstant.CLIENT_CODE.getValue())){ |
|
|
|
|
redis.del(RedisKeyConstant.FINAL_CLIENT_CODE + AuthUtil.getTenantId()); |
|
|
|
|
} |
|
|
|
|
return this.updateById(basicTenantCode); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R saveBasicTenantCodeEntity(BasicTenantCodeEntity basicTenantCode) { |
|
|
|
|
//参数校验
|
|
|
|
|
if (Objects.isNull(basicTenantCode.getCodeType())){ |
|
|
|
|
return R.fail("CodeType参数缺失"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(basicTenantCode.getShowType())){ |
|
|
|
|
return R.fail("ShowType参数缺失"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//查询此类编码是否存在
|
|
|
|
|
List<BasicTenantCodeEntity> list = this.list(Wrappers.<BasicTenantCodeEntity>query().lambda() |
|
|
|
|
.eq(BasicTenantCodeEntity::getCodeType, basicTenantCode.getCodeType()) |
|
|
|
|
.eq(BasicTenantCodeEntity::getShowType, basicTenantCode.getShowType()) |
|
|
|
|
); |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
return R.fail("此编码配置已存在"); |
|
|
|
|
} |
|
|
|
|
return R.status(this.save(basicTenantCode)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean save(BasicTenantCodeEntity entity) { |
|
|
|
|
String code = entity.getCode(); |
|
|
|
|