diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/RemoteLogService.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/RemoteLogService.java index 20ab7c1b..bfb0168f 100644 --- a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/RemoteLogService.java +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/RemoteLogService.java @@ -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 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 saveNumberLog(@RequestBody BmNumLogs bmNumLogs, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception; + + /** * 保存访问记录 * diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/domain/BmNumLogs.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/domain/BmNumLogs.java new file mode 100644 index 00000000..dd10acdd --- /dev/null +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/domain/BmNumLogs.java @@ -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; + +} \ No newline at end of file diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/factory/RemoteLogFallbackFactory.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/factory/RemoteLogFallbackFactory.java index 19045eef..f25abcec 100644 --- a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/factory/RemoteLogFallbackFactory.java +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/system/api/factory/RemoteLogFallbackFactory.java @@ -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 saveNumberLog(BmNumLogs bmNumLogs, String source) throws Exception { + return R.fail("保存物资库存日志失败:" + throwable.getMessage()); + } + @Override public R saveLogininfor(SysLogininfor sysLogininfor, String source) { diff --git a/sgzb-auth/src/main/java/com/bonus/sgzb/auth/controller/TokenController.java b/sgzb-auth/src/main/java/com/bonus/sgzb/auth/controller/TokenController.java index 516d7fc1..644a0d17 100644 --- a/sgzb-auth/src/main/java/com/bonus/sgzb/auth/controller/TokenController.java +++ b/sgzb-auth/src/main/java/com/bonus/sgzb/auth/controller/TokenController.java @@ -33,6 +33,7 @@ import java.util.Map; @RestController @Slf4j public class TokenController { + @Autowired private TokenService tokenService; diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/BmNumLogsController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/BmNumLogsController.java new file mode 100644 index 00000000..c6dc4e47 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/BmNumLogsController.java @@ -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 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)); + } + + +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/BmNumLogsMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/BmNumLogsMapper.java new file mode 100644 index 00000000..ef417e9d --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/BmNumLogsMapper.java @@ -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 selectAll(); + + int updateByPrimaryKeySelective(BmNumLogs record); + + int updateByPrimaryKey(BmNumLogs record); +} \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BmNumLogsService.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BmNumLogsService.java new file mode 100644 index 00000000..3b1044e8 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BmNumLogsService.java @@ -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 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); + } + +} diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BmNumLogsMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BmNumLogsMapper.xml new file mode 100644 index 00000000..f85c75fc --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BmNumLogsMapper.xml @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + id, model_title, `method`, task, type_id, description, json_result, `time`, creator, + remark, status + + + + + + + + + + delete from bm_num_logs + where id = #{id,jdbcType=INTEGER} + + + + + 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 into bm_num_logs + + + model_title, + + + `method`, + + + task, + + + type_id, + + + description, + + + json_result, + + + `time`, + + + creator, + + + remark, + + + + + #{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}, + + + + + + + update bm_num_logs + + + 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 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} + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/ScrapApplyDetailsMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/ScrapApplyDetailsMapper.xml index 1bf7e402..2ab763d8 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/ScrapApplyDetailsMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/ScrapApplyDetailsMapper.xml @@ -319,10 +319,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) t GROUP BY task_id + + + + + + + +