短信模版

This commit is contained in:
愉快的大福 2024-07-23 10:05:14 +08:00
parent a4cb7a1dcc
commit 665d7ce5f2
10 changed files with 557 additions and 112 deletions

View File

@ -0,0 +1,37 @@
import request from '@/utils/request'
// 分页查询所有的订单信息
export function getListApi(query) {
return request({
url: 'sysLog',
method: 'get',
params: query
})
}
//
export function deleteApi(ids) {
return request({
url: 'sysLog?idList=' + ids,
method: 'delete'
})
}
//
export function saveApi(data) {
return request({
url: 'sysLog',
method: 'post',
data: data
})
}
// 保存修改信息
export function updateApi(data) {
return request({
url: 'sysLog',
method: 'put',
data: data
})
}

View File

@ -0,0 +1,366 @@
<template>
<div class="app-container">
<el-card >
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="中台系统" name="first"></el-tab-pane>
<el-tab-pane label="油站系统" name="second"></el-tab-pane>
</el-tabs>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="90px">
<el-form-item label="" prop="createName">
<el-input
v-model="queryParams.createName"
placeholder="请输入用户名称"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="deptId">
<el-select
v-model="queryParams.deptId"
placeholder="请选择机构"
clearable
style="width: 240px"
>
<el-option
v-for="item in deptListSelect"
:key="item.deptId"
:label="item.deptName"
:value="item.deptId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="" prop="moudle">
<el-input
v-model="queryParams.moudle"
placeholder="请输入操作模块"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="turnoverType" >
<el-date-picker
v-model="queryParams.startTime"
style="width: 140px"
type="date"
value-format="yyyy-MM-dd"
placeholder="开始日期">
</el-date-picker>
<el-date-picker
v-model="queryParams.endTime"
style="width: 140px"
type="date"
value-format="yyyy-MM-dd"
placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item style="float: right">
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table :data="tableData" style="width: 100%">
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="createAccount" label="登录账号"></el-table-column>
<el-table-column prop="createName" label="操作用户"></el-table-column>
<el-table-column prop="deptName" label="所属机构"></el-table-column>
<el-table-column prop="systemName" label="系统终端">
<template slot-scope="scope">
<div v-if="scope.row.systemName==1">
中台端
</div>
<div v-else>
油站端
</div>
</template>
</el-table-column>
<el-table-column prop="moudle" label="操作模块"></el-table-column>
<el-table-column prop="content" label="操作内容"></el-table-column>
<el-table-column prop="ipAddr" label="IP地址"></el-table-column>
<el-table-column prop="createTime" label="操作时间"></el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="50%" append-to-body>
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item label="商品名称" prop="name">
<el-input v-model="form.name" style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="商品分类" prop="categoryName">
<el-select v-model="form.categoryName" style="width: 150px" placeholder="全部">
<el-option
v-for="dict in dict.type.hardware_type"
:key="dict.label"
:label="dict.label"
:value="dict.label"
/>
</el-select>
</el-form-item>
<el-form-item label="采购商家" prop="formStore">
<el-input v-model="form.formStore" style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="图片" prop="image">
<ImageUpload v-model="form.image"></ImageUpload>
</el-form-item>
<el-form-item label="商品介绍" prop="content">
<el-input type="textarea" v-model="form.content"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('form')">提交</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import {deleteApi, getListApi, saveApi, updateApi} from "@/api/setting/sysLog";
import { getToken } from '@/utils/auth'
import {selectChildByDeptId} from "@/api/system/Site/site";
export default {
name: "printIndex",
dicts: ['hardware_type','hardware_status'],
data() {
return {
tableData: [],
activeName:'first',
form: {
},
deptListSelect:[],
systemPositionList:[{
value: '首页',
label: '首页'
}, {
value: '系统首页',
label: '系统首页'
},],
//
open: false,
title:"",
total:0,
//
queryParams: {
page: 1,
pageSize: 10,
bannerName:'',
systemPosition:'',
bannerStatus:'',
},
//
uploadAction: process.env.VUE_APP_BASE_API + 'backendApi/file/upload',
uploadHeader: { 'Access-Token' : getToken() }, //
uploadFiles: [
{name:"nihao",
url:'http://localhost:8008/static/uploadImages/20231103/ffbbe7d3ee1441fdaf706802fa0f176a.png'}
],
//
imagePath: process.env.VUE_APP_BASE_API,
//
hideUpload: false,
//
rules: {
name: [
{ required: true, message: "商品名称不能为空", trigger: "blur" }
],
categoryName: [
{ required: true, message: "商品分类不能为空", trigger: "blur" }
],
formStore: [
{ required: true, message: "采购商家不能为空", trigger: "blur" }
],
image: [
{ required: true, message: "商品图片不能为空", trigger: "blur" }
],
content: [
{ required: true, message: "商品介绍不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList()
this.selectChildByDeptIdApi()
},
methods: {
selectChildByDeptIdApi() {
selectChildByDeptId().then(res=>{
this.deptListSelect = res.data
})
},
handleClick(tab, event) {
if (tab.$options.propsData.name == 'first'){
this.queryParams.systemName ='1'
}else {
this.queryParams.systemName ='2'
}
this.getList()
},
getList(){
getListApi(this.queryParams).then(res=>{
this.tableData = res.data.records;
this.total = res.data.total
})
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
//
this.submitDeviceInfo();
} else {
//
return false;
}
});
},
submitDeviceInfo() {
//
console.log('提交设备信息数据:', this.form);
if (this.form.id) {
updateApi(this.form).then(res=>{
if(res.code === 200) {
this.getList()
this.open = false
}
})
}else {
saveApi(this.form).then(res=>{
if(res.code === 200) {
this.getList()
this.open = false
}
})
}
},
changeStatus(data){
updateApi(data).then(res=>{
if(res.code === 200) {
this.$message({
type: 'success',
message: '修改状态成功!'
});
this.getList()
}
})
},
//
handleUploadSuccessCover(file) {
this.form.productImage = file.data.fileName;
this.form.productImage = file.data.fileName;
},
handleQuery(){
this.getList()
},
resetQuery(){
this.queryParams = {
page: 1,
pageSize: 10,
deviceName:'',
},
this.getList()
},
handleAdd(e) {
this.clean()
this.open = true;
this.title = "新增商品"
},
edit(e) {
this.clean()
this.open = true;
this.title = "修改商品"
this.form = e
},
del(e) {
this.$confirm('此操作将永久删除该商品, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteApi(e.id).then(res=>{
if (res.code == 200) {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList()
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
clean() {
this.form= {
id: null, // id
bannerName: '', // Banner
productImage: '', //
systemPosition: '', //
sortOrder: null, //
bannerLink: '', // Banner
bannerStatus: false, // Banner
note: '', //
createByName: '', //
}
},
}
};
</script>
<style lang="scss" scoped>
.common-dialog >>> .el-upload--picture-card {
width: 60px;
height: 50px;
line-height: 60px;
}
.d-dialog >>> .el-upload--picture-card {
width: 100px;
height: 100px;
line-height: 100px;
}
.d-dialog >>> .avatar-uploader .el-upload {
width: 100px;
height: 100px;
}
.d-dialog >>> .el-upload-list--picture-card .el-upload-list__item {
width: 100px;
height: 100px;
}
.list-img{
width: 98px;
height: 98px;
}
</style>

View File

@ -5,8 +5,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.service.CommissionRecordService;
import com.fuint.business.commission.vo.CommissionRecordVo;
import com.fuint.business.setting.entity.SysLog;
import com.fuint.business.setting.service.SysLogService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.lettuce.core.dynamic.annotation.Param;
@ -82,7 +85,8 @@ public class CommissionRecordController extends BaseController {
*/
@PostMapping
public ResponseObject add(@RequestBody CommissionRecord commissionRecord) {
return getSuccessResult(this.commissionRecordService.insert(commissionRecord));
CommissionRecord insert = this.commissionRecordService.insert(commissionRecord);
return getSuccessResult(insert);
}
/**

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.StaffCommission;
import com.fuint.business.commission.service.StaffCommissionService;
import com.fuint.business.commission.vo.StaffCommissionVo;
import com.fuint.business.setting.entity.SysLog;
import com.fuint.business.setting.service.SysLogService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,6 +21,8 @@ import org.springframework.web.bind.annotation.*;
public class StaffCommissionController extends BaseController {
@Autowired
private StaffCommissionService commissionService;
@Autowired
private SysLogService sysLogService;
/**
* 根据条件分页查询员工提成方案信息
@ -64,6 +68,12 @@ public class StaffCommissionController extends BaseController {
*/
@DeleteMapping("/{id}")
public ResponseObject remove(@PathVariable Integer id){
StaffCommission staffCommission = commissionService.getById(id);
SysLog sysLog =new SysLog();
sysLog.setSystemName("2");
sysLog.setMoudle("短信模版");
sysLog.setContent("删除了模版名称为"+staffCommission.getName()+"的数据");
sysLogService.saveVo(sysLog);
commissionService.deleteCommissionById(id);
return getSuccessResult("操作成功");
}
@ -76,6 +86,11 @@ public class StaffCommissionController extends BaseController {
@PostMapping
public ResponseObject add(@Validated @RequestBody StaffCommission commission){
int row = commissionService.insertStaffCommission(commission);
SysLog sysLog =new SysLog();
sysLog.setSystemName("2");
sysLog.setMoudle("提成方案");
sysLog.setContent("新增了一条数据");
sysLogService.saveVo(sysLog);
return getSuccessResult(row);
}
@ -87,6 +102,11 @@ public class StaffCommissionController extends BaseController {
@PutMapping
public ResponseObject edit(@Validated @RequestBody StaffCommission commission){
int row = commissionService.updateStaffCommission(commission);
SysLog sysLog =new SysLog();
sysLog.setSystemName("2");
sysLog.setMoudle("提成方案");
sysLog.setContent("修改了方案名称为"+commission.getName()+"的方案");
sysLogService.saveVo(sysLog);
return getSuccessResult(row);
}

View File

@ -6,12 +6,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.setting.entity.HardwareStore;
import com.fuint.business.setting.entity.SysLog;
import com.fuint.business.setting.service.HardwareStoreService;
import com.fuint.business.setting.service.SysLogService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -32,6 +35,8 @@ public class HardwareStoreController extends BaseController {
*/
@Resource
private HardwareStoreService hardwareStoreService;
@Autowired
private SysLogService sysLogService;
/**
* 分页查询所有数据
@ -77,6 +82,11 @@ public class HardwareStoreController extends BaseController {
//获取当前登录用户
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
hardwareStore.setCreateName(nowAccountInfo.getRealName());
SysLog sysLog =new SysLog();
sysLog.setSystemName("1");
sysLog.setMoudle("硬件商城");
sysLog.setContent("新增了硬件名称为"+hardwareStore.getName()+"的数据");
sysLogService.saveVo(sysLog);
return getSuccessResult(this.hardwareStoreService.save(hardwareStore));
}
@ -88,6 +98,11 @@ public class HardwareStoreController extends BaseController {
*/
@PutMapping
public ResponseObject update(@RequestBody HardwareStore hardwareStore) {
SysLog sysLog =new SysLog();
sysLog.setSystemName("1");
sysLog.setMoudle("硬件商城");
sysLog.setContent("更新了硬件名称为"+hardwareStore.getName()+"的数据");
sysLogService.saveVo(sysLog);
return getSuccessResult(this.hardwareStoreService.updateById(hardwareStore));
}
@ -99,6 +114,15 @@ public class HardwareStoreController extends BaseController {
*/
@DeleteMapping
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
for (Long aLong : idList) {
HardwareStore hardwareStore = hardwareStoreService.getById(aLong);
SysLog sysLog =new SysLog();
sysLog.setSystemName("1");
sysLog.setMoudle("硬件商城");
sysLog.setContent("删除了硬件名称为"+hardwareStore.getName()+"的数据");
sysLogService.saveVo(sysLog);
}
return getSuccessResult(this.hardwareStoreService.removeByIds(idList));
}
}

View File

@ -5,11 +5,14 @@ package com.fuint.business.setting.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.setting.entity.MessageTemplate;
import com.fuint.business.setting.entity.SysLog;
import com.fuint.business.setting.service.MessageTemplateService;
import com.fuint.business.setting.service.SysLogService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -30,7 +33,8 @@ public class MessageTemplateController extends BaseController {
*/
@Resource
private MessageTemplateService messageTemplateService;
@Autowired
private SysLogService sysLogService;
/**
* 分页查询所有数据
*
@ -64,6 +68,11 @@ public class MessageTemplateController extends BaseController {
public ResponseObject insert(@RequestBody MessageTemplate messageTemplate) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
messageTemplate.setCreateName(nowAccountInfo.getRealName());
SysLog sysLog =new SysLog();
sysLog.setSystemName("1");
sysLog.setMoudle("短信模版");
sysLog.setContent("新增了模版名称为"+messageTemplate.getName()+"的数据");
sysLogService.saveVo(sysLog);
return getSuccessResult(this.messageTemplateService.save(messageTemplate));
}
@ -75,6 +84,11 @@ public class MessageTemplateController extends BaseController {
*/
@PutMapping
public ResponseObject update(@RequestBody MessageTemplate messageTemplate) {
SysLog sysLog =new SysLog();
sysLog.setSystemName("1");
sysLog.setMoudle("短信模版");
sysLog.setContent("更新了模版名称为"+messageTemplate.getName()+"的数据");
sysLogService.saveVo(sysLog);
return getSuccessResult(this.messageTemplateService.updateById(messageTemplate));
}
@ -86,6 +100,14 @@ public class MessageTemplateController extends BaseController {
*/
@DeleteMapping
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
for (Long aLong : idList) {
MessageTemplate messageTemplate = messageTemplateService.getById(aLong);
SysLog sysLog =new SysLog();
sysLog.setSystemName("1");
sysLog.setMoudle("短信模版");
sysLog.setContent("删除了模版名称为"+messageTemplate.getName()+"的数据");
sysLogService.saveVo(sysLog);
}
return getSuccessResult(this.messageTemplateService.removeByIds(idList));
}
}

View File

@ -2,12 +2,17 @@ package com.fuint.business.setting.controller;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.setting.entity.HardwareStore;
import com.fuint.business.setting.entity.SysLog;
import com.fuint.business.setting.service.SysLogService;
import com.fuint.common.util.StringUtils;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -38,7 +43,26 @@ public class SysLogController extends BaseController {
*/
@GetMapping
public ResponseObject selectAll(Page<SysLog> page, SysLog sysLog) {
return getSuccessResult(this.sysLogService.page(page, new QueryWrapper<>(sysLog)));
LambdaQueryWrapper<SysLog> sysLogLambdaQueryWrapper = new LambdaQueryWrapper();
if (!StringUtils.isEmpty(sysLog.getCreateName())){
sysLogLambdaQueryWrapper.like(SysLog::getCreateName,sysLog.getCreateName());
}
if (!StringUtils.isEmpty(sysLog.getDeptId())){
sysLogLambdaQueryWrapper.eq(SysLog::getDeptId,sysLog.getDeptId());
}
if (!StringUtils.isEmpty(sysLog.getMoudle())){
sysLogLambdaQueryWrapper.like(SysLog::getMoudle,sysLog.getMoudle());
}
if (!StringUtils.isEmpty(sysLog.getSystemName())){
sysLogLambdaQueryWrapper.eq(SysLog::getSystemName,sysLog.getSystemName());
}
if (!ObjectUtils.isEmpty(sysLog.getStartTime())){
sysLogLambdaQueryWrapper.ge(SysLog::getCreateTime,sysLog.getStartTime());
}
if (!ObjectUtils.isEmpty(sysLog.getEndTime())){
sysLogLambdaQueryWrapper.le(SysLog::getCreateTime, DateUtil.format(sysLog.getEndTime(),"yyyy-MM-dd")+" 23:59:59");
}
return getSuccessResult(this.sysLogService.page(page, sysLogLambdaQueryWrapper));
}
/**

View File

@ -1,7 +1,15 @@
package com.fuint.business.setting.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
@ -10,9 +18,9 @@ import java.io.Serializable;
* @author makejava
* @since 2024-07-18 15:37:16
*/
@SuppressWarnings("serial")
@Data
public class SysLog extends Model<SysLog> {
@TableId(type = IdType.AUTO)
private Integer id;
//ip地址
private String ipAddr;
@ -22,6 +30,8 @@ public class SysLog extends Model<SysLog> {
private String moudle;
//1中台端2油站端
private String systemName;
//机构主键
private String deptId;
//机构名称
private String deptName;
//登录账户
@ -29,6 +39,7 @@ public class SysLog extends Model<SysLog> {
//创建人名称
private String createName;
//创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
//创建人
private String createBy;
@ -36,112 +47,13 @@ public class SysLog extends Model<SysLog> {
private Date updateTime;
//更新人
private String updateBy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getIpAddr() {
return ipAddr;
}
public void setIpAddr(String ipAddr) {
this.ipAddr = ipAddr;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getMoudle() {
return moudle;
}
public void setMoudle(String moudle) {
this.moudle = moudle;
}
public String getSystemName() {
return systemName;
}
public void setSystemName(String systemName) {
this.systemName = systemName;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getCreateAccount() {
return createAccount;
}
public void setCreateAccount(String createAccount) {
this.createAccount = createAccount;
}
public String getCreateName() {
return createName;
}
public void setCreateName(String createName) {
this.createName = createName;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
/**
* 获取主键值
*
* @return 主键值
*/
@Override
protected Serializable pkVal() {
return this.id;
}
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date startTime;
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endTime;
}

View File

@ -10,6 +10,7 @@ import com.fuint.business.setting.entity.SysLog;
* @since 2024-07-18 15:37:16
*/
public interface SysLogService extends IService<SysLog> {
void saveVo(SysLog sysLog);
}

View File

@ -4,7 +4,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.setting.mapper.SysLogMapper;
import com.fuint.business.setting.entity.SysLog;
import com.fuint.business.setting.service.SysLogService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.system.dept.entity.SysDept;
import com.fuint.system.dept.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* (SysLog)表服务实现类
@ -14,6 +24,31 @@ import org.springframework.stereotype.Service;
*/
@Service("sysLogService")
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
@Autowired
private ISysDeptService deptService;
@Override
public void saveVo(SysLog sysLog) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String ipAddress = request.getHeader("X-Forwarded-For");
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getHeader("Proxy-Client-IP");
}
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getHeader("WL-Proxy-Client-IP");
}
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getRemoteAddr();
}
sysLog.setIpAddr(ipAddress);
//获取当前登录用户
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
sysLog.setCreateAccount(nowAccountInfo.getAccountName());
sysLog.setCreateName(nowAccountInfo.getRealName());
SysDept sysDept = deptService.selectDeptById(nowAccountInfo.getDeptId());
sysLog.setDeptId(sysDept.getDeptId().toString());
sysLog.setDeptName(sysDept.getDeptName());
this.save(sysLog);
}
}