parent
adbe0035e2
commit
d84000de25
|
|
@ -1,26 +0,0 @@
|
|||
package com.czg.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author GYJoker
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/feign")
|
||||
public class FeignController {
|
||||
|
||||
// @DubboReference
|
||||
private SysParamsService sysParamsService;
|
||||
|
||||
@RequestMapping("/test")
|
||||
public String test() {
|
||||
SysParamsDTO test = sysParamsService.getParamsByCode2("test");
|
||||
return JSONObject.toJSONString(test);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ public interface SysParamsService extends IService<SysParams> {
|
|||
* @return 参数
|
||||
*/
|
||||
CzgResult<SysParamsDTO> getParamsByCode(String code);
|
||||
SysParamsDTO getParamsByCode2(String code);
|
||||
SysParams getSysParam(String code);
|
||||
|
||||
/**
|
||||
* 根据参数类型获取参数
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.dto.auth.LoginTokenDTO;
|
||||
|
|
@ -14,8 +13,7 @@ import com.czg.enums.UserAuthSourceEnum;
|
|||
import com.czg.exception.CzgException;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import com.czg.utils.AlipayUtil;
|
||||
import com.czg.utils.WechatAuthUtil;
|
||||
import com.czg.service.account.util.AlipayUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
package com.czg.utils;
|
||||
package com.czg.service.account.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.AlipayConfig;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.internal.util.AlipayEncrypt;
|
||||
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
|
||||
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
|
||||
import com.czg.exception.CzgException;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.czg.utils;
|
||||
package com.czg.service.account.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
|
|
@ -2,6 +2,9 @@ package com.czg.service.system.mapper;
|
|||
|
||||
import com.czg.system.entity.SysParams;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
/**
|
||||
* 映射层。
|
||||
|
|
@ -9,6 +12,11 @@ import com.mybatisflex.core.BaseMapper;
|
|||
* @author mac
|
||||
* @since 2025-02-07
|
||||
*/
|
||||
@CacheConfig(cacheNames = "params")
|
||||
public interface SysParamsMapper extends BaseMapper<SysParams> {
|
||||
|
||||
@Cacheable(key = "#code")
|
||||
@Select("select * from sys_params where param_code = #{code}")
|
||||
SysParams getSysParam(String code);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,20 +12,19 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务层实现。
|
||||
* 服务层实现。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-02-07
|
||||
*/
|
||||
@DubboService
|
||||
@CacheConfig(cacheNames = "params")
|
||||
public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams> implements SysParamsService {
|
||||
public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams> implements SysParamsService {
|
||||
|
||||
@Override
|
||||
public CzgResult<String> insertParams(SysParamsDTO paramsDTO) {
|
||||
|
|
@ -42,7 +41,7 @@ public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams
|
|||
sysParams.setParamCode(paramsDTO.getParamCode())
|
||||
.setParamValue(paramsDTO.getParamValue())
|
||||
.setParamType(paramsDTO.getParamType())
|
||||
.setRemark(paramsDTO.getRemark())
|
||||
.setRemark(paramsDTO.getRemark())
|
||||
.setCreateUserId(userId);
|
||||
|
||||
save(sysParams);
|
||||
|
|
@ -90,10 +89,8 @@ public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams
|
|||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "#code")
|
||||
public CzgResult<SysParamsDTO> getParamsByCode(String code) {
|
||||
SysParams sysParams = getOne(new QueryWrapper().eq(SysParams::getParamCode, code));
|
||||
|
||||
SysParams sysParams = getMapper().getSysParam(code);
|
||||
if (sysParams == null) {
|
||||
return CzgResult.failure("参数不存在");
|
||||
}
|
||||
|
|
@ -104,14 +101,8 @@ public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams
|
|||
}
|
||||
|
||||
@Override
|
||||
public SysParamsDTO getParamsByCode2(String code) {
|
||||
SysParams sysParams = getOne(new QueryWrapper().eq(SysParams::getParamCode, code));
|
||||
|
||||
if (sysParams == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return BeanUtil.toBean(sysParams, SysParamsDTO.class);
|
||||
public SysParams getSysParam(String code) {
|
||||
return getMapper().getSysParam(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue