zhuo
2025-03-29 94288b8314a4cdc9feedfba28292af41104aeaaf
检验任务数据预警
已修改4个文件
已添加12个文件
534 ■■■■■ 文件已修改
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsProductDeviationWarningController.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductDeviationWarningDto.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningDetailMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarning.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarningDetail.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningDetailService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningService.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java 118 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningDetailServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningServiceImpl.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsProductDeviationWarningDetailMapper.xml 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsProductMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/CodeGenerator.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsProductDeviationWarningController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
package com.ruoyi.inspect.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.inspect.dto.InsProductDeviationWarningDto;
import com.ruoyi.inspect.dto.SampleOrderDto;
import com.ruoyi.inspect.service.InsProductDeviationWarningService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * <p>
 * æ£€éªŒé¡¹åå·®é¢„警主表 å‰ç«¯æŽ§åˆ¶å™¨
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2025-03-28 02:18:02
 */
@RestController
@RequestMapping("/insProductDeviationWarning")
@AllArgsConstructor
@Api(tags="检验项偏差预警")
public class InsProductDeviationWarningController {
    private InsProductDeviationWarningService insProductDeviationWarningService;
    /**
     * æŸ¥è¯¢é¢„警列表
     * @param page
     * @return
     * @throws Exception
     */
    @ApiOperation(value = "查询预警列表")
    @GetMapping("/selectDeviationWarningPage")
    public Result selectDeviationWarningPage(Page page, InsProductDeviationWarningDto deviationWarningDto) {
        return Result.success(insProductDeviationWarningService.selectDeviationWarningPage(page, deviationWarningDto));
    }
//    /**
//     * æŸ¥è¯¢é¢„警详情
//     * @param page
//     * @return
//     * @throws Exception
//     */
//    @ApiOperation(value = "查询预警列表")
//    @GetMapping("/selectDeviationWarning")
//    public Result selectDeviationWarning(InsProductDeviationWarningDto deviationWarningDto){
////        return Result.success(insProductDeviationWarningService.selectDeviationWarningPage(page, deviationWarningDto));
//    }
}
inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductDeviationWarningDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
package com.ruoyi.inspect.dto;
import com.ruoyi.inspect.pojo.InsProductDeviationWarning;
import lombok.Data;
/**
 * @Author zhuo
 * @Date 2025/3/28
 */
@Data
public class InsProductDeviationWarningDto extends InsProductDeviationWarning {
}
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningDetailMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.ruoyi.inspect.mapper;
import com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
 * <p>
 * æ£€éªŒé¡¹åå·®é¢„警详情表 Mapper æŽ¥å£
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2025-03-28 02:18:58
 */
public interface InsProductDeviationWarningDetailMapper extends BaseMapper<InsProductDeviationWarningDetail> {
}
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
package com.ruoyi.inspect.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.inspect.dto.InsProductDeviationWarningDto;
import com.ruoyi.inspect.pojo.InsProductDeviationWarning;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
 * <p>
 * æ£€éªŒé¡¹åå·®é¢„警主表 Mapper æŽ¥å£
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2025-03-28 02:18:02
 */
public interface InsProductDeviationWarningMapper extends BaseMapper<InsProductDeviationWarning> {
    /**
     * æŸ¥çœ‹é¢„警列表
     * @param page
     * @return
     */
    IPage<InsProductDeviationWarningDto> selectDeviationWarningPage(Page page, QueryWrapper<InsProductDeviationWarningDto> ew);
}
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java
@@ -7,6 +7,7 @@
import com.ruoyi.inspect.dto.ProductResultDto2;
import com.ruoyi.inspect.dto.SampleProductRawAnalysisDto;
import com.ruoyi.inspect.pojo.InsProduct;
import com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -75,7 +76,7 @@
     * @param supplierName
     * @return
     */
    List<InsProductAnalysisDto> selectAnalysis(@Param("insProduct") InsProduct insProduct, @Param("supplierName") String supplierName);
    List<InsProductDeviationWarningDetail> selectAnalysis(@Param("insProduct") InsProduct insProduct, @Param("supplierName") String supplierName);
}
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarning.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
package com.ruoyi.inspect.pojo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
 * <p>
 * æ£€éªŒé¡¹åå·®é¢„警主表
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2025-03-28 02:18:02
 */
@Getter
@Setter
@TableName("ins_product_deviation_warning")
@ApiModel(value = "InsProductDeviationWarning对象", description = "检验项偏差预警主表")
public class InsProductDeviationWarning implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "deviation_warning_id", type = IdType.AUTO)
    private Integer deviationWarningId;
    @ApiModelProperty("订单id")
    private Integer insOrderId;
    @ApiModelProperty("样品id")
    private Integer insSampleId;
    @ApiModelProperty("检验项id")
    private Integer insProductId;
    @ApiModelProperty("订单编号")
    private String entrustCode;
    @ApiModelProperty("样品编号")
    private String sampleCode;
    @ApiModelProperty("供应商")
    private String supplierName;
    @ApiModelProperty("偏差值")
    private String deviationValue;
    @ApiModelProperty("检测时间")
    private LocalDateTime detectionTime;
    @TableField(fill = FieldFill.INSERT)
    private String createUser;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateUser;
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarningDetail.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,75 @@
package com.ruoyi.inspect.pojo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
 * <p>
 * æ£€éªŒé¡¹åå·®é¢„警详情表
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2025-03-28 02:18:58
 */
@Getter
@Setter
@TableName("ins_product_deviation_warning_detail")
@ApiModel(value = "InsProductDeviationWarningDetail对象", description = "检验项偏差预警详情表")
public class InsProductDeviationWarningDetail implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "deviation_warning_detail_id", type = IdType.AUTO)
    private Integer deviationWarningDetailId;
    @ApiModelProperty("主表id")
    private Integer deviationWarningId;
    @ApiModelProperty("订单id")
    private Integer insOrderId;
    @ApiModelProperty("样品id")
    private Integer insSampleId;
    @ApiModelProperty("检验项id")
    private Integer insProductId;
    @ApiModelProperty("订单编号")
    private String entrustCode;
    @ApiModelProperty("样品编号")
    private String sampleCode;
    @ApiModelProperty("供应商")
    private String supplierName;
    @ApiModelProperty("检测值")
    private String testValue;
    @ApiModelProperty("检测时间")
    private LocalDateTime detectionTime;
    @ApiModelProperty("是否是问题数据 0: å¦, 1: æ˜¯")
    private Integer isIssue;
    @TableField(fill = FieldFill.INSERT)
    private String createUser;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateUser;
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningDetailService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.ruoyi.inspect.service;
import com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail;
import com.baomidou.mybatisplus.extension.service.IService;
/**
 * <p>
 * æ£€éªŒé¡¹åå·®é¢„警详情表 æœåŠ¡ç±»
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2025-03-28 02:18:58
 */
public interface InsProductDeviationWarningDetailService extends IService<InsProductDeviationWarningDetail> {
}
inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
package com.ruoyi.inspect.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.inspect.dto.InsProductDeviationWarningDto;
import com.ruoyi.inspect.pojo.InsProductDeviationWarning;
import com.baomidou.mybatisplus.extension.service.IService;
/**
 * <p>
 * æ£€éªŒé¡¹åå·®é¢„警主表 æœåŠ¡ç±»
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2025-03-28 02:18:02
 */
public interface InsProductDeviationWarningService extends IService<InsProductDeviationWarning> {
    /**
     * æŸ¥è¯¢é¢„警列表
     * @param page
     * @param deviationWarningDto
     * @return
     */
    IPage<InsProductDeviationWarningDto> selectDeviationWarningPage(Page page, InsProductDeviationWarningDto deviationWarningDto);
}
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -158,6 +158,11 @@
    private ISysDictTypeService iSysDictTypeService;
    @Resource
    private InsOrderRatesService insOrderRatesService;
    @Resource
    private InsProductDeviationWarningService insProductDeviationWarningService;
    @Resource
    private InsProductDeviationWarningDetailService insProductDeviationWarningDetailService;
    @Override
    public IPage<InsOrderPlanVO> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) {
@@ -942,33 +947,10 @@
            // 16 åˆ¤æ–­å½“前样品是否为原材料, åŽŸææ–™éœ€è¦è¿›è¡Œæ•°æ®åˆ†æž, åˆ¤æ–­ä¹‹å‰10条数据同一个供应商, åŒä¸€ä¸ªæ£€éªŒé¡¹çš„偏差是否超过10%
            // æŸ¥è¯¢ifs信息获取获取前10个供应商一样的, æ£€éªŒé¡¹ä¸€æ ·ä¿¡æ¯
//            threadPoolTaskExecutor.execute(() -> {
//
//                for (InsProduct insProduct : productList) {
//                    // todo: æš‚时判断是否是老化
//                    if (insProduct.getInspectionItem().contains("老化")) {
//                        List<InsProductAnalysisDto> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName());
//
//                        if (insProductAnalysisDtoList.size() < 10) {
//                            continue;
//                        }
//
//                        // åˆ¤æ–­å½“前检测项是否偏差超过10%
//                        List<String> laseValueList = insProductAnalysisDtoList.stream().map(InsProductAnalysisDto::getLastValue)
//                                .collect(Collectors.toList());
//
//                        double deviation = isDeviationOverTenPercent(laseValueList, insProduct.getLastValue());
//                        // åˆ¤æ–­åå·®æ˜¯å¦å¤§äºŽ10
//                        if (deviation > 10) {
//                            // å‘送通知, å¹¶ä¸”添加数据
//
//
//
//
//                        }
//                    }
//                }
//            });
            threadPoolTaskExecutor.execute(() -> {
                // æ·»åŠ åˆ†æžæ•°æ®
                addAnalysis(productList, ifsInventoryQuantity, order);
            });
        } else {
@@ -990,6 +972,88 @@
    }
    /**
     * *****添加分析数据******
     * @param productList
     * @param ifsInventoryQuantity
     * @param order
     */
    private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order) {
        for (InsProduct insProduct : productList) {
            // todo: æš‚时判断是否是老化
            if (insProduct.getInspectionItem().contains("老化")) {
                List<InsProductDeviationWarningDetail> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName());
                if (insProductAnalysisDtoList.size() < 10) {
                    continue;
                }
                // åˆ¤æ–­å½“前检测项是否偏差超过10%
                List<String> laseValueList = insProductAnalysisDtoList.stream().map(InsProductDeviationWarningDetail::getTestValue)
                        .collect(Collectors.toList());
                double deviation = isDeviationOverTenPercent(laseValueList, insProduct.getLastValue());
                // åˆ¤æ–­åå·®æ˜¯å¦å¤§äºŽ10
                if (deviation > 10) {
                    // åˆ¤æ–­ä¹‹å‰æ˜¯å¦æ·»åŠ è¿‡, æ·»åŠ è¿‡ä¸éœ€è¦æ·»åŠ 
                    long count = insProductDeviationWarningService.count(Wrappers.<InsProductDeviationWarning>lambdaQuery()
                            .eq(InsProductDeviationWarning::getInsProductId, insProduct.getId()));
                    if (count == 0L) {
                        // å‘送通知, å¹¶ä¸”添加数据
                        // æ·»åŠ ä¸»è¡¨ä¿¡æ¯
                        InsProductDeviationWarning deviationWarning = new InsProductDeviationWarning();
                        deviationWarning.setInsOrderId(order.getId());
                        deviationWarning.setInsSampleId(insProduct.getInsSampleId());
                        deviationWarning.setInsProductId(insProduct.getId());
                        deviationWarning.setEntrustCode(order.getEntrustCode());
                        deviationWarning.setSampleCode(insProduct.getSampleCode());
                        deviationWarning.setSupplierName(ifsInventoryQuantity.getSupplierName());
                        deviationWarning.setDeviationValue(Double.toString(deviation));
                        deviationWarning.setDetectionTime(insProduct.getUpdateTime());
                        insProductDeviationWarningService.save(deviationWarning);
                        // æ·»åŠ è¯¦æƒ…æ•°æ®
                        InsProductDeviationWarningDetail deviationWarningDetail = new InsProductDeviationWarningDetail();
                        deviationWarningDetail.setInsOrderId(order.getId());
                        deviationWarningDetail.setInsSampleId(insProduct.getInsSampleId());
                        deviationWarningDetail.setInsProductId(insProduct.getId());
                        deviationWarningDetail.setEntrustCode(order.getEntrustCode());
                        deviationWarningDetail.setSampleCode(insProduct.getSampleCode());
                        deviationWarningDetail.setSupplierName(ifsInventoryQuantity.getSupplierName());
                        deviationWarningDetail.setTestValue(insProduct.getLastValue());
                        deviationWarningDetail.setIsIssue(1);
                        insProductAnalysisDtoList.add(deviationWarningDetail);
                        // æ·»åŠ id
                        for (InsProductDeviationWarningDetail warningDetail : insProductAnalysisDtoList) {
                            warningDetail.setDeviationWarningId(deviationWarning.getDeviationWarningId());
                        }
                        insProductDeviationWarningDetailService.saveBatch(insProductAnalysisDtoList);
//                    String message = "";
//                    message += "检验任务复核通知";
//                    message += "\n提交人: " + userName;
//                    message += "\n委托编号: " + order.getEntrustCode();
//                    message += "\n样品名称: " + insSample.getModel();
//                    message += "\n规格型号: " + order.getPartDetail();
//                    if (ifsInventoryQuantity != null) {
//                        message += "\n批次号: " + ifsInventoryQuantity.getUpdateBatchNo();
//                    }
//                    //发送企业微信消息通知  æäº¤å¤æ ¸
//                    try {
//                        WxCpUtils.inform(sendUserAccount, message, null);
//                    } catch (Exception e) {
//                        throw new RuntimeException(e);
//                    }
                    }
                }
            }
        }
    }
    /**
     * *****计算偏差****
     * @param data
     * @param targetStr
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningDetailServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package com.ruoyi.inspect.service.impl;
import com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail;
import com.ruoyi.inspect.mapper.InsProductDeviationWarningDetailMapper;
import com.ruoyi.inspect.service.InsProductDeviationWarningDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
 * <p>
 * æ£€éªŒé¡¹åå·®é¢„警详情表 æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2025-03-28 02:18:58
 */
@Service
public class InsProductDeviationWarningDetailServiceImpl extends ServiceImpl<InsProductDeviationWarningDetailMapper, InsProductDeviationWarningDetail> implements InsProductDeviationWarningDetailService {
}
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
package com.ruoyi.inspect.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.inspect.dto.InsProductDeviationWarningDto;
import com.ruoyi.inspect.pojo.InsProductDeviationWarning;
import com.ruoyi.inspect.mapper.InsProductDeviationWarningMapper;
import com.ruoyi.inspect.service.InsProductDeviationWarningService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
 * <p>
 * æ£€éªŒé¡¹åå·®é¢„警主表 æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2025-03-28 02:18:02
 */
@Service
public class InsProductDeviationWarningServiceImpl extends ServiceImpl<InsProductDeviationWarningMapper, InsProductDeviationWarning> implements InsProductDeviationWarningService {
    /**
     * æŸ¥çœ‹é¢„警列表
     * @param page
     * @param deviationWarningDto
     * @return
     */
    @Override
    public IPage<InsProductDeviationWarningDto> selectDeviationWarningPage(Page page, InsProductDeviationWarningDto deviationWarningDto) {
        return baseMapper.selectDeviationWarningPage(page, QueryWrappers.queryWrappers(deviationWarningDto));
    }
}
inspect-server/src/main/resources/mapper/InsProductDeviationWarningDetailMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inspect.mapper.InsProductDeviationWarningDetailMapper">
    <!-- é€šç”¨æŸ¥è¯¢æ˜ å°„结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail">
        <id column="deviation_warning_detail_id" property="deviationWarningDetailId" />
        <result column="deviation_warning_id" property="deviationWarningId" />
        <result column="ins_order_id" property="insOrderId" />
        <result column="ins_sample_id" property="insSampleId" />
        <result column="ins_product_id" property="insProductId" />
        <result column="entrust_code" property="entrustCode" />
        <result column="sample_code" property="sampleCode" />
        <result column="supplier_name" property="supplierName" />
        <result column="test_value" property="testValue" />
        <result column="detection_time" property="detectionTime" />
        <result column="create_user" property="createUser" />
        <result column="update_user" property="updateUser" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>
</mapper>
inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inspect.mapper.InsProductDeviationWarningMapper">
    <!-- æŸ¥çœ‹é¢„警列表 -->
    <select id="selectDeviationWarningPage" resultType="com.ruoyi.inspect.dto.InsProductDeviationWarningDto">
        select * from (select ipdw.*,
        isa.sample sample_name,
        isa.model  sample_model
        from ins_product_deviation_warning ipdw
        left join ins_sample isa on isa.id = ipdw.ins_sample_id) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
        order by ipdw.detection_time desc
    </select>
</mapper>
inspect-server/src/main/resources/mapper/InsProductMapper.xml
@@ -149,11 +149,15 @@
                 left join ins_sample is2 on is2.id = ip.ins_sample_id
        where is2.ins_order_id = #{orderId}
    </select>
    <select id="selectAnalysis" resultType="com.ruoyi.inspect.dto.InsProductAnalysisDto">
        select ip.id insProductId,
               ip.`last_value`,
               io.id insOrderId,
               is2.id insSampleId
    <select id="selectAnalysis" resultType="com.ruoyi.inspect.pojo.InsProductDeviationWarningDetail">
        select io.id           insOrderId,
               is2.id          insSampleId,
               ip.id           insProductId,
               io.entrust_code,
               is2.sample_code,
               iiq.supplier_name,
               ip.`last_value` testValue,
               ip.update_time  detectionTime
        from ins_product ip
                 left join ins_sample is2 on is2.id = ip.ins_sample_id
                 left join ins_order io on io.id = is2.ins_order_id
ruoyi-admin/src/main/java/com/ruoyi/CodeGenerator.java
@@ -16,13 +16,13 @@
// æ¼”示例子,执行 main æ–¹æ³•控制台输入模块表名回车自动生成对应项目目录中
public class CodeGenerator {
    public static String database_url = "jdbc:mysql://114.132.189.42:9004/lims-zb";
    public static String database_url = "jdbc:mysql://localhost:3306/center-lims";
    public static String database_username = "root";
    public static String database_password= "123456";
    public static String author = "芯导软件(江苏)有限公司";
    public static String model_name = "/mes-technical"; // å¦‚果为分布式填子模块名称,如果不是分布式为空即可
    public static String setParent = "com.ruoyi.technical"; // åŒ…路径
    public static String tablePrefix = "technical"; // è®¾ç½®è¿‡æ»¤è¡¨å‰ç¼€
    public static String model_name = "/inspect-server"; // å¦‚果为分布式填子模块名称,如果不是分布式为空即可
    public static String setParent = "com.ruoyi.inspect"; // åŒ…路径
    public static String tablePrefix = ""; // è®¾ç½®è¿‡æ»¤è¡¨å‰ç¼€
    public static void main(String[] args) {
        String projectPath = System.getProperty("user.dir");
        FastAutoGenerator.create(database_url, database_username, database_password)