|
|
|
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
import jnpf.base.UserInfo;
|
|
|
|
|
import jnpf.base.model.ColumnDataModel;
|
|
|
|
|
import jnpf.database.model.superQuery.SuperJsonModel;
|
|
|
|
@ -19,6 +20,7 @@ import jnpf.model.yysmaterialclass.MaterialClassSync;
|
|
|
|
|
import jnpf.model.yysmaterialclass.YysMaterialClassConstant;
|
|
|
|
|
import jnpf.model.yysmaterialclass.YysMaterialClassForm;
|
|
|
|
|
import jnpf.model.yysmaterialclass.YysMaterialClassPagination;
|
|
|
|
|
import jnpf.model.yyssupplierclass.SupplierClassSync;
|
|
|
|
|
import jnpf.permission.entity.UserEntity;
|
|
|
|
|
import jnpf.service.YysMaterialClassService;
|
|
|
|
|
import jnpf.util.*;
|
|
|
|
@ -33,6 +35,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -316,6 +320,16 @@ public class YysMaterialClassServiceImpl extends ServiceImpl<YysMaterialClassMap
|
|
|
|
|
//过滤出同步过的
|
|
|
|
|
List<String> list = this.list(new LambdaQueryWrapper<>(YysMaterialClassEntity.class).isNull(YysMaterialClassEntity::getDeleteMark))
|
|
|
|
|
.stream().map(YysMaterialClassEntity::getClassId).collect(Collectors.toList());
|
|
|
|
|
//顶级分类
|
|
|
|
|
Map<String, String> topCollect = query.stream()
|
|
|
|
|
.filter(obj -> obj.getCInvCCode().equals("1"))
|
|
|
|
|
.collect(Collectors.toMap(MaterialClassSync::getCInvCCode, MaterialClassSync::getCInvCName));
|
|
|
|
|
|
|
|
|
|
//二级分类
|
|
|
|
|
Map<String, String> secondCollect = query.stream()
|
|
|
|
|
.filter(obj -> obj.getCInvCCode().equals("1"))
|
|
|
|
|
.collect(Collectors.toMap(MaterialClassSync::getCInvCCode, MaterialClassSync::getCInvCName));
|
|
|
|
|
|
|
|
|
|
List<YysMaterialClassEntity> result = Lists.newArrayList();
|
|
|
|
|
for (MaterialClassSync sync : query) {
|
|
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list) && list.contains(sync.getCInvCCode())) {
|
|
|
|
@ -326,6 +340,22 @@ public class YysMaterialClassServiceImpl extends ServiceImpl<YysMaterialClassMap
|
|
|
|
|
entity.setId(mainId);
|
|
|
|
|
entity.setClassId(sync.getCInvCCode());
|
|
|
|
|
entity.setClassName(sync.getCInvCName());
|
|
|
|
|
if (sync.getIInvCGrade().equals("1")) {
|
|
|
|
|
entity.setParentClassification(sync.getIInvCGrade());
|
|
|
|
|
entity.setParentClassname("顶级");
|
|
|
|
|
} else if (sync.getIInvCGrade().equals("2")) {
|
|
|
|
|
char charAt = sync.getCInvCCode().charAt(0);
|
|
|
|
|
if (topCollect.containsKey(String.valueOf(charAt))) {
|
|
|
|
|
entity.setParentClassification(String.valueOf(charAt));
|
|
|
|
|
entity.setParentClassname(topCollect.get(String.valueOf(charAt)));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
String rule = sync.getCInvCCode().substring(0, 3);
|
|
|
|
|
if (secondCollect.containsKey(rule)) {
|
|
|
|
|
entity.setParentClassification(rule);
|
|
|
|
|
entity.setParentClassname(secondCollect.get(rule));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
entity.setEnableStatus("1");
|
|
|
|
|
result.add(entity);
|
|
|
|
|
}
|
|
|
|
|