value
2024-04-28 ecaf6326139d524e71c96b7fa459f452f8498065
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -1,13 +1,13 @@
package com.yuanchu.mom.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.mapper.StandardProductListMapper;
import com.yuanchu.mom.mapper.StandardTreeMapper;
import com.yuanchu.mom.pojo.InsSample;
import com.yuanchu.mom.pojo.StandardProductList;
import com.yuanchu.mom.service.StandardProductListService;
import com.yuanchu.mom.mapper.StandardProductListMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
@@ -28,6 +28,8 @@
    private StandardProductListMapper standardProductListMapper;
    private StandardTreeMapper standardTreeMapper;
    @Override
    public int upStandardProductList(StandardProductList list) {
        return standardProductListMapper.updateById(list);
@@ -43,15 +45,15 @@
        List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1));
        list = list.stream().filter(a -> {
            try {
                if(a.getSection()!=null && !Objects.equals(a.getSection(), "")){
                if (a.getSection() != null && !Objects.equals(a.getSection(), "")) {
                    if (a.getSection().contains("~")) {
                        String[] split = a.getSection().split("~");
                        return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(split[0])) > -1 && new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(split[1])) < 1;
                    } else if (a.getSection().contains("≥") || a.getSection().contains(">=")) {
                        String param = a.getSection().replace("≥", "").replace(">=","");
                        String param = a.getSection().replace("≥", "").replace(">=", "");
                        return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) > -1;
                    } else if (a.getSection().contains("≤") || a.getSection().contains("<=")) {
                        String param = a.getSection().replace("≤", "").replace("<=","");
                        String param = a.getSection().replace("≤", "").replace("<=", "");
                        return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) < 1;
                    } else if (a.getSection().contains(">")) {
                        String param = a.getSection().replace(">", "");
@@ -73,8 +75,16 @@
    }
    @Override
    public List<StandardProductList> selectStandardProductListByMethodId(Integer id) {
        return standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id));
    public List<StandardProductList> selectStandardProductListByMethodId(Integer id, String tree) {
        String[] trees = tree.split(" - ");
        List<StandardProductList> list;
        if(tree.length() == 3){
            list = standardTreeMapper.selectStandardProductListByTree(trees[2], trees[3]);
        }else{
            list = standardTreeMapper.selectStandardProductListByTree(trees[2], null);
        }
        List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id));
        return list;
    }
}