Merge remote-tracking branch 'remotes/origin/dev' into test
commit
2898a82ce8
@ -0,0 +1,29 @@
|
|||||||
|
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysUserCustomizeConfig;
|
||||||
|
import cn.estsh.impp.framework.base.service.ICrudService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-08-10 15:35
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface ISysUserCustomizeConfigService extends ICrudService<SysUserCustomizeConfig> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验客户定制化配置是否唯一
|
||||||
|
* @param sysUserCustomizeConfig
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean checkSysUserCustomizeConfigOnly(SysUserCustomizeConfig sysUserCustomizeConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按条件查询指定的用户定制化配置
|
||||||
|
* @param sysUserCustomizeConfig
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SysUserCustomizeConfig getSysUserCustomizeConfigByCondition(SysUserCustomizeConfig sysUserCustomizeConfig);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,118 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.controller.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserCustomizeConfigService;
|
||||||
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
||||||
|
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
||||||
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysUserCustomizeConfig;
|
||||||
|
import cn.estsh.impp.framework.base.controller.CrudBaseController;
|
||||||
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ImppRedis;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 用户定制化配置
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-08-10 15:37
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "用户定制化配置")
|
||||||
|
@RequestMapping(PlatformConstWords.BASE_URL + "/sys-user-customize-config")
|
||||||
|
public class SysUserCustomizeConfigController extends CrudBaseController<SysUserCustomizeConfig> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserCustomizeConfigService sysUserCustomizeConfigService;
|
||||||
|
|
||||||
|
@Resource(name = CommonConstWords.IMPP_REDIS_CORE)
|
||||||
|
private ImppRedis redisCore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前端表格显示列信息
|
||||||
|
*
|
||||||
|
* @param customizeConfig 用户定制化配置
|
||||||
|
* @return 处理结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/save/web-table-show-col")
|
||||||
|
@ApiOperation(value = "保存前端表格显示列信息", notes = "保存前端表格显示列信息")
|
||||||
|
public ResultBean saveSysUserCustomizeConfig(SysUserCustomizeConfig customizeConfig) {
|
||||||
|
try {
|
||||||
|
ValidatorBean.beginValid(customizeConfig)
|
||||||
|
.notNull("configKey", customizeConfig.getConfigKey())
|
||||||
|
.notNull("configValue", customizeConfig.getConfigValue());
|
||||||
|
|
||||||
|
customizeConfig.setUserId(AuthUtil.getSessionUser().getUserId());
|
||||||
|
customizeConfig.setCustomizeConfigType(ImppEnumUtil.USER_CUSTOMIZE_CONFIG_TYPE.WEB_TABLE_SHOW_COL.getValue());
|
||||||
|
|
||||||
|
// 唯一校验
|
||||||
|
if (!sysUserCustomizeConfigService.checkSysUserCustomizeConfigOnly(customizeConfig)) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
||||||
|
.setErrorDetail("用户定制化配置已存在")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存配置数据
|
||||||
|
sysUserCustomizeConfigService.insert(customizeConfig);
|
||||||
|
|
||||||
|
// 清理缓存
|
||||||
|
redisCore.deleteKey(customizeConfig.getRedisKey(CommonConstWords.REDIS_PREFIX_USER_CUSTOMIZE_CONFIG));
|
||||||
|
|
||||||
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
} catch (ImppBusiException busExcep) {
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询前端表格显示列信息
|
||||||
|
*
|
||||||
|
* @param tableCode 表格编码
|
||||||
|
* @return 处理结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/get/web-table-show-col")
|
||||||
|
@ApiOperation(value = "查询前端表格显示列信息", notes = "查询前端表格显示列信息")
|
||||||
|
public ResultBean getWebTableShowColCustomizeConfigByKey(String tableCode) {
|
||||||
|
try {
|
||||||
|
ValidatorBean.checkNotNull(tableCode, "表格code不能为空");
|
||||||
|
|
||||||
|
SysUserCustomizeConfig customizeConfig = new SysUserCustomizeConfig();
|
||||||
|
customizeConfig.setUserId(AuthUtil.getSessionUser().getUserId());
|
||||||
|
customizeConfig.setCustomizeConfigType(ImppEnumUtil.USER_CUSTOMIZE_CONFIG_TYPE.WEB_TABLE_SHOW_COL.getValue());
|
||||||
|
customizeConfig.setConfigKey(tableCode);
|
||||||
|
|
||||||
|
String redisKey = customizeConfig.getRedisKey(CommonConstWords.REDIS_PREFIX_USER_CUSTOMIZE_CONFIG);
|
||||||
|
if (redisCore.hasKey(redisKey)) {
|
||||||
|
customizeConfig = (SysUserCustomizeConfig) redisCore.getObject(redisKey);
|
||||||
|
} else {
|
||||||
|
customizeConfig = sysUserCustomizeConfigService.getSysUserCustomizeConfigByCondition(customizeConfig);
|
||||||
|
redisCore.putObject(redisKey, customizeConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultObject(customizeConfig);
|
||||||
|
} catch (ImppBusiException busExcep) {
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserCustomizeConfigService;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysUserCustomizeConfig;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
|
||||||
|
import cn.estsh.impp.framework.base.service.CrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 用户定制化配置服务
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-08-10 15:36
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class SysUserCustomizeConfigService extends CrudService<SysUserCustomizeConfig> implements ISysUserCustomizeConfigService {
|
||||||
|
/**
|
||||||
|
* 校验客户定制化配置是否唯一
|
||||||
|
*
|
||||||
|
* @param sysUserCustomizeConfig
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkSysUserCustomizeConfigOnly(SysUserCustomizeConfig sysUserCustomizeConfig) {
|
||||||
|
return !getRepository().isExitByHql(CoreHqlPack.packHqlSysUserCustomizeConfigOnly(sysUserCustomizeConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按条件查询指定的用户定制化配置
|
||||||
|
*
|
||||||
|
* @param sysUserCustomizeConfig
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUserCustomizeConfig getSysUserCustomizeConfigByCondition(SysUserCustomizeConfig sysUserCustomizeConfig) {
|
||||||
|
return getRepository().getByProperty(CoreHqlPack.packHqlSysUserCustomizeConfigOnly(sysUserCustomizeConfig));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue