Commit e6198034 authored by 刘_震's avatar 刘_震

code转一二级分类(代码修改)-添加费用来源(处理特殊矿的材料)

parent 33bfbcbf
......@@ -13,6 +13,7 @@ import org.apache.commons.lang3.Range;
import org.springframework.stereotype.Service;
import javax.accessibility.AccessibleValue;
import java.lang.reflect.Array;
import java.util.*;
/**
......@@ -62,62 +63,76 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService {
ActSupplies actSupplies = asiccSuppliesMapper.selectByNum();
//存放处理之后的code (asiccDAO中的Code)
for (String code : asiccDAO.getCodes()) {
Map<String,Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>();
//存放基本生产原煤的一级、二级分类
Map<String,Object> codeList1 = new HashMap<>();
Map<String, Object> codeList1 = new HashMap<>();
//存放基本生产洗煤的一级、二级分类
Map<String,Object> codeList2 = new HashMap<>();
Map<String, Object> codeList2 = new HashMap<>();
//存放其他费用来源的一级、二级分类
Map<String,Object> codeList3 = new HashMap<>();
Map<String, Object> codeList3 = new HashMap<>();
Range<String> range = Range.between("30", "36");
String kmCode1 = StringUtils.substring(code, 0, 2);
String kmCode2 = StringUtils.substring(code, 0, 4);
if (mineId.equals("011704") && range.contains(kmCode1)) {
codeList1.put("一级分类", "配件");
codeList1.put("二级分类", "配件");
codeList2.put("一级分类", "配件");
codeList2.put("二级分类", "配件");
codeList3.put("一级分类", "其他材料");
codeList3.put("二级分类", "其他");
map.put("基本生产原煤", codeList1);
map.put("基本生产洗煤", codeList2);
map.put("其他费用来源", codeList3);
voMap.put(code, map);
} else if (mineId.equals("011704") && kmCode2.equals("6199")) {
codeList1.put("一级分类", "其他材料");
codeList1.put("二级分类", "其他");
codeList2.put("一级分类", "其他材料");
codeList2.put("二级分类", "其他");
codeList3.put("一级分类", "其他材料");
codeList3.put("二级分类", "其他");
map.put("基本生产原煤", codeList1);
map.put("基本生产洗煤", codeList2);
map.put("其他费用来源", codeList3);
voMap.put(code, map);
} else {
String kmCode = StringUtils.substring(code, 0, 6);
if (codeMap.containsKey(kmCode)) {
get(voMap, suppliesMap, codeMap, code, map, codeList1, codeList2, codeList3, kmCode);
} else {
kmCode = StringUtils.substring(kmCode, 0, 4);
if (codeMap.containsKey(kmCode)) {
if (mineId.equals("011704") && kmCode.equals("6199")) {
codeList1.put("一级分类","其他材料");
codeList1.put("二级分类","其他");
codeList2.put("一级分类","其他材料");
codeList2.put("二级分类","其他");
} else {
getId(suppliesMap, codeMap, codeList1, codeList2, kmCode);
}
codeList3.put("一级分类","其他材料");
codeList3.put("二级分类","其他");
codeList3.put("一级分类", "其他材料");
codeList3.put("二级分类", "其他");
map.put("基本生产原煤", codeList1);
map.put("基本生产洗煤", codeList2);
map.put("其他费用来源", codeList3);
voMap.put(code,map);
voMap.put(code, map);
} else {
kmCode = StringUtils.substring(kmCode, 0, 2);
Range<String> range = Range.between("30", "36");
if (mineId.equals("011704") && range.contains(kmCode)) {
codeList1.put("一级分类","配件");
codeList1.put("二级分类","配件");
codeList2.put("一级分类","配件");
codeList2.put("二级分类","配件");
} else if (codeMap.containsKey(kmCode)) {
if (codeMap.containsKey(kmCode)) {
get(voMap, suppliesMap, codeMap, code, map, codeList1, codeList2, codeList3, kmCode);
} else {
//kmCode一律为10
String oneLevel = actSupplies.getSuppliesName();
codeList1.put("一级分类",oneLevel);
codeList1.put("二级分类",null);
if (oneLevel.equals("油脂")||oneLevel.equals("配件")) {
codeList2.put("一级分类",oneLevel);
codeList2.put("二级分类",null);
}else{
codeList2.put("一级分类","其他材料");
codeList2.put("二级分类","其他");
}
codeList3.put("一级分类","其他材料");
codeList3.put("二级分类","其他");
codeList1.put("一级分类", oneLevel);
codeList1.put("二级分类", null);
if (oneLevel.equals("油脂") || oneLevel.equals("配件")) {
codeList2.put("一级分类", oneLevel);
codeList2.put("二级分类", null);
} else {
codeList2.put("一级分类", "其他材料");
codeList2.put("二级分类", "其他");
}
codeList3.put("一级分类", "其他材料");
codeList3.put("二级分类", "其他");
map.put("基本生产原煤", codeList1);
map.put("基本生产洗煤", codeList2);
map.put("其他费用来源", codeList3);
voMap.put(code,map);
voMap.put(code, map);
}
}
}
}
......@@ -131,13 +146,13 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService {
});
for (String code : asiccDAO.getCodes()) {
boolean matched = false;
Map<String,Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>();
//存放基本生产原煤的一级、二级分类
Map<String,Object> codeList1 = new HashMap<>();
Map<String, Object> codeList1 = new HashMap<>();
//存放基本生产洗煤的一级、二级分类
Map<String,Object> codeList2 = new HashMap<>();
Map<String, Object> codeList2 = new HashMap<>();
//存放其他费用来源的一级、二级分类
Map<String,Object> codeList3 = new HashMap<>();
Map<String, Object> codeList3 = new HashMap<>();
for (ActSuppliesMaterialCode materialCode : materialCodeList) {
String kmCode = code;
String codeMin = materialCode.getCodeMin();
......@@ -155,14 +170,47 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService {
break; // 跳出内部循环
} else {
kmCode = StringUtils.substring(kmCode, 0, 4);
String[] number = {"6101", "6102"};
if (range.contains(kmCode)) {
// 跳出内部循环
if (mineId.equals("011702") && Arrays.asList(number).contains(kmCode)) {
String twoLevel = materialCode.getMaterialName();
String codeType = materialCode.getMaterialCodeType();
String oneLevel = suppliesMap.get(codeType);
codeList1.put("一级分类", oneLevel);
codeList1.put("二级分类", twoLevel);
codeList2.put("一级分类", "油脂及乳化液");
codeList2.put("二级分类", "油脂");
codeList3.put("一级分类", "其他材料");
codeList3.put("二级分类", "其他");
map.put("基本生产原煤", codeList1);
map.put("基本生产洗煤", codeList2);
map.put("其他费用来源", codeList3);
} else {
getLevelInfo(voMap, suppliesMap, code, map, codeList1, codeList2, codeList3, materialCode);
}
matched = true;
break; // 跳出内部循环
} else {
kmCode = StringUtils.substring(kmCode, 0, 2);
if (range.contains(kmCode)) {
String[] numbers = {"30", "31", "32", "34", "35"};
if (mineId.equals("011702") && Arrays.asList(numbers).contains(kmCode)) {
String twoLevel = materialCode.getMaterialName();
String codeType = materialCode.getMaterialCodeType();
String oneLevel = suppliesMap.get(codeType);
codeList1.put("一级分类", oneLevel);
codeList1.put("二级分类", twoLevel);
codeList2.put("一级分类", "配件");
codeList2.put("二级分类", "配件");
codeList3.put("一级分类", "其他材料");
codeList3.put("二级分类", "其他");
map.put("基本生产原煤", codeList1);
map.put("基本生产洗煤", codeList2);
map.put("其他费用来源", codeList3);
} else {
getLevelInfo(voMap, suppliesMap, code, map, codeList1, codeList2, codeList3, materialCode);
}
matched = true;
break; // 跳出内部循环
}
......@@ -171,12 +219,12 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService {
}
}
if (!matched) {
codeList1.put("一级分类","其他材料");
codeList1.put("二级分类","其他");
codeList2.put("一级分类","其他材料");
codeList2.put("二级分类","其他");
codeList3.put("一级分类","其他材料");
codeList3.put("二级分类","其他");
codeList1.put("一级分类", "其他材料");
codeList1.put("二级分类", "其他");
codeList2.put("一级分类", "其他材料");
codeList2.put("二级分类", "其他");
codeList3.put("一级分类", "其他材料");
codeList3.put("二级分类", "其他");
map.put("基本生产原煤", codeList1);
map.put("基本生产洗煤", codeList2);
map.put("其他费用来源", codeList3);
......@@ -192,26 +240,26 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService {
*/
private void getLevelInfo(Map<String, Object> voMap, Map<Object, String> suppliesMap,
String code, Map<String, Object> map,
Map<String,Object> codeList1, Map<String,Object> codeList2,
Map<String,Object> codeList3, ActSuppliesMaterialCode materialCode) {
Map<String, Object> codeList1, Map<String, Object> codeList2,
Map<String, Object> codeList3, ActSuppliesMaterialCode materialCode) {
String twoLevel = materialCode.getMaterialName();
String codeType = materialCode.getMaterialCodeType();
String oneLevel = suppliesMap.get(codeType);
codeList1.put("一级分类",oneLevel);
codeList1.put("二级分类",twoLevel);
if (oneLevel.equals("油脂及乳化液")||oneLevel.equals("配件")) {
codeList2.put("一级分类",oneLevel);
codeList2.put("二级分类",twoLevel);
}else{
codeList2.put("一级分类","其他材料");
codeList2.put("二级分类","其他");
}
codeList3.put("一级分类","其他材料");
codeList3.put("二级分类","其他");
codeList1.put("一级分类", oneLevel);
codeList1.put("二级分类", twoLevel);
if (oneLevel.equals("油脂及乳化液") || oneLevel.equals("配件")) {
codeList2.put("一级分类", oneLevel);
codeList2.put("二级分类", twoLevel);
} else {
codeList2.put("一级分类", "其他材料");
codeList2.put("二级分类", "其他");
}
codeList3.put("一级分类", "其他材料");
codeList3.put("二级分类", "其他");
map.put("基本生产原煤", codeList1);
map.put("基本生产洗煤", codeList2);
map.put("其他费用来源", codeList3);
voMap.put(code,map);
voMap.put(code, map);
}
/**
......@@ -219,35 +267,35 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService {
*/
private void get(Map<String, Object> voMap, Map<Object, String> suppliesMap,
Map<String, Object> codeMap, String code, Map<String, Object> map,
Map<String,Object> codeList1, Map<String,Object> codeList2,
Map<String,Object> codeList3, String kmCode) {
Map<String, Object> codeList1, Map<String, Object> codeList2,
Map<String, Object> codeList3, String kmCode) {
getId(suppliesMap, codeMap, codeList1, codeList2, kmCode);
codeList3.put("一级分类","其他材料");
codeList3.put("二级分类","其他");
codeList3.put("一级分类", "其他材料");
codeList3.put("二级分类", "其他");
map.put("基本生产原煤", codeList1);
map.put("基本生产洗煤", codeList2);
map.put("其他费用来源", codeList3);
voMap.put(code,map);
voMap.put(code, map);
}
/**
* 处理原煤和洗煤的一级和二级分类(处理矿id不存在)
*/
private void getId(Map<Object, String> suppliesMap, Map<String, Object> codeMap,
Map<String,Object> codeList1, Map<String,Object> codeList2, String kmCode) {
Map<String, Object> codeList1, Map<String, Object> codeList2, String kmCode) {
Object sid = codeMap.get(kmCode);
String finalLevel = suppliesMap.get(sid);
String[] part = finalLevel.split("_");
String oneLevel = part[0];
String twoLevel = part[1];
codeList1.put("一级分类",oneLevel);
codeList1.put("二级分类",twoLevel);
if (oneLevel.equals("油脂及乳化液")||oneLevel.equals("配件")) {
codeList2.put("一级分类",oneLevel);
codeList2.put("二级分类",twoLevel);
}else{
codeList2.put("一级分类","其他材料");
codeList2.put("二级分类","其他");
codeList1.put("一级分类", oneLevel);
codeList1.put("二级分类", twoLevel);
if (oneLevel.equals("油脂及乳化液") || oneLevel.equals("配件")) {
codeList2.put("一级分类", oneLevel);
codeList2.put("二级分类", twoLevel);
} else {
codeList2.put("一级分类", "其他材料");
codeList2.put("二级分类", "其他");
}
}
}
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