【7.0.1】【timer】增加timer的包装器

pull/3/head
fengshuonan 2021-03-01 23:52:21 +08:00
parent 0c595a6cb0
commit a719605e1e
3 changed files with 62 additions and 0 deletions

View File

@ -40,6 +40,22 @@
<version>7.0.1</version>
</dependency>
<!--system的api-->
<!--查询用户-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>system-api</artifactId>
<version>7.0.1</version>
</dependency>
<!--包装器模块-->
<!--包装结果-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>wrapper-api</artifactId>
<version>7.0.1</version>
</dependency>
<!--数据库sdk-->
<!--数据库dao框架-->
<dependency>

View File

@ -7,6 +7,8 @@ import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.timer.modular.param.SysTimersParam;
import cn.stylefeng.roses.kernel.timer.modular.service.SysTimersService;
import cn.stylefeng.roses.kernel.timer.modular.wrapper.TimerWrapper;
import cn.stylefeng.roses.kernel.wrapper.api.annotation.Wrapper;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@ -105,6 +107,7 @@ public class SysTimersController {
* @date 2020/6/30 18:26
*/
@GetResource(name = "分页查询定时任务", path = "/sysTimers/page")
@Wrapper(TimerWrapper.class)
public ResponseData page(SysTimersParam sysTimersParam) {
return new SuccessResponseData(sysTimersService.findPage(sysTimersParam));
}

View File

@ -0,0 +1,43 @@
package cn.stylefeng.roses.kernel.timer.modular.wrapper;
import cn.hutool.extra.spring.SpringUtil;
import cn.stylefeng.roses.kernel.system.api.UserServiceApi;
import cn.stylefeng.roses.kernel.system.api.pojo.user.SysUserDTO;
import cn.stylefeng.roses.kernel.timer.modular.entity.SysTimers;
import cn.stylefeng.roses.kernel.wrapper.api.BaseWrapper;
import java.util.HashMap;
import java.util.Map;
/**
*
*
* @author fengshuonan
* @date 2021/3/1 23:45
*/
public class TimerWrapper implements BaseWrapper<SysTimers> {
@Override
public Map<String, Object> doWrap(SysTimers beWrappedModel) {
HashMap<String, Object> resultMap = new HashMap<>();
UserServiceApi userServiceApi = SpringUtil.getBean(UserServiceApi.class);
if (beWrappedModel.getCreateUser() != null) {
SysUserDTO sysUserDTO = userServiceApi.getUserInfoByUserId(beWrappedModel.getCreateUser());
if (sysUserDTO != null) {
resultMap.put("createUserName", sysUserDTO.getRealName());
}
}
if (beWrappedModel.getUpdateUser() != null) {
SysUserDTO sysUserDTO = userServiceApi.getUserInfoByUserId(beWrappedModel.getUpdateUser());
if (sysUserDTO != null) {
resultMap.put("updateUserName", sysUserDTO.getRealName());
}
}
return resultMap;
}
}