新增对接批平台功能,
This commit is contained in:
parent
e32a08bb2b
commit
3ac250027d
@ -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<RzAttendanceSt
|
||||
|
||||
|
||||
RzAttendanceStatistical selectRzAttendanceStatisticalByIdCardAndMonth(@Param("idCard")String idCard, @Param("month")Date month);
|
||||
|
||||
RzAttendanceStatistical getRzSalaryStatisticsByNameAndTime(@Param("name") String name, @Param("time")Date time);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.evo.attendance.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.common.annotation.ParamName;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
import com.evo.system.domain.vo.RzAttendanceStatisticalTemplate;
|
||||
@ -67,4 +68,7 @@ public interface IRzAttendanceStatisticalService extends IService<RzAttendanceSt
|
||||
*/
|
||||
AjaxResult autoCalculateTheDayBeforeAttendance(Date date);
|
||||
|
||||
public RzAttendanceStatistical getRzSalaryStatisticsByNameAndTime(@ParamName("name") String name, @ParamName("time") Date time);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import com.evo.attendance.mapper.RzSpecialAttendanceMapper;
|
||||
import com.evo.attendance.service.IRzAttendanceStatisticalService;
|
||||
import com.evo.attendance.service.IRzSysParamService;
|
||||
import com.evo.common.annotation.DataScope;
|
||||
import com.evo.common.annotation.ParamName;
|
||||
import com.evo.common.annotation.StatisticalOperationLog;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
@ -18,7 +19,7 @@ import com.evo.common.core.domain.entity.SysDept;
|
||||
import com.evo.common.core.domain.model.LoginUser;
|
||||
import com.evo.common.utils.*;
|
||||
import com.evo.common.utils.bean.BeanUtils;
|
||||
import com.evo.framework.aspectj.StatisticalOperationAspect;
|
||||
import com.evo.finance.domain.RzSalaryStatistics;
|
||||
import com.evo.personnelMatters.domain.RzOverTime;
|
||||
import com.evo.personnelMatters.mapper.RzLeaveDetailMapper;
|
||||
import com.evo.personnelMatters.mapper.RzOverTimeDetailMapper;
|
||||
@ -28,7 +29,6 @@ import com.evo.system.domain.SysStatisticalOperationLog;
|
||||
import com.evo.system.domain.vo.RzAttendanceStatisticalTemplate;
|
||||
import com.evo.system.mapper.SysDeptMapper;
|
||||
import com.evo.system.mapper.SysStatisticalOperationLogMapper;
|
||||
import com.evo.system.service.ISysStatisticalOperationLogService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -312,6 +312,13 @@ public class RzAttendanceStatisticalServiceImpl extends ServiceImpl<RzAttendance
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RzAttendanceStatistical getRzSalaryStatisticsByNameAndTime(@ParamName("name") String name, @ParamName("time")Date time) {
|
||||
return getBaseMapper().getRzSalaryStatisticsByNameAndTime(name, time);
|
||||
}
|
||||
|
||||
|
||||
public BigDecimal getValue(Map<String, Object> map, String key){
|
||||
return new BigDecimal(Collections.isEmpty(map) || ObjectUtils.isEmpty(map.get(key)) ? "0" : String.valueOf(map.get(key)));
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
@ -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<String, Object> 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<String, Object> 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;
|
||||
}
|
||||
}
|
||||
@ -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/微信同步
|
||||
|
||||
35
evo-admin/src/main/java/com/evo/common/vo/OpenParam.java
Normal file
35
evo-admin/src/main/java/com/evo/common/vo/OpenParam.java
Normal file
@ -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;
|
||||
}
|
||||
@ -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()
|
||||
|
||||
@ -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<String> serviceList(){
|
||||
return platformService.serviceList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -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/微信同步
|
||||
|
||||
@ -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<SysPlatform> {
|
||||
|
||||
}
|
||||
@ -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/微信同步
|
||||
|
||||
@ -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<SysPlatform> {
|
||||
|
||||
List<SysPlatform> selectList(SysPlatform platform);
|
||||
|
||||
List<String> serviceList();
|
||||
|
||||
Boolean checkData(String code);
|
||||
|
||||
SysPlatform getData(String code, String secretKey);
|
||||
}
|
||||
@ -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/微信同步
|
||||
|
||||
@ -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<SysPlatformMapper, SysPlatform> implements SysPlatformService {
|
||||
|
||||
@Resource
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public List<SysPlatform> selectList(SysPlatform platform) {
|
||||
return super.list(new LambdaQueryWrapper<SysPlatform>().eq(StringUtils.isNotEmpty(platform.getName()), SysPlatform::getName, platform.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> serviceList() {
|
||||
List<String> resultList = new ArrayList<>();
|
||||
// 获取所有 IService 类型的Bean(是ServiceImpl实例)
|
||||
Map<String, IService> beanMap = applicationContext.getBeansOfType(IService.class);
|
||||
for (Map.Entry<String, IService> 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<SysPlatform>().select(SysPlatform::getId).eq(SysPlatform::getUniqueCode, code)) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysPlatform getData(String code, String secretKey) {
|
||||
return getOne(new LambdaQueryWrapper<SysPlatform>()
|
||||
.eq(StringUtils.isNotEmpty(code), SysPlatform::getUniqueCode, code)
|
||||
.eq(StringUtils.isNotEmpty(secretKey), SysPlatform::getSecretKey, secretKey));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
35
evo-admin/src/main/java/com/evo/utils/PlatformUtils.java
Normal file
35
evo-admin/src/main/java/com/evo/utils/PlatformUtils.java
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
@ -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'
|
||||
</select>
|
||||
|
||||
<select id="getRzSalaryStatisticsByNameAndTime" resultMap="RzAttendanceStatisticalResult">
|
||||
select ras.* from rz_attendance_statistical ras
|
||||
where ras.name=#{name} and DATE_FORMAT( ras.month, '%Y%m' ) = DATE_FORMAT(#{time} , '%Y%m' ) AND ras.del_flag = '0'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user