lsw 1 year ago
parent
commit
feb7b59bfb

+ 2 - 2
admin-ui/src/assets/styles/extend.scss

@@ -2,13 +2,13 @@
 .vl-notify-mask {
   background-color: black !important;
   opacity: 0.4 !important;
-  z-index: 1502!important;
+  z-index: 1503!important;
 }
 .vl-notify.vl-notify-msg.vl-notify-loading {
   z-index: 1505 !important;
 }
 .vl-notify.vl-notify-iframe {
-  z-index: 1502 !important;
+  z-index: 1503 !important;
   border: 0px !important;
   border-radius: 10px !important;
   box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2) !important;

+ 6 - 5
admin-ui/src/views/system/role/index.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
       <el-form-item label="角色名称" prop="roleName">
-        <el-input v-model="queryParams.roleName" placeholder="请输入角色名称" clearable @keyup.enter.native="handleQuery"/>
+        <el-input v-model="queryParams.roleName" placeholder="请输入角色名称" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="状态" prop="status">
         <el-select v-model="queryParams.status" placeholder="角色状态" clearable class="se">
@@ -26,20 +26,21 @@
     </el-row>
     <el-table :data="roleList" border @selection-change="handleSelectionChange" height="calc(100vh - 273px)">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="角色名称" prop="roleName" align="center" :show-overflow-tooltip="true" />
+      <el-table-column label="角色名称" prop="roleName" align="left" :show-overflow-tooltip="true" />
       <el-table-column label="权限字符" prop="roleKey" align="center" :show-overflow-tooltip="true" width="150" v-if="!user.companyId" />
+      <el-table-column label="备注信息" prop="remark" align="center" />
       <el-table-column label="状态" align="center" width="130">
         <template slot-scope="scope">
           <el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
         </template>
       </el-table-column>
-      <el-table-column label="创建人" prop="createBy" align="center" width="130"/>
-      <el-table-column label="创建时间" align="center" prop="createTime" width="160">
+      <el-table-column label="创建人" prop="createBy" align="center" width="130" />
+      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime) }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center">
+      <el-table-column label="操作" align="center" width="260">
         <template slot-scope="scope" v-if="scope.row.roleId !== 1">
           <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:role:edit']">修改</el-button>
           <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:role:remove']">删除</el-button>

+ 1 - 0
admin-ui/src/views/system/user/index.vue

@@ -299,6 +299,7 @@ export default {
           }
         ],
         phonenumber: [
+          { required: true, message: '手机号不能为空', trigger: 'blur' },
           {
             pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
             message: '请输入正确的手机号码',

+ 15 - 21
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java

@@ -1,15 +1,5 @@
 package com.ruoyi.web.controller.monitor;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -18,23 +8,29 @@ import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.domain.SysOperLog;
 import com.ruoyi.system.service.ISysOperLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.rmi.ServerException;
+import java.util.List;
 
 /**
  * 操作日志记录
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/operlog")
-public class SysOperlogController extends BaseController
-{
+public class SysOperlogController extends BaseController {
     @Autowired
     private ISysOperLogService operLogService;
 
     @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysOperLog operLog)
-    {
+    public TableDataInfo list(SysOperLog operLog) {
+        operLog.setCompanyId(getLoginUser().getUser().getCompanyId());
         startPage();
         List<SysOperLog> list = operLogService.selectOperLogList(operLog);
         return getDataTable(list);
@@ -43,8 +39,8 @@ public class SysOperlogController extends BaseController
     @Log(title = "操作日志", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysOperLog operLog)
-    {
+    public void export(HttpServletResponse response, SysOperLog operLog) {
+        operLog.setCompanyId(getLoginUser().getUser().getCompanyId());
         List<SysOperLog> list = operLogService.selectOperLogList(operLog);
         ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
         util.exportExcel(response, list, "操作日志");
@@ -53,16 +49,14 @@ public class SysOperlogController extends BaseController
     @Log(title = "操作日志", businessType = BusinessType.DELETE)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
     @DeleteMapping("/{operIds}")
-    public AjaxResult remove(@PathVariable Long[] operIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] operIds) throws ServerException {
         return toAjax(operLogService.deleteOperLogByIds(operIds));
     }
 
     @Log(title = "操作日志", businessType = BusinessType.CLEAN)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
     @DeleteMapping("/clean")
-    public AjaxResult clean()
-    {
+    public AjaxResult clean() throws ServerException {
         operLogService.cleanOperLog();
         return AjaxResult.success();
     }

+ 3 - 7
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/MoneyOutController.java

@@ -44,9 +44,7 @@ public class MoneyOutController extends BaseController {
     @PreAuthorize("@ss.hasPermi('work:out:list')")
     @GetMapping("/list")
     public TableDataInfo list(MoneyOut moneyOut) {
-        if (getLoginUser().getUser().getType() == 1) {
-            moneyOut.setCompanyId(getLoginUser().getUser().getCompanyId());
-        }
+        moneyOut.setCompanyId(getLoginUser().getUser().getCompanyId());
         startPage();
         List<MoneyOut> list = moneyOutService.selectList(moneyOut);
         return getDataTable(list);
@@ -68,7 +66,7 @@ public class MoneyOutController extends BaseController {
     }
 
     @PreAuthorize("@ss.hasPermi('work:out:add')")
-    @Log(title = "企业提现申请", businessType = BusinessType.INSERT)
+    @Log(title = "提现申请", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     public AjaxResult add(@Validated @RequestBody MoneyOut moneyOut) throws ServerException {
         return moneyOutService.add(moneyOut);
@@ -92,9 +90,7 @@ public class MoneyOutController extends BaseController {
     @PreAuthorize("@ss.hasPermi('work:out:export')")
     @PostMapping("/export")
     public void export(HttpServletResponse response, MoneyOut moneyOut) {
-        if (getLoginUser().getUser().getType() == 1) {
-            moneyOut.setCompanyId(getLoginUser().getUser().getCompanyId());
-        }
+        moneyOut.setCompanyId(getLoginUser().getUser().getCompanyId());
         PageUtils.orderBy("r.id desc");
         List<MoneyOut> list = moneyOutService.selectList(moneyOut);
         ExcelUtil<MoneyOut> util = new ExcelUtil<MoneyOut>(MoneyOut.class);

+ 4 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/ProjectController.java

@@ -31,9 +31,7 @@ public class ProjectController extends BaseController {
     @PreAuthorize("@ss.hasPermi('work:project:list')")
     @GetMapping("/list")
     public TableDataInfo list(Project project) {
-        if (getLoginUser().getUser().getType() == 1) {
-            project.setCompanyId(getLoginUser().getUser().getCompanyId());
-        }
+        project.setCompanyId(getLoginUser().getUser().getCompanyId());
         startPage();
         List<Project> list = projectService.selectList(project);
         return getDataTable(list);
@@ -54,21 +52,21 @@ public class ProjectController extends BaseController {
     }
 
     @PreAuthorize("@ss.hasPermi('work:project:add')")
-    @Log(title = "项目管理", businessType = BusinessType.INSERT)
+    @Log(title = "新增项目", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     public AjaxResult add(@Validated @RequestBody Project project) throws ServerException {
         return projectService.add(project);
     }
 
     @PreAuthorize("@ss.hasPermi('work:project:edit')")
-    @Log(title = "项目管理", businessType = BusinessType.UPDATE)
+    @Log(title = "编辑项目", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
     public AjaxResult edit(@Validated @RequestBody Project project) {
         return toAjax(projectService.updateById(project));
     }
 
     @PreAuthorize("@ss.hasPermi('work:project:remove')")
-    @Log(title = "项目管理", businessType = BusinessType.DELETE)
+    @Log(title = "删除项目", businessType = BusinessType.DELETE)
     @GetMapping("/remove/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(projectService.removeByIds(Arrays.asList(ids)));

+ 6 - 12
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/RechargeController.java

@@ -1,7 +1,6 @@
 package com.ruoyi.web.work.controller;
 
 import com.ruoyi.common.annotation.Log;
-import com.ruoyi.common.annotation.RepeatSubmit;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
@@ -36,9 +35,7 @@ public class RechargeController extends BaseController {
     @PreAuthorize("@ss.hasPermi('work:recharge:list')")
     @GetMapping("/list")
     public TableDataInfo list(Recharge recharge) {
-        if (getLoginUser().getUser().getType() == 1) {
-            recharge.setCompanyId(getLoginUser().getUser().getCompanyId());
-        }
+        recharge.setCompanyId(getLoginUser().getUser().getCompanyId());
         startPage();
         List<Recharge> list = rechargeService.selectList(recharge);
         return getDataTable(list);
@@ -51,34 +48,31 @@ public class RechargeController extends BaseController {
     }
 
     @PreAuthorize("@ss.hasPermi('work:recharge:add')")
-    @Log(title = "充值管理", businessType = BusinessType.INSERT)
+    @Log(title = "充值申请", businessType = BusinessType.INSERT)
     @PostMapping("/add")
-    @RepeatSubmit
     public AjaxResult add(@Validated @RequestBody Recharge recharge) {
         return rechargeService.add(recharge);
     }
 
     @PreAuthorize("@ss.hasPermi('work:recharge:edit')")
-    @Log(title = "充值管理", businessType = BusinessType.UPDATE)
+    @Log(title = "充值审核", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
     public AjaxResult edit(@Validated @RequestBody RechargeDto dto) throws ServerException {
         return rechargeService.edit(dto);
     }
 
     @PreAuthorize("@ss.hasPermi('work:recharge:remove')")
-    @Log(title = "充值管理", businessType = BusinessType.DELETE)
+    @Log(title = "充值记录删除", businessType = BusinessType.DELETE)
     @GetMapping("/remove/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(rechargeService.removeByIds(Arrays.asList(ids)));
     }
 
-    @Log(title = "充值管理", businessType = BusinessType.EXPORT)
+    @Log(title = "充值记录导出", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('work:recharge:export')")
     @PostMapping("/export")
     public void export(HttpServletResponse response, Recharge recharge) {
-        if (getLoginUser().getUser().getType() == 1) {
-            recharge.setCompanyId(getLoginUser().getUser().getCompanyId());
-        }
+        recharge.setCompanyId(getLoginUser().getUser().getCompanyId());
         PageUtils.orderBy("r.id desc");
         List<Recharge> list = rechargeService.selectList(recharge);
         ExcelUtil<Recharge> util = new ExcelUtil<Recharge>(Recharge.class);

+ 2 - 22
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/RelateController.java

@@ -37,34 +37,14 @@ public class RelateController extends BaseController {
         return getDataTable(list);
     }
 
-    @PreAuthorize("@ss.hasPermi('work:relate:query')")
-    @GetMapping(value = "/detail/{id}")
-    public AjaxResult detail(@PathVariable("id") Long id) {
-        return AjaxResult.success(relateService.getById(id));
-    }
-
-    @PreAuthorize("@ss.hasPermi('work:relate:add')")
-    @Log(title = "关联企业", businessType = BusinessType.INSERT)
-    @PostMapping("/add")
-    public AjaxResult add(@RequestBody Relate relate) {
-        return toAjax(relateService.save(relate));
-    }
-
-    @PreAuthorize("@ss.hasPermi('work:relate:edit')")
-    @Log(title = "关联企业", businessType = BusinessType.UPDATE)
-    @PostMapping("/edit")
-    public AjaxResult edit(@RequestBody Relate relate) {
-        return toAjax(relateService.updateById(relate));
-    }
-
     @PreAuthorize("@ss.hasPermi('work:relate:remove')")
-    @Log(title = "关联企业", businessType = BusinessType.DELETE)
+    @Log(title = "解除关联用户", businessType = BusinessType.DELETE)
     @GetMapping("/remove/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(relateService.removeByIds(Arrays.asList(ids)));
     }
 
-    @Log(title = "关联企业", businessType = BusinessType.EXPORT)
+    @Log(title = "导出关联用户", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('work:relate:export')")
     @PostMapping("/export")
     public void export(HttpServletResponse response, Relate relate) {

+ 13 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/StatementController.java

@@ -9,6 +9,8 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.web.work.domain.Statement;
 import com.ruoyi.web.work.domain.StatementDetail;
 import com.ruoyi.web.work.domain.dto.RejectDto;
+import com.ruoyi.web.work.domain.dto.SmsDto;
+import com.ruoyi.web.work.service.ICommonService;
 import com.ruoyi.web.work.service.IStatementDetailService;
 import com.ruoyi.web.work.service.IStatementService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,6 +36,9 @@ public class StatementController extends BaseController {
     @Autowired
     private IStatementDetailService detailService;
 
+    @Autowired
+    private ICommonService commonService;
+
     /**
      * 制单管理
      */
@@ -93,6 +98,13 @@ public class StatementController extends BaseController {
     }
 
     @PreAuthorize("@ss.hasPermi('work:statement:give')")
+    @Log(title = "发放业务费获取验证码", businessType = BusinessType.INSERT)
+    @GetMapping("/sms")
+    public AjaxResult sms() {
+        return commonService.sms(new SmsDto().setTemplateCode("SMS_465690916"));
+    }
+
+    @PreAuthorize("@ss.hasPermi('work:statement:give')")
     @Log(title = "发放业务费", businessType = BusinessType.UPDATE)
     @GetMapping("/give/send/{id}")
     public AjaxResult giveSend(@PathVariable("id") Long id) {
@@ -169,6 +181,7 @@ public class StatementController extends BaseController {
      * 结算单模板下载
      */
     @PreAuthorize("@ss.hasPermi('work:statement:make')")
+    @Log(title = "下载结算单模板", businessType = BusinessType.DOWNLOAD)
     @PostMapping("/make/download")
     public void download(HttpServletResponse response) {
         ExcelUtil<StatementDetail> util = new ExcelUtil<StatementDetail>(StatementDetail.class);

+ 6 - 11
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java

@@ -1,26 +1,21 @@
 package com.ruoyi.common.annotation;
 
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.enums.OperatorType;
 
+import java.lang.annotation.*;
+
 /**
  * 自定义操作日志记录注解
- * 
- * @author ruoyi
  *
+ * @author ruoyi
  */
-@Target({ ElementType.PARAMETER, ElementType.METHOD })
+@Target({ElementType.PARAMETER, ElementType.METHOD})
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
-public @interface Log
-{
+public @interface Log {
     /**
-     * 模块 
+     * 模块
      */
     public String title() default "";
 

+ 8 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@@ -5,12 +5,14 @@ import com.ruoyi.common.annotation.Excel.ColumnType;
 import com.ruoyi.common.annotation.Excel.Type;
 import com.ruoyi.common.annotation.Excels;
 import com.ruoyi.common.core.domain.BaseEntity;
+import com.ruoyi.common.core.validate.Regexp;
 import com.ruoyi.common.xss.Xss;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
 import javax.validation.constraints.Email;
 import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import java.util.Date;
 import java.util.List;
@@ -38,12 +40,14 @@ public class SysUser extends BaseEntity {
     /**
      * 用户账号
      */
+    @NotBlank(message = "账号不能为空")
     @Excel(name = "登录名称")
     private String userName;
 
     /**
      * 用户昵称
      */
+    @NotBlank(message = "姓名不能为空")
     @Excel(name = "用户名称")
     private String nickName;
 
@@ -56,6 +60,8 @@ public class SysUser extends BaseEntity {
     /**
      * 手机号码
      */
+    @NotBlank(message = "手机号不能为空")
+    @Pattern(regexp = Regexp.PHONE, message = "手机号不合法")
     @Excel(name = "手机号码")
     private String phonenumber;
 
@@ -73,11 +79,13 @@ public class SysUser extends BaseEntity {
     /**
      * 密码
      */
+    @NotBlank(message = "密码不能为空")
     private String password;
 
     /**
      * 帐号状态(0正常 1停用)
      */
+    @NotBlank(message = "帐号状态不能为空")
     @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
     private String status;
 

+ 5 - 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java

@@ -65,4 +65,9 @@ public enum BusinessType
      * 状态操作
      */
     STATE,
+
+    /**
+     * 下载
+     */
+    DOWNLOAD,
 }

+ 3 - 2
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java

@@ -75,6 +75,8 @@ public class LogAspect {
             operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
             // 请求的地址
             String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
+            operLog.setCompanyId(loginUser.getUser().getCompanyId());
+            operLog.setUserId(loginUser.getUserId());
             operLog.setOperIp(ip);
             operLog.setOperUrl(StringUtils.substring(ServletUtils.getRequest().getRequestURI(), 0, 255));
             if (loginUser != null) {
@@ -194,7 +196,6 @@ public class LogAspect {
                 return entry.getValue() instanceof MultipartFile;
             }
         }
-        return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse
-                || o instanceof BindingResult;
+        return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse || o instanceof BindingResult;
     }
 }

+ 19 - 29
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java

@@ -1,11 +1,5 @@
 package com.ruoyi.quartz.util;
 
-import java.util.Date;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.constant.ScheduleConstants;
 import com.ruoyi.common.utils.ExceptionUtil;
@@ -15,14 +9,20 @@ import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.quartz.domain.SysJob;
 import com.ruoyi.quartz.domain.SysJobLog;
 import com.ruoyi.quartz.service.ISysJobLogService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
 
 /**
  * 抽象quartz调用
  *
  * @author ruoyi
  */
-public abstract class AbstractQuartzJob implements Job
-{
+public abstract class AbstractQuartzJob implements Job {
     private static final Logger log = LoggerFactory.getLogger(AbstractQuartzJob.class);
 
     /**
@@ -31,21 +31,16 @@ public abstract class AbstractQuartzJob implements Job
     private static ThreadLocal<Date> threadLocal = new ThreadLocal<>();
 
     @Override
-    public void execute(JobExecutionContext context) throws JobExecutionException
-    {
+    public void execute(JobExecutionContext context) throws JobExecutionException {
         SysJob sysJob = new SysJob();
         BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES));
-        try
-        {
+        try {
             before(context, sysJob);
-            if (sysJob != null)
-            {
+            if (sysJob != null) {
                 doExecute(context, sysJob);
             }
             after(context, sysJob, null);
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             log.error("任务执行异常  - :", e);
             after(context, sysJob, e);
         }
@@ -55,10 +50,9 @@ public abstract class AbstractQuartzJob implements Job
      * 执行前
      *
      * @param context 工作执行上下文对象
-     * @param sysJob 系统计划任务
+     * @param sysJob  系统计划任务
      */
-    protected void before(JobExecutionContext context, SysJob sysJob)
-    {
+    protected void before(JobExecutionContext context, SysJob sysJob) {
         threadLocal.set(new Date());
     }
 
@@ -66,10 +60,9 @@ public abstract class AbstractQuartzJob implements Job
      * 执行后
      *
      * @param context 工作执行上下文对象
-     * @param sysJob 系统计划任务
+     * @param sysJob  系统计划任务
      */
-    protected void after(JobExecutionContext context, SysJob sysJob, Exception e)
-    {
+    protected void after(JobExecutionContext context, SysJob sysJob, Exception e) {
         Date startTime = threadLocal.get();
         threadLocal.remove();
 
@@ -81,14 +74,11 @@ public abstract class AbstractQuartzJob implements Job
         sysJobLog.setStopTime(new Date());
         long runMs = sysJobLog.getStopTime().getTime() - sysJobLog.getStartTime().getTime();
         sysJobLog.setJobMessage(sysJobLog.getJobName() + " 总共耗时:" + runMs + "毫秒");
-        if (e != null)
-        {
+        if (e != null) {
             sysJobLog.setStatus(Constants.FAIL);
             String errorMsg = StringUtils.substring(ExceptionUtil.getExceptionMessage(e), 0, 2000);
             sysJobLog.setExceptionInfo(errorMsg);
-        }
-        else
-        {
+        } else {
             sysJobLog.setStatus(Constants.SUCCESS);
         }
 
@@ -100,7 +90,7 @@ public abstract class AbstractQuartzJob implements Job
      * 执行方法,由子类重载
      *
      * @param context 工作执行上下文对象
-     * @param sysJob 系统计划任务
+     * @param sysJob  系统计划任务
      * @throws Exception 执行过程中的异常
      */
     protected abstract void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception;

+ 109 - 89
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java

@@ -1,255 +1,275 @@
 package com.ruoyi.system.domain;
 
-import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.annotation.Excel.ColumnType;
 import com.ruoyi.common.core.domain.BaseEntity;
 
+import java.util.Date;
+
 /**
  * 操作日志记录表 oper_log
- * 
+ *
  * @author ruoyi
  */
-public class SysOperLog extends BaseEntity
-{
+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删除) */
+    /**
+     * 业务类型(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手机端用户) */
+    /**
+     * 操作类别(0其它 1后台用户 2手机端用户)
+     */
     @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
     private Integer operatorType;
 
-    /** 操作人员 */
+    /**
+     * 操作人员
+     */
     @Excel(name = "操作人员")
     private String operName;
 
-    /** 部门名称 */
+    /**
+     * 部门名称
+     */
     @Excel(name = "部门名称")
     private String deptName;
 
-    /** 请求url */
+    /**
+     * 请求url
+     */
     @Excel(name = "请求地址")
     private String operUrl;
 
-    /** 操作地址 */
+    /**
+     * 操作地址
+     */
     @Excel(name = "操作地址")
     private String operIp;
 
-    /** 操作地点 */
+    /**
+     * 操作地点
+     */
     @Excel(name = "操作地点")
     private String operLocation;
 
-    /** 请求参数 */
+    /**
+     * 请求参数
+     */
     @Excel(name = "请求参数")
     private String operParam;
 
-    /** 返回参数 */
+    /**
+     * 返回参数
+     */
     @Excel(name = "返回参数")
     private String jsonResult;
 
-    /** 操作状态(0正常 1异常) */
+    /**
+     * 操作状态(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;
 
-    public Long getOperId()
-    {
+    private Long companyId;
+
+    private Long userId;
+
+    public Long getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Long companyId) {
+        this.companyId = companyId;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public Long getOperId() {
         return operId;
     }
 
-    public void setOperId(Long operId)
-    {
+    public void setOperId(Long operId) {
         this.operId = operId;
     }
 
-    public String getTitle()
-    {
+    public String getTitle() {
         return title;
     }
 
-    public void setTitle(String title)
-    {
+    public void setTitle(String title) {
         this.title = title;
     }
 
-    public Integer getBusinessType()
-    {
+    public Integer getBusinessType() {
         return businessType;
     }
 
-    public void setBusinessType(Integer businessType)
-    {
+    public void setBusinessType(Integer businessType) {
         this.businessType = businessType;
     }
 
-    public Integer[] getBusinessTypes()
-    {
+    public Integer[] getBusinessTypes() {
         return businessTypes;
     }
 
-    public void setBusinessTypes(Integer[] businessTypes)
-    {
+    public void setBusinessTypes(Integer[] businessTypes) {
         this.businessTypes = businessTypes;
     }
 
-    public String getMethod()
-    {
+    public String getMethod() {
         return method;
     }
 
-    public void setMethod(String method)
-    {
+    public void setMethod(String method) {
         this.method = method;
     }
 
-    public String getRequestMethod()
-    {
+    public String getRequestMethod() {
         return requestMethod;
     }
 
-    public void setRequestMethod(String requestMethod)
-    {
+    public void setRequestMethod(String requestMethod) {
         this.requestMethod = requestMethod;
     }
 
-    public Integer getOperatorType()
-    {
+    public Integer getOperatorType() {
         return operatorType;
     }
 
-    public void setOperatorType(Integer operatorType)
-    {
+    public void setOperatorType(Integer operatorType) {
         this.operatorType = operatorType;
     }
 
-    public String getOperName()
-    {
+    public String getOperName() {
         return operName;
     }
 
-    public void setOperName(String operName)
-    {
+    public void setOperName(String operName) {
         this.operName = operName;
     }
 
-    public String getDeptName()
-    {
+    public String getDeptName() {
         return deptName;
     }
 
-    public void setDeptName(String deptName)
-    {
+    public void setDeptName(String deptName) {
         this.deptName = deptName;
     }
 
-    public String getOperUrl()
-    {
+    public String getOperUrl() {
         return operUrl;
     }
 
-    public void setOperUrl(String operUrl)
-    {
+    public void setOperUrl(String operUrl) {
         this.operUrl = operUrl;
     }
 
-    public String getOperIp()
-    {
+    public String getOperIp() {
         return operIp;
     }
 
-    public void setOperIp(String operIp)
-    {
+    public void setOperIp(String operIp) {
         this.operIp = operIp;
     }
 
-    public String getOperLocation()
-    {
+    public String getOperLocation() {
         return operLocation;
     }
 
-    public void setOperLocation(String operLocation)
-    {
+    public void setOperLocation(String operLocation) {
         this.operLocation = operLocation;
     }
 
-    public String getOperParam()
-    {
+    public String getOperParam() {
         return operParam;
     }
 
-    public void setOperParam(String operParam)
-    {
+    public void setOperParam(String operParam) {
         this.operParam = operParam;
     }
 
-    public String getJsonResult()
-    {
+    public String getJsonResult() {
         return jsonResult;
     }
 
-    public void setJsonResult(String jsonResult)
-    {
+    public void setJsonResult(String jsonResult) {
         this.jsonResult = jsonResult;
     }
 
-    public Integer getStatus()
-    {
+    public Integer getStatus() {
         return status;
     }
 
-    public void setStatus(Integer status)
-    {
+    public void setStatus(Integer status) {
         this.status = status;
     }
 
-    public String getErrorMsg()
-    {
+    public String getErrorMsg() {
         return errorMsg;
     }
 
-    public void setErrorMsg(String errorMsg)
-    {
+    public void setErrorMsg(String errorMsg) {
         this.errorMsg = errorMsg;
     }
 
-    public Date getOperTime()
-    {
+    public Date getOperTime() {
         return operTime;
     }
 
-    public void setOperTime(Date operTime)
-    {
+    public void setOperTime(Date operTime) {
         this.operTime = operTime;
     }
 }

+ 5 - 3
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java

@@ -1,8 +1,10 @@
 package com.ruoyi.system.service;
 
-import java.util.List;
 import com.ruoyi.system.domain.SysOperLog;
 
+import java.rmi.ServerException;
+import java.util.List;
+
 /**
  * 操作日志 服务层
  * 
@@ -31,7 +33,7 @@ public interface ISysOperLogService
      * @param operIds 需要删除的操作日志ID
      * @return 结果
      */
-    public int deleteOperLogByIds(Long[] operIds);
+    public int deleteOperLogByIds(Long[] operIds) throws ServerException;
 
     /**
      * 查询操作日志详细
@@ -44,5 +46,5 @@ public interface ISysOperLogService
     /**
      * 清空操作日志
      */
-    public void cleanOperLog();
+    public void cleanOperLog() throws ServerException;
 }

+ 23 - 20
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java

@@ -1,67 +1,68 @@
 package com.ruoyi.system.service.impl;
 
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.system.domain.SysOperLog;
 import com.ruoyi.system.mapper.SysOperLogMapper;
 import com.ruoyi.system.service.ISysOperLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.rmi.ServerException;
+import java.util.List;
 
 /**
  * 操作日志 服务层处理
- * 
+ *
  * @author ruoyi
  */
 @Service
-public class SysOperLogServiceImpl implements ISysOperLogService
-{
+public class SysOperLogServiceImpl implements ISysOperLogService {
     @Autowired
     private SysOperLogMapper operLogMapper;
 
     /**
      * 新增操作日志
-     * 
+     *
      * @param operLog 操作日志对象
      */
     @Override
-    public void insertOperlog(SysOperLog operLog)
-    {
+    public void insertOperlog(SysOperLog operLog) {
         operLogMapper.insertOperlog(operLog);
     }
 
     /**
      * 查询系统操作日志集合
-     * 
+     *
      * @param operLog 操作日志对象
      * @return 操作日志集合
      */
     @Override
-    public List<SysOperLog> selectOperLogList(SysOperLog operLog)
-    {
+    public List<SysOperLog> selectOperLogList(SysOperLog operLog) {
         return operLogMapper.selectOperLogList(operLog);
     }
 
     /**
      * 批量删除系统操作日志
-     * 
+     *
      * @param operIds 需要删除的操作日志ID
      * @return 结果
      */
     @Override
-    public int deleteOperLogByIds(Long[] operIds)
-    {
+    public int deleteOperLogByIds(Long[] operIds) throws ServerException {
+        if (SecurityUtils.getLoginUser().getUser().getType() == 1) {
+            throw new ServerException("企业用户不允许删除日志");
+        }
         return operLogMapper.deleteOperLogByIds(operIds);
     }
 
     /**
      * 查询操作日志详细
-     * 
+     *
      * @param operId 操作ID
      * @return 操作日志对象
      */
     @Override
-    public SysOperLog selectOperLogById(Long operId)
-    {
+    public SysOperLog selectOperLogById(Long operId) {
         return operLogMapper.selectOperLogById(operId);
     }
 
@@ -69,8 +70,10 @@ public class SysOperLogServiceImpl implements ISysOperLogService
      * 清空操作日志
      */
     @Override
-    public void cleanOperLog()
-    {
+    public void cleanOperLog() throws ServerException {
+        if (SecurityUtils.getLoginUser().getUser().getType() == 1) {
+            throw new ServerException("企业用户不允许删除日志");
+        }
         operLogMapper.cleanOperLog();
     }
 }

+ 7 - 2
ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml

@@ -21,6 +21,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="status"         column="status"         />
 		<result property="errorMsg"       column="error_msg"      />
 		<result property="operTime"       column="oper_time"      />
+		<result property="companyId"       column="company_id"      />
+		<result property="userId"       column="user_id"      />
 	</resultMap>
 
 	<sql id="selectOperLogVo">
@@ -29,13 +31,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
     
 	<insert id="insertOperlog" parameterType="SysOperLog">
-		insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time)
-        values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate())
+		insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time,company_id,user_id)
+        values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate(),#{companyId},#{userId})
 	</insert>
 	
 	<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
 		<include refid="selectOperLogVo"/>
 		<where>
+			<if test="companyId != null">
+				AND company_id = #{companyId}
+			</if>
 			<if test="title != null and title != ''">
 				AND title like concat('%', #{title}, '%')
 			</if>