对接企业微信
This commit is contained in:
@@ -3,6 +3,8 @@ package com.rj.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rj.common.DictItemConstants;
|
||||
import com.rj.common.PasswordUtil;
|
||||
import com.rj.entity.DictItem;
|
||||
import com.rj.mapper.DictItemMapper;
|
||||
import com.rj.service.IDictItemService;
|
||||
@@ -33,6 +35,26 @@ public class DictItemServiceImpl extends ServiceImpl<DictItemMapper, DictItem> i
|
||||
result.put("message", "name不能为空");
|
||||
return result;
|
||||
}
|
||||
|
||||
String tenantId = entity.getTenantId().trim();
|
||||
String name = entity.getName().trim();
|
||||
LambdaQueryWrapper<DictItem> dupQ = new LambdaQueryWrapper<DictItem>()
|
||||
.eq(DictItem::getName, name);
|
||||
if (this.count(dupQ) > 0) {
|
||||
result.put("success", false);
|
||||
result.put("message", "该租户下name已存在,不能重复添加");
|
||||
return result;
|
||||
}
|
||||
if (DictItemConstants.QIWEI_CONFIG.equals(name)){
|
||||
String rawValue = entity.getValue();
|
||||
if (rawValue == null) {
|
||||
rawValue = "";
|
||||
}
|
||||
entity.setValue(PasswordUtil.encryptReversibleWithDefaultSalt(rawValue));
|
||||
}
|
||||
|
||||
entity.setTenantId(tenantId);
|
||||
entity.setName(name);
|
||||
entity.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
entity.setCreatedTime(now);
|
||||
@@ -60,6 +82,13 @@ public class DictItemServiceImpl extends ServiceImpl<DictItemMapper, DictItem> i
|
||||
result.put("message", "ID不能为空");
|
||||
return result;
|
||||
}
|
||||
if (DictItemConstants.QIWEI_CONFIG.equals(entity.getName())) {
|
||||
String rawValue = entity.getValue();
|
||||
if (rawValue == null) {
|
||||
rawValue = "";
|
||||
}
|
||||
entity.setValue(PasswordUtil.encryptReversibleWithDefaultSalt(rawValue));
|
||||
}
|
||||
entity.setUpdatedTime(LocalDateTime.now());
|
||||
boolean ok = this.updateById(entity);
|
||||
result.put("success", ok);
|
||||
|
||||
Reference in New Issue
Block a user