bom 排序
This commit is contained in:
parent
7db0f7555e
commit
74ff1fd5e3
|
|
@ -359,6 +359,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子级
|
* 获取子级
|
||||||
*
|
*
|
||||||
|
|
@ -450,6 +453,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
//动态判断异常
|
//动态判断异常
|
||||||
//CheckEBomExceptoinDynamic.check(parentChild);
|
//CheckEBomExceptoinDynamic.check(parentChild);
|
||||||
|
BomNewSortUtil.orderNumEbomSort(parentChild,0);
|
||||||
return parentChild;
|
return parentChild;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -400,6 +400,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BomNewSortUtil.orderNumPbomSort(parentChild,0);
|
||||||
return parentChild;
|
return parentChild;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.nflg.product.bomnew.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class BomNewSortUtil {
|
||||||
|
|
||||||
|
|
||||||
|
static int sortOrderNum(String o1,String o2,int sort){
|
||||||
|
if (Objects.isNull(o1)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (Objects.isNull(o2)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int result = 0;
|
||||||
|
try {
|
||||||
|
if (sort == 0) { //升
|
||||||
|
result = Integer.parseInt(o1 ) - Integer.parseInt(o2);
|
||||||
|
} else if (sort == 1) {//降
|
||||||
|
result = Integer.parseInt(o2 ) - Integer.parseInt(o1 );
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void orderNumPbomSort(List<BomNewPbomParentVO> list, int sort) {
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CollUtil.sort(list, new Comparator<BomNewPbomParentVO>() {
|
||||||
|
@Override
|
||||||
|
public int compare(BomNewPbomParentVO o1, BomNewPbomParentVO o2) {
|
||||||
|
|
||||||
|
|
||||||
|
return sortOrderNum(o1.getOrderNumber(),o2.getOrderNumber(),sort);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list
|
||||||
|
* @param sort
|
||||||
|
*/
|
||||||
|
public static void orderNumEbomSort(List<BomNewEbomParentVO> list, int sort) {
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CollUtil.sort(list, new Comparator<BomNewEbomParentVO>() {
|
||||||
|
@Override
|
||||||
|
public int compare(BomNewEbomParentVO o1, BomNewEbomParentVO o2) {
|
||||||
|
|
||||||
|
return sortOrderNum(o1.getOrderNumber(),o2.getOrderNumber(),sort);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue