|
|
@ -32,6 +32,7 @@ import com.elink.esua.epdc.modules.phrases.entity.ActPhraseRedisEntity; |
|
|
|
import com.elink.esua.epdc.modules.phrases.redis.ActPhraseRedis; |
|
|
|
import com.elink.esua.epdc.modules.phrases.service.ActPhraseService; |
|
|
|
import com.elink.esua.epdc.phrases.ActPhraseDTO; |
|
|
|
import io.netty.util.internal.StringUtil; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -120,7 +121,7 @@ public class ActPhraseServiceImpl extends BaseServiceImpl<ActPhraseDao, ActPhras |
|
|
|
String key = RedisKeys.getPhraseListKey(); |
|
|
|
List<ActPhraseRedisEntity> list = baseDao.selectListPhraseInOrder(); |
|
|
|
if (null != list && list.size() > 0) { |
|
|
|
redisUtils.set(key, list,RedisUtils.NOT_EXPIRE); |
|
|
|
redisUtils.set(key, list, RedisUtils.NOT_EXPIRE); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -128,6 +129,17 @@ public class ActPhraseServiceImpl extends BaseServiceImpl<ActPhraseDao, ActPhras |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(ActPhraseDTO dto) { |
|
|
|
ActPhraseEntity act = baseDao.selectById(dto.getId()); |
|
|
|
// 判断本次修改是否修改了编码
|
|
|
|
String categoryCode = dto.getCode(); |
|
|
|
// 如果本次修改了唯一项编码,则判断输入的编码是否重复
|
|
|
|
if (!(act.getCode().equals(categoryCode))) { |
|
|
|
if (StringUtils.isNotBlank(categoryCode)) { |
|
|
|
if (getCodeCount(dto) > 0) { |
|
|
|
throw new RenException("您输入的编码已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ActPhraseEntity entity = ConvertUtils.sourceToTarget(dto, ActPhraseEntity.class); |
|
|
|
updateById(entity); |
|
|
|
|
|
|
@ -135,7 +147,7 @@ public class ActPhraseServiceImpl extends BaseServiceImpl<ActPhraseDao, ActPhras |
|
|
|
String key = RedisKeys.getPhraseListKey(); |
|
|
|
redisUtils.delete(key); |
|
|
|
List<ActPhraseRedisEntity> list = baseDao.selectListPhraseInOrder(); |
|
|
|
redisUtils.set(key, list,RedisUtils.NOT_EXPIRE); |
|
|
|
redisUtils.set(key, list, RedisUtils.NOT_EXPIRE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -149,7 +161,7 @@ public class ActPhraseServiceImpl extends BaseServiceImpl<ActPhraseDao, ActPhras |
|
|
|
String key = RedisKeys.getPhraseListKey(); |
|
|
|
redisUtils.delete(key); |
|
|
|
List<ActPhraseRedisEntity> list = baseDao.selectListPhraseInOrder(); |
|
|
|
redisUtils.set(key, list,RedisUtils.NOT_EXPIRE); |
|
|
|
redisUtils.set(key, list, RedisUtils.NOT_EXPIRE); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -179,7 +191,7 @@ public class ActPhraseServiceImpl extends BaseServiceImpl<ActPhraseDao, ActPhras |
|
|
|
String key = RedisKeys.getPhraseListKey(); |
|
|
|
redisUtils.delete(key); |
|
|
|
List<ActPhraseRedisEntity> list = baseDao.selectListPhraseInOrder(); |
|
|
|
redisUtils.set(key, list,RedisUtils.NOT_EXPIRE); |
|
|
|
redisUtils.set(key, list, RedisUtils.NOT_EXPIRE); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -206,7 +218,7 @@ public class ActPhraseServiceImpl extends BaseServiceImpl<ActPhraseDao, ActPhras |
|
|
|
list = (List<ActPhraseRedisEntity>) object; |
|
|
|
} else { |
|
|
|
list = baseDao.selectListPhraseInOrder(); |
|
|
|
redisUtils.set(key, list,RedisUtils.NOT_EXPIRE); |
|
|
|
redisUtils.set(key, list, RedisUtils.NOT_EXPIRE); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|