李林
2024-06-14 681ebad558051dd3b18c379b5c06b23bc08c0761
标准库导入
已修改13个文件
206 ■■■■■ 文件已修改
cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/StandardProductListMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryWorkingHoursDayController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java
@@ -223,6 +223,7 @@
                        db_str = structureItemParameterService.getOne(Wrappers.lambdaQuery(StructureItemParameter.class)
                                .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem())
                                .eq(StructureItemParameter::getSample, str.getSample())
                                .last("limit 1")
                        );
                    } catch (Exception e) {
                        throw new ErrorException("重复查询:" + str.getInspectionItem());
@@ -233,6 +234,7 @@
                                .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem())
                                .eq(StructureItemParameter::getSample, str.getSample())
                                .eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass())
                                .last("limit 1")
                        );
                    } catch (Exception e) {
                        throw new ErrorException("重复查询:" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
@@ -282,7 +284,7 @@
                if (list1.get(13) == null) {
                    str.setPrice(null);
                } else {
                    str.setPrice(BigDecimal.valueOf(Long.parseLong((list1.get(13).toString()))));
                    str.setPrice(list1.get(13) + "");
                }
                if (list1.get(14) == null) {
@@ -334,6 +336,18 @@
                } else {
                    str.setTemplateId(null);
                }
                try {
                    if (list1.get(22) != null) {
                        str.setInspectionItemClass(list1.get(22) + "");
                    }
                } catch (Exception e) {
                }
                try {
                    if (list1.get(23) != null) {
                        str.setInspectionItemClassEn(list1.get(23) + "");
                    }
                } catch (Exception e) {
                }
                lists.add(str);
            }
        });
cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
@@ -46,7 +46,7 @@
    @ValueTableShow(4)
    @ApiModelProperty(value = "单价(元)")
    private BigDecimal price;
    private String price;
    @ApiModelProperty(value = "场所")
    private String laboratory;
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
@@ -31,6 +31,7 @@
    List<StandardMethodList> selectListEnum();
    Integer getStandardMethodId(String code);
}
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java
@@ -14,6 +14,7 @@
    IPage<StandardProductList> standardProductListIPage(Integer id, String tree, IPage<StandardProductList> iPage, String laboratory, String item, String items);
    StandardProductList getOne(Integer standardMethodListId, String inspectionItem, String sample, String inspectionItemSubclass, String model);
}
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
@@ -1,6 +1,7 @@
package com.yuanchu.mom.mapper;
import com.yuanchu.mom.dto.FactoryDto;
import com.yuanchu.mom.dto.SampleDto;
import com.yuanchu.mom.dto.SampleTypeDto;
import com.yuanchu.mom.pojo.StandardMethodList;
import com.yuanchu.mom.pojo.StandardProductList;
@@ -8,6 +9,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
@@ -34,6 +36,10 @@
    List<StandardProductList> selectStandardProductListByTree3(String tree, String sample, String model, String trees);
    List<SampleTypeDto> getStandardTree2();
    List<SampleDto> getStandardTree3(String sampleType);
    String getLaboratory(String str);
}
inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java
@@ -23,4 +23,6 @@
    List<StandardMethodList> selectStandardMethodEnum();
    Integer getStandardMethodId(String code);
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
@@ -136,6 +136,10 @@
        return standardMethodListMapper.selectListEnum();
    }
    @Override
    public Integer getStandardMethodId(String code) {
        return baseMapper.getStandardMethodId(code);
    }
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
@@ -1,29 +1,34 @@
package com.yuanchu.mom.service.impl;
import cn.hutool.core.lang.Console;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.dto.FactoryDto;
import com.yuanchu.mom.dto.LaboratoryDto;
import com.yuanchu.mom.dto.SampleTypeDto;
import com.yuanchu.mom.mapper.StandardMethodListMapper;
import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.mapper.StandardProductListMapper;
import com.yuanchu.mom.mapper.StandardTreeMapper;
import com.yuanchu.mom.pojo.StandardProductList;
import com.yuanchu.mom.pojo.StandardTemplate;
import com.yuanchu.mom.pojo.StandardTree;
import com.yuanchu.mom.service.StandardMethodListService;
import com.yuanchu.mom.service.StandardProductListService;
import com.yuanchu.mom.service.StandardTreeService;
import com.yuanchu.mom.service.*;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
/**
 * @author Administrator
@@ -37,17 +42,29 @@
    private StandardTreeMapper standardTreeMapper;
    private StandardMethodListMapper standardMethodListMapper;
    private StandardMethodListService standardMethodListService;
    private StandardProductListMapper standardProductListMapper;
    private StandardProductListService standardProductListService;
    private StandardTemplateService standardTemplateService;
    private EnumService enumService;
    @Override
    public List<FactoryDto> selectStandardTreeList() {
        return standardTreeMapper.selectStandardTreeList();
        List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeList();
        for (FactoryDto factoryDto : factoryDtos) {
            for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
                for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
                    if (sampleTypeDto.getChildren().size() == 0) {
                        sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue()));
                    }
                }
            }
        }
        return factoryDtos;
    }
    @Override
@@ -132,6 +149,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void inExcelOfTree(MultipartFile file) {
        InputStream inputStream;
        try {
@@ -139,10 +157,114 @@
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        List<StandardProductList> lists = new ArrayList<>();
        AtomicReference<String> laboratory = new AtomicReference<>();
        ExcelUtil.readBySax(inputStream, 0, (i, l, list) -> {
            System.out.println(list);
            StandardProductList str = new StandardProductList();
            if (i == 0 && l == 1) {
                laboratory.set(standardTreeMapper.getLaboratory(list.get(1) + ""));
                if (laboratory.get() == null) {
                    throw new ErrorException("检验对象不存在:" + list.get(1));
                }
            }
            if (i == 0 && l >= 1) {
                Integer standardMethodId = standardMethodListService.getStandardMethodId(list.get(0) + "");
                if (standardMethodId == null) {
                    throw new ErrorException("标准编号不存在:" + list.get(0));
                }
                str.setStandardMethodListId(standardMethodId);
                str.setSampleType(list.get(1) + "");
                if (list.get(2) != null) {
                    str.setSample(list.get(2) + "");
                } else {
                    str.setSample(null);
                }
                if (list.get(3) != null) {
                    str.setModel(list.get(3) + "");
                    Long aLong = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery()
                            .eq(StandardTree::getModel, str.getModel())
                            .eq(StandardTree::getSampleType, list.get(1) + ""));
                    if (aLong == 0) {
                        StandardTree standardTree = new StandardTree();
                        standardTree.setFactory("中天科技检测中心");
                        standardTree.setLaboratory(laboratory.get());
                        standardTree.setSampleType(str.getSampleType());
                        standardTree.setSample(str.getSample());
                        standardTree.setModel(str.getModel());
                        standardTreeMapper.insert(standardTree);
                    }
                } else {
                    str.setModel(null);
                }
                str.setInspectionItem(list.get(4) + "");
                if (list.get(6) == null) {
                    str.setInspectionItemSubclass(null);
                } else {
                    str.setInspectionItemSubclass(list.get(6).toString());
                }
                StandardProductList db_str;
                try {
                    db_str = standardProductListMapper.getOne(str.getStandardMethodListId(),str.getInspectionItem(),str.getSample(),str.getInspectionItemSubclass(),str.getModel());
                } catch (Exception e) {
                    throw new ErrorException("重复查询:" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
                }
                if (ObjectUtils.isNotEmpty(db_str)) {
                    str.setId(db_str.getId());
                    str.setStructureItemParameterId(db_str.getStructureItemParameterId());
                }
                if (list.get(8) != null) {
                    StringBuilder buffer = new StringBuilder();
                    String input = list.get(8).toString();
                    buffer.append("[");
                    String[] values = input.split("、");
                    for (String value : values) {
                        buffer.append("\"").append(value.trim()).append("\",");
                    }
                    buffer.deleteCharAt(buffer.length() - 1);
                    buffer.append("]");
                    str.setMethod(buffer.toString());
                }
                if (list.get(11) == null) {
                    str.setTell(null);
                } else {
                    str.setTell(list.get(11).toString());
                }
                if (list.get(12) == null) {
                    str.setAsk(null);
                } else {
                    str.setAsk(list.get(12).toString());
                }
                if (list.get(13) == null) {
                    str.setPrice(null);
                } else {
                    str.setPrice((list.get(13).toString()));
                }
                if (list.get(14) == null) {
                    str.setManHour(null);
                } else {
                    str.setManHour(list.get(14).toString());
                }
                StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list.get(21)));
                if (standTempIdByName != null) {
                    str.setTemplateId(standTempIdByName.getId());
                } else {
                    throw new ErrorException("模板不存在:" + list.get(21));
                }
                str.setState(1);
                lists.add(str);
            }
        });
        lists.forEach(a->{
            if(a.getId() != null){
                standardProductListMapper.updateById(a);
            }else{
                standardProductListMapper.insert(a);
            }
        });
    }
inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
@@ -93,4 +93,7 @@
                OR structure_test_object_id = '[]'
            )
    </select>
    <select id="getStandardMethodId" resultType="java.lang.Integer">
        select id from standard_method where code = #{code}
    </select>
</mapper>
inspect-server/src/main/resources/mapper/StandardProductListMapper.xml
@@ -43,4 +43,18 @@
            and inspection_item_subclass = #{items}
        </if>
    </select>
    <select id="getOne" resultType="com.yuanchu.mom.pojo.StandardProductList">
        select * from standard_product_list
        where standard_method_list_id = #{standardMethodListId}
        and inspection_item = #{inspectionItem}
        <if test="sample!=null">
            and sample = #{sample}
        </if>
        <if test="inspectionItemSubclass!=null">
            and inspection_item_subclass = #{inspectionItemSubclass}
        </if>
        <if test="model!=null">
            and model = #{model}
        </if>
    </select>
</mapper>
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -56,8 +56,7 @@
        from laboratory l
                 left join structure_test_object sto on sto.laboratory_id = l.id
                 left join product p on p.object_id = sto.id
                 left join standard_tree st on st.laboratory = l.laboratory_name
            and st.sample_type = sto.specimen_name
                 left join standard_tree st on st.sample_type = sto.specimen_name
            and st.sample = p.name
        order by l.id,CAST(sto.code AS DECIMAL),p.id,ISNULL(st.id),st.id
    </select>
@@ -251,4 +250,17 @@
                      OR sample LIKE CONCAT('%', #{tree}, '%')
                  )
    </select>
    <select id="getStandardTree3" resultType="com.yuanchu.mom.dto.SampleDto">
        select model label,
               model value
        from standard_tree
        where sample_type = #{sampleType}
        and sample is null
    </select>
    <select id="getLaboratory" resultType="java.lang.String">
        select l.laboratory_name
        from structure_test_object sto
        left join laboratory l on sto.laboratory_id = l.id
        where sto.specimen_name = #{str}
    </select>
</mapper>
performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java
@@ -46,6 +46,7 @@
        return Result.success(auxiliaryOutputWorkingHoursService.selectAuxiliaryOutputWorkingHours(page, entity));
    }
    @ValueClassify("工时管理")
    @ApiOperation(value = "统计产量工时汇总和辅助工时汇总")
    @PostMapping("/collectWorkingHours")
    public Result collectWorkingHours(){
performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryWorkingHoursDayController.java
@@ -48,12 +48,14 @@
        return Result.success(auxiliaryWorkingHoursDayService.selectAuxiliaryWorkingHoursDay(page, entity));
    }
    @ValueClassify("工时管理")
    @ApiOperation(value = "根据编号查询辅助工时配置信息")
    @PostMapping("/selectAuxiliaryWorkingHoursByNumber")
    public Result selectAuxiliaryWorkingHoursByNumber(String number) {
        return Result.success(auxiliaryWorkingHoursDayService.selectAuxiliaryWorkingHoursByNumber(number));
    }
    @ValueClassify("工时管理")
    @ApiOperation(value = "根据编号当前用户信息查询所在班次")
    @PostMapping("/selectshiftByUser")
    public Result selectshiftByUser(LocalDateTime dateTime) {