| | |
| | | package com.ruoyi.web.controller.monitor; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TCrmClinic; |
| | | import com.ruoyi.system.model.TCrmSupplier; |
| | | import com.ruoyi.system.query.SysOperLogQuery; |
| | | import com.ruoyi.system.service.ISysOperLogService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TCrmClinicService; |
| | | import com.ruoyi.system.service.TCrmSupplierService; |
| | | import com.ruoyi.system.vo.SysOperLogVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 操作日志记录 |
| | |
| | | private ISysOperLogService operLogService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | @Autowired |
| | | private TCrmSupplierService crmSupplierService; |
| | | @Autowired |
| | | private TCrmClinicService crmClinicService; |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | @ApiOperation(value = "操作日志分页列表") |
| | | @PostMapping("/list") |
| | | public AjaxResult list(@RequestBody SysOperLogQuery query) |
| | | { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | query.setRoleType(roleType); |
| | | query.setUserId(userId); |
| | | if(roleType == 4 || roleType == 5){ |
| | | query.setRoleType(roleType); |
| | | } |
| | | if(roleType == 4){ |
| | | // 查询供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | // *** |
| | | if(Objects.isNull(crmSupplier)){ |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | crmSupplier = crmSupplierService.getById(sysUser.getObjectId()); |
| | | } |
| | | query.setObjectId(crmSupplier.getId()); |
| | | } |
| | | if(roleType == 5){ |
| | | // 查询诊所 |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | // --- |
| | | if(Objects.isNull(crmClinic)){ |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | crmClinic = crmClinicService.getById(sysUser.getObjectId()); |
| | | } |
| | | query.setObjectId(crmClinic.getId()); |
| | | } |
| | | PageInfo<SysOperLogVO> list = operLogService.selectOperLogPageList(query); |
| | | return AjaxResult.success(list); |
| | | } |