value
2024-04-19 bb9499352faae20bb2c898f3f6078f7a4e9ceef2
检验项目数据导入;检验模板调整
已修改9个文件
138 ■■■■■ 文件已修改
cnas-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/pojo/StandardMethod.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/resources/mapper/StandardMethodMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsProductUser.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsSampleMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodMapper.java
@@ -17,6 +17,8 @@
    IPage<StandardMethod> selectStandardMethodList(Page page, QueryWrapper<StandardMethod> ew);
    StandardMethod selectStandMethodById(Integer id);
}
cnas-server/src/main/java/com/yuanchu/mom/pojo/StandardMethod.java
@@ -49,7 +49,7 @@
    private String name;
    @ValueTableShow(2)
    @ApiModelProperty(value = "标准描述(英文)")
    @ApiModelProperty(value = "标准描述EN")
    private String nameEn;
    /**
cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
@@ -29,13 +29,29 @@
    @ApiModelProperty(value = "检验项")
    private String inspectionItem;
    @ValueTableShow(2)
    @ApiModelProperty(value = "检验项EN")
    private String inspectionItemEn;
//    @ValueTableShow(2)
//    @ApiModelProperty(value = "检验子项")
//    @ApiModelProperty(value = "检验分类")
//    private String inspectionItemClassify;
    @ValueTableShow(3)
    @ApiModelProperty(value = "检验项子项")
    @ApiModelProperty(value = "检验子项")
    private String inspectionItemSubclass;
    @ValueTableShow(3)
    @ApiModelProperty(value = "检验子项EN")
    private String inspectionItemSubclassEn;
    @ValueTableShow(3)
    @ApiModelProperty(value = "检验对象")
    private Integer sample;
    @ValueTableShow(4)
    @ApiModelProperty(value = "单价(元)")
    private BigDecimal price;
    @ValueTableShow(4)
    @ApiModelProperty(value = "实验室")
@@ -46,16 +62,20 @@
    private String sonLaboratory;
    @ValueTableShow(5)
    @ApiModelProperty(value = "要求描述")
    private String askTell;
    @ValueTableShow(5)
    @ApiModelProperty(value = "要求值")
    private String ask;
    @ValueTableShow(5)
    @ApiModelProperty(value = "计量单位")
    private String unit;
    @ValueTableShow(5)
    @ValueTableShow(6)
    @ApiModelProperty(value = "试验方法")
    private String method;
    @ValueTableShow(6)
    @ApiModelProperty(value = "单价(元)")
    private BigDecimal price;
    @ValueTableShow(7)
    @ApiModelProperty(value = "工时(H)")
@@ -77,7 +97,6 @@
    @ApiModelProperty(value = "检验值类型")
    private String inspectionValueType;
    @ValueTableShow(10)
    @ApiModelProperty(value = "设备组")
    private String deviceGroup;
@@ -95,10 +114,6 @@
    @ValueTableShow(13)
    @ApiModelProperty(value = "特殊标识")
    private String bsm;
    @ValueTableShow(5)
    @ApiModelProperty(value = "检验对象")
    private Integer sample;
    @ValueTableShow(14)
    @ApiModelProperty(value = "原始记录模板")
cnas-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodServiceImpl.java
@@ -66,7 +66,7 @@
    @Override
    public int upStandardMethod(StandardMethod standardMethod) {
        int i = standardMethodMapper.updateById(standardMethod);
        standardTreeService.reTreeBySampleType(standardMethod.getSampleType());
        standardTreeService.reTreeBySampleType(standardMethodMapper.selectStandMethodById(standardMethod.getId()).getSampleType());
        return i;
    }
}
cnas-server/src/main/resources/mapper/StandardMethodMapper.xml
@@ -41,4 +41,26 @@
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="selectStandMethodById" resultType="com.yuanchu.mom.pojo.StandardMethod">
        select sm.id,
               sm.code,
               sm.name,
               sm.structure_test_object_id,
               sto.specimen_name sample_type,
               sm.remark,
               u1.name create_user_name,
               sm.create_time,
               u2.name update_user_name,
               sm.update_time,
               sm.is_product,
               sm.field,
               sm.name_en,
               sm.is_use,
               sm.qualification_id
        from standard_method sm
                 left join user u1 on sm.create_user = u1.id
                 left join user u2 on sm.update_user = u2.id
                 left join structure_test_object sto on sm.structure_test_object_id = sto.id
        where sm.id = #{id}
    </select>
</mapper>
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsProductUser.java
@@ -7,7 +7,9 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
 * 检验项目的人员检验记录
@@ -15,6 +17,8 @@
 */
@TableName(value ="ins_product_user")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class InsProductUser implements Serializable {
    /**
     * 
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -91,6 +91,9 @@
    @Resource
    private InsProductResultMapper insProductResultMapper;
    @Resource
    private InsProductUserMapper insProductUserMapper;
    @Override
    public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) {
        Map<String, Object> map = new HashMap<>();
@@ -144,7 +147,6 @@
    public void saveInsContext(Map<String, Object> insContext) {
        Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
        CompletableFuture.supplyAsync(() -> {
            AtomicInteger count = new AtomicInteger();
            insContext.forEach((k, v) -> {
                JSONObject jo = JSON.parseObject(JSON.toJSONString(v));
                InsProduct insProduct = new InsProduct();
@@ -154,7 +156,7 @@
                    result = new InsProductResult();
                }
                result.setInsProductId(Integer.parseInt(k));
                if(jo.get("insValue") != null){
                if (jo.get("insValue") != null) {
                    JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue")));
                    List<Map<String, Object>> iv = new ArrayList<>();
                    for (Object o : jsonArray) {
@@ -168,11 +170,12 @@
                                map.put("u", insValue.get("u"));
                            }
                            iv.add(map);
                        }catch (Exception e){}
                        } catch (Exception e) {
                        }
                    }
                    result.setInsValue(JSON.toJSONString(iv));
                }
                if(jo.get("comValue") != null){
                if (jo.get("comValue") != null) {
                    JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("comValue")));
                    List<Map<String, Object>> cv = new ArrayList<>();
                    for (Object o : jsonArray2) {
@@ -184,7 +187,7 @@
                    result.setComValue(JSON.toJSONString(cv));
                }
                JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue")));
                if(resValue.get("v")!=null){
                if (resValue.get("v") != null) {
                    insProduct.setLastValue(JSON.parseObject(JSON.toJSONString(resValue.get("v"))).get("v") + "");
                }
                JSONObject equipValue = JSON.parseObject(JSON.toJSONString(jo.get("equipValue")));
@@ -206,11 +209,17 @@
                }
                insProduct.setUpdateUser(userId);
                insProductMapper.updateById(insProduct);
                if (count.get() == 0) {
                    InsSample insSample = insSampleMapper.selectById(insProductMapper.selectById(insProduct.getId()).getInsSampleId());
                    insSample.setInsState(1);
                    count.addAndGet(1);
                insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId()));
                InsSample insSample = insSampleMapper.selectById(insProductMapper.selectById(insProduct.getId()).getInsSampleId());
                insSample.setInsState(1);
                Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
                        .eq(InsProduct::getInsSampleId, insSample.getId()));
                Long l1 = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
                        .eq(InsProduct::getInsSampleId, insSample.getId()).isNotNull(InsProduct::getInsResult));
                if (l == l1) {
                    insSample.setInsState(2);
                }
                insSampleMapper.updateById(insSample);
            });
            return null;
        }).thenAccept(res -> {
@@ -251,11 +260,11 @@
            samples.forEach(a -> {
                Set<String> templateSet = new HashSet<>();
                getTemplateThing(set, map2, a);
                a.getInsProduct().forEach(b->{
                    String[] split = b.getMethod().replaceAll("]", "").replaceAll("\\[","").replaceAll("\"","").split(",");
                a.getInsProduct().forEach(b -> {
                    String[] split = b.getMethod().replaceAll("]", "").replaceAll("\\[", "").replaceAll("\"", "").split(",");
                    standardMethod.addAll(Arrays.asList(split));
                    if(b.getInsProductResult()!=null){
                        if(b.getInsProductResult().getEquipValue()!=null&& !Objects.equals(b.getInsProductResult().getEquipValue(), "")){
                    if (b.getInsProductResult() != null) {
                        if (b.getInsProductResult().getEquipValue() != null && !Objects.equals(b.getInsProductResult().getEquipValue(), "")) {
                            deviceSet.add(b.getInsProductResult().getEquipValue());
                        }
                    }
@@ -265,7 +274,7 @@
                    templateSet.add(JSON.toJSONString(b.getTemplate()));
                });
                AtomicInteger index = new AtomicInteger();
                templateSet.forEach(tem->{
                templateSet.forEach(tem -> {
                    Set<Integer> set2 = new HashSet<>();
                    List<RowRenderData> rows = new ArrayList<>();
                    List<TextRenderData> text = new ArrayList<>();
@@ -283,15 +292,15 @@
                            if ("检验子项".equals(JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "")) {
                                int count2 = 0;
                                for (InsProduct p : a.getInsProduct()) {
                                    if(v.get("v").equals(p.getInspectionItemSubclass())){
                                        pMap.put(jo1.get("r")+"", p);
                                    if (v.get("v").equals(p.getInspectionItemSubclass())) {
                                        pMap.put(jo1.get("r") + "", p);
                                        break;
                                    }else{
                                    } else {
                                        count2++;
                                    }
                                }
                                if(count2 == a.getInsProduct().size()){
                                    delRSet.add(jo1.get("r")+"");
                                if (count2 == a.getInsProduct().size()) {
                                    delRSet.add(jo1.get("r") + "");
                                }
                            }
                        }
@@ -315,7 +324,7 @@
                        }
                        JSONObject v = JSON.parseObject(JSON.toJSONString(jo1.get("v")));
                        InsProduct p = pMap.get(jo1.get("r") + "");
                        if (p!=null && v.get("ps") != null) {
                        if (p != null && v.get("ps") != null) {
                            String value = JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "";
                            if (value.equals("要求值")) {
                                textRenderData.setText(p.getAsk());
@@ -350,7 +359,7 @@
                            } else {
                                textRenderData.setText(v.get("v") == null ? "" : v.get("v") + "");
                            }
                        } else if (p==null && v.get("ps") != null) {
                        } else if (p == null && v.get("ps") != null) {
                            String value = JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "";
                            p = pMap.get(pMap.keySet().iterator().next());
                            if (value.equals("最终值")) {
@@ -427,8 +436,8 @@
            for (String s : standardMethod) {
                standardMethod2.append("、").append(s);
            }
            standardMethod2.replace(0, 1,"");
            tables.forEach(table->{
            standardMethod2.replace(0, 1, "");
            tables.forEach(table -> {
                table.put("tableSize", tables.size() + 1);
            });
            List<Map<String, String>> deviceList = insOrderMapper.selectDeviceList(deviceSet);
@@ -439,8 +448,8 @@
            codeStr.put("发放日期", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
            String codePath;
            try {
                codePath = new MatrixToImageWriter().code(JackSonUtil.marshal(codeStr).replaceAll("\\{","")
                        .replaceAll("}","").replaceAll(",","").replaceAll("\"",""), twoCode);
                codePath = new MatrixToImageWriter().code(JackSonUtil.marshal(codeStr).replaceAll("\\{", "")
                        .replaceAll("}", "").replaceAll(",", "").replaceAll("\"", ""), twoCode);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
@@ -491,8 +500,8 @@
                Map<String, Object> style = new HashMap<>();
                style.put("rowlen", config.get("rowlen"));
                style.put("columnlen", config.get("columnlen"));
//                int r = -1;
                /*if (BeanUtil.isNotEmpty(cellData)) {
                /*int r = -1;
                if (BeanUtil.isNotEmpty(cellData)) {
                    for (JSONObject o : cellData) {
                        JSONObject v = JSON.parseObject(JSON.toJSONString(o.get("v")));
                        tableData.add(o);
inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -51,12 +51,12 @@
        io.state = 1
        AND io.ins_state != 5
        and send_time is not null
        and (isu.user_id = #{userId} OR isu.user_id is NULL)
        GROUP BY
        ip.son_laboratory,
        io.id
        ) a
        LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory
        where a.user_id = #{userId} OR a.user_id is NULL
        ORDER BY
        a.user_id DESC,
        a.type DESC,
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -103,6 +103,6 @@
        select sm.code,sm.name,sm.remark from standard_method sm
        left join structure_test_object sto on sm.structure_test_object_id = sto.id
        where sto.specimen_name = #{sampleType}
        and is_product = 1
        and is_use = 1
    </select>
</mapper>