zhibing.pu
2024-08-12 34d18c08f04de78eccb42b88b7484b0531d263ff
新增加系统管理部分功能接口
5个文件已删除
11个文件已添加
36个文件已修改
2698 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TEvaluationTagFallbackFactory.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TEvaluationTagClient.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/pom.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteLogService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysOperLog.java 484 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteLogFallbackFactory.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/SysLoginLogFallbackFactory.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysLoginLogClient.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysPasswordService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysRecordLogService.java 162 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/BaseEntity.java 252 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-log/src/main/java/com/ruoyi/common/log/service/AsyncLogService.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysLoginLogController.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysLogininforController.java 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysOperlogController.java 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLoginLog.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLoginLogMapper.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/query/SysOperLogQuery.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLoginLogService.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLoginLogServiceImpl.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java 208 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysLoginLogMapper.xml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/GetOrderEvaluatePageList.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/GetOrderEvaluatePageListDTO.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TOrderEvaluateMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEvaluationTagController.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TEvaluationTagMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TInvoiceTypeMapper.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/query/InvoiceTypePageList.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TEvaluationTagService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TInvoiceTypeService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TEvaluationTagServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TInvoiceTypeServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/TEvaluationTagMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/TInvoiceTypeMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.api.factory;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.TAppUser;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,6 +29,11 @@
            public R<List<Long>> getUserIdsByPhone(String phone) {
                return R.fail("根据手机号查询用户ids失败:"+throwable.getMessage());
            }
            @Override
            public R<TAppUser> getUserById(Long id) {
                return R.fail("根据id查询用户失败:"+throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -1,10 +1,12 @@
package com.ruoyi.account.api.feignClient;
import com.ruoyi.account.api.model.TAppUser;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.account.api.factory.AppUserFallbackFactory;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -19,5 +21,13 @@
    @ApiOperation(value = "管理后台-根据手机号查询用户ids", tags = {"管理后台-活动费用统计"})
    @PostMapping(value = "/t-app-user/user/getUserIdsByPhone")
    public R<List<Long>> getUserIdsByPhone(@RequestParam("phone") String phone);
    /**
     * 根据id获取用户
     * @param id
     * @return
     */
    @GetMapping(value = "/user/getUserById")
    R<TAppUser> getUserById(Long id);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TEvaluationTagFallbackFactory.java
@@ -1,6 +1,7 @@
package com.ruoyi.other.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.TEvaluationTag;
import com.ruoyi.other.api.feignClient.RoleSiteClient;
import com.ruoyi.other.api.feignClient.TEvaluationTagClient;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
@@ -26,9 +27,14 @@
        return new TEvaluationTagClient() {
            @Override
            public R<List<TEvaluationTagVO>> getTagList() {
            public R<List<TEvaluationTagVO>> getTagList(Integer type) {
                return R.fail("获取标签列表:" + throwable.getMessage());
            }
            @Override
            public R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds) {
                return R.fail("根据id集合获取数据失败:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TEvaluationTagClient.java
@@ -2,6 +2,7 @@
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.TEvaluationTag;
import com.ruoyi.other.api.factory.RoleSiteFallbackFactory;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
import org.springframework.cloud.openfeign.FeignClient;
@@ -24,5 +25,14 @@
     * @return
     */
    @PostMapping("/t-evaluation-tag/getTagList")
    R<List<TEvaluationTagVO>> getTagList();
    R<List<TEvaluationTagVO>> getTagList(Integer type);
    /**
     * 根据id集合获取数据
     * @param tagIds
     * @return
     */
    @GetMapping("/t-evaluation-tag/getListByIds")
    R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds);
}
ruoyi-api/ruoyi-api-system/pom.xml
@@ -28,7 +28,13 @@
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-modules-system</artifactId>
            <version>3.6.2</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteLogService.java
@@ -28,14 +28,5 @@
     */
    @PostMapping("/operlog")
    public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
    /**
     * 保存访问记录
     *
     * @param sysLogininfor 访问实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/logininfor")
    public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysOperLog.java
@@ -1,6 +1,7 @@
package com.ruoyi.system.api.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
@@ -8,248 +9,247 @@
/**
 * 操作日志记录表 oper_log
 *
 *
 * @author ruoyi
 */
public class SysOperLog extends BaseEntity
{
    private static final long serialVersionUID = 1L;
    /** 日志主键 */
    @Excel(name = "操作序号", cellType = ColumnType.NUMERIC)
    private Long operId;
    /** 操作模块 */
    @Excel(name = "操作模块")
    private String title;
    /** 业务类型(0其它 1新增 2修改 3删除) */
    @Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据")
    private Integer businessType;
    /** 业务类型数组 */
    private Integer[] businessTypes;
    /** 请求方法 */
    @Excel(name = "请求方法")
    private String method;
    /** 请求方式 */
    @Excel(name = "请求方式")
    private String requestMethod;
    /** 操作类别(0其它 1后台用户 2手机端用户) */
    @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
    private Integer operatorType;
    /** 操作人员 */
    @Excel(name = "操作人员")
    private String operName;
    /** 部门名称 */
    @Excel(name = "部门名称")
    private String deptName;
    /** 请求url */
    @Excel(name = "请求地址")
    private String operUrl;
    /** 操作地址 */
    @Excel(name = "操作地址")
    private String operIp;
    /** 请求参数 */
    @Excel(name = "请求参数")
    private String operParam;
    /** 返回参数 */
    @Excel(name = "返回参数")
    private String jsonResult;
    /** 操作状态(0正常 1异常) */
    @Excel(name = "状态", readConverterExp = "0=正常,1=异常")
    private Integer status;
    /** 错误消息 */
    @Excel(name = "错误消息")
    private String errorMsg;
    /** 操作时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date operTime;
    /** 消耗时间 */
    @Excel(name = "消耗时间", suffix = "毫秒")
    private Long costTime;
    public Long getOperId()
    {
        return operId;
    }
    public void setOperId(Long operId)
    {
        this.operId = operId;
    }
    public String getTitle()
    {
        return title;
    }
    public void setTitle(String title)
    {
        this.title = title;
    }
    public Integer getBusinessType()
    {
        return businessType;
    }
    public void setBusinessType(Integer businessType)
    {
        this.businessType = businessType;
    }
    public Integer[] getBusinessTypes()
    {
        return businessTypes;
    }
    public void setBusinessTypes(Integer[] businessTypes)
    {
        this.businessTypes = businessTypes;
    }
    public String getMethod()
    {
        return method;
    }
    public void setMethod(String method)
    {
        this.method = method;
    }
    public String getRequestMethod()
    {
        return requestMethod;
    }
    public void setRequestMethod(String requestMethod)
    {
        this.requestMethod = requestMethod;
    }
    public Integer getOperatorType()
    {
        return operatorType;
    }
    public void setOperatorType(Integer operatorType)
    {
        this.operatorType = operatorType;
    }
    public String getOperName()
    {
        return operName;
    }
    public void setOperName(String operName)
    {
        this.operName = operName;
    }
    public String getDeptName()
    {
        return deptName;
    }
    public void setDeptName(String deptName)
    {
        this.deptName = deptName;
    }
    public String getOperUrl()
    {
        return operUrl;
    }
    public void setOperUrl(String operUrl)
    {
        this.operUrl = operUrl;
    }
    public String getOperIp()
    {
        return operIp;
    }
    public void setOperIp(String operIp)
    {
        this.operIp = operIp;
    }
    public String getOperParam()
    {
        return operParam;
    }
    public void setOperParam(String operParam)
    {
        this.operParam = operParam;
    }
    public String getJsonResult()
    {
        return jsonResult;
    }
    public void setJsonResult(String jsonResult)
    {
        this.jsonResult = jsonResult;
    }
    public Integer getStatus()
    {
        return status;
    }
    public void setStatus(Integer status)
    {
        this.status = status;
    }
    public String getErrorMsg()
    {
        return errorMsg;
    }
    public void setErrorMsg(String errorMsg)
    {
        this.errorMsg = errorMsg;
    }
    public Date getOperTime()
    {
        return operTime;
    }
    public void setOperTime(Date operTime)
    {
        this.operTime = operTime;
    }
    public Long getCostTime()
    {
        return costTime;
    }
    public void setCostTime(Long costTime)
    {
        this.costTime = costTime;
    }
public class SysOperLog extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**
     * 日志主键
     */
    @Excel(name = "操作序号", cellType = ColumnType.NUMERIC)
    private Long operId;
    /**
     * 操作模块
     */
    @Excel(name = "操作模块")
    private String title;
    /**
     * 业务类型(0其它 1新增 2修改 3删除)
     */
    @Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据")
    private Integer businessType;
    /**
     * 业务类型数组
     */
    private Integer[] businessTypes;
    /**
     * 请求方法
     */
    @Excel(name = "请求方法")
    private String method;
    /**
     * 请求方式
     */
    @Excel(name = "请求方式")
    private String requestMethod;
    /**
     * 操作类别(0其它 1后台用户 2手机端用户)
     */
    @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
    private Integer operatorType;
    /**
     * 操作人员
     */
    @Excel(name = "操作人员")
    private String operName;
    /**
     * 部门名称
     */
    @Excel(name = "部门名称")
    private String deptName;
    /**
     * 请求url
     */
    @Excel(name = "请求地址")
    private String operUrl;
    /**
     * 操作地址
     */
    @Excel(name = "操作地址")
    private String operIp;
    /**
     * 请求参数
     */
    @Excel(name = "请求参数")
    private String operParam;
    /**
     * 返回参数
     */
    @Excel(name = "返回参数")
    private String jsonResult;
    /**
     * 操作状态(0正常 1异常)
     */
    @Excel(name = "状态", readConverterExp = "0=正常,1=异常")
    private Integer status;
    /**
     * 错误消息
     */
    @Excel(name = "错误消息")
    private String errorMsg;
    /**
     * 操作时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date operTime;
    /**
     * 消耗时间
     */
    @Excel(name = "消耗时间", suffix = "毫秒")
    private Long costTime;
    public Long getOperId() {
        return operId;
    }
    public void setOperId(Long operId) {
        this.operId = operId;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public Integer getBusinessType() {
        return businessType;
    }
    public void setBusinessType(Integer businessType) {
        this.businessType = businessType;
    }
    public Integer[] getBusinessTypes() {
        return businessTypes;
    }
    public void setBusinessTypes(Integer[] businessTypes) {
        this.businessTypes = businessTypes;
    }
    public String getMethod() {
        return method;
    }
    public void setMethod(String method) {
        this.method = method;
    }
    public String getRequestMethod() {
        return requestMethod;
    }
    public void setRequestMethod(String requestMethod) {
        this.requestMethod = requestMethod;
    }
    public Integer getOperatorType() {
        return operatorType;
    }
    public void setOperatorType(Integer operatorType) {
        this.operatorType = operatorType;
    }
    public String getOperName() {
        return operName;
    }
    public void setOperName(String operName) {
        this.operName = operName;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getOperUrl() {
        return operUrl;
    }
    public void setOperUrl(String operUrl) {
        this.operUrl = operUrl;
    }
    public String getOperIp() {
        return operIp;
    }
    public void setOperIp(String operIp) {
        this.operIp = operIp;
    }
    public String getOperParam() {
        return operParam;
    }
    public void setOperParam(String operParam) {
        this.operParam = operParam;
    }
    public String getJsonResult() {
        return jsonResult;
    }
    public void setJsonResult(String jsonResult) {
        this.jsonResult = jsonResult;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getErrorMsg() {
        return errorMsg;
    }
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
    public Date getOperTime() {
        return operTime;
    }
    public void setOperTime(Date operTime) {
        this.operTime = operTime;
    }
    public Long getCostTime() {
        return costTime;
    }
    public void setCostTime(Long costTime) {
        this.costTime = costTime;
    }
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteLogFallbackFactory.java
@@ -20,8 +20,7 @@
    private static final Logger log = LoggerFactory.getLogger(RemoteLogFallbackFactory.class);
    @Override
    public RemoteLogService create(Throwable throwable)
    {
    public RemoteLogService create(Throwable throwable) {
        log.error("日志服务调用失败:{}", throwable.getMessage());
        return new RemoteLogService()
        {
@@ -30,12 +29,7 @@
            {
                return null;
            }
            @Override
            public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source)
            {
                return null;
            }
        };
    }
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/SysLoginLogFallbackFactory.java
New file
@@ -0,0 +1,28 @@
package com.ruoyi.system.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysLoginLogClient;
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.model.*;
import com.ruoyi.system.domain.SysLoginLog;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class SysLoginLogFallbackFactory implements FallbackFactory<SysLoginLogClient> {
    @Override
    public SysLoginLogClient create(Throwable cause) {
        return new SysLoginLogClient(){
            @Override
            public R saveLoginLog(SysLoginLog loginLog) {
                return R.fail("添加登录日志失败!" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysLoginLogClient.java
New file
@@ -0,0 +1,26 @@
package com.ruoyi.system.api.feignClient;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.factory.SysLoginLogFallbackFactory;
import com.ruoyi.system.domain.SysLoginLog;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
 * @author zhibing.pu
 * @Date 2024/8/12 16:30
 */
@FeignClient(contextId = "SysLoginLogClient", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = SysLoginLogFallbackFactory.class)
public interface SysLoginLogClient {
    /**
     * 添加登陆日志
     * @param loginLog
     * @return
     */
    @PostMapping("/saveLoginLog")
    R saveLoginLog(@RequestBody SysLoginLog loginLog);
}
ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -3,3 +3,4 @@
com.ruoyi.system.api.factory.RemoteFileFallbackFactory
com.ruoyi.system.api.factory.SysUserFallbackFactory
com.ruoyi.system.api.factory.SysRoleFallbackFactory
com.ruoyi.system.api.factory.SysLoginLogFallbackFactory
ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java
@@ -1,12 +1,15 @@
package com.ruoyi.auth.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysLoginLogClient;
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.domain.SysLoginLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
@@ -24,6 +27,9 @@
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.model.LoginUser;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.time.LocalDateTime;
import java.util.*;
/**
@@ -39,14 +45,18 @@
    @Autowired
    private SysLoginService sysLoginService;
    @Autowired
    @Resource
    private SysUserClient userClient;
    @PostMapping("login")
    public R<?> login(@RequestBody LoginBody form)
    {
    public R<?> login(@RequestBody LoginBody form, HttpServletRequest request) {
        // 用户登录
        LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
        LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(), request);
        HashMap<String, Object> map = new HashMap<>();
        map.put("token",tokenService.createToken(userInfo));
        List<SysRole> roles = userInfo.getSysUser().getRoles();
@@ -62,13 +72,15 @@
        sysUser.setLoginDate(new Date());
        System.out.println("修改用户登录时间"+sysUser);
        userClient.updateSysUser(sysUser);
        // 获取登录token
        return R.ok(map);
    }
    @DeleteMapping("logout")
    public R<?> logout(HttpServletRequest request)
    {
    public R<?> logout(HttpServletRequest request) {
        String token = SecurityUtils.getToken(request);
        if (StringUtils.isNotEmpty(token))
        {
@@ -76,7 +88,7 @@
            // 删除用户缓存记录
            AuthUtil.logoutByToken(token);
            // 记录用户退出日志
            sysLoginService.logout(username);
            sysLoginService.logout(username, request);
        }
        return R.ok();
    }
@@ -95,10 +107,10 @@
    }
    @PostMapping("register")
    public R<?> register(@RequestBody RegisterBody registerBody)
    public R<?> register(@RequestBody RegisterBody registerBody, HttpServletRequest request)
    {
        // 用户注册
        sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
        sysLoginService.register(registerBody.getUsername(), registerBody.getPassword(), request);
        return R.ok();
    }
}
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java
@@ -1,5 +1,6 @@
package com.ruoyi.auth.service;
import com.ruoyi.system.domain.SysLoginLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.constant.CacheConstants;
@@ -17,6 +18,9 @@
import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
/**
 * 登录校验方法
@@ -41,42 +45,44 @@
    /**
     * 登录
     */
    public LoginUser login(String username, String password)
    {
    public LoginUser login(String username, String password, HttpServletRequest request) {
        // 查询用户信息
        R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
        if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
        {
            recordLogService.recordLogininfor(request, null, username, Constants.LOGIN_FAIL_STATUS, "登录用户不存在");
            throw new ServiceException("登录用户:" + username + " 不存在");
        }
        LoginUser userInfo = userResult.getData();
        SysUser user = userResult.getData().getSysUser();
        // 用户名或密码为空 错误
        if (StringUtils.isAnyBlank(username, password))
        {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户/密码必须填写");
            throw new ServiceException("用户/密码必须填写");
        }
        // 密码如果不在指定范围内 错误
        if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
                || password.length() > UserConstants.PASSWORD_MAX_LENGTH)
        {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围");
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户密码不在指定范围");
            throw new ServiceException("用户密码不在指定范围");
        }
        // 用户名不在指定范围内 错误
        if (username.length() < UserConstants.USERNAME_MIN_LENGTH
                || username.length() > UserConstants.USERNAME_MAX_LENGTH)
        {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围");
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户名不在指定范围");
            throw new ServiceException("用户名不在指定范围");
        }
        // IP黑名单校验
        String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
        if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr()))
        {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾,访问IP已被列入系统黑名单");
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "很遗憾,访问IP已被列入系统黑名单");
            throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
        }
        // 查询用户信息
        R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
        if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
        {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
            throw new ServiceException("登录用户:" + username + " 不存在");
        }
        if (R.FAIL == userResult.getCode())
@@ -84,32 +90,31 @@
            throw new ServiceException(userResult.getMsg());
        }
        
        LoginUser userInfo = userResult.getData();
        SysUser user = userResult.getData().getSysUser();
        if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
        {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "对不起,您的账号已被删除");
            throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
        }
        if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
        {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户已停用,请联系管理员");
            throw new ServiceException("对不起,您的账号:" + username + " 已停用");
        }
        passwordService.validate(user, password);
        recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
        passwordService.validate(user, password, request);
        recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "登录成功");
        return userInfo;
    }
    public void logout(String loginName)
    public void logout(String loginName, HttpServletRequest request)
    {
        recordLogService.recordLogininfor(loginName, Constants.LOGOUT, "退出成功");
        recordLogService.recordLogininfor(request, null, loginName, Constants.LOGIN_SUCCESS_STATUS, "退出成功");
    }
    /**
     * 注册
     */
    public void register(String username, String password)
    public void register(String username, String password, HttpServletRequest request)
    {
        // 用户名或密码为空 错误
        if (StringUtils.isAnyBlank(username, password))
@@ -138,6 +143,6 @@
        {
            throw new ServiceException(registerResult.getMsg());
        }
        recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
        recordLogService.recordLogininfor(request, sysUser.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "注册成功");
    }
}
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysPasswordService.java
@@ -10,6 +10,8 @@
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysUser;
import javax.servlet.http.HttpServletRequest;
/**
 * 登录密码方法
 * 
@@ -39,7 +41,7 @@
        return CacheConstants.PWD_ERR_CNT_KEY + username;
    }
    public void validate(SysUser user, String password)
    public void validate(SysUser user, String password, HttpServletRequest request)
    {
        String username = user.getUserName();
@@ -53,14 +55,14 @@
        if (retryCount >= Integer.valueOf(maxRetryCount).intValue())
        {
            String errMsg = String.format("密码输入错误%s次,帐户锁定%s分钟", maxRetryCount, lockTime);
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL,errMsg);
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS,errMsg);
            throw new ServiceException(errMsg);
        }
        if (!matches(user, password))
        {
            retryCount = retryCount + 1;
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount));
            redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
            throw new ServiceException("密码错误");
        }
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysRecordLogService.java
@@ -1,48 +1,134 @@
package com.ruoyi.auth.service;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.system.api.feignClient.SysLoginLogClient;
import com.ruoyi.system.domain.SysLoginLog;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.ip.IpUtils;
import com.ruoyi.system.api.RemoteLogService;
import com.ruoyi.system.api.domain.SysLogininfor;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
/**
 * 记录日志方法
 *
 *
 * @author ruoyi
 */
@Component
public class SysRecordLogService
{
    @Autowired
    private RemoteLogService remoteLogService;
    /**
     * 记录登录信息
     *
     * @param username 用户名
     * @param status 状态
     * @param message 消息内容
     * @return
     */
    public void recordLogininfor(String username, String status, String message)
    {
        SysLogininfor logininfor = new SysLogininfor();
        logininfor.setUserName(username);
        logininfor.setIpaddr(IpUtils.getIpAddr());
        logininfor.setMsg(message);
        // 日志状态
        if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER))
        {
            logininfor.setStatus(Constants.LOGIN_SUCCESS_STATUS);
        }
        else if (Constants.LOGIN_FAIL.equals(status))
        {
            logininfor.setStatus(Constants.LOGIN_FAIL_STATUS);
        }
        remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER);
    }
public class SysRecordLogService {
    @Resource
    private SysLoginLogClient sysLoginLogClient;
    /**
     * 记录登录信息
     *
     * @param username 用户名
     * @param status   状态
     * @param message  消息内容
     * @return
     */
    public void recordLogininfor(HttpServletRequest request, Integer userId, String username, String status, String message) {
        Map<String, String> headerData = getHeaderData(request);
        //添加登录日志
        SysLoginLog loginLog = new SysLoginLog();
        loginLog.setUserId(userId);
        loginLog.setUsername(username);
        loginLog.setIpAddress(headerData.get("ip"));
        loginLog.setAddress("");// todo 待完善  https://www.juhe.cn/docs/api/id/1
        loginLog.setBrowserType(headerData.get("browser"));
        loginLog.setOperatingSystem(headerData.get("os"));
        loginLog.setLoginTime(LocalDateTime.now());
        loginLog.setLoginStatus(Integer.valueOf(status));
        loginLog.setMessage(message);
        sysLoginLogClient.saveLoginLog(loginLog);
    }
    public Map<String, String> getHeaderData(HttpServletRequest request) {
        //Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0
        String browserDetails = request.getHeader("User-Agent");
        String userAgent = browserDetails;
        String user = userAgent.toLowerCase();
        Map<String, String> map = new HashMap<>();
        String os = "";
        String browser = "";
        if (userAgent.toLowerCase().indexOf("windows") >= 0) {
            os = "Windows";
        } else if (userAgent.toLowerCase().indexOf("mac") >= 0) {
            os = "Mac";
        } else if (userAgent.toLowerCase().indexOf("x11") >= 0) {
            os = "Unix";
        } else if (userAgent.toLowerCase().indexOf("android") >= 0) {
            os = "Android";
        } else if (userAgent.toLowerCase().indexOf("iphone") >= 0) {
            os = "IPhone";
        } else {
            os = "UnKnown, More-Info: " + userAgent;
        }
        if (user.contains("edge")) {
            browser = (userAgent.substring(userAgent.indexOf("Edge")).split(" ")[0]).replace("/", "-");
        } else if (user.contains("msie")) {
            String substring = userAgent.substring(userAgent.indexOf("MSIE")).split(";")[0];
            browser = substring.split(" ")[0].replace("MSIE", "IE") + "-" + substring.split(" ")[1];
        } else if (user.contains("safari") && user.contains("version")) {
            browser = (userAgent.substring(userAgent.indexOf("Safari")).split(" ")[0]).split("/")[0]
                    + "-" + (userAgent.substring(userAgent.indexOf("Version")).split(" ")[0]).split("/")[1];
        } else if (user.contains("opr") || user.contains("opera")) {
            if (user.contains("opera")) {
                browser = (userAgent.substring(userAgent.indexOf("Opera")).split(" ")[0]).split("/")[0]
                        + "-" + (userAgent.substring(userAgent.indexOf("Version")).split(" ")[0]).split("/")[1];
            } else if (user.contains("opr")) {
                browser = ((userAgent.substring(userAgent.indexOf("OPR")).split(" ")[0]).replace("/", "-"))
                        .replace("OPR", "Opera");
            }
        } else if (user.contains("chrome")) {
            browser = (userAgent.substring(userAgent.indexOf("Chrome")).split(" ")[0]).replace("/", "-");
        } else if ((user.indexOf("mozilla/7.0") > -1) || (user.indexOf("netscape6") != -1) ||
                (user.indexOf("mozilla/4.7") != -1) || (user.indexOf("mozilla/4.78") != -1) ||
                (user.indexOf("mozilla/4.08") != -1) || (user.indexOf("mozilla/3") != -1)) {
            browser = "Netscape-?";
        } else if (user.contains("firefox")) {
            browser = (userAgent.substring(userAgent.indexOf("Firefox")).split(" ")[0]).replace("/", "-");
        } else if (user.contains("rv")) {
            String IEVersion = (userAgent.substring(userAgent.indexOf("rv")).split(" ")[0]).replace("rv:", "-");
            browser = "IE" + IEVersion.substring(0, IEVersion.length() - 1);
        } else {
            browser = "UnKnown, More-Info: " + userAgent;
        }
        String ip = request.getHeader("x-forwarded-for");
        if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) {
            // 多次反向代理后会有多个ip值,第一个ip才是真实ip
            if (ip.indexOf(",") != -1) {
                ip = ip.split(",")[0];
            }
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("X-Real-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        map.put("os", os);
        map.put("browser", browser);
        map.put("ip", ip);
        return map;
    }
}
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/BaseEntity.java
@@ -16,132 +16,132 @@
/**
 * Entity基类
 *
 *
 * @author ruoyi
 */
public class BaseEntity implements Serializable
{
    private static final long serialVersionUID = 1L;
    /** 搜索值 */
    @JsonIgnore
    @TableField(exist = false)
    private String searchValue;
    /** 创建者 */
    @ApiModelProperty(value = "记录创建人,前端忽略")
    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private String createBy;
    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private Date createTime;
    /** 更新者 */
    @ApiModelProperty(value = "记录修改人,前端忽略")
    //@JsonIgnore
    @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE)
    private String updateBy;
    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("update_time")
    private Date updateTime;
    /** 是否删除 1未删除 0已删除 */
    @TableLogic
    @Excel(name = "是否删除 0未删除 1已删除")
    @TableField(exist = false)
    private Boolean disabled;
    /** 备注 */
    private String remark;
    /** 请求参数 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @TableField(exist = false)
    private Map<String, Object> params;
    public Boolean getDisabled() {
        return disabled;
    }
    public void setDisabled(Boolean disabled) {
        this.disabled = disabled;
    }
    public String getSearchValue()
    {
        return searchValue;
    }
    public void setSearchValue(String searchValue)
    {
        this.searchValue = searchValue;
    }
    public String getCreateBy()
    {
        return createBy;
    }
    public void setCreateBy(String createBy)
    {
        this.createBy = createBy;
    }
    public Date getCreateTime()
    {
        return createTime;
    }
    public void setCreateTime(Date createTime)
    {
        this.createTime = createTime;
    }
    public String getUpdateBy()
    {
        return updateBy;
    }
    public void setUpdateBy(String updateBy)
    {
        this.updateBy = updateBy;
    }
    public Date getUpdateTime()
    {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime)
    {
        this.updateTime = updateTime;
    }
    public String getRemark()
    {
        return remark;
    }
    public void setRemark(String remark)
    {
        this.remark = remark;
    }
    public Map<String, Object> getParams()
    {
        if (params == null)
        {
            params = new HashMap<>();
        }
        return params;
    }
    public void setParams(Map<String, Object> params)
    {
        this.params = params;
    }
public class BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 搜索值
     */
    @JsonIgnore
    @TableField(exist = false)
    private String searchValue;
    /**
     * 创建者
     */
    @ApiModelProperty(value = "记录创建人,前端忽略")
    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private String createBy;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private Date createTime;
    /**
     * 更新者
     */
    @ApiModelProperty(value = "记录修改人,前端忽略")
    //@JsonIgnore
    @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE)
    private String updateBy;
    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("update_time")
    private Date updateTime;
    /**
     * 是否删除 1未删除 0已删除
     */
    @TableLogic
    @Excel(name = "是否删除 0未删除 1已删除")
    @TableField(exist = false)
    private Boolean disabled;
    /**
     * 备注
     */
    private String remark;
    /**
     * 请求参数
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @TableField(exist = false)
    private Map<String, Object> params;
    public Boolean getDisabled() {
        return disabled;
    }
    public void setDisabled(Boolean disabled) {
        this.disabled = disabled;
    }
    public String getSearchValue() {
        return searchValue;
    }
    public void setSearchValue(String searchValue) {
        this.searchValue = searchValue;
    }
    public String getCreateBy() {
        return createBy;
    }
    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getUpdateBy() {
        return updateBy;
    }
    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Map<String, Object> getParams() {
        if (params == null) {
            params = new HashMap<>();
        }
        return params;
    }
    public void setParams(Map<String, Object> params) {
        this.params = params;
    }
}
ruoyi-common/ruoyi-common-log/src/main/java/com/ruoyi/common/log/service/AsyncLogService.java
@@ -7,23 +7,23 @@
import com.ruoyi.system.api.RemoteLogService;
import com.ruoyi.system.api.domain.SysOperLog;
import javax.annotation.Resource;
/**
 * 异步调用日志服务
 * 
 * @author ruoyi
 */
@Service
public class AsyncLogService
{
    @Autowired
public class AsyncLogService {
    @Resource
    private RemoteLogService remoteLogService;
    /**
     * 保存系统日志记录
     */
    @Async
    public void saveSysLog(SysOperLog sysOperLog) throws Exception
    {
    public void saveSysLog(SysOperLog sysOperLog) throws Exception {
        remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
    }
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysLoginLogController.java
New file
@@ -0,0 +1,63 @@
package com.ruoyi.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.BasePage;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.domain.SysLoginLog;
import com.ruoyi.system.service.ISysLoginLogService;
import com.ruoyi.system.service.ISysUserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDateTime;
/**
 * @author zhibing.pu
 * @Date 2024/8/12 15:48
 */
@RestController
@RequestMapping("/sysLoginLog")
public class SysLoginLogController {
    @Resource
    private ISysLoginLogService sysLoginLogService;
    @Resource
    private ISysUserService sysUserService;
    @GetMapping("/pageList")
    @ApiOperation(value = "获取登录日志列表", tags = {"管理后台-登录日志"})
    public AjaxResult<PageInfo<SysLoginLog>> pageList(String name, BasePage basePage){
        PageInfo<SysLoginLog> pageInfo = sysLoginLogService.pageList(name, basePage);
        return AjaxResult.success(pageInfo);
    }
    @PostMapping("/addLoginLog")
    @ApiOperation(value = "添加登录日志", tags = {"管理后台-登录日志"})
    public AjaxResult addLoginLog(@RequestBody SysLoginLog loginLog){
        return sysLoginLogService.addLoginLog(loginLog);
    }
    /**
     * 添加登陆日志
     * @param loginLog
     * @return
     */
    @PostMapping("/saveLoginLog")
    public R saveLoginLog(@RequestBody SysLoginLog loginLog){
        loginLog.setCreateTime(LocalDateTime.now());
        loginLog.setDelFlag(0);
        sysLoginLogService.save(loginLog);
        return R.ok();
    }
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysLogininforController.java
File was deleted
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysOperlogController.java
@@ -1,13 +1,11 @@
package com.ruoyi.system.controller;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.system.query.SysOperLogQuery;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,7 +19,6 @@
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.InnerAuth;
@@ -31,78 +28,65 @@
/**
 * 操作日志记录
 *
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("/operlog")
public class SysOperlogController extends BaseController
{
    @Autowired
    private ISysOperLogService operLogService;
//    @RequiresPermissions("system:operlog:list")
//    @GetMapping("/list")
//    public TableDataInfo list(SysOperLog operLog)
//    {
//        startPage();
//        List<SysOperLog> list = operLogService.selectOperLogList(operLog);
//        return getDataTable(list);
//    }
    @ApiOperation(value = "当前车辆操作日志查询")
    @PostMapping("/list")
    public AjaxResult list(@RequestBody SysOperLogQuery query)
    {
        LambdaQueryWrapper<SysOperLog> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(SysOperLog::getTitle,"车辆管理");
        wrapper.ne(SysOperLog::getBusinessType,1);
        List<SysOperLog> list = operLogService.list(wrapper);
        Iterator<SysOperLog> iterator = list.iterator();
        while (iterator.hasNext()){
            SysOperLog sysOperLog = iterator.next();
            String operParam = sysOperLog.getOperParam();
            JSONObject jsonObject = JSONObject.parseObject(operParam);
            String carId = jsonObject.getString("carId");
            if(StringUtils.isNotEmpty(carId) && Objects.nonNull(query.getCarId()) && !carId.equals(String.valueOf(query.getCarId()))){
                iterator.remove();
            }
        }
        return AjaxResult.success(list);
    }
    @Log(title = "操作日志", businessType = BusinessType.EXPORT)
    @RequiresPermissions("system:operlog:export")
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysOperLog operLog)
    {
        List<SysOperLog> list = operLogService.selectOperLogList(operLog);
        ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
        util.exportExcel(response, list, "操作日志");
    }
    @Log(title = "操作日志", businessType = BusinessType.DELETE)
    @RequiresPermissions("system:operlog:remove")
    @DeleteMapping("/{operIds}")
    public AjaxResult remove(@PathVariable Long[] operIds)
    {
        return toAjax(operLogService.deleteOperLogByIds(operIds));
    }
    @RequiresPermissions("system:operlog:remove")
    @Log(title = "操作日志", businessType = BusinessType.CLEAN)
    @DeleteMapping("/clean")
    public AjaxResult clean()
    {
        operLogService.cleanOperLog();
        return success();
    }
    @InnerAuth
    @PostMapping
    public AjaxResult add(@RequestBody SysOperLog operLog)
    {
        return toAjax(operLogService.insertOperlog(operLog));
    }
public class SysOperlogController extends BaseController {
    @Autowired
    private ISysOperLogService operLogService;
    @GetMapping("/list")
    @ApiOperation(value = "获取操作日志列表", tags = {"管理后台-操作日志"})
    public AjaxResult<PageInfo<SysOperLog>> list(SysOperLogQuery query) {
        PageInfo<SysOperLog> pageInfo = new PageInfo(query.getPageCurr(), query.getPageSize());
        LambdaQueryWrapper<SysOperLog> wrapper = new LambdaQueryWrapper<>();
        if(StringUtils.isNotEmpty(query.getOperName())){
            wrapper.like(SysOperLog::getOperName, query.getOperName());
        }
        if(StringUtils.isNotEmpty(query.getTitle())){
            wrapper.like(SysOperLog::getTitle, query.getTitle());
        }
        if(null != query.getStatus()){
            wrapper.eq(SysOperLog::getStatus, query.getStatus());
        }
        if(null != query.getStartTime() && null != query.getEndTime()){
            wrapper.between(SysOperLog::getOperTime, query.getStartTime(), query.getEndTime());
        }
        PageInfo<SysOperLog> page = operLogService.page(pageInfo, wrapper);
        return AjaxResult.success(page);
    }
    @Log(title = "操作日志", businessType = BusinessType.EXPORT)
    @RequiresPermissions("system:operlog:export")
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysOperLog operLog) {
        List<SysOperLog> list = operLogService.selectOperLogList(operLog);
        ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
        util.exportExcel(response, list, "操作日志");
    }
    @Log(title = "操作日志", businessType = BusinessType.DELETE)
    @RequiresPermissions("system:operlog:remove")
    @DeleteMapping("/{operIds}")
    public AjaxResult remove(@PathVariable Long[] operIds) {
        return toAjax(operLogService.deleteOperLogByIds(operIds));
    }
    @RequiresPermissions("system:operlog:remove")
    @Log(title = "操作日志", businessType = BusinessType.CLEAN)
    @DeleteMapping("/clean")
    public AjaxResult clean() {
        operLogService.cleanOperLog();
        return success();
    }
    @InnerAuth
    @PostMapping
    public AjaxResult add(@RequestBody SysOperLog operLog) {
        return toAjax(operLogService.insertOperlog(operLog));
    }
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLoginLog.java
New file
@@ -0,0 +1,91 @@
package com.ruoyi.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
 * @author zhibing.pu
 * @Date 2024/8/12 15:38
 */
@Data
@TableName("sys_login_log")
@ApiModel
public class SysLoginLog {
    /**
     * 主键
     */
    @ApiModelProperty(value = "数据id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 用户id
     */
    @TableField("user_id")
    private Integer userId;
    /**
     * 登录账号
     */
    @TableField("username")
    @ApiModelProperty(value = "用户账号")
    private String username;
    /**
     * 登录IP地址
     */
    @TableField("ip_address")
    @ApiModelProperty(value = "登录IP地址")
    private String ipAddress;
    /**
     * 登录地址
     */
    @TableField("address")
    @ApiModelProperty(value = "登录地址")
    private String address;
    /**
     * 浏览器类型
     */
    @TableField("browser_type")
    @ApiModelProperty(value = "浏览器类型")
    private String browserType;
    /**
     * 操作系统
     */
    @TableField("operating_system")
    @ApiModelProperty(value = "操作系统")
    private String operatingSystem;
    /**
     * 登录时间
     */
    @TableField("login_time")
    @ApiModelProperty(value = "登录时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime loginTime;
    /**
     * 登录状态(1=成功,2=失败)
     */
    @TableField("login_status")
    private Integer loginStatus;
    /**
     * 提示消息
     */
    @TableField("message")
    private String message;
    /**
     * 添加时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;
    /**
     * 删除状态(0=否,1=是)
     */
    @TableField("del_flag")
    private Integer delFlag;
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLoginLogMapper.java
New file
@@ -0,0 +1,24 @@
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.web.page.BasePage;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.system.domain.SysLoginLog;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @author zhibing.pu
 * @Date 2024/8/12 15:44
 */
public interface SysLoginLogMapper extends BaseMapper<SysLoginLog> {
    /**
     * 获取列表数据
     * @param pageInfo
     * @param name
     * @return
     */
    List<SysLoginLog> pageList(PageInfo<SysLoginLog> pageInfo, @Param("name") String name);
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java
File was deleted
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/query/SysOperLogQuery.java
@@ -1,16 +1,27 @@
package com.ruoyi.system.query;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.web.page.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@ApiModel(value = "当前车辆查询操作日志")
@ApiModel()
public class SysOperLogQuery extends BasePage {
    @ApiModelProperty(value = "车辆id")
    private Integer carId;
    @ApiModelProperty(value = "操作人员")
    private String operName;
    @ApiModelProperty(value = "操作标题")
    private String title;
    @ApiModelProperty(value = "状态(0=正常,1=异常)")
    private Integer status;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "操作开始时间", notes = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "操作结束时间", notes = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLoginLogService.java
New file
@@ -0,0 +1,32 @@
package com.ruoyi.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.BasePage;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.system.domain.SysLoginLog;
import org.springframework.web.bind.annotation.RequestBody;
/**
 * @author zhibing.pu
 * @Date 2024/8/12 15:47
 */
public interface ISysLoginLogService extends IService<SysLoginLog> {
    /**
     * 获取列表数据
     * @param name
     * @param basePage
     * @return
     */
    PageInfo<SysLoginLog> pageList(String name, BasePage basePage);
    /**
     * 添加登录日志
     * @param loginLog
     * @return
     */
    AjaxResult addLoginLog(SysLoginLog loginLog);
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java
File was deleted
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java
@@ -7,45 +7,44 @@
/**
 * 操作日志 服务层
 *
 *
 * @author ruoyi
 */
public interface ISysOperLogService extends IService<SysOperLog>
{
    /**
     * 新增操作日志
     *
     * @param operLog 操作日志对象
     * @return 结果
     */
    public int insertOperlog(SysOperLog operLog);
    /**
     * 查询系统操作日志集合
     *
     * @param operLog 操作日志对象
     * @return 操作日志集合
     */
    public List<SysOperLog> selectOperLogList(SysOperLog operLog);
    /**
     * 批量删除系统操作日志
     *
     * @param operIds 需要删除的操作日志ID
     * @return 结果
     */
    public int deleteOperLogByIds(Long[] operIds);
    /**
     * 查询操作日志详细
     *
     * @param operId 操作ID
     * @return 操作日志对象
     */
    public SysOperLog selectOperLogById(Long operId);
    /**
     * 清空操作日志
     */
    public void cleanOperLog();
public interface ISysOperLogService extends IService<SysOperLog> {
    /**
     * 新增操作日志
     *
     * @param operLog 操作日志对象
     * @return 结果
     */
    public int insertOperlog(SysOperLog operLog);
    /**
     * 查询系统操作日志集合
     *
     * @param operLog 操作日志对象
     * @return 操作日志集合
     */
    public List<SysOperLog> selectOperLogList(SysOperLog operLog);
    /**
     * 批量删除系统操作日志
     *
     * @param operIds 需要删除的操作日志ID
     * @return 结果
     */
    public int deleteOperLogByIds(Long[] operIds);
    /**
     * 查询操作日志详细
     *
     * @param operId 操作ID
     * @return 操作日志对象
     */
    public SysOperLog selectOperLogById(Long operId);
    /**
     * 清空操作日志
     */
    public void cleanOperLog();
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLoginLogServiceImpl.java
New file
@@ -0,0 +1,66 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.BasePage;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.domain.SysLoginLog;
import com.ruoyi.system.mapper.SysLoginLogMapper;
import com.ruoyi.system.service.ISysLoginLogService;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
 * @author zhibing.pu
 * @Date 2024/8/12 15:47
 */
@Service
public class SysLoginLogServiceImpl extends ServiceImpl<SysLoginLogMapper, SysLoginLog> implements ISysLoginLogService {
    @Resource
    private ISysUserService sysUserService;
    /**
     * 获取列表数据
     * @param name
     * @param basePage
     * @return
     */
    @Override
    public PageInfo<SysLoginLog> pageList(String name, BasePage basePage) {
        PageInfo<SysLoginLog> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize());
        List<SysLoginLog> list = this.baseMapper.pageList(pageInfo, name);
        return pageInfo.setRecords(list);
    }
    /**
     * 添加登录日志
     * @param loginLog
     * @return
     */
    @Override
    public AjaxResult addLoginLog(SysLoginLog loginLog) {
        String username = loginLog.getUsername();
        SysUser sysUser = sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, username).eq(SysUser::getDelFlag, 0));
        if(null == sysUser){
            return AjaxResult.error("用户账号无效");
        }
        loginLog.setUserId(sysUser.getUserId().intValue());
        loginLog.setCreateTime(LocalDateTime.now());
        loginLog.setDelFlag(0);
        this.save(loginLog);
        return AjaxResult.success();
    }
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java
File was deleted
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java
@@ -15,114 +15,108 @@
/**
 * 操作日志 服务层处理
 *
 *
 * @author ruoyi
 */
@Service
public class SysOperLogServiceImpl implements ISysOperLogService
{
    @Autowired
    private SysOperLogMapper operLogMapper;
    /**
     * 新增操作日志
     *
     * @param operLog 操作日志对象
     * @return 结果
     */
    @Override
    public int insertOperlog(SysOperLog operLog)
    {
        return operLogMapper.insertOperlog(operLog);
    }
    /**
     * 查询系统操作日志集合
     *
     * @param operLog 操作日志对象
     * @return 操作日志集合
     */
    @Override
    public List<SysOperLog> selectOperLogList(SysOperLog operLog)
    {
        return operLogMapper.selectOperLogList(operLog);
    }
    /**
     * 批量删除系统操作日志
     *
     * @param operIds 需要删除的操作日志ID
     * @return 结果
     */
    @Override
    public int deleteOperLogByIds(Long[] operIds)
    {
        return operLogMapper.deleteOperLogByIds(operIds);
    }
    /**
     * 查询操作日志详细
     *
     * @param operId 操作ID
     * @return 操作日志对象
     */
    @Override
    public SysOperLog selectOperLogById(Long operId)
    {
        return operLogMapper.selectOperLogById(operId);
    }
    /**
     * 清空操作日志
     */
    @Override
    public void cleanOperLog()
    {
        operLogMapper.cleanOperLog();
    }
    @Override
    public boolean saveBatch(Collection<SysOperLog> entityList, int batchSize) {
        return false;
    }
    @Override
    public boolean saveOrUpdateBatch(Collection<SysOperLog> entityList, int batchSize) {
        return false;
    }
    @Override
    public boolean updateBatchById(Collection<SysOperLog> entityList, int batchSize) {
        return false;
    }
    @Override
    public boolean saveOrUpdate(SysOperLog entity) {
        return false;
    }
    @Override
    public SysOperLog getOne(Wrapper<SysOperLog> queryWrapper, boolean throwEx) {
        return null;
    }
    @Override
    public Map<String, Object> getMap(Wrapper<SysOperLog> queryWrapper) {
        return null;
    }
    @Override
    public <V> V getObj(Wrapper<SysOperLog> queryWrapper, Function<? super Object, V> mapper) {
        return null;
    }
    @Override
    public BaseMapper<SysOperLog> getBaseMapper() {
        return null;
    }
    @Override
    public Class<SysOperLog> getEntityClass() {
        return null;
    }
public class SysOperLogServiceImpl implements ISysOperLogService {
    @Autowired
    private SysOperLogMapper operLogMapper;
    /**
     * 新增操作日志
     *
     * @param operLog 操作日志对象
     * @return 结果
     */
    @Override
    public int insertOperlog(SysOperLog operLog) {
        return operLogMapper.insertOperlog(operLog);
    }
    /**
     * 查询系统操作日志集合
     *
     * @param operLog 操作日志对象
     * @return 操作日志集合
     */
    @Override
    public List<SysOperLog> selectOperLogList(SysOperLog operLog) {
        return operLogMapper.selectOperLogList(operLog);
    }
    /**
     * 批量删除系统操作日志
     *
     * @param operIds 需要删除的操作日志ID
     * @return 结果
     */
    @Override
    public int deleteOperLogByIds(Long[] operIds) {
        return operLogMapper.deleteOperLogByIds(operIds);
    }
    /**
     * 查询操作日志详细
     *
     * @param operId 操作ID
     * @return 操作日志对象
     */
    @Override
    public SysOperLog selectOperLogById(Long operId) {
        return operLogMapper.selectOperLogById(operId);
    }
    /**
     * 清空操作日志
     */
    @Override
    public void cleanOperLog() {
        operLogMapper.cleanOperLog();
    }
    @Override
    public boolean saveBatch(Collection<SysOperLog> entityList, int batchSize) {
        return false;
    }
    @Override
    public boolean saveOrUpdateBatch(Collection<SysOperLog> entityList, int batchSize) {
        return false;
    }
    @Override
    public boolean updateBatchById(Collection<SysOperLog> entityList, int batchSize) {
        return false;
    }
    @Override
    public boolean saveOrUpdate(SysOperLog entity) {
        return false;
    }
    @Override
    public SysOperLog getOne(Wrapper<SysOperLog> queryWrapper, boolean throwEx) {
        return null;
    }
    @Override
    public Map<String, Object> getMap(Wrapper<SysOperLog> queryWrapper) {
        return null;
    }
    @Override
    public <V> V getObj(Wrapper<SysOperLog> queryWrapper, Function<? super Object, V> mapper) {
        return null;
    }
    @Override
    public BaseMapper<SysOperLog> getBaseMapper() {
        return null;
    }
    @Override
    public Class<SysOperLog> getEntityClass() {
        return null;
    }
}
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysLoginLogMapper.xml
New file
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysLoginLogMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.SysLoginLog">
        <id column="id" property="id" />
        <result column="user_id" property="userId" />
        <result column="user_name" property="username" />
        <result column="ip_address" property="ipAddress"/>
        <result column="address" property="address"/>
        <result column="browser_type" property="browserType"/>
        <result column="operating_system" property="operatingSystem"/>
        <result column="login_time" property="loginTime"/>
        <result column="login_status" property="loginStatus"/>
        <result column="message" property="message"/>
        <result column="create_time" property="createTime"/>
        <result column="del_flag" property="delFlag"/>
    </resultMap>
    <select id="pageList" resultMap="BaseResultMap">
        select
        a.*,
        b.user_name
        from sys_login_log a
        left join sys_user b on (a.user_id = b.user_id)
        where a.del_flag = 0
        <if test="null != name and '' != name">
            and b.user_name like CONCAT('%', #{name}, '%')
        </if>
        order by a.create_time desc
    </select>
</mapper>
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
File was deleted
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -333,5 +333,16 @@
        return R.ok();
    }
    /**
     * 根据用户id获取用户
     * @param id
     * @return
     */
    @GetMapping(value = "/user/getUserById/{id}")
    public R<TAppUser> getUserById(@PathVariable Long id){
        TAppUser appUser = appUserService.getById(id);
        return R.ok(appUser);
    }
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
@@ -156,7 +156,7 @@
    
    @ResponseBody
    @GetMapping("/getAllSiteList")
    @ApiOperation(value = "获取所有站点数据", tags = {"管理后台-充电桩信息", "管理后台-系统用户管理", "管理后台-角色管理", "管理后台-系统通知"})
    @ApiOperation(value = "获取所有站点数据", tags = {"管理后台-充电桩信息", "管理后台-系统用户管理", "管理后台-角色管理", "管理后台-系统通知", "管理后台-充电评价"})
    public AjaxResult<List<Site>> getAllSiteList(){
        //校验当前账户站点权限
        SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData();
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java
@@ -1,22 +1,21 @@
package com.ruoyi.order.controller;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.order.api.model.TOrderEvaluate;
import com.ruoyi.order.api.query.TOrderEvaluateQuery;
import com.ruoyi.order.api.vo.TOrderEvaluateVO;
import com.ruoyi.order.dto.GetOrderEvaluatePageList;
import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO;
import com.ruoyi.order.service.TOrderEvaluateService;
import com.ruoyi.other.api.feignClient.TEvaluationTagClient;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -47,6 +46,62 @@
    public AjaxResult<PageInfo<TOrderEvaluateVO>> pageList(@RequestBody TOrderEvaluateQuery query) {
        return AjaxResult.ok(orderEvaluateService.getTagList(query));
    }
    @GetMapping(value = "/getPageList")
    @ApiOperation(value = "获取充电评价列表", tags = {"管理后台-充电评价"})
    public AjaxResult<PageInfo<GetOrderEvaluatePageListDTO>> getPageList(@RequestBody GetOrderEvaluatePageList pageList){
        PageInfo<GetOrderEvaluatePageListDTO> list = orderEvaluateService.getPageList(pageList);
        return AjaxResult.success(list);
    }
    @DeleteMapping(value = "/delOrderEvaluate")
    @ApiOperation(value = "删除充电评价", tags = {"管理后台-充电评价"})
    public AjaxResult delOrderEvaluate(@PathVariable Long id){
        TOrderEvaluate orderEvaluate = orderEvaluateService.getById(id);
        orderEvaluate.setDelFlag(true);
        orderEvaluateService.updateById(orderEvaluate);
        return AjaxResult.success();
    }
    @PostMapping(value = "/replyEvaluation")
    @ApiOperation(value = "充电评价回复", tags = {"管理后台-充电评价"})
    public AjaxResult replyEvaluation(@PathVariable("id") Long id, @RequestParam("reply") String reply){
        TOrderEvaluate orderEvaluate = orderEvaluateService.getById(id);
        reply = reply.replaceAll("& #40;", "(")
                .replaceAll("& #41;", ")")
                .replaceAll("& #40;", "(")
                .replaceAll("& #41;", ")")
                .replaceAll("& #39;", "'")
                .replaceAll("& lt;", "<")
                .replaceAll("& gt;", ">");
        orderEvaluate.setEvaluationResponse(reply);
        orderEvaluate.setResponseTime(LocalDateTime.now());
        orderEvaluateService.updateById(orderEvaluate);
        return AjaxResult.success();
    }
    @DeleteMapping(value = "/delOrderEvaluateReply")
    @ApiOperation(value = "删除充电评价回复", tags = {"管理后台-充电评价"})
    public AjaxResult delOrderEvaluateReply(@PathVariable Long id){
        TOrderEvaluate orderEvaluate = orderEvaluateService.getById(id);
        orderEvaluate.setEvaluationResponse("");
        orderEvaluateService.updateById(orderEvaluate);
        return AjaxResult.success();
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/GetOrderEvaluatePageList.java
New file
@@ -0,0 +1,23 @@
package com.ruoyi.order.dto;
import com.ruoyi.common.core.web.page.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2024/8/12 19:07
 */
@Data
@ApiModel
public class GetOrderEvaluatePageList extends BasePage {
    @ApiModelProperty(value = "订单编号")
    private String code;
    @ApiModelProperty(value = "评价内容")
    private String content;
    @ApiModelProperty(value = "评价类型(1=好评,2=中评,3=差评)")
    private Integer evaluateType;
    @ApiModelProperty(value = "归属电站id")
    private Integer siteId;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/GetOrderEvaluatePageListDTO.java
New file
@@ -0,0 +1,40 @@
package com.ruoyi.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * @author zhibing.pu
 * @Date 2024/8/12 19:09
 */
@Data
@ApiModel
public class GetOrderEvaluatePageListDTO {
    @ApiModelProperty("订单id")
    private String id;
    @ApiModelProperty("订单编号")
    private String code;
    private Long appUserId;
    @ApiModelProperty("用户头像")
    private String avatar;
    @ApiModelProperty("用户电话")
    private String phone;
    @ApiModelProperty("评分")
    private Integer mark;
    @ApiModelProperty("归属电站名称")
    private String siteName;
    private Integer siteId;
    @ApiModelProperty("评价内容")
    private String content;
    @ApiModelProperty("评价图片")
    private String imgUrl;
    @ApiModelProperty("评价时间")
    private String createTime;
    @ApiModelProperty("评价标签")
    private List<String> tags;
    @ApiModelProperty("回复内容")
    private String recover;
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TOrderEvaluateMapper.java
@@ -5,6 +5,8 @@
import com.ruoyi.order.api.model.TOrderEvaluate;
import com.ruoyi.order.api.query.TOrderEvaluateQuery;
import com.ruoyi.order.api.vo.TOrderEvaluateVO;
import com.ruoyi.order.dto.GetOrderEvaluatePageList;
import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -30,4 +32,14 @@
     * @return
     */
    List<TOrderEvaluateVO> pageList(@Param("query") TOrderEvaluateQuery query,@Param("pageInfo")PageInfo<TOrderEvaluateVO> pageInfo);
    /**
     * 获取充电评价列表数据
     * @param pageList
     * @param pageInfo
     * @return
     */
    List<GetOrderEvaluatePageListDTO> getPageList(@Param("query") GetOrderEvaluatePageList pageList, @Param("evaluationTagIds") List<Integer> evaluationTagIds,
                                                  PageInfo<GetOrderEvaluatePageListDTO> pageInfo);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java
@@ -5,7 +5,10 @@
import com.ruoyi.order.api.model.TOrderEvaluate;
import com.ruoyi.order.api.query.TOrderEvaluateQuery;
import com.ruoyi.order.api.vo.TOrderEvaluateVO;
import com.ruoyi.order.dto.GetOrderEvaluatePageList;
import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@@ -31,4 +34,12 @@
     * @return
     */
    PageInfo<TOrderEvaluateVO> getTagList(TOrderEvaluateQuery query);
    /**
     * 获取充电评价列表
     * @param pageList
     * @return
     */
    PageInfo<GetOrderEvaluatePageListDTO> getPageList(GetOrderEvaluatePageList pageList);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
@@ -1,24 +1,35 @@
package com.ruoyi.order.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.TAppUser;
import com.ruoyi.chargingPile.api.feignClient.SiteClient;
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.order.api.model.TChargingOrder;
import com.ruoyi.order.api.model.TOrderEvaluate;
import com.ruoyi.order.api.model.TOrderEvaluateTag;
import com.ruoyi.order.api.query.TOrderEvaluateQuery;
import com.ruoyi.order.api.vo.TOrderEvaluateVO;
import com.ruoyi.order.dto.GetOrderEvaluatePageList;
import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO;
import com.ruoyi.order.mapper.TChargingOrderMapper;
import com.ruoyi.order.mapper.TOrderEvaluateMapper;
import com.ruoyi.order.mapper.TOrderEvaluateTagMapper;
import com.ruoyi.order.service.TOrderEvaluateService;
import com.ruoyi.other.api.domain.TEvaluationTag;
import com.ruoyi.other.api.feignClient.TEvaluationTagClient;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@@ -35,16 +46,34 @@
@Service
public class TOrderEvaluateServiceImpl extends ServiceImpl<TOrderEvaluateMapper, TOrderEvaluate> implements TOrderEvaluateService {
    @Autowired
    @Resource
    private TEvaluationTagClient evaluationTagClient;
    @Autowired
    @Resource
    private TOrderEvaluateTagMapper orderEvaluateTagMapper;
    @Autowired
    @Resource
    private TChargingOrderMapper chargingOrderMapper;
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private SiteClient siteClient;
    @Override
    public List<TEvaluationTagVO> getTagCount() {
        // 查询标签列表
        R<List<TEvaluationTagVO>> r = evaluationTagClient.getTagList();
        R<List<TEvaluationTagVO>> r = evaluationTagClient.getTagList(null);
        List<TEvaluationTagVO> tagList = r.getData();
        List<Integer> tagIds = tagList.stream().map(TEvaluationTagVO::getId).collect(Collectors.toList());
        // 统计标签使用数量
@@ -100,5 +129,35 @@
            tagList.add(evaluationTagVO);
        }
    }
    /**
     * 获取充电评价列表
     * @param pageList
     * @return
     */
    @Override
    public PageInfo<GetOrderEvaluatePageListDTO> getPageList(GetOrderEvaluatePageList pageList) {
        PageInfo<GetOrderEvaluatePageListDTO> pageInfo = new PageInfo<>(pageList.getPageCurr(), pageList.getPageSize());
        List<Integer> evaluationTagIds = null;
        if(null != pageList.getEvaluateType()){
            List<TEvaluationTagVO> data = evaluationTagClient.getTagList(pageList.getEvaluateType()).getData();
            evaluationTagIds = data.stream().map(TEvaluationTagVO::getId).collect(Collectors.toList());
        }
        List<GetOrderEvaluatePageListDTO> list = this.baseMapper.getPageList(pageList, evaluationTagIds, pageInfo);
        for (GetOrderEvaluatePageListDTO dto : list) {
            TAppUser appUser = appUserClient.getUserById(dto.getAppUserId()).getData();
            dto.setAvatar(appUser.getAvatar());
            String phone = appUser.getPhone();
            dto.setPhone(phone.substring(0, 3) + "****" + phone.substring(6));
            Site site = siteClient.getSiteByIds(Arrays.asList(dto.getSiteId())).getData().get(0);
            dto.setSiteName(site.getName());
            List<TOrderEvaluateTag> tOrderEvaluateTags = orderEvaluateTagMapper.selectList(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, dto.getId()));
            List<Integer> tagIds = tOrderEvaluateTags.stream().map(TOrderEvaluateTag::getEvaluationTagId).collect(Collectors.toList());
            List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagIds).getData();
            List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList());
            dto.setTags(collect);
        }
        return pageInfo.setRecords(list);
    }
}
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml
@@ -79,4 +79,38 @@
        </if>
    </select>
    <select id="getPageList" resultType="com.ruoyi.order.dto.GetOrderEvaluatePageListDTO">
        select
        CAST(a.id AS CHAR) as id,
        b.`code`,
        a.mark,
        b.site_id as siteId,
        b.app_user_id as appUserId,
        a.content,
        a.img_url as imgUrl,
        DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%i:%s') as createTime,
        a.evaluation_response as `recover`
        from t_order_evaluate a
        left join t_charging_order b on (a.order_id = b.id)
        where a.order_type = 1 and a.del_flag = 0
        <if test="null != query.code and '' != query.code">
            and b.`code` like CONCAT('%', #{query.code}, '%')
        </if>
        <if test="null != query.content and '' != query.content">
            and a.content like CONCAT('%', #{query.content}, '%')
        </if>
        <if test="null != query.evaluateType">
            and a.id in (select order_evaluate_id from t_order_evaluate_tag where evaluation_tag_id in
            <foreach collection="evaluationTagIds" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
            )
        </if>
        <if test="null != query.siteId">
            and b.site_id = #{query.siteId}
        </if>
        order by a.create_time desc
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEvaluationTagController.java
@@ -3,15 +3,18 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.BasePage;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.other.api.domain.TEvaluationTag;
import com.ruoyi.other.api.domain.TInvoiceType;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
import com.ruoyi.other.query.InvoiceTypePageList;
import com.ruoyi.other.service.TEvaluationTagService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
/**
@@ -37,6 +40,66 @@
    public R<List<TEvaluationTagVO>> getTagList() {
        return R.ok(evaluationTagService.getTagList());
    }
    @ResponseBody
    @GetMapping("/pageList")
    @ApiOperation(value = "获取评价标签列表", tags = {"管理后台-评价标签设置"})
    public AjaxResult<PageInfo<TEvaluationTag>> pageList(String name, BasePage basePage){
        PageInfo<TEvaluationTag> pageInfo = evaluationTagService.pageList(name, basePage);
        return AjaxResult.success(pageInfo);
    }
    @ResponseBody
    @PostMapping("/addEvaluationTag")
    @ApiOperation(value = "添加评价标签", tags = {"管理后台-评价标签设置"})
    public AjaxResult addEvaluationTag(@RequestBody TEvaluationTag evaluationTag){
        evaluationTagService.save(evaluationTag);
        return AjaxResult.success();
    }
    @ResponseBody
    @GetMapping("/getEvaluationTagInfo/{id}")
    @ApiOperation(value = "获取评价标签详情", tags = {"管理后台-评价标签设置"})
    public AjaxResult<TEvaluationTag> getEvaluationTagInfo(@PathVariable Integer id){
        TEvaluationTag evaluationTag = evaluationTagService.getById(id);
        return AjaxResult.success(evaluationTag);
    }
    @ResponseBody
    @PostMapping("/editEvaluationTag")
    @ApiOperation(value = "编辑评价标签", tags = {"管理后台-评价标签设置"})
    public AjaxResult editEvaluationTag(@RequestBody TEvaluationTag evaluationTag){
        evaluationTagService.updateById(evaluationTag);
        return AjaxResult.success();
    }
    @ResponseBody
    @DeleteMapping("/delEvaluationTag/{id}")
    @ApiOperation(value = "删除评价标签", tags = {"管理后台-评价标签设置"})
    public AjaxResult<TInvoiceType> delEvaluationTag(@PathVariable Integer[] id){
        List<TEvaluationTag> tEvaluationTags = evaluationTagService.listByIds(Arrays.asList(id));
        for (TEvaluationTag evaluationTag : tEvaluationTags) {
            evaluationTag.setDelFlag(true);
            evaluationTagService.updateById(evaluationTag);
        }
        return AjaxResult.success();
    }
    /**
     * 根据id集合获取数据
     * @param tagIds
     * @return
     */
    @GetMapping("/getListByIds")
    public R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds){
        List<TEvaluationTag> tEvaluationTags = evaluationTagService.listByIds(tagIds);
        return R.ok(tEvaluationTags);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TInvoiceTypeController.java
@@ -1,9 +1,17 @@
package com.ruoyi.other.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.other.api.domain.TInvoiceType;
import com.ruoyi.other.query.InvoiceTypePageList;
import com.ruoyi.other.service.TInvoiceTypeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
/**
 * <p>
@@ -16,6 +24,56 @@
@RestController
@RequestMapping("/t-invoice-type")
public class TInvoiceTypeController {
    @Resource
    private TInvoiceTypeService invoiceTypeService;
    @ResponseBody
    @GetMapping("/pageList")
    @ApiOperation(value = "获取发票类型列表", tags = {"管理后台-发票类型管理"})
    public AjaxResult<PageInfo<TInvoiceType>> pageList(InvoiceTypePageList pageList){
        PageInfo<TInvoiceType> pageInfo = invoiceTypeService.pageList(pageList);
        return AjaxResult.success(pageInfo);
    }
    @ResponseBody
    @PostMapping("/addInvoiceType")
    @ApiOperation(value = "添加发票类型", tags = {"管理后台-发票类型管理"})
    public AjaxResult addInvoiceType(@RequestBody TInvoiceType invoiceType){
        invoiceTypeService.save(invoiceType);
        return AjaxResult.success();
    }
    @ResponseBody
    @GetMapping("/getInvoiceTypeInfo/{id}")
    @ApiOperation(value = "获取发票类型详情", tags = {"管理后台-发票类型管理"})
    public AjaxResult<TInvoiceType> getInvoiceTypeInfo(@PathVariable Integer id){
        TInvoiceType invoiceType = invoiceTypeService.getById(id);
        return AjaxResult.success(invoiceType);
    }
    @ResponseBody
    @PostMapping("/editInvoiceType")
    @ApiOperation(value = "编辑发票类型", tags = {"管理后台-发票类型管理"})
    public AjaxResult editInvoiceType(@RequestBody TInvoiceType invoiceType){
        invoiceTypeService.updateById(invoiceType);
        return AjaxResult.success();
    }
    @ResponseBody
    @DeleteMapping("/delInvoiceType/{id}")
    @ApiOperation(value = "删除发票类型", tags = {"管理后台-发票类型管理"})
    public AjaxResult<TInvoiceType> delInvoiceType(@PathVariable Integer[] id){
        List<TInvoiceType> tInvoiceTypes = invoiceTypeService.listByIds(Arrays.asList(id));
        for (TInvoiceType invoiceType : tInvoiceTypes) {
            invoiceType.setDelFlag(true);
            invoiceTypeService.updateById(invoiceType);
        }
        return AjaxResult.success();
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TEvaluationTagMapper.java
@@ -1,8 +1,10 @@
package com.ruoyi.other.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.other.api.domain.TEvaluationTag;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -21,5 +23,13 @@
     * @return
     */
    List<TEvaluationTagVO> getTagList();
    /**
     * 获取列表数据
     * @param pageInfo
     * @param name
     * @return
     */
    List<TEvaluationTag> pageList(PageInfo<TEvaluationTag> pageInfo, @Param("name") String name);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TInvoiceTypeMapper.java
@@ -1,7 +1,12 @@
package com.ruoyi.other.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.other.api.domain.TInvoiceType;
import com.ruoyi.other.query.InvoiceTypePageList;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * <p>
@@ -12,5 +17,7 @@
 * @since 2024-08-06
 */
public interface TInvoiceTypeMapper extends BaseMapper<TInvoiceType> {
    List<TInvoiceType> pageList(PageInfo<TInvoiceType> pageInfo, @Param("req") InvoiceTypePageList pageList);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/query/InvoiceTypePageList.java
New file
@@ -0,0 +1,21 @@
package com.ruoyi.other.query;
import com.ruoyi.common.core.web.page.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2024/8/12 18:07
 */
@Data
@ApiModel
public class InvoiceTypePageList extends BasePage {
    @ApiModelProperty(value = "类型名称")
    private String name;
    @ApiModelProperty(value = "公司名称")
    private String company;
    @ApiModelProperty(value = "开票方式(1=人工,2=自动)")
    private Integer method;
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TEvaluationTagService.java
@@ -1,6 +1,8 @@
package com.ruoyi.other.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.web.page.BasePage;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.other.api.domain.TEvaluationTag;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
@@ -21,4 +23,13 @@
     * @return
     */
    List<TEvaluationTagVO> getTagList();
    /**
     * 获取列表页数据
     * @param name
     * @param basePage
     * @return
     */
    PageInfo<TEvaluationTag> pageList(String name, BasePage basePage);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TInvoiceTypeService.java
@@ -1,7 +1,9 @@
package com.ruoyi.other.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.other.api.domain.TInvoiceType;
import com.ruoyi.other.query.InvoiceTypePageList;
/**
 * <p>
@@ -12,5 +14,11 @@
 * @since 2024-08-06
 */
public interface TInvoiceTypeService extends IService<TInvoiceType> {
    /**
     * 获取发票类型列表数据
     * @param pageList
     * @return
     */
    PageInfo<TInvoiceType> pageList(InvoiceTypePageList pageList);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TEvaluationTagServiceImpl.java
@@ -1,5 +1,7 @@
package com.ruoyi.other.service.impl;
import com.ruoyi.common.core.web.page.BasePage;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.other.api.domain.TEvaluationTag;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
import com.ruoyi.other.mapper.TEvaluationTagMapper;
@@ -21,7 +23,21 @@
public class TEvaluationTagServiceImpl extends ServiceImpl<TEvaluationTagMapper, TEvaluationTag> implements TEvaluationTagService {
    @Override
    public List<TEvaluationTagVO> getTagCount() {
    public List<TEvaluationTagVO> getTagList() {
        return this.baseMapper.getTagList();
    }
    /**
     * 获取列表数据
     * @param name
     * @param basePage
     * @return
     */
    @Override
    public PageInfo<TEvaluationTag> pageList(String name, BasePage basePage) {
        PageInfo<TEvaluationTag> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize());
        List<TEvaluationTag> list = this.baseMapper.pageList(pageInfo, name);
        return pageInfo.setRecords(list);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TInvoiceTypeServiceImpl.java
@@ -1,10 +1,14 @@
package com.ruoyi.other.service.impl;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.other.api.domain.TInvoiceType;
import com.ruoyi.other.mapper.TInvoiceTypeMapper;
import com.ruoyi.other.query.InvoiceTypePageList;
import com.ruoyi.other.service.TInvoiceTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * <p>
@@ -16,5 +20,18 @@
 */
@Service
public class TInvoiceTypeServiceImpl extends ServiceImpl<TInvoiceTypeMapper, TInvoiceType> implements TInvoiceTypeService {
    /**
     * 获取发票类型列表数据
     * @param pageList
     * @return
     */
    @Override
    public PageInfo<TInvoiceType> pageList(InvoiceTypePageList pageList) {
        PageInfo<TInvoiceType> pageInfo = new PageInfo<>(pageList.getPageCurr(), pageList.getPageSize());
        List<TInvoiceType> list = this.baseMapper.pageList(pageInfo, pageList);
        pageInfo.setRecords(list);
        return pageInfo;
    }
}
ruoyi-service/ruoyi-other/src/main/resources/mapper/TEvaluationTagMapper.xml
@@ -20,4 +20,13 @@
        from t_evaluation_tag where del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} ORDER BY `type`
    </select>
    <select id="pageList" resultMap="BaseResultMap">
        select * from t_evaluation_tag where del_flag = 0
        <if test="null != name and '' != name">
            and name like CONCAT('%', #{name}, '%')
        </if>
        order by create_time desc
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/resources/mapper/TInvoiceTypeMapper.xml
@@ -20,4 +20,18 @@
        id, name, invoicing_company, invoicing_method, electricity_tariff, service_tariff, added_service_tariff, del_flag, create_time
    </sql>
    <select id="pageList" resultMap="BaseResultMap">
        select * from t_invoice_type where del_flag = 0
        <if test="null != req.name and '' != req.name">
            and name like CONCAT('%', #{req.name}, '%')
        </if>
        <if test="null != req.company and '' != req.company">
            and invoicing_company like CONCAT('%', #{req.company}, '%')
        </if>
        <if test="null != req.method">
            and invoicing_method = #{req.method}
        </if>
        order by create_time desc
    </select>
</mapper>