From fcb3780c934e1a579bce38f71114ac1f14889db8 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 1 Aug 2024 20:30:13 +0800 Subject: [PATCH] numlog --- .../sgzb/base/api/domain/LeaseOutDetails.java | 3 ++ .../sgzb/system/api/domain/BmNumLogs.java | 36 +++++++++++++++---- .../sgzb/common/log/aspect/LogAspect.java | 2 +- .../system/service/impl/BmNumLogsService.java | 27 ++++++++++++++ .../mapper/system/BmNumLogsMapper.xml | 14 ++++---- 5 files changed, 68 insertions(+), 14 deletions(-) diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/LeaseOutDetails.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/LeaseOutDetails.java index 415b6cd1..499f54c0 100644 --- a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/LeaseOutDetails.java +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/LeaseOutDetails.java @@ -173,4 +173,7 @@ public class LeaseOutDetails implements Serializable { @ApiModelProperty(value = "数量出库-出库数量") private Integer inputNum; + @ApiModelProperty(value = "数量出库 -> 操作前库存量") + private Integer num; + } \ No newline at end of file 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 index 0a4ef93a..17379642 100644 --- 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 @@ -42,7 +42,7 @@ public class BmNumLogs extends BaseEntity { * 实例 */ @Excel(name = "实例/任务") - private String task; + private String taskId; /** * 任务名称 @@ -83,12 +83,6 @@ public class BmNumLogs extends BaseEntity { @Excel(name = "响应内容/状态码/返回参数") private String jsonResult; - /** - * 请求时间 - */ - @Excel(name = "请求时间") - private LocalDateTime time; - /** * 创建人 */ @@ -107,4 +101,32 @@ public class BmNumLogs extends BaseEntity { @Excel(name = "状态") private Integer status; + @Excel(name = "型号") + private String typeModelName; + + @Excel(name = "申请数量") + private String preNum; + + @Excel(name = "申核数量") + private String auditNum; + + @Excel(name = "操作前库存") + private String preStoreNum; + + @Excel(name = "入库数量") + private String inNum; + + @Excel(name = "出库数量") + private String outNum; + + @Excel(name = "退库数量") + private String backNum; + + @Excel(name = "出库类型 0编码出库 1数量出库 2成套出库") + private String manageType; + + private String createBy; + private String parentId; + private String inputNum; + } \ No newline at end of file diff --git a/sgzb-common/sgzb-common-log/src/main/java/com/bonus/sgzb/common/log/aspect/LogAspect.java b/sgzb-common/sgzb-common-log/src/main/java/com/bonus/sgzb/common/log/aspect/LogAspect.java index 30c5bf0c..f1a56391 100644 --- a/sgzb-common/sgzb-common-log/src/main/java/com/bonus/sgzb/common/log/aspect/LogAspect.java +++ b/sgzb-common/sgzb-common-log/src/main/java/com/bonus/sgzb/common/log/aspect/LogAspect.java @@ -276,7 +276,7 @@ public class LogAspect } } if (paramsMap.containsKey("taskId")) { - numLog.setTask(String.valueOf(paramsMap.get("taskId"))); + numLog.setTaskId(String.valueOf(paramsMap.get("taskId"))); } if (paramsMap.containsKey("typeId")) { if (paramsMap.get("typeId") instanceof Integer) { diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/BmNumLogsService.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/BmNumLogsService.java index 60d0845a..253be11b 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/BmNumLogsService.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/BmNumLogsService.java @@ -1,6 +1,9 @@ package com.bonus.sgzb.system.service.impl; import com.bonus.sgzb.system.mapper.BmNumLogsMapper; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; @@ -10,17 +13,41 @@ import com.bonus.sgzb.system.api.domain.BmNumLogs; import java.util.List; @Service +@Slf4j public class BmNumLogsService{ @Autowired private BmNumLogsMapper bmNumLogsMapper; + private static ObjectMapper objectMapper = new ObjectMapper(); + public int deleteByPrimaryKey(Integer id) { return bmNumLogsMapper.deleteByPrimaryKey(id); } +// public int insert(BmNumLogs record) { +// return bmNumLogsMapper.insert(record); +// } public int insert(BmNumLogs record) { + try { + String description = record.getDescription().replace("[", "").replace("]", ""); + log.info("goto print material log {}", description); + BmNumLogs des = objectMapper.readValue(description, BmNumLogs.class); + record.setTypeName(des.getTypeName()); + record.setTypeModelName(des.getTypeModelName()); + record.setPreNum(des.getPreNum()); //领料申请数量、退料申请数量 + record.setAuditNum(des.getAuditNum()); //领料审核数量、但自2024/8/1退料无审核环节 + record.setInputNum(des.getInputNum()); //输入数量 + record.setOutNum(des.getOutNum()); // 出库数 + record.setManageType(des.getManageType()); + record.setTaskId(des.getTaskId()); + record.setTypeId(des.getTypeId()); + record.setPreStoreNum(des.getNum()); //操作前库存数 + } catch (JsonProcessingException e) { + //[{"auditNum":null,"createBy":"1","id":1790,"inputNum":1,"manageType":1,"outNum":1.0,"parentId":657,"preNum":null,"taskId":2082,"typeId":121,"typeModelName":"5T(博大)","typeName":"马达头"}] + log.error("解析日志对象失败:{}", record.getDescription()); + } return bmNumLogsMapper.insert(record); } diff --git a/sgzb-modules/sgzb-system/src/main/resources/mapper/system/BmNumLogsMapper.xml b/sgzb-modules/sgzb-system/src/main/resources/mapper/system/BmNumLogsMapper.xml index 01f4a674..cf23d3be 100644 --- a/sgzb-modules/sgzb-system/src/main/resources/mapper/system/BmNumLogsMapper.xml +++ b/sgzb-modules/sgzb-system/src/main/resources/mapper/system/BmNumLogsMapper.xml @@ -64,13 +64,15 @@ - insert into bm_num_logs (model_title, `method`, task, - type_id, description, json_result, - `time`, creator, remark + insert into bm_num_logs (model_title, `method`, task_id, type_id, + description, json_result, create_time, creator, remark, + pre_num, input_num, out_num, audit_num, manage_type, + type_name, type_model_name, pre_store_num ) - values (#{modelTitle,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{task,jdbcType=VARCHAR}, - #{typeId,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{jsonResult,jdbcType=VARCHAR}, - now(), #{creator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR} + values (#{modelTitle,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR}, #{typeId,jdbcType=INTEGER}, + #{description,jdbcType=VARCHAR}, #{jsonResult,jdbcType=VARCHAR}, now(), #{creator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, + #{preNum,jdbcType=VARCHAR}, #{inputNum,jdbcType=VARCHAR}, #{outNum,jdbcType=VARCHAR}, #{auditNum,jdbcType=VARCHAR}, #{manageType,jdbcType=VARCHAR}, + #{typeName,jdbcType=VARCHAR}, #{typeModelName,jdbcType=VARCHAR}, #{preStoreNum,jdbcType=VARCHAR} )