修改bug
This commit is contained in:
@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -24,9 +25,7 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -211,15 +210,30 @@ public class InitformulaServiceImpl implements InitformulaService {
|
||||
//需配总量
|
||||
jo.put("need_sum_qty",workorder_qty*mater_standard_rate/100.0);
|
||||
jo.put("mater_standard_rate",mater_standard_rate);
|
||||
jo.put("seqno",mater_standard_rate);
|
||||
}else{
|
||||
//需配总量
|
||||
jo.put("need_sum_qty","0");
|
||||
//需配总量
|
||||
jo.put("mater_standard_rate","0");
|
||||
jo.put("seqno","0");
|
||||
}
|
||||
ja.add(jo);
|
||||
}
|
||||
return json;
|
||||
if(ja!=null){
|
||||
List<JSONObject> list = JSONObject.parseArray(ja.toJSONString(), JSONObject.class);
|
||||
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
||||
//转成JSON对象中保存的值类型
|
||||
double a = Double.parseDouble(o1.getString("seqno"));
|
||||
double b = Double.parseDouble(o2.getString("seqno"));
|
||||
// 如果a, b数据类型为int,可直接 return a - b ;(升序,降序为 return b - a;)
|
||||
if (a < b) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(a == b) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
ja = JSONArray.parseArray(JSON.toJSONString(list));
|
||||
}
|
||||
return ja;
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
Reference in New Issue
Block a user