From 5701eb6693c654d53f1bba460eb3a417d495b344 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期三, 11 六月 2025 17:31:53 +0800
Subject: [PATCH] bug修复;下发任务给rcs携带货架码
---
src/main/java/com/zy/common/web/BaseController.java | 57 ++++++++++++++++++++++++++++++---------------------------
1 files changed, 30 insertions(+), 27 deletions(-)
diff --git a/src/main/java/com/zy/common/web/BaseController.java b/src/main/java/com/zy/common/web/BaseController.java
index 0309a4a..3f0647c 100644
--- a/src/main/java/com/zy/common/web/BaseController.java
+++ b/src/main/java/com/zy/common/web/BaseController.java
@@ -42,14 +42,14 @@
@Autowired
private UserLoginService userLoginService;
- protected Long getUserId(){
- if(Cools.isEmpty(request.getAttribute("userId"))){
+ protected Long getUserId() {
+ if (Cools.isEmpty(request.getAttribute("userId"))) {
return 000L;
}
return Long.parseLong(String.valueOf(request.getAttribute("userId")));
}
- protected User getUser(){
+ protected User getUser() {
User user = userService.selectById(getUserId());
if (null == user) {
throw new CoolException(BaseRes.DENIED);
@@ -57,21 +57,21 @@
return user;
}
- protected String getComment(Class<?> cls, String fieldName){
+ protected String getComment(Class<?> cls, String fieldName) {
Field[] fields = Cools.getAllFields(cls);
- for (Field field : fields){
- if (fieldName.equals(field.getName())){
+ for (Field field : fields) {
+ if (fieldName.equals(field.getName())) {
return field.getAnnotation(ApiModelProperty.class).value();
}
}
return "";
}
- protected Tag getOriginTag(){
+ protected Tag getOriginTag() {
return tagService.getTop();
}
- protected Node getOriginNode(){
+ protected Node getOriginNode() {
Node node = nodeService.getTop();
if (node == null) {
throw new CoolException("搴撳尯鏁版嵁閿欒");
@@ -88,7 +88,7 @@
* @param <T>
* @return
*/
- protected <T> Page<T> toPage(Integer pageNumber, Integer pageSize, Map<String, Object> map, Class<T> cls){
+ protected <T> Page<T> toPage(Integer pageNumber, Integer pageSize, Map<String, Object> map, Class<T> cls) {
// 鍒嗛〉绱㈠紩鍜屽崟椤垫暟閲忕粍瑁�
pageNumber = Optional.ofNullable(pageNumber).orElse(1);
pageSize = Optional.ofNullable(pageSize).orElse(10);
@@ -99,10 +99,10 @@
// 鍏ㄥ瓧娈垫ā绯婃悳绱� todo
if (!Cools.isEmpty(map.get("condition"))) {
Set<String> columns = new HashSet<>();
- for (Field field : Cools.getAllFields(cls)){
+ for (Field field : Cools.getAllFields(cls)) {
if (Modifier.isFinal(field.getModifiers())
|| Modifier.isStatic(field.getModifiers())
- || Modifier.isTransient(field.getModifiers())){
+ || Modifier.isTransient(field.getModifiers())) {
continue;
}
String column = null;
@@ -116,7 +116,7 @@
columns.add(column);
}
}
- columns.forEach(col->map.put(col, map.get("condition")));
+ columns.forEach(col -> map.put(col, map.get("condition")));
}
page.setCondition(map);
return page;
@@ -128,33 +128,36 @@
* @param set 鎺掗櫎瀛楁闆嗗悎
* @param condition 鎼滅储鍐呭
*/
- protected <T> void allLike(Class<T> cls, Set<String> set, EntityWrapper<T> wrapper, String condition){
+ protected <T> void allLike(Class<T> cls, Set<String> set, EntityWrapper<T> wrapper, String condition) {
if (Cools.isEmpty(condition)) {
return;
}
List<String> columns = new ArrayList<>();
- for (Field field :Cools.getAllFields(cls)){
+ for (Field field : Cools.getAllFields(cls)) {
if (Modifier.isFinal(field.getModifiers())
|| Modifier.isStatic(field.getModifiers())
- || Modifier.isTransient(field.getModifiers())){
+ || Modifier.isTransient(field.getModifiers())) {
continue;
}
String column = null;
if (field.isAnnotationPresent(TableField.class)) {
- column = field.getAnnotation(TableField.class).value();
+ if (field.getAnnotation(TableField.class).exist()) {
+ column = field.getAnnotation(TableField.class).value();
+ }
+ } else {
+ if (Cools.isEmpty(column)) {
+ column = field.getName();
+ }
}
- if (Cools.isEmpty(column)) {
- column = field.getName();
- }
- if (!set.contains(column)) {
+ if (!Cools.isEmpty(column) && !set.contains(column)) {
columns.add(column);
}
}
if (columns.isEmpty()) {
return;
}
- for (int i=0;i<columns.size();i++){
- if (i==0){
+ for (int i = 0; i < columns.size(); i++) {
+ if (i == 0) {
wrapper.andNew();
} else {
wrapper.or();
@@ -178,14 +181,14 @@
}
}
- protected <T> void hostEq(EntityWrapper<T> wrapper){
+ protected <T> void hostEq(EntityWrapper<T> wrapper) {
Long hostId = getHostId();
if (hostId != null) {
wrapper.eq("host_id", hostId);
}
}
- protected Long getHostId(){
+ protected Long getHostId() {
if (getUserId() == 9527) {
return null;
}
@@ -205,9 +208,9 @@
}
}
- public static boolean isNumber(String str){
- for (int i = str.length();--i>=0;){
- if (!Character.isDigit(str.charAt(i))){
+ public static boolean isNumber(String str) {
+ for (int i = str.length(); --i >= 0; ) {
+ if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
--
Gitblit v1.9.1