物资LOG日志

This commit is contained in:
syruan 2024-04-12 16:19:28 +08:00
parent c83193c9a9
commit 77c740164c
10 changed files with 413 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.system.api;
import com.bonus.sgzb.system.api.domain.BmNumLogs;
import com.bonus.sgzb.system.api.domain.SysOperLog;
import com.bonus.sgzb.system.api.factory.RemoteLogFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
@ -29,6 +30,17 @@ public interface RemoteLogService
@PostMapping("/operlog")
public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
/**
* 保存物资记录日志
* @param bmNumLogs 物资信息
* @param source 请求来源
* @return 结果
* @throws Exception 异常信息
*/
@PostMapping("/bm_num_logs")
public R<Boolean> saveNumberLog(@RequestBody BmNumLogs bmNumLogs, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
/**
* 保存访问记录
*

View File

@ -0,0 +1,85 @@
package com.bonus.sgzb.system.api.domain;
import java.time.LocalDateTime;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
/**
* @author syruan
*/
@Getter
@Setter
public class BmNumLogs extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
@Excel(name = "ID")
private Integer id;
/**
* 模块名称/title标题
*/
@Excel(name = "模块名称/title标题")
private String modelTitle;
/**
* 接口地址/请求方法
*/
@Excel(name = "接口地址/请求方法")
private String method;
/**
* 实例
*/
@Excel(name = "实例/任务")
private String task;
/**
* 规格id
*/
@Excel(name = "规格id")
private Integer typeId;
/**
* 描述/请求参数/实体
*/
@Excel(name = "描述/请求参数/实体")
private String description;
/**
* 响应内容/状态码/返回参数
*/
@Excel(name = "响应内容/状态码/返回参数")
private String jsonResult;
/**
* 请求时间
*/
@Excel(name = "请求时间")
private LocalDateTime time;
/**
* 创建人
*/
@Excel(name = "创建人")
private String creator;
/**
* 备注
*/
@Excel(name = "备注")
private String remark;
/**
* 状态: 默认0, 其他值则为异常
*/
@Excel(name = "状态")
private Byte status;
}

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.system.api.factory;
import com.bonus.sgzb.system.api.domain.BmNumLogs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
@ -31,6 +32,11 @@ public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogServic
return R.fail("保存操作日志失败:" + throwable.getMessage());
}
@Override
public R<Boolean> saveNumberLog(BmNumLogs bmNumLogs, String source) throws Exception {
return R.fail("保存物资库存日志失败:" + throwable.getMessage());
}
@Override
public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source)
{

View File

@ -33,6 +33,7 @@ import java.util.Map;
@RestController
@Slf4j
public class TokenController {
@Autowired
private TokenService tokenService;

View File

@ -0,0 +1,54 @@
package com.bonus.sgzb.material.controller;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.security.annotation.InnerAuth;
import com.bonus.sgzb.system.api.domain.BmNumLogs;
import com.bonus.sgzb.material.service.impl.BmNumLogsService;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* (bm_num_logs)表控制层
*
* @author syruan
*/
@RestController
@RequestMapping("/bm_num_logs")
public class BmNumLogsController extends BaseController {
/**
* 服务对象
*/
@Autowired
private BmNumLogsService bmNumLogsService;
@GetMapping("/list")
public TableDataInfo list() {
startPage();
List<BmNumLogs> list = bmNumLogsService.selectAll();
return getDataTable(list);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("selectByPrimaryKey")
public BmNumLogs selectByPrimaryKey(Integer id) {
return bmNumLogsService.selectByPrimaryKey(id);
}
@InnerAuth
@PostMapping
public AjaxResult add(@RequestBody BmNumLogs bmNumLogs) {
return toAjax(bmNumLogsService.insert(bmNumLogs));
}
}

View File

@ -0,0 +1,23 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.system.api.domain.BmNumLogs;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface BmNumLogsMapper {
int deleteByPrimaryKey(Integer id);
int insert(BmNumLogs record);
int insertSelective(BmNumLogs record);
BmNumLogs selectByPrimaryKey(Integer id);
List<BmNumLogs> selectAll();
int updateByPrimaryKeySelective(BmNumLogs record);
int updateByPrimaryKey(BmNumLogs record);
}

View File

@ -0,0 +1,50 @@
package com.bonus.sgzb.material.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.bonus.sgzb.system.api.domain.BmNumLogs;
import com.bonus.sgzb.material.mapper.BmNumLogsMapper;
import java.util.List;
@Service
public class BmNumLogsService{
@Autowired
private BmNumLogsMapper bmNumLogsMapper;
public int deleteByPrimaryKey(Integer id) {
return bmNumLogsMapper.deleteByPrimaryKey(id);
}
public int insert(BmNumLogs record) {
return bmNumLogsMapper.insert(record);
}
public List<BmNumLogs> selectAll() {
return bmNumLogsMapper.selectAll();
}
public int insertSelective(BmNumLogs record) {
return bmNumLogsMapper.insertSelective(record);
}
public BmNumLogs selectByPrimaryKey(Integer id) {
return bmNumLogsMapper.selectByPrimaryKey(id);
}
public int updateByPrimaryKeySelective(BmNumLogs record) {
return bmNumLogsMapper.updateByPrimaryKeySelective(record);
}
public int updateByPrimaryKey(BmNumLogs record) {
return bmNumLogsMapper.updateByPrimaryKey(record);
}
}

View File

@ -0,0 +1,172 @@
<?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.bonus.sgzb.material.mapper.BmNumLogsMapper">
<resultMap id="BaseResultMap" type="com.bonus.sgzb.system.api.domain.BmNumLogs">
<!--@mbg.generated-->
<!--@Table bm_num_logs-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="model_title" jdbcType="VARCHAR" property="modelTitle" />
<result column="method" jdbcType="VARCHAR" property="method" />
<result column="task" jdbcType="VARCHAR" property="task" />
<result column="type_id" jdbcType="INTEGER" property="typeId" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="json_result" jdbcType="VARCHAR" property="jsonResult" />
<result column="time" jdbcType="TIMESTAMP" property="time" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="status" jdbcType="TINYINT" property="status" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, model_title, `method`, task, type_id, description, json_result, `time`, creator,
remark, status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from bm_num_logs
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from bm_num_logs
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from bm_num_logs
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.system.api.domain.BmNumLogs" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into bm_num_logs (model_title, `method`, task,
type_id, description, json_result,
`time`, creator, remark
)
values (#{modelTitle,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{task,jdbcType=VARCHAR},
#{typeId,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{jsonResult,jdbcType=VARCHAR},
#{time,jdbcType=TIMESTAMP}, #{creator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.system.api.domain.BmNumLogs" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into bm_num_logs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modelTitle != null and modelTitle != ''">
model_title,
</if>
<if test="method != null and method != ''">
`method`,
</if>
<if test="task != null and task != ''">
task,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="description != null and description != ''">
description,
</if>
<if test="jsonResult != null and jsonResult != ''">
json_result,
</if>
<if test="time != null">
`time`,
</if>
<if test="creator != null and creator != ''">
creator,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelTitle != null and modelTitle != ''">
#{modelTitle,jdbcType=VARCHAR},
</if>
<if test="method != null and method != ''">
#{method,jdbcType=VARCHAR},
</if>
<if test="task != null and task != ''">
#{task,jdbcType=VARCHAR},
</if>
<if test="typeId != null">
#{typeId,jdbcType=INTEGER},
</if>
<if test="description != null and description != ''">
#{description,jdbcType=VARCHAR},
</if>
<if test="jsonResult != null and jsonResult != ''">
#{jsonResult,jdbcType=VARCHAR},
</if>
<if test="time != null">
#{time,jdbcType=TIMESTAMP},
</if>
<if test="creator != null and creator != ''">
#{creator,jdbcType=VARCHAR},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.sgzb.system.api.domain.BmNumLogs">
<!--@mbg.generated-->
update bm_num_logs
<set>
<if test="modelTitle != null and modelTitle != ''">
model_title = #{modelTitle,jdbcType=VARCHAR},
</if>
<if test="method != null and method != ''">
`method` = #{method,jdbcType=VARCHAR},
</if>
<if test="task != null and task != ''">
task = #{task,jdbcType=VARCHAR},
</if>
<if test="typeId != null">
type_id = #{typeId,jdbcType=INTEGER},
</if>
<if test="description != null and description != ''">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="jsonResult != null and jsonResult != ''">
json_result = #{jsonResult,jdbcType=VARCHAR},
</if>
<if test="time != null">
`time` = #{time,jdbcType=TIMESTAMP},
</if>
<if test="creator != null and creator != ''">
creator = #{creator,jdbcType=VARCHAR},
</if>
<if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bonus.sgzb.system.api.domain.BmNumLogs">
<!--@mbg.generated-->
update bm_num_logs
set model_title = #{modelTitle,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
task = #{task,jdbcType=VARCHAR},
type_id = #{typeId,jdbcType=INTEGER},
description = #{description,jdbcType=VARCHAR},
json_result = #{jsonResult,jdbcType=VARCHAR},
`time` = #{time,jdbcType=TIMESTAMP},
creator = #{creator,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -319,10 +319,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) t
GROUP BY task_id
</select>
<select id="selectnotScrapByTaskId" resultType="com.bonus.sgzb.material.domain.ScrapApplyDetails">
<include refid="selectScrapApplyDetailsVo"/>
where task_id = #{taskId} and status = '0'
</select>
<select id="getBackApplyInfo" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
select id,
code,
@ -338,6 +340,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from back_apply_info
where id = #{parentId}
</select>
<select id="getRepairAudit" resultType="com.bonus.sgzb.material.domain.RepairAuditDetails">
select id,
task_id as taskId,
@ -350,11 +353,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from repair_audit_details
where id = #{parentId}
</select>
<select id="getRepairId" resultType="java.lang.String">
select repair_id
from repair_audit_details
where id = #{parentId}
</select>
<select id="getByRepairId" resultType="com.bonus.sgzb.material.domain.RepairAuditDetails">
select task_id as taskId,
ma_id as maId,
@ -362,6 +367,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from repair_apply_details
where id = #{repairId}
</select>
<select id="getRepairRecord" resultType="com.bonus.sgzb.material.domain.RepairRecord">
select scrap_num as scrapNum,
scrap_reason as scrapReason,
@ -379,11 +385,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and rar.type_id = #{typeId}
</if>
</select>
<select id="getFileUrl" resultType="java.lang.String">
select file_url
from sys_file_info
where id = #{s}
</select>
<select id="getGyoupRepairRecord" resultType="com.bonus.sgzb.material.domain.RepairRecord">
select sum(scrap_num) as scrapNum,
scrap_reason as scrapReason,

View File

@ -32,8 +32,8 @@ import com.bonus.sgzb.system.service.ISysOperLogService;
*/
@RestController
@RequestMapping("/operlog")
public class SysOperlogController extends BaseController
{
public class SysOperlogController extends BaseController {
@Autowired
private ISysOperLogService operLogService;