字典微服务调整

定时任务优化
自定义表单实体
yun-zuoyi
yunhao.wang 6 years ago
parent 0e26184ff0
commit 2d81c898d8

@ -121,4 +121,10 @@ public interface ISysDictionaryService {
*/
@ApiOperation(value = "根据父节点 以及当前节点名称 获取字典信息")
SysDictionary getSysDictionaryByParentCodeAndName(String parentCode,String name);
/**
*
*/
@ApiOperation(value = "根据模块查询顶级字典")
List<SysDictionary> findSysDictionaryByTopBySoftType(Integer softType);
}

@ -53,7 +53,6 @@ public class SysDictionaryController extends CoreBaseController{
try {
// 条件验证
ValidatorBean.beginValid(sysDictionary)
.notNull("id",sysDictionary.getId())
.notNull("name",sysDictionary.getName())
.notNull("dictionarySoftType",sysDictionary.getDictionarySoftType())
.notNull("dictionaryCode",sysDictionary.getDictionaryCode())
@ -221,7 +220,7 @@ public class SysDictionaryController extends CoreBaseController{
}
}
@GetMapping("/find/top")
@GetMapping("/find-top")
@ApiOperation(value = "查询顶级字典项",notes = "查询顶级字典项")
public ResultBean findSysDictionaryByTop() {
try {
@ -282,12 +281,13 @@ public class SysDictionaryController extends CoreBaseController{
for (CommonEnumUtil.SOFT_TYPE softType :CommonEnumUtil.SOFT_TYPE.values()) {
if(group.containsKey(softType.getValue())){
child = new HashMap();
child.put("id",softType.getCode());
child.put("name",softType.getValue());
child.put("id",softType.getValue());
child.put("name",softType.getCode());
child.put("childList",group.get(softType.getValue()));
dictTree.add(child);
}
}
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(dictTree);
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
@ -295,4 +295,17 @@ public class SysDictionaryController extends CoreBaseController{
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@GetMapping("/find-soft-type")
@ApiOperation(value = "根据模块查询顶级字典",notes = "根据模块查询顶级字典")
public ResultBean findSysDictionaryByTopBySoftType(Integer softType){
try {
List<SysDictionary> dictionaryList = sysDictionaryService.findSysDictionaryByTopBySoftType(softType);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(dictionaryList);
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
}catch(Exception e){
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -85,8 +85,7 @@ public class SysTaskCycleController extends CoreBaseController{
// 数据校验
ValidatorBean.beginValid(sysTaskCycle)
.notNull("name", sysTaskCycle.getName())
.notNull("taskCycleExps", sysTaskCycle.getTaskCycleExps())
.notNull("taskCycleStartDatetime",sysTaskCycle.getTaskCycleStartDatetime());
.notNull("taskCycleExps", sysTaskCycle.getTaskCycleExps());
sysTaskCycleService.insertSysTaskCycle(sysTaskCycle);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());

@ -10,7 +10,6 @@ import cn.estsh.i3plus.pojo.platform.bean.SysLocaleLanguage;
import cn.estsh.i3plus.pojo.platform.bean.SysLocaleResource;
import cn.estsh.i3plus.pojo.platform.repository.SysConfigRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysDictionaryRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysLocaleLanguageRepository;
import cn.estsh.impp.framework.boot.util.ImppRedis;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -118,29 +117,29 @@ public class SystemInitService implements ISystemInitService {
//查询所有资源
List<SysLocaleResource> resourceList = systemResourceService.listSysLocaleResource(null);
LOGGER.info("【加载平台资源】共有{}个资源,{}种语言。",resourceList.size(),langList.size());
for(SysLocaleResource res : resourceList) {
LOGGER.info("【加载平台资源】共有{}个资源,{}种语言。", resourceList.size(), langList.size());
for (SysLocaleResource res : resourceList) {
//遍历资源放入map中
lanMap = resMap.get(res.getResourceKey());
//判断是否已存在资源信息
if(lanMap == null){
if (lanMap == null){
lanMap = new HashMap();
//将key/代码放入
resMap.put(res.getResourceKey(),lanMap);
resMap.put(res.getResourceKey(), lanMap);
}
//根据语言放入
lanMap.put(res.getLanguageCode(),res.getResourceValue());
lanMap.put(res.getLanguageCode(), res.getResourceValue());
// web 资源
if(!webLangMap.containsKey(res.getLanguageCode())){
webLangMap.put(res.getLanguageCode(),new HashMap<>());
webLangMap.put(res.getLanguageCode(), new HashMap<>());
}
// 放入资源信息
webResMap = webLangMap.get(res.getLanguageCode());
webResMap.put(res.getResourceKey(),res.getResourceValue());
webResMap.put(res.getResourceKey(), res.getResourceValue());
}
for(String key : resMap.keySet()){
for (String key : resMap.keySet()) {
//放入缓存
redisRes.putHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + key,resMap.get(key),0);
}

@ -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});
}
}

Loading…
Cancel
Save