From 3ac250027dbdbf47978167001e1963c2732309bf Mon Sep 17 00:00:00 2001 From: andy <1042025947@qq.com> Date: Tue, 29 Sep 2026 08:56:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=B9=E6=8E=A5=E6=89=B9?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=8A=9F=E8=83=BD,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/RzAttendanceStatisticalMapper.java | 3 + .../IRzAttendanceStatisticalService.java | 4 + .../RzAttendanceStatisticalServiceImpl.java | 11 +- .../com/evo/common/annotation/ParamName.java | 10 + .../evo/common/controller/OpenController.java | 171 ++++++++++++++++++ .../core/domain/entity/DeptMonthHistory.java | 1 - .../java/com/evo/common/vo/OpenParam.java | 35 ++++ .../evo/framework/config/SecurityConfig.java | 1 + .../controller/SysPlatformController.java | 101 +++++++++++ .../com/evo/system/domain/SysPlatform.java | 57 ++++++ .../vo/RzAttendanceStatisticalTemplate.java | 1 - .../evo/system/mapper/SysPlatformMapper.java | 14 ++ .../service/DeptMonthHistoryService.java | 1 - .../system/service/SysPlatformService.java | 25 +++ .../impl/DeptMonthHistoryServiceImpl.java | 1 - .../service/impl/SysPlatformServiceImpl.java | 68 +++++++ .../java/com/evo/utils/PlatformUtils.java | 35 ++++ .../RzAttendanceStatisticalMapper.xml | 6 + 18 files changed, 539 insertions(+), 6 deletions(-) create mode 100644 evo-admin/src/main/java/com/evo/common/annotation/ParamName.java create mode 100644 evo-admin/src/main/java/com/evo/common/controller/OpenController.java create mode 100644 evo-admin/src/main/java/com/evo/common/vo/OpenParam.java create mode 100644 evo-admin/src/main/java/com/evo/system/controller/SysPlatformController.java create mode 100644 evo-admin/src/main/java/com/evo/system/domain/SysPlatform.java create mode 100644 evo-admin/src/main/java/com/evo/system/mapper/SysPlatformMapper.java create mode 100644 evo-admin/src/main/java/com/evo/system/service/SysPlatformService.java create mode 100644 evo-admin/src/main/java/com/evo/system/service/impl/SysPlatformServiceImpl.java create mode 100644 evo-admin/src/main/java/com/evo/utils/PlatformUtils.java diff --git a/evo-admin/src/main/java/com/evo/attendance/mapper/RzAttendanceStatisticalMapper.java b/evo-admin/src/main/java/com/evo/attendance/mapper/RzAttendanceStatisticalMapper.java index a4ffbee..4ff3791 100644 --- a/evo-admin/src/main/java/com/evo/attendance/mapper/RzAttendanceStatisticalMapper.java +++ b/evo-admin/src/main/java/com/evo/attendance/mapper/RzAttendanceStatisticalMapper.java @@ -2,6 +2,7 @@ package com.evo.attendance.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.evo.attendance.domain.RzAttendanceStatistical; +import com.evo.finance.domain.RzSalaryStatistics; import org.apache.ibatis.annotations.Param; import java.util.Date; @@ -64,4 +65,6 @@ public interface RzAttendanceStatisticalMapper extends BaseMapper map, String key){ return new BigDecimal(Collections.isEmpty(map) || ObjectUtils.isEmpty(map.get(key)) ? "0" : String.valueOf(map.get(key))); } diff --git a/evo-admin/src/main/java/com/evo/common/annotation/ParamName.java b/evo-admin/src/main/java/com/evo/common/annotation/ParamName.java new file mode 100644 index 0000000..5354d44 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/common/annotation/ParamName.java @@ -0,0 +1,10 @@ +package com.evo.common.annotation; + +import java.lang.annotation.*; + +@Target(ElementType.PARAMETER) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ParamName { + String value(); +} \ No newline at end of file diff --git a/evo-admin/src/main/java/com/evo/common/controller/OpenController.java b/evo-admin/src/main/java/com/evo/common/controller/OpenController.java new file mode 100644 index 0000000..453476f --- /dev/null +++ b/evo-admin/src/main/java/com/evo/common/controller/OpenController.java @@ -0,0 +1,171 @@ +package com.evo.common.controller; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.evo.common.annotation.ParamName; +import com.evo.common.core.controller.BaseController; +import com.evo.common.core.domain.AjaxResult; +import com.evo.common.utils.DateUtils; +import com.evo.common.utils.spring.SpringUtils; +import com.evo.common.vo.OpenParam; +import com.evo.ding.DingCallbackCrypto; +import com.evo.ding.DingGlobalParams; +import com.evo.ding.processor.callback.DingCallBackExchangeProcessor; +import com.evo.system.domain.SysPlatform; +import com.evo.system.service.SysPlatformService; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.aop.support.AopUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; +import java.util.Date; +import java.util.Map; + +/** + * @desc: + * @ClassName:OpenController + * @date: 2026年09月24日 10:15 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ +@RestController +@RequestMapping("/open/api") +@Slf4j +public class OpenController extends BaseController { + + // 全局ObjectMapper,复用 + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + @Autowired + private SysPlatformService platformService; + + @PostMapping("/post") + public AjaxResult get(@RequestBody OpenParam openParam){ + log.info("开发平台调用信息>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+JSONObject.toJSONString(openParam)); + try { + Assert.notEmpty(openParam.getPlatformCode(), "平台授权码不能为空"); + Assert.notEmpty(openParam.getPlatformSecretKey(), "平台授权秘钥不能为空"); + SysPlatform platform = platformService.getData(openParam.getPlatformCode(), openParam.getPlatformSecretKey()); + if(ObjectUtils.isEmpty(platform)){ + throw new RuntimeException("未找到授权平台信息"); + } + Assert.notEmpty(openParam.getServiceName(), "服务方法不能为空"); + Assert.notEmpty(openParam.getMethodName(), "服务接口不能为空"); + + //序列化参数 + Object targetService =SpringUtils.getBean(openParam.getServiceName()); + // 2. 找到目标方法(简单版:匹配方法名,暂不处理重载) + Method targetMethod = findMethod(targetService, openParam.getMethodName()); + // 直接转Map + Map methodParamMap = JSON.parseObject(openParam.getParams()); + + if (targetMethod == null) { + throw new RuntimeException("找不到指定方法:" + openParam.getMethodName()); + } + // 3. 解析方法,组装 invoke 需要的参数数组 Object[] args + Object[] args = buildMethodArgs(targetMethod, methodParamMap); + + // 4. 反射执行方法 + Object result = targetMethod.invoke(targetService, args); + // 1. 从http请求中获取加解密参数 + return AjaxResult.success(result); + + } catch (Exception e) { + e.printStackTrace(); + return AjaxResult.error(e.getMessage()); + } + } + + + private Method findMethod(Object beanObj, String methodName) { + Class targetCls = AopUtils.getTargetClass(beanObj); + Method[] declaredMethods = targetCls.getDeclaredMethods(); + for (Method method : declaredMethods) { + if (method.getName().equals(methodName)) { + method.setAccessible(true); + return method; + } + } + return null; + } + + /** + * 核心:构造方法入参数组,自动区分【单个实体】 / 【多个普通参数】 + */ + private Object[] buildMethodArgs(Method method, Map paramMap) { + Parameter[] parameters = method.getParameters(); + // ========== 重点:读取参数注解二维数组 ========== + Annotation[][] allParamAnnotations = method.getParameterAnnotations(); + Object[] args = new Object[parameters.length]; + + // 分支1:单个参数,实体对象,不受注解影响 + if (parameters.length == 1) { + Parameter param = parameters[0]; + Class paramType = param.getType(); + Object entity = OBJECT_MAPPER.convertValue(paramMap, paramType); + args[0] = entity; + return args; + } + + // 分支2:多个参数,循环读取注解 + for (int i = 0; i < parameters.length; i++) { + Annotation[] annotations = allParamAnnotations[i]; + String paramName = null; + for (Annotation anno : annotations) { + if (anno instanceof ParamName) { + ParamName paramNameAnno = (ParamName) anno; + paramName = paramNameAnno.value(); + break; + } + } + if(paramName == null){ + throw new RuntimeException("方法【"+method.getName()+"】第"+i+"个参数缺少@ParamName注解"); + } + Object rawVal = paramMap.get(paramName); + Object castVal = convertType(rawVal, parameters[i].getType()); + args[i] = castVal; + } + return args; + } + + + /** + * 简单类型转换 Object -> Integer/Long/String/Boolean等 + */ + private Object convertType(Object value, Class targetType) { + if (value == null) { + return null; + } + if (targetType.isInstance(value)) { + return value; + } + String str = value.toString(); + if (Integer.class == targetType || int.class == targetType) { + return Integer.parseInt(str); + } else if (Long.class == targetType || long.class == targetType) { + return Long.parseLong(str); + } else if (Boolean.class == targetType || boolean.class == targetType) { + return Boolean.parseBoolean(str); + } else if (Double.class == targetType || double.class == targetType) { + return Double.parseDouble(str); + } else if (String.class == targetType) { + return str; + }else if(Date.class == targetType){ + return DateUtils.parseDate(str); + } + // 其他类型直接返回,可扩展BigDecimal、Date等 + return value; + } +} diff --git a/evo-admin/src/main/java/com/evo/common/core/domain/entity/DeptMonthHistory.java b/evo-admin/src/main/java/com/evo/common/core/domain/entity/DeptMonthHistory.java index 53a5f27..00981c1 100644 --- a/evo-admin/src/main/java/com/evo/common/core/domain/entity/DeptMonthHistory.java +++ b/evo-admin/src/main/java/com/evo/common/core/domain/entity/DeptMonthHistory.java @@ -8,7 +8,6 @@ import java.io.Serializable; * @desc: * @ClassName:DeptMonthHistory * @date: 2026年08月15日 15:34 - * @company: 茹臣科技 * @author: andy.shi * @contact: 17330188597 * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 diff --git a/evo-admin/src/main/java/com/evo/common/vo/OpenParam.java b/evo-admin/src/main/java/com/evo/common/vo/OpenParam.java new file mode 100644 index 0000000..fc99830 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/common/vo/OpenParam.java @@ -0,0 +1,35 @@ +package com.evo.common.vo; + +import lombok.Data; + +/** + * @desc: + * @ClassName:OpenParam + * @date: 2026年09月24日 10:16 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ +@Data +public class OpenParam { + /*** + * 平台code + */ + String platformCode; + /*** + * 平台密码 + */ + String platformSecretKey; + /*** + * 服务名称 + */ + String serviceName; + /*** + * 方法 + */ + String methodName; + /*** + * 参数 + */ + String params; +} diff --git a/evo-admin/src/main/java/com/evo/framework/config/SecurityConfig.java b/evo-admin/src/main/java/com/evo/framework/config/SecurityConfig.java index 8271636..ea1c0d6 100644 --- a/evo-admin/src/main/java/com/evo/framework/config/SecurityConfig.java +++ b/evo-admin/src/main/java/com/evo/framework/config/SecurityConfig.java @@ -112,6 +112,7 @@ public class SecurityConfig permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); // 对于登录login 注册register 验证码captchaImage 允许匿名访问 requests.antMatchers("/login", "/register", "/captchaImage").permitAll() + .antMatchers("/open/api/**").permitAll() .antMatchers("/common/download").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() diff --git a/evo-admin/src/main/java/com/evo/system/controller/SysPlatformController.java b/evo-admin/src/main/java/com/evo/system/controller/SysPlatformController.java new file mode 100644 index 0000000..c3d3772 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/controller/SysPlatformController.java @@ -0,0 +1,101 @@ +package com.evo.system.controller; + +import com.evo.common.annotation.Log; +import com.evo.common.core.controller.BaseController; +import com.evo.common.core.domain.AjaxResult; +import com.evo.common.core.page.TableDataInfo; +import com.evo.common.enums.BusinessType; +import com.evo.system.domain.SysPlatform; +import com.evo.system.service.SysPlatformService; +import com.evo.utils.PlatformUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; + +/** + * 用户信息 + * + * @author evo + */ +@RestController +@RequestMapping("/system/platform") +public class SysPlatformController extends BaseController +{ + @Autowired + private SysPlatformService platformService; + + /** + * 获取用户列表 + */ + @PreAuthorize("@ss.hasPermi('system:platform:list')") + @GetMapping("/list") + public TableDataInfo list(SysPlatform platform) + { + startPage(); + return getDataTable(platformService.selectList(platform)); + } + + @Log(title = "授权平台管理", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('system:platform:add')") + @PostMapping + public AjaxResult add(@Validated @RequestBody SysPlatform platform){ + platform.setCreateBy(getUsername()); + String code = null; + do{ + code = PlatformUtils.getCode("OA");// 循环体 + }while(platformService.checkData(code)); + platform.setUniqueCode(code); + platform.setSecretKey(PlatformUtils.getKey()); + return toAjax(platformService.save(platform)); + } + + /** + * 修改用户 + */ + @PreAuthorize("@ss.hasPermi('system:platform:edit')") + @Log(title = "授权平台管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysPlatform platform){ + return toAjax(platformService.updateById(platform)); + } + /** + * 删除用户 + */ + @GetMapping("/{id}") + public AjaxResult remove(@PathVariable Long id){ + return success(platformService.getById(id)); + } + + /** + * 删除用户 + */ + @PreAuthorize("@ss.hasPermi('system:platform:remove')") + @Log(title = "授权平台管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{userIds}") + public AjaxResult remove(@PathVariable Long[] userIds){ + return toAjax(platformService.removeByIds(Arrays.asList(userIds))); + } + /** + * 重置密码 + */ + @PreAuthorize("@ss.hasPermi('system:platform:resetPwd')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/resetKey") + public AjaxResult resetPwd(@RequestBody SysPlatform platform) + { + platform.setSecretKey(PlatformUtils.getKey()); + return toAjax(platformService.updateById(platform)); + } + + + @GetMapping("/service/list") + public List serviceList(){ + return platformService.serviceList(); + } + + +} diff --git a/evo-admin/src/main/java/com/evo/system/domain/SysPlatform.java b/evo-admin/src/main/java/com/evo/system/domain/SysPlatform.java new file mode 100644 index 0000000..7ca56b6 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/domain/SysPlatform.java @@ -0,0 +1,57 @@ +package com.evo.system.domain; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @desc: + * @ClassName:SysPlatform + * @date: 2026年09月22日 17:21 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ + +@Data +public class SysPlatform implements Serializable { + + /** 主键ID */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + /*** + * 平台名称 + */ + private String name; + /*** + * 唯一授权code. 不可变 + */ + private String uniqueCode; + /*** + * 授权秘钥 + */ + private String secretKey; + /*** + * 允许访问的服务 + */ + private String allowAccessService; + + /** 创建者 */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @TableField(fill = FieldFill.INSERT) + private Date createTime; + /*** + * 是否删除 + */ + private Boolean deleted; +} diff --git a/evo-admin/src/main/java/com/evo/system/domain/vo/RzAttendanceStatisticalTemplate.java b/evo-admin/src/main/java/com/evo/system/domain/vo/RzAttendanceStatisticalTemplate.java index de0250b..e474453 100644 --- a/evo-admin/src/main/java/com/evo/system/domain/vo/RzAttendanceStatisticalTemplate.java +++ b/evo-admin/src/main/java/com/evo/system/domain/vo/RzAttendanceStatisticalTemplate.java @@ -11,7 +11,6 @@ import java.util.Date; * @desc: * @ClassName:RzAttendanceStatisticalTemplate * @date: 2026年09月01日 14:51 - * @company: 茹臣科技 * @author: andy.shi * @contact: 17330188597 * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 diff --git a/evo-admin/src/main/java/com/evo/system/mapper/SysPlatformMapper.java b/evo-admin/src/main/java/com/evo/system/mapper/SysPlatformMapper.java new file mode 100644 index 0000000..4405781 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/mapper/SysPlatformMapper.java @@ -0,0 +1,14 @@ +package com.evo.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.evo.system.domain.SysPlatform; + +/** + * 员工管理Mapper接口 + * + * @author evo + * @date 2024-11-21 + */ +public interface SysPlatformMapper extends BaseMapper { + +} diff --git a/evo-admin/src/main/java/com/evo/system/service/DeptMonthHistoryService.java b/evo-admin/src/main/java/com/evo/system/service/DeptMonthHistoryService.java index 80c6dd3..714954c 100644 --- a/evo-admin/src/main/java/com/evo/system/service/DeptMonthHistoryService.java +++ b/evo-admin/src/main/java/com/evo/system/service/DeptMonthHistoryService.java @@ -7,7 +7,6 @@ import com.evo.common.core.domain.entity.DeptMonthHistory; * @desc: 接口 * @ClassName:DeptMonthHistoryService * @date: 2026年08月15日 14:54 - * @company: 茹臣科技 * @author: andy.shi * @contact: 17330188597 * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 diff --git a/evo-admin/src/main/java/com/evo/system/service/SysPlatformService.java b/evo-admin/src/main/java/com/evo/system/service/SysPlatformService.java new file mode 100644 index 0000000..3447964 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/service/SysPlatformService.java @@ -0,0 +1,25 @@ +package com.evo.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.evo.system.domain.SysPlatform; + +import java.util.List; + +/** + * @desc: 授权平台接口 + * @ClassName:SysPlatformService + * @date: 2026年09月23日 9:14 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ +public interface SysPlatformService extends IService { + + List selectList(SysPlatform platform); + + List serviceList(); + + Boolean checkData(String code); + + SysPlatform getData(String code, String secretKey); +} diff --git a/evo-admin/src/main/java/com/evo/system/service/impl/DeptMonthHistoryServiceImpl.java b/evo-admin/src/main/java/com/evo/system/service/impl/DeptMonthHistoryServiceImpl.java index db00e87..6a3f295 100644 --- a/evo-admin/src/main/java/com/evo/system/service/impl/DeptMonthHistoryServiceImpl.java +++ b/evo-admin/src/main/java/com/evo/system/service/impl/DeptMonthHistoryServiceImpl.java @@ -14,7 +14,6 @@ import java.util.List; * @desc: * @ClassName:DeptMonthHistoryServiceImpl * @date: 2026年08月15日 15:30 - * @company: 茹臣科技 * @author: andy.shi * @contact: 17330188597 * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 diff --git a/evo-admin/src/main/java/com/evo/system/service/impl/SysPlatformServiceImpl.java b/evo-admin/src/main/java/com/evo/system/service/impl/SysPlatformServiceImpl.java new file mode 100644 index 0000000..c9b4b69 --- /dev/null +++ b/evo-admin/src/main/java/com/evo/system/service/impl/SysPlatformServiceImpl.java @@ -0,0 +1,68 @@ +package com.evo.system.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.evo.common.utils.StringUtils; +import com.evo.system.domain.SysPlatform; +import com.evo.system.mapper.SysPlatformMapper; +import com.evo.system.service.SysPlatformService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 员工管理Service业务层处理 + * + * @author evo + * @date 2024-11-21 + */ +@Slf4j +@Service +public class SysPlatformServiceImpl extends ServiceImpl implements SysPlatformService { + + @Resource + private ApplicationContext applicationContext; + + @Override + public List selectList(SysPlatform platform) { + return super.list(new LambdaQueryWrapper().eq(StringUtils.isNotEmpty(platform.getName()), SysPlatform::getName, platform.getName())); + } + + @Override + public List serviceList() { + List resultList = new ArrayList<>(); + // 获取所有 IService 类型的Bean(是ServiceImpl实例) + Map beanMap = applicationContext.getBeansOfType(IService.class); + for (Map.Entry entry : beanMap.entrySet()) { + resultList.add(entry.getKey()); +// IService bean = entry.getValue(); + // 获取对应的业务接口(SysPlatformService.class) +// Class[] interfaces = bean.getClass().getInterfaces(); +// for (Class inter : interfaces) { +// resultList.add(inter.getName()); +// } + } + + return resultList; + } + + @Override + public Boolean checkData(String code) { + return count(new LambdaQueryWrapper().select(SysPlatform::getId).eq(SysPlatform::getUniqueCode, code)) > 0; + } + + @Override + public SysPlatform getData(String code, String secretKey) { + return getOne(new LambdaQueryWrapper() + .eq(StringUtils.isNotEmpty(code), SysPlatform::getUniqueCode, code) + .eq(StringUtils.isNotEmpty(secretKey), SysPlatform::getSecretKey, secretKey)); + } +} + + diff --git a/evo-admin/src/main/java/com/evo/utils/PlatformUtils.java b/evo-admin/src/main/java/com/evo/utils/PlatformUtils.java new file mode 100644 index 0000000..daecb3e --- /dev/null +++ b/evo-admin/src/main/java/com/evo/utils/PlatformUtils.java @@ -0,0 +1,35 @@ +package com.evo.utils; + +import java.security.SecureRandom; + +/** + * @desc: + * @ClassName:Platform + * @date: 2026年09月23日 9:32 + * @company: 茹臣科技 + * @author: andy.shi + * @contact: 17330188597 + * @remark: 开发人员联系方式 1042025947@qq.com/微信同步 + */ + +public class PlatformUtils { + + public static String getCode(String prefix) { + return String.format(prefix+"%06d", new SecureRandom().nextInt(1000000)); + } + private static final SecureRandom SECURE_RANDOM = new SecureRandom(); + + public static String getKey() { + byte[] bytes = new byte[16]; + SECURE_RANDOM.nextBytes(bytes); + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + String hex = Integer.toHexString(0xff & b); + if (hex.length() == 1) { + sb.append('0'); + } + sb.append(hex); + } + return sb.toString(); + } +} diff --git a/evo-admin/src/main/resources/mapper/attendance/RzAttendanceStatisticalMapper.xml b/evo-admin/src/main/resources/mapper/attendance/RzAttendanceStatisticalMapper.xml index 36bc2ef..b69b7d1 100644 --- a/evo-admin/src/main/resources/mapper/attendance/RzAttendanceStatisticalMapper.xml +++ b/evo-admin/src/main/resources/mapper/attendance/RzAttendanceStatisticalMapper.xml @@ -143,4 +143,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select ras.* from rz_attendance_statistical ras left join sys_staff ss on ss.user_id = ras.staff_id where ss.id_card=#{idCard} and DATE_FORMAT( ras.month, '%Y%m' ) = DATE_FORMAT(#{month} , '%Y%m' ) AND ras.del_flag = '0' + + +