Commit 4851c837 authored by 刘_震's avatar 刘_震

修改实体类的类型,接受小数类型以及优化代码

parent 46426fc3
...@@ -29,7 +29,7 @@ public class ActSuppliesMaterialDetails { ...@@ -29,7 +29,7 @@ public class ActSuppliesMaterialDetails {
private String departmentColumn; private String departmentColumn;
//数量 //数量
@JsonProperty(value = "NumberColumn") @JsonProperty(value = "NumberColumn")
private Long numberColumn; private BigDecimal numberColumn;
//单价 //单价
@JsonProperty(value = "MoneyColumn") @JsonProperty(value = "MoneyColumn")
private BigDecimal moneyColumn; private BigDecimal moneyColumn;
......
...@@ -25,6 +25,7 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService { ...@@ -25,6 +25,7 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService {
@Override @Override
public Map<String,Object> getData(AsiccDAO asiccDAO) { public Map<String,Object> getData(AsiccDAO asiccDAO) {
long begin = System.currentTimeMillis();
//建立一个map集合用于存储返回的数据 //建立一个map集合用于存储返回的数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
...@@ -45,25 +46,32 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService { ...@@ -45,25 +46,32 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService {
List<ActSupplies> suppliesList = asiccSuppliesMapper.select(); List<ActSupplies> suppliesList = asiccSuppliesMapper.select();
List<ActSupplies> accInfos = asiccSuppliesMapper.selectByCodeAndMineId(mineId, filteredCodes); List<ActSupplies> accInfos = asiccSuppliesMapper.selectByCodeAndMineId(mineId, filteredCodes);
for (ActSupplies accInfo : accInfos) { for (ActSupplies accInfo : accInfos) {
List<String> voList = new ArrayList<>(); List<String> voList = getList(accInfo, suppliesList);
Long level = accInfo.getLevel();
if (level == 1) {
String suppliesName = accInfo.getSuppliesName();
voList.add(suppliesName);
voList.add("null"); // 添加一个 null,可能需要根据需求调整
}else if (level == 2) {
for (ActSupplies supplies : suppliesList) {
String oneLevel = supplies.getOneLevel();
if (oneLevel.equals(accInfo.getOneLevel())) {
String oneSupplies = supplies.getSuppliesName();
String twoSupplies = accInfo.getSuppliesName();
voList.add(oneSupplies);
voList.add(twoSupplies);
}
}
}
map.put(accInfo.getCodeColumn(), voList); map.put(accInfo.getCodeColumn(), voList);
} }
long end = System.currentTimeMillis();
System.err.println(end-begin);
return map; return map;
} }
private static List<String> getList(ActSupplies accInfo, List<ActSupplies> suppliesList) {
List<String> voList = new ArrayList<>();
Long level = accInfo.getLevel();
if (level == 1) {
String suppliesName = accInfo.getSuppliesName();
voList.add(suppliesName);
voList.add("null"); // 添加一个 null,可能需要根据需求调整
}else if (level == 2) {
for (ActSupplies supplies : suppliesList) {
String oneLevel = supplies.getOneLevel();
if (oneLevel.equals(accInfo.getOneLevel())) {
String oneSupplies = supplies.getSuppliesName();
String twoSupplies = accInfo.getSuppliesName();
voList.add(oneSupplies);
voList.add(twoSupplies);
}
}
}
return voList;
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment