|
|
|
@ -13,6 +13,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.MailConfig;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
|
|
|
|
import cn.estsh.i3plus.sdk.sms.base.pojo.SmsConfig;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysConfig;
|
|
|
|
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
@ -29,6 +30,8 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import static cn.estsh.i3plus.platform.common.util.CommonConstWords.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 系统参数管理服务
|
|
|
|
|
* @Reference :
|
|
|
|
@ -38,7 +41,7 @@ import java.util.List;
|
|
|
|
|
**/
|
|
|
|
|
@RestController
|
|
|
|
|
@Api(tags = "系统参数管理服务")
|
|
|
|
|
@RequestMapping(PlatformConstWords.BASE_URL +"/sys-config")
|
|
|
|
|
@RequestMapping(PlatformConstWords.BASE_URL + "/sys-config")
|
|
|
|
|
public class SysConfigController extends CoreBaseController {
|
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(SysConfigController.class);
|
|
|
|
|
|
|
|
|
@ -53,11 +56,12 @@ public class SysConfigController extends CoreBaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加系统参数
|
|
|
|
|
*
|
|
|
|
|
* @param sysConfig 系统参数
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/insert")
|
|
|
|
|
@ApiOperation(value = "添加系统参数",notes = "添加系统参数")
|
|
|
|
|
@ApiOperation(value = "添加系统参数", notes = "添加系统参数")
|
|
|
|
|
public ResultBean insertSysConfig(SysConfig sysConfig) {
|
|
|
|
|
try {
|
|
|
|
|
// 登录用户
|
|
|
|
@ -65,26 +69,27 @@ public class SysConfigController extends CoreBaseController {
|
|
|
|
|
|
|
|
|
|
// 条件验证
|
|
|
|
|
ValidatorBean.beginValid(sysConfig)
|
|
|
|
|
.notNull("name",sysConfig.getName())
|
|
|
|
|
.notNull("configCode",sysConfig.getConfigCode())
|
|
|
|
|
.notNull("configType",sysConfig.getConfigType())
|
|
|
|
|
.notNull("configValue",sysConfig.getConfigValue());
|
|
|
|
|
.notNull("name", sysConfig.getName())
|
|
|
|
|
.notNull("configCode", sysConfig.getConfigCode())
|
|
|
|
|
.notNull("configType", sysConfig.getConfigType())
|
|
|
|
|
.notNull("configValue", sysConfig.getConfigValue());
|
|
|
|
|
|
|
|
|
|
//修改初始化
|
|
|
|
|
ConvertBean.modelInitialize(sysConfig,user);
|
|
|
|
|
ConvertBean.modelInitialize(sysConfig, user);
|
|
|
|
|
|
|
|
|
|
sysConfigService.insertSysConfig(sysConfig);
|
|
|
|
|
systemInitService.putAndLoadSysConfig();
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据id删除系统参数
|
|
|
|
|
*
|
|
|
|
|
* @param idStr 系统参数id
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
@ -95,8 +100,8 @@ public class SysConfigController extends CoreBaseController {
|
|
|
|
|
startMultiService();
|
|
|
|
|
|
|
|
|
|
// 条件验证
|
|
|
|
|
ValidatorBean.checkNotNull(idStr,"id不能为空");
|
|
|
|
|
if(sysConfigService.getSysConfigById(Long.parseLong(idStr)) == null){
|
|
|
|
|
ValidatorBean.checkNotNull(idStr, "id不能为空");
|
|
|
|
|
if (sysConfigService.getSysConfigById(Long.parseLong(idStr)) == null) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
|
|
|
|
@ -107,42 +112,43 @@ public class SysConfigController extends CoreBaseController {
|
|
|
|
|
|
|
|
|
|
sysConfigService.deleteSysConfigById(Long.parseLong(idStr));
|
|
|
|
|
systemInitService.putAndLoadSysConfig();
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 系统参数
|
|
|
|
|
*
|
|
|
|
|
* @param sysConfig 系统参数
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@PutMapping(value = "/update")
|
|
|
|
|
@ApiOperation(value = "修改系统参数",notes = "修改系统参数")
|
|
|
|
|
public ResultBean updateSysConfig(SysConfig sysConfig){
|
|
|
|
|
@ApiOperation(value = "修改系统参数", notes = "修改系统参数")
|
|
|
|
|
public ResultBean updateSysConfig(SysConfig sysConfig) {
|
|
|
|
|
try {
|
|
|
|
|
// 登录用户
|
|
|
|
|
SessionUser user = AuthUtil.getSessionUser();
|
|
|
|
|
|
|
|
|
|
// 条件验证
|
|
|
|
|
ValidatorBean.beginValid(sysConfig)
|
|
|
|
|
.notNull("name",sysConfig.getName())
|
|
|
|
|
.notNull("configCode",sysConfig.getConfigCode())
|
|
|
|
|
.notNull("configType",sysConfig.getConfigType())
|
|
|
|
|
.notNull("configValue",sysConfig.getConfigValue());
|
|
|
|
|
.notNull("name", sysConfig.getName())
|
|
|
|
|
.notNull("configCode", sysConfig.getConfigCode())
|
|
|
|
|
.notNull("configType", sysConfig.getConfigType())
|
|
|
|
|
.notNull("configValue", sysConfig.getConfigValue());
|
|
|
|
|
|
|
|
|
|
//添加初始化
|
|
|
|
|
ConvertBean.modelUpdate(sysConfig,user);
|
|
|
|
|
ConvertBean.modelUpdate(sysConfig, user);
|
|
|
|
|
|
|
|
|
|
sysConfigService.updateSysConfig(sysConfig);
|
|
|
|
|
systemInitService.putAndLoadSysConfig();
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -150,139 +156,144 @@ public class SysConfigController extends CoreBaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 系统参数
|
|
|
|
|
*
|
|
|
|
|
* @param bean 系统参数
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@PutMapping(value = "/update-value")
|
|
|
|
|
@ApiOperation(value = "修改系统参数内容",notes = "修改系统参数内容")
|
|
|
|
|
public ResultBean updateSysConfigValue(SysConfig bean){
|
|
|
|
|
@ApiOperation(value = "修改系统参数内容", notes = "修改系统参数内容")
|
|
|
|
|
public ResultBean updateSysConfigValue(SysConfig bean) {
|
|
|
|
|
try {
|
|
|
|
|
// 条件验证
|
|
|
|
|
ValidatorBean.beginValid(bean)
|
|
|
|
|
.notNull("configCode",bean.getConfigCode());
|
|
|
|
|
.notNull("configCode", bean.getConfigCode());
|
|
|
|
|
|
|
|
|
|
SysConfig config = sysConfigService.getSysConfigByCode(bean.getConfigCode());
|
|
|
|
|
ValidatorBean.checkNotNull(config,"不存在的配置信息");
|
|
|
|
|
ValidatorBean.checkNotNull(config, "不存在的配置信息");
|
|
|
|
|
|
|
|
|
|
config.setConfigValue(bean.getConfigValue());
|
|
|
|
|
ConvertBean.modelUpdate(config,getSessionUser());
|
|
|
|
|
ConvertBean.modelUpdate(config, getSessionUser());
|
|
|
|
|
|
|
|
|
|
sysConfigService.updateSysConfig(config);
|
|
|
|
|
systemInitService.putAndLoadSysConfig();
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询全部系统参数
|
|
|
|
|
*
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping(value = "/list")
|
|
|
|
|
@ApiOperation(value = "查询全部系统参数",notes = "查询全部系统参数")
|
|
|
|
|
public ResultBean findSysConfigAll(){
|
|
|
|
|
@ApiOperation(value = "查询全部系统参数", notes = "查询全部系统参数")
|
|
|
|
|
public ResultBean findSysConfigAll() {
|
|
|
|
|
try {
|
|
|
|
|
List<SysConfig> sysConfigList = sysConfigService.ListSysConfig();
|
|
|
|
|
return ResultBean.success("操作成功")
|
|
|
|
|
.setResultList(sysConfigList)
|
|
|
|
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
return ResultBean.success("操作成功")
|
|
|
|
|
.setResultList(sysConfigList)
|
|
|
|
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据id查询系统参数
|
|
|
|
|
*
|
|
|
|
|
* @param id 系统参数id
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping(value = "/get/{id}")
|
|
|
|
|
@ApiOperation(value = "根据id查询系统参数",notes = "根据id查询系统参数")
|
|
|
|
|
public ResultBean getSysConfigById(@PathVariable("id") String id){
|
|
|
|
|
@ApiOperation(value = "根据id查询系统参数", notes = "根据id查询系统参数")
|
|
|
|
|
public ResultBean getSysConfigById(@PathVariable("id") String id) {
|
|
|
|
|
try {
|
|
|
|
|
ValidatorBean.checkNotNull(id,"id不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(id, "id不能为空");
|
|
|
|
|
|
|
|
|
|
SysConfig sysConfig = sysConfigService.getSysConfigById(Long.parseLong(id));
|
|
|
|
|
if (sysConfig != null) {
|
|
|
|
|
return ResultBean.success("操作成功")
|
|
|
|
|
.setResultObject(sysConfig).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
return ResultBean.fail("数据不存在").setCode(ResourceEnumUtil.MESSAGE.EMPTY.getCode());
|
|
|
|
|
}
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 系统参数复杂查询,分页,排序
|
|
|
|
|
*
|
|
|
|
|
* @param sysConfig 系统参数
|
|
|
|
|
* @param pager 分页信息
|
|
|
|
|
* @param pager 分页信息
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/query")
|
|
|
|
|
@ApiOperation(value = "系统参数复杂查询,分页,排序",notes = "系统参数复杂查询,分页,排序")
|
|
|
|
|
public ResultBean querySysConfigByPager(SysConfig sysConfig,Pager pager) {
|
|
|
|
|
@ApiOperation(value = "系统参数复杂查询,分页,排序", notes = "系统参数复杂查询,分页,排序")
|
|
|
|
|
public ResultBean querySysConfigByPager(SysConfig sysConfig, Pager pager) {
|
|
|
|
|
try {
|
|
|
|
|
ListPager sysConfigListPager = sysConfigService.querySysConfigByPager(sysConfig,pager);
|
|
|
|
|
return ResultBean.success("操作成功").setListPager(sysConfigListPager).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
ListPager sysConfigListPager = sysConfigService.querySysConfigByPager(sysConfig, pager);
|
|
|
|
|
return ResultBean.success("操作成功").setListPager(sysConfigListPager).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据代码获取系统配置
|
|
|
|
|
*
|
|
|
|
|
* @param code 系统参数代码
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping(value = "/get-code/{code}")
|
|
|
|
|
@ApiOperation(value = "根据代码获取系统配置")
|
|
|
|
|
public ResultBean getSysConfigByCode(@PathVariable("code") String code){
|
|
|
|
|
public ResultBean getSysConfigByCode(@PathVariable("code") String code) {
|
|
|
|
|
try {
|
|
|
|
|
ValidatorBean.checkNotNull(code,"配置项代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(code, "配置项代码不能为空");
|
|
|
|
|
|
|
|
|
|
SysConfig sysConfig = sysConfigService.getSysConfigByCode(code);
|
|
|
|
|
if(sysConfig == null){
|
|
|
|
|
if (sysConfig == null) {
|
|
|
|
|
return ResultBean.fail("数据不存在").setCode(ResourceEnumUtil.MESSAGE.EMPTY.getCode());
|
|
|
|
|
} else{
|
|
|
|
|
return ResultBean.success("操作成功").setResultObject(sysConfig).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} else {
|
|
|
|
|
return ResultBean.success("操作成功").setResultObject(sysConfig).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询邮件配置
|
|
|
|
|
*
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/find-mail")
|
|
|
|
|
@ApiOperation(value = "查询邮件配置")
|
|
|
|
|
public ResultBean findMailSysConfig(){
|
|
|
|
|
public ResultBean findMailSysConfig() {
|
|
|
|
|
try {
|
|
|
|
|
List sysConfig = sysConfigService.findMailConfig();
|
|
|
|
|
if(sysConfig == null){
|
|
|
|
|
if (sysConfig == null) {
|
|
|
|
|
return ResultBean.fail("数据不存在").setCode(ResourceEnumUtil.MESSAGE.EMPTY.getCode());
|
|
|
|
|
} else{
|
|
|
|
|
return ResultBean.success("操作成功").setResultList(sysConfig).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} else {
|
|
|
|
|
return ResultBean.success("操作成功").setResultList(sysConfig).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -290,49 +301,51 @@ public class SysConfigController extends CoreBaseController {
|
|
|
|
|
/**
|
|
|
|
|
* 根据系统代码修改系统配置值
|
|
|
|
|
* wei.peng :
|
|
|
|
|
* 该方法已过期 推荐使用 SysConfigController.updateSysConfigValue()
|
|
|
|
|
* @param code 系统代码
|
|
|
|
|
* 该方法已过期 推荐使用 SysConfigController.updateSysConfigValue()
|
|
|
|
|
*
|
|
|
|
|
* @param code 系统代码
|
|
|
|
|
* @param value 系统配置值
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
@PostMapping("/update-code/{code}/{value}")
|
|
|
|
|
@ApiOperation(value = "根据code修改系统配置")
|
|
|
|
|
public ResultBean updateSysConfigByCode(@PathVariable("code") String code,@PathVariable("value") String value){
|
|
|
|
|
try{
|
|
|
|
|
ValidatorBean.checkNotNull(code,"配置项代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(value,"值不能为空");
|
|
|
|
|
public ResultBean updateSysConfigByCode(@PathVariable("code") String code, @PathVariable("value") String value) {
|
|
|
|
|
try {
|
|
|
|
|
ValidatorBean.checkNotNull(code, "配置项代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(value, "值不能为空");
|
|
|
|
|
|
|
|
|
|
sysConfigService.updateSysConfigByCode(code,value);
|
|
|
|
|
sysConfigService.updateSysConfigByCode(code, value);
|
|
|
|
|
systemInitService.putAndLoadSysConfig();
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发送测试邮件
|
|
|
|
|
*
|
|
|
|
|
* @param mailConfig 邮件配置信息
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/send-test-mail")
|
|
|
|
|
@ApiOperation(value = "邮件测试")
|
|
|
|
|
public ResultBean sendTestMail(MailConfig mailConfig){
|
|
|
|
|
public ResultBean sendTestMail(MailConfig mailConfig) {
|
|
|
|
|
try {
|
|
|
|
|
ValidatorBean.beginValid(mailConfig)
|
|
|
|
|
.notNull("mailSwitch",mailConfig.getMailSwitch())
|
|
|
|
|
.notNull("mailHost",mailConfig.getMailHost())
|
|
|
|
|
.notNull("mailPort",mailConfig.getMailPort())
|
|
|
|
|
.notNull("mailUser",mailConfig.getMailUser())
|
|
|
|
|
.notNull("mailPassword",mailConfig.getMailPassword())
|
|
|
|
|
.notNull("mailNick",mailConfig.getMailNick())
|
|
|
|
|
.notNull("testTo",mailConfig.getTestTo());
|
|
|
|
|
.notNull("mailSwitch", mailConfig.getMailSwitch())
|
|
|
|
|
.notNull("mailHost", mailConfig.getMailHost())
|
|
|
|
|
.notNull("mailPort", mailConfig.getMailPort())
|
|
|
|
|
.notNull("mailUser", mailConfig.getMailUser())
|
|
|
|
|
.notNull("mailPassword", mailConfig.getMailPassword())
|
|
|
|
|
.notNull("mailNick", mailConfig.getMailNick())
|
|
|
|
|
.notNull("testTo", mailConfig.getTestTo());
|
|
|
|
|
|
|
|
|
|
// 是否开启邮件服务器
|
|
|
|
|
if(mailConfig.getMailSwitch() != CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()){
|
|
|
|
|
if (mailConfig.getMailSwitch() != CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.MAIL_SERVER_NOT_OPEN_ERROR.getCode())
|
|
|
|
@ -349,29 +362,108 @@ public class SysConfigController extends CoreBaseController {
|
|
|
|
|
mailUtil.send();
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("测试邮件已发送").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch(ImppBusiException busExcep){
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据系统配置组查询系统配置信息
|
|
|
|
|
*
|
|
|
|
|
* @param group 系统配置组
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/find-group/{group}")
|
|
|
|
|
@ApiOperation(value = "根据参数组查询系统参数")
|
|
|
|
|
public ResultBean findSysConfigByGroup(@PathVariable("group") Integer group){
|
|
|
|
|
public ResultBean findSysConfigByGroup(@PathVariable("group") Integer group) {
|
|
|
|
|
try {
|
|
|
|
|
ValidatorBean.checkNotNull(group,"参数组不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(group, "参数组不能为空");
|
|
|
|
|
List<SysConfig> sysConfigList = sysConfigService.findSysConfigByGroup(group);
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(sysConfigList);
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询短信配置
|
|
|
|
|
**/
|
|
|
|
|
@GetMapping("/find-sms")
|
|
|
|
|
@ApiOperation(value = "查询短信配置")
|
|
|
|
|
public ResultBean<SmsConfig> findSmsConfig() {
|
|
|
|
|
try {
|
|
|
|
|
SmsConfig smsConfig = new SmsConfig();
|
|
|
|
|
smsConfig.setSmsSwitch(getConfigIntValByCode(CONFIG_SMS_SWITCH));
|
|
|
|
|
smsConfig.setSmsSupplier(getConfigIntValByCode(CONFIG_SMS_SUPPLIER));
|
|
|
|
|
smsConfig.setSmsAccessKeyId(getConfigStrValByCode(CONFIG_SMS_ACCESS_KEY_ID));
|
|
|
|
|
smsConfig.setSmsSecret(getConfigStrValByCode(CONFIG_SMS_SECRET));
|
|
|
|
|
smsConfig.setSmsEndpoint(getConfigStrValByCode(CONFIG_SMS_ENDPOINT));
|
|
|
|
|
smsConfig.setSmsRegionId(getConfigStrValByCode(CONFIG_SMS_REGION_ID));
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功")
|
|
|
|
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
|
|
|
|
|
.setResultObject(smsConfig);
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询短信配置
|
|
|
|
|
**/
|
|
|
|
|
@GetMapping("/save-sms")
|
|
|
|
|
@ApiOperation(value = "查询短信配置")
|
|
|
|
|
public ResultBean saveSmsConfig(@RequestBody SmsConfig smsConfig) {
|
|
|
|
|
try {
|
|
|
|
|
ValidatorBean.beginValid(smsConfig)
|
|
|
|
|
.notNull("smsSwitch", smsConfig.getSmsSwitch())
|
|
|
|
|
.notNull("smsSupplier", smsConfig.getSmsSupplier())
|
|
|
|
|
.notNull("smsAccessKeyId", smsConfig.getSmsAccessKeyId())
|
|
|
|
|
.notNull("smsSecret", smsConfig.getSmsSecret())
|
|
|
|
|
.notNull("smsEndpoint", smsConfig.getSmsEndpoint())
|
|
|
|
|
.notNull("smsRegionId", smsConfig.getSmsRegionId());
|
|
|
|
|
|
|
|
|
|
sysConfigService.updateSysConfigByCode(CONFIG_SMS_SWITCH, smsConfig.getSmsSwitch().toString());
|
|
|
|
|
sysConfigService.updateSysConfigByCode(CONFIG_SMS_SUPPLIER, smsConfig.getSmsSupplier().toString());
|
|
|
|
|
sysConfigService.updateSysConfigByCode(CONFIG_SMS_ACCESS_KEY_ID, smsConfig.getSmsAccessKeyId());
|
|
|
|
|
sysConfigService.updateSysConfigByCode(CONFIG_SMS_SECRET, smsConfig.getSmsSecret());
|
|
|
|
|
sysConfigService.updateSysConfigByCode(CONFIG_SMS_ENDPOINT, smsConfig.getSmsEndpoint());
|
|
|
|
|
sysConfigService.updateSysConfigByCode(CONFIG_SMS_REGION_ID, smsConfig.getSmsRegionId());
|
|
|
|
|
|
|
|
|
|
systemInitService.putAndLoadSysConfig();
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据代码查询字符串类型配置值
|
|
|
|
|
*
|
|
|
|
|
* @param code 配置代码
|
|
|
|
|
* @return 查询结果
|
|
|
|
|
*/
|
|
|
|
|
public String getConfigStrValByCode(String code) {
|
|
|
|
|
SysConfig sysConfig = sysConfigService.getSysConfigByCode(code);
|
|
|
|
|
return sysConfig != null ? sysConfig.getConfigValue() : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据代码查询整类配置值
|
|
|
|
|
*
|
|
|
|
|
* @param code 配置代码
|
|
|
|
|
* @return 查询结果
|
|
|
|
|
*/
|
|
|
|
|
public int getConfigIntValByCode(String code) {
|
|
|
|
|
SysConfig sysConfig = sysConfigService.getSysConfigByCode(code);
|
|
|
|
|
return sysConfig != null ? Integer.parseInt(sysConfig.getConfigValue()) : -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|