|
|
|
@ -1,8 +1,13 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.controller;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISystemResourceService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.enumutil.ResourceEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysLocaleLanguage;
|
|
|
|
@ -51,16 +56,22 @@ public class DemoSystemController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISystemResourceService systemResourceService;
|
|
|
|
|
|
|
|
|
|
@PutMapping(value="/language/add")
|
|
|
|
|
@PutMapping(value="/language/insert")
|
|
|
|
|
@ApiOperation(value="添加语言",notes = "添加系统语言,可用于国际化")
|
|
|
|
|
public ResultBean addLanguage(SysLocaleLanguage lang) {
|
|
|
|
|
public ResultBean insertLanguage(SysLocaleLanguage lang) {
|
|
|
|
|
try {
|
|
|
|
|
//登陆用户
|
|
|
|
|
SessionUser user = AuthUtil.getSessionUser();
|
|
|
|
|
|
|
|
|
|
//条件验证
|
|
|
|
|
ValidatorBean.beginValid(lang)
|
|
|
|
|
.notNull("languageName",lang.getLanguageName())
|
|
|
|
|
.notNull("languageCode",lang.getLanguageCode());
|
|
|
|
|
|
|
|
|
|
systemResourceService.saveSysLocaleLanguage(lang);
|
|
|
|
|
//新增初始化
|
|
|
|
|
ConvertBean.modelInitialize(lang,user);
|
|
|
|
|
|
|
|
|
|
systemResourceService.insertSysLocaleLanguage(lang);
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep);
|
|
|
|
@ -70,15 +81,39 @@ public class DemoSystemController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PutMapping(value="/language/update")
|
|
|
|
|
@ApiOperation(value="修改语言",notes = "修改系统语言,可用于国际化")
|
|
|
|
|
public ResultBean updateLanguage(SysLocaleLanguage lang) {
|
|
|
|
|
try {
|
|
|
|
|
//登陆用户
|
|
|
|
|
SessionUser user = AuthUtil.getSessionUser();
|
|
|
|
|
|
|
|
|
|
//条件验证
|
|
|
|
|
ValidatorBean.beginValid(lang)
|
|
|
|
|
.notNull("languageName",lang.getLanguageName())
|
|
|
|
|
.notNull("languageCode",lang.getLanguageCode());
|
|
|
|
|
|
|
|
|
|
//修改条件
|
|
|
|
|
ConvertBean.modelUpdate(lang,user);
|
|
|
|
|
systemResourceService.updateSysLocaleLanguage(lang);
|
|
|
|
|
return ResultBean.success("修改成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep);
|
|
|
|
|
return ResultBean.fail(busExcep.getErrorShow()).build();
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
return ResultBean.fail(e.getMessage()).setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PutMapping(value="/language/query")
|
|
|
|
|
@ApiOperation(value="查询语言",notes = "添加系统语言,可用于国际化")
|
|
|
|
|
public ResultBean queryLanguage(SysLocaleLanguage lang,Pager pager) {
|
|
|
|
|
try {
|
|
|
|
|
ListPager listPager = systemResourceService.listSysLocaleLanguageByPager(lang,pager);
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
return ResultBean.success("操作成功").setListPager(listPager).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep);
|
|
|
|
|
return ResultBean.fail(busExcep.getErrorShow()).build();
|
|
|
|
|
return ResultBean.fail(busExcep.getErrorShow());
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + ":{}",e.getMessage(),e);
|
|
|
|
|
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
|
|
|
|
@ -89,11 +124,16 @@ public class DemoSystemController {
|
|
|
|
|
@ApiOperation(value="添加资源",notes = "添加系统语言,可用于国际化")
|
|
|
|
|
public ResultBean insertResource(SysLocaleResource res) {
|
|
|
|
|
try {
|
|
|
|
|
//登陆用户
|
|
|
|
|
SessionUser user = AuthUtil.getSessionUser();
|
|
|
|
|
|
|
|
|
|
//条件验证
|
|
|
|
|
ValidatorBean.beginValid(res)
|
|
|
|
|
.notNull("resourceKey",res.getResourceKey())
|
|
|
|
|
.notNull("resourceValue",res.getResourceValue());
|
|
|
|
|
|
|
|
|
|
//新增初始化
|
|
|
|
|
ConvertBean.modelInitialize(res,user);
|
|
|
|
|
systemResourceService.insertSysLocaleResource(res);
|
|
|
|
|
return ResultBean.success("操作成功")
|
|
|
|
|
.setResultObject(res)
|
|
|
|
@ -148,4 +188,27 @@ public class DemoSystemController {
|
|
|
|
|
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(value="/locale-resource/delete")
|
|
|
|
|
@ApiOperation(value="删除资源",notes="批量删除资源")
|
|
|
|
|
public ResultBean deleteLocaleResource(String[] resourceIds) {
|
|
|
|
|
try {
|
|
|
|
|
if(resourceIds.length == 0){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("请选择需要删除的资源。")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
systemResourceService.deleteSysLocaleResourceByIds(resourceIds);
|
|
|
|
|
|
|
|
|
|
return ResultBean.success().setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep);
|
|
|
|
|
return ResultBean.fail(busExcep.getErrorShow());
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + ":{}",e.getMessage(),e);
|
|
|
|
|
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|