From bbe82af8a6fda010a8c7a01927c8e17ac505a14a Mon Sep 17 00:00:00 2001 From: "15881625488@163.com" <15881625488@163.com> Date: Wed, 24 Dec 2025 22:04:42 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A[=E8=B5=84=E6=BA=90=E5=BA=93?= =?UTF-8?q?=E7=AE=A1=E7=90=86][=E9=BA=BB=E7=B2=BE=E8=8D=AF=E7=AE=A1?= =?UTF-8?q?=E7=90=86]=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hxhq/business/enums/zykgl/ShXgkcEnum.java | 53 ++++++++++++++++++++++ .../com/hxhq/business/enums/zykgl/ShbjEnum.java | 53 ++++++++++++++++++++++ .../java/com/hxhq/business/form/yq/YqForm.java | 3 ++ .../com/hxhq/business/form/yq/YqSearchForm.java | 3 +- .../hxhq/business/service/impl/MjyServiceImpl.java | 10 ++-- .../com/hxhq/business/utils/ObjectCompareUtil.java | 19 ++++---- 6 files changed, 127 insertions(+), 14 deletions(-) create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/zykgl/ShXgkcEnum.java create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/zykgl/ShbjEnum.java diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/zykgl/ShXgkcEnum.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/zykgl/ShXgkcEnum.java new file mode 100644 index 0000000..83bec3d --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/zykgl/ShXgkcEnum.java @@ -0,0 +1,53 @@ +package com.hxhq.business.enums.zykgl; + +/** + * 是否同意修改库存:1:拒绝修改库存;10:同意修改库存 + * @author tanfei + */ +public enum ShXgkcEnum { + + /** + * 拒绝修改库存 + */ + jj(1, "拒绝修改库存"), + + /** + * 同意修改库存 + */ + ty(10, "同意修改库存"), + + ; + + private int value; + private String text; + + ShXgkcEnum(int value, String text) { + this.value = value; + this.text = text; + } + + public int getValue() { + return value; + } + + public void setValue(int value) { + this.value = value; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public static ShXgkcEnum getEnumByValue(int type) { + for (ShXgkcEnum bt : values()) { + if (bt.value == type) { + return bt; + } + } + return null; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/zykgl/ShbjEnum.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/zykgl/ShbjEnum.java new file mode 100644 index 0000000..2b392c0 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/zykgl/ShbjEnum.java @@ -0,0 +1,53 @@ +package com.hxhq.business.enums.zykgl; + +/** + * 是否同意修改:1:拒绝编辑;10:同意编辑 + * @author tanfei + */ +public enum ShbjEnum { + + /** + * 拒绝编辑 + */ + jj(1, "拒绝编辑"), + + /** + * 同意编辑 + */ + ty(10, "同意编辑"), + + ; + + private int value; + private String text; + + ShbjEnum(int value, String text) { + this.value = value; + this.text = text; + } + + public int getValue() { + return value; + } + + public void setValue(int value) { + this.value = value; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public static ShbjEnum getEnumByValue(int type) { + for (ShbjEnum bt : values()) { + if (bt.value == type) { + return bt; + } + } + return null; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java index 5ce5819..61b494c 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java @@ -8,6 +8,9 @@ import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.Date; +/** + * @author 15881 + */ public class YqForm { private Long id; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqSearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqSearchForm.java index 9191717..b969b7d 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqSearchForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqSearchForm.java @@ -1,6 +1,7 @@ package com.hxhq.business.form.yq; -/** 仪器列表搜索 */ +/** 仪器列表搜索 + * @author 15881*/ public class YqSearchForm { /** 名称 */ diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java index b3c7976..e9d1541 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java @@ -1046,7 +1046,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS mjyJcgj.setMjyId(mjyOld.getId()); mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); mjyJcgj.setJcmc(form.getQmyy()); - if (form.getQmyy().equals("同意编辑")) { + if (form.getQmyy().equals(ShbjEnum.ty.getValue())) { mjyJcgj.setJcmcys(JcmcysEnum.green.getValue()); } else { mjyJcgj.setJcmcys(JcmcysEnum.red.getValue()); @@ -1058,7 +1058,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS //endregion //region 更新 - if (form.getQmyy().equals("同意编辑")) { + if (form.getQmyy().equals(ShbjEnum.ty.getValue())) { mjyOld.setCcwz(mjyOld.getCcwzbj()); mjyOld.setCctj(mjyOld.getCctjbj()); mjyOld.setSxrq(mjyOld.getSxrqbj()); @@ -1165,7 +1165,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS mjyJcgj.setMjyId(mjyOld.getId()); mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); mjyJcgj.setJcmc(form.getQmyy()); - if (form.getQmyy().equals("同意修改库存")) { + if (form.getQmyy().equals(ShXgkcEnum.ty.getValue())) { mjyJcgj.setJcmcys(JcmcysEnum.green.getValue()); } else { mjyJcgj.setJcmcys(JcmcysEnum.red.getValue()); @@ -1177,7 +1177,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS //endregion //region 更新 - if (form.getQmyy().equals("同意修改库存")) { + if (form.getQmyy().equals(ShXgkcEnum.ty.getValue())) { mjyOld.setKcdw(mjyOld.getKcdwbj()); mjyOld.setKc(mjyOld.getKcbj()); } @@ -1189,7 +1189,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS //endregion //region 台账 - if (form.getQmyy().equals("同意修改库存")) { + if (form.getQmyy().equals(ShXgkcEnum.ty.getValue())) { mjyTzService.saveTz(mjyOld.getId(), "", "", "", "", qmr.getUserId(), qmr.getNickName(), "修改库存", form.getKc(), form.getKcdw(), mjyOld.getKcbjbz()); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/ObjectCompareUtil.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/ObjectCompareUtil.java index c780a28..e8c1875 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/ObjectCompareUtil.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/ObjectCompareUtil.java @@ -55,10 +55,11 @@ public class ObjectCompareUtil { Object oldValue = field.get(oldObj); String oldValueStr = ""; String newValueStr = ""; + String date="java.util.Date"; if(oldValue == null) { oldValueStr = ""; } else { - if (field.getType().getName().equals("java.util.Date")) { + if (field.getType().getName().equals(date)) { JsonFormat annotation = field.getAnnotation(JsonFormat.class); if(annotation != null && StringUtils.isNotEmpty(annotation.pattern())) { oldValueStr = autoConvert(oldValue, annotation.pattern()); @@ -75,7 +76,7 @@ public class ObjectCompareUtil { if(newValue == null) { newValueStr = ""; } else { - if (field.getType().getName().equals("java.util.Date")) { + if (field.getType().getName().equals(date)) { JsonFormat annotation = field.getAnnotation(JsonFormat.class); if(annotation != null && StringUtils.isNotEmpty(annotation.pattern())) { newValueStr = autoConvert(newValue, annotation.pattern()); @@ -131,11 +132,11 @@ public class ObjectCompareUtil { long millis = 0L; if (timestamp instanceof Long) { - // 检查是毫秒还是秒 Long ts = (Long) timestamp; - if (ts > 1000000000000L) { // 毫秒时间戳 + Long hm=1000000000000L; + if (ts >hm ) { millis = ts; - } else { // 秒时间戳 + } else { millis = ts * 1000L; } } else if (timestamp instanceof Integer) { @@ -143,9 +144,11 @@ public class ObjectCompareUtil { } else if (timestamp instanceof String) { try { String tsStr = (String) timestamp; - if (tsStr.length() == 10) { // 秒时间戳 + Integer a=10; + Integer b=13; + if (tsStr.length() == a) { millis = Long.parseLong(tsStr) * 1000L; - } else if (tsStr.length() == 13) { // 毫秒时间戳 + } else if (tsStr.length() == b) { millis = Long.parseLong(tsStr); } else { throw new IllegalArgumentException("不支持的时间戳格式: " + tsStr); @@ -229,7 +232,7 @@ public class ObjectCompareUtil { @Override public String toString() { - Map map = new HashMap<>(); + Map map = new HashMap(3); map.put("字段名", fieldLabel); map.put("原值", oldValue); map.put("新值", newValue);