use of com.albedo.java.common.log.annotation.LogOperate in project albedo by somowhere.
the class UserResource method uploadData.
/**
* @param dataFile
* @param response
* @return
* @throws Exception
*/
@PostMapping(value = "/upload")
@PreAuthorize("@pms.hasPermission('sys_user_upload')")
@LogOperate(value = "用户管理导入")
public ResponseEntity<Result> uploadData(@RequestParam("uploadFile") MultipartFile dataFile, HttpServletResponse response) throws Exception {
if (dataFile.isEmpty()) {
return ResponseEntityBuilder.buildFail("上传文件为空");
}
ExcelUtil<UserExcelVo> util = new ExcelUtil(UserExcelVo.class);
List<UserExcelVo> dataList = util.importExcel(dataFile.getInputStream());
for (UserExcelVo userExcelVo : dataList) {
if (userExcelVo.getPhone().length() != 11) {
BigDecimal bd = new BigDecimal(userExcelVo.getPhone());
userExcelVo.setPhone(bd.toPlainString());
}
userService.save(userExcelVo);
}
return ResponseEntityBuilder.buildOk("操作成功");
}
use of com.albedo.java.common.log.annotation.LogOperate in project albedo by somowhere.
the class AliPayResource method toPayAsPc.
@LogOperate("支付宝PC网页支付")
@Operation(summary = "PC网页支付")
@PostMapping(value = "/toPayAsPC")
public ResponseEntity<String> toPayAsPc(@Validated @RequestBody TradeVo trade) throws Exception {
AlipayConfigDo aliPay = alipayService.find();
trade.setOutTradeNo(alipayUtils.getOrderCode());
String payUrl = alipayService.toPayAsPc(aliPay, trade);
return ResponseEntity.ok(payUrl);
}
use of com.albedo.java.common.log.annotation.LogOperate in project albedo by somowhere.
the class DeptResource method findTreeList.
/**
* 部门树列表信息
*
* @return 分页对象
*/
@GetMapping
@PreAuthorize("@pms.hasPermission('sys_dept_view')")
@LogOperate(value = "部门管理查看")
public Result<IPage<DeptVo>> findTreeList(DeptQueryCriteria deptQueryCriteria) {
DataScope dataScope = SecurityUtil.getDataScope();
if (!dataScope.isAll()) {
ArgumentAssert.notEmpty(dataScope.getDeptIds(), "login user deptIds is empty");
deptQueryCriteria.setDeptIds(dataScope.getDeptIds());
}
return Result.buildOkData(deptService.findTreeList(deptQueryCriteria));
}
use of com.albedo.java.common.log.annotation.LogOperate in project albedo by somowhere.
the class LogOperateResource method download.
@LogOperate(value = "操作日志导出")
@GetMapping(value = "/download")
@PreAuthorize("@pms.hasPermission('sys_logOperate_export')")
public void download(LogOperateQueryCriteria logOperateQueryCriteria, HttpServletResponse response) {
QueryWrapper wrapper = QueryWrapperUtil.getWrapper(logOperateQueryCriteria);
ExcelUtil<LogOperateDo> util = new ExcelUtil(LogOperateDo.class);
util.exportExcel(logOperateService.list(wrapper), "操作日志", response);
}
use of com.albedo.java.common.log.annotation.LogOperate in project albedo by somowhere.
the class UserOnlineResource method batchForceLogout.
@PreAuthorize("@pms.hasPermission('sys_userOnline_logout')")
@LogOperate(value = "在线用户强退")
@PutMapping("/batch-force-logout")
public Result<String> batchForceLogout(@RequestBody Set<String> ids, HttpServletRequest request) {
for (String id : ids) {
UserOnlineDo online = userOnlineService.getById(id);
if (online == null) {
return Result.buildFail("用户已下线");
}
SessionInformation sessionInformation = sessionRegistry.getSessionInformation(online.getSessionId());
if (sessionInformation != null) {
if (sessionInformation.getSessionId().equals(request.getSession(false).getId())) {
return Result.buildFail("当前登陆用户无法强退");
}
sessionInformation.expireNow();
redisTemplate.boundHashOps(RedisSessionRegistry.SESSIONIDS).put(online.getSessionId(), sessionInformation);
}
online.setStatus(OnlineStatus.OFFLINE);
userOnlineService.updateById(online);
}
return Result.buildOk("操作成功");
}
Aggregations