|
|
|
@ -2,13 +2,11 @@ package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysDictionaryService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseConstWords;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysDictionary;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysDictionaryRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
|
|
|
|
@ -44,7 +42,7 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
new Object[]{sysDictionary.getDictionaryCode(), sysDictionary.getDictionarySoftType()});
|
|
|
|
|
long repeatValueCount = sysDictionaryRDao.findByPropertyCount(new String[]{"parentId", "dictionaryValue", "dictionarySoftType"},
|
|
|
|
|
new Object[]{sysDictionary.getParentId(), sysDictionary.getDictionaryValue(), sysDictionary.getDictionarySoftType()});
|
|
|
|
|
if (repeatCodeCount > 0 || repeatValueCount > 0){
|
|
|
|
|
if (repeatCodeCount > 0 || repeatValueCount > 0) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
|
|
|
@ -65,14 +63,14 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
sysDictionary.setParentId(CommonEnumUtil.PARENT.DEFAULT.getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY sysDictionary:{}",sysDictionary);
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY sysDictionary:{}", sysDictionary);
|
|
|
|
|
sysDictionaryRDao.insert(sysDictionary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据id删除字典")
|
|
|
|
|
public void deleteSysDictionaryById(Long id) {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY id:{}",id);
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY id:{}", id);
|
|
|
|
|
sysDictionaryRDao.deleteById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -84,7 +82,7 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
long repeatCodeCount = sysDictionaryRDao.findByHqlWhereCount(hqlPack);
|
|
|
|
|
hqlPack = CoreHqlPack.packHqlSysDictionaryValue(sysDictionary);
|
|
|
|
|
long repeatValueCount = sysDictionaryRDao.findByHqlWhereCount(hqlPack);
|
|
|
|
|
if (repeatCodeCount > 0 || repeatValueCount > 0){
|
|
|
|
|
if (repeatCodeCount > 0 || repeatValueCount > 0) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
|
|
|
@ -114,7 +112,7 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
newSysDict.setParentCodeRdd(parentSysDictionary.getDictionaryCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY sysDictionary:{}",newSysDict);
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY sysDictionary:{}", newSysDict);
|
|
|
|
|
sysDictionaryRDao.update(newSysDict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -128,32 +126,32 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据id查询字典信息")
|
|
|
|
|
public SysDictionary getSysDictionaryById(Long id) {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY id:{}",id);
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY id:{}", id);
|
|
|
|
|
return sysDictionaryRDao.getById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据父级代码查询字典项信息")
|
|
|
|
|
public List<SysDictionary> findSysDictionaryBySoftTypeAndParentCode(Integer softType,String parentCode) {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY parentCode:{}",parentCode);
|
|
|
|
|
public List<SysDictionary> findSysDictionaryBySoftTypeAndParentCode(Integer softType, String parentCode) {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY parentCode:{}", parentCode);
|
|
|
|
|
return sysDictionaryRDao.findByProperty(new String[]{"softType", "parentCodeRdd"}, new Object[]{softType, parentCode});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "字典复杂查询,分页,排序",notes = "默认查询非顶级字典")
|
|
|
|
|
@ApiOperation(value = "字典复杂查询,分页,排序", notes = "默认查询非顶级字典")
|
|
|
|
|
public ListPager querySysDictionaryByPager(SysDictionary sysDictionary, Pager pager) {
|
|
|
|
|
sysDictionary = sysDictionary == null ? new SysDictionary():sysDictionary;
|
|
|
|
|
sysDictionary = sysDictionary == null ? new SysDictionary() : sysDictionary;
|
|
|
|
|
|
|
|
|
|
String hqlPack = CoreHqlPack.packHqlSysDictionary(sysDictionary);
|
|
|
|
|
pager = PagerHelper.getPager(pager, sysDictionaryRDao.findByHqlWhereCount(hqlPack));
|
|
|
|
|
return new ListPager(sysDictionaryRDao.findByHqlWherePage(hqlPack + sysDictionary.orderBy(),pager),pager);
|
|
|
|
|
return new ListPager(sysDictionaryRDao.findByHqlWherePage(hqlPack + sysDictionary.orderBy(), pager), pager);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "查询顶级字典")
|
|
|
|
|
public List<SysDictionary> findSysDictionaryByTop() {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY parentId:{}", CommonEnumUtil.PARENT.DEFAULT.getValue());
|
|
|
|
|
return sysDictionaryRDao.findByProperty("parentId",(long)CommonEnumUtil.PARENT.DEFAULT.getValue());
|
|
|
|
|
return sysDictionaryRDao.findByProperty("parentId", (long) CommonEnumUtil.PARENT.DEFAULT.getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -178,11 +176,11 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
List<SysDictionary> list = findSysDictionaryBySoftTypeAndParentCode(CommonEnumUtil.SOFT_TYPE.CORE.getValue(),
|
|
|
|
|
BaseConstWords.DICTIONARY_FILE_TYPE);
|
|
|
|
|
|
|
|
|
|
if(list != null && list.size()> 0){
|
|
|
|
|
String suffix = StringTool.getStringFileSuffix(fileName,true);
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
String suffix = StringTool.getStringFileSuffix(fileName, true);
|
|
|
|
|
|
|
|
|
|
for (SysDictionary dictionary : list) {
|
|
|
|
|
if(suffix.toUpperCase().equals(dictionary.getDictionaryValue().toUpperCase())){
|
|
|
|
|
if (suffix.toUpperCase().equals(dictionary.getDictionaryValue().toUpperCase())) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -193,32 +191,39 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据父节点 以及当前节点CODE 获取字典信息")
|
|
|
|
|
public SysDictionary getSysDictionaryByParentCodeAndCode(String parentCode, String code) {
|
|
|
|
|
return sysDictionaryRDao.getByProperty(new String[]{"parentCodeRdd","dictionaryCode"},
|
|
|
|
|
new Object[]{parentCode,code});
|
|
|
|
|
return sysDictionaryRDao.getByProperty(new String[]{"parentCodeRdd", "dictionaryCode"},
|
|
|
|
|
new Object[]{parentCode, code});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "设置默认字典项",notes = "根据id设置默认字典项")
|
|
|
|
|
@ApiOperation(value = "设置默认字典项", notes = "根据id设置默认字典项")
|
|
|
|
|
public void updateSysDictionaryDefaultById(Long id) {
|
|
|
|
|
SysDictionary sysDictionary = sysDictionaryRDao.getById(id);
|
|
|
|
|
sysDictionaryRDao.updateByProperties("parentId",sysDictionary.getParentId(),
|
|
|
|
|
"isDefault",CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
|
sysDictionaryRDao.updateByProperties("parentId", sysDictionary.getParentId(),
|
|
|
|
|
"isDefault", CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
|
|
|
|
|
|
sysDictionaryRDao.updateByProperties("id",id,
|
|
|
|
|
"isDefault",CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
|
|
|
|
sysDictionaryRDao.updateByProperties("id", id,
|
|
|
|
|
"isDefault", CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据父节点 以及当前节点值 获取字典信息")
|
|
|
|
|
public SysDictionary getSysDictionaryByParentCodeAndValue(String parentCode, String value) {
|
|
|
|
|
return sysDictionaryRDao.getByProperty(new String[]{"parentCodeRdd","dictionaryValue"},
|
|
|
|
|
new Object[]{parentCode,value});
|
|
|
|
|
return sysDictionaryRDao.getByProperty(new String[]{"parentCodeRdd", "dictionaryValue"},
|
|
|
|
|
new Object[]{parentCode, value});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据父节点 以及当前节点名称 获取字典信息")
|
|
|
|
|
public SysDictionary getSysDictionaryByParentCodeAndName(String parentCode, String name) {
|
|
|
|
|
return sysDictionaryRDao.getByProperty(new String[]{"parentCodeRdd","name"},
|
|
|
|
|
new Object[]{parentCode,name});
|
|
|
|
|
return sysDictionaryRDao.getByProperty(new String[]{"parentCodeRdd", "name"},
|
|
|
|
|
new Object[]{parentCode, name});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据模块查询顶级字典")
|
|
|
|
|
public List<SysDictionary> findSysDictionaryByTopBySoftType(Integer softType) {
|
|
|
|
|
return sysDictionaryRDao.findByProperty(new String[]{"parentId", "dictionarySoftType"},
|
|
|
|
|
new Object[]{(long) CommonEnumUtil.PARENT.DEFAULT.getValue(), softType});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|