From 94288b8314a4cdc9feedfba28292af41104aeaaf Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期六, 29 三月 2025 10:06:03 +0800 Subject: [PATCH] 检验任务数据预警 --- inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningDetailServiceImpl.java | 20 ++ inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarning.java | 69 +++++++ inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningService.java | 26 ++ inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java | 3 ruoyi-admin/src/main/java/com/ruoyi/CodeGenerator.java | 8 inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarningDetail.java | 75 ++++++++ inspect-server/src/main/resources/mapper/InsProductDeviationWarningDetailMapper.xml | 23 ++ inspect-server/src/main/resources/mapper/InsProductMapper.xml | 14 + inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningDetailMapper.java | 16 + inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningServiceImpl.java | 34 +++ inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml | 18 ++ inspect-server/src/main/java/com/ruoyi/inspect/controller/InsProductDeviationWarningController.java | 56 ++++++ inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningMapper.java | 26 ++ inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductDeviationWarningDto.java | 12 + inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningDetailService.java | 16 + inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 118 ++++++++++--- 16 files changed, 497 insertions(+), 37 deletions(-) diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsProductDeviationWarningController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsProductDeviationWarningController.java new file mode 100644 index 0000000..2456861 --- /dev/null +++ b/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)); +// } + +} diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductDeviationWarningDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/InsProductDeviationWarningDto.java new file mode 100644 index 0000000..f4fe2f5 --- /dev/null +++ b/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 { +} diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningDetailMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningDetailMapper.java new file mode 100644 index 0000000..97ff637 --- /dev/null +++ b/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> { + +} diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductDeviationWarningMapper.java new file mode 100644 index 0000000..b3ca203 --- /dev/null +++ b/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); +} diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java index 16af37f..d3e7fe3 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsProductMapper.java +++ b/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); } diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarning.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarning.java new file mode 100644 index 0000000..b2a5e9d --- /dev/null +++ b/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; +} diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarningDetail.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsProductDeviationWarningDetail.java new file mode 100644 index 0000000..3b925cb --- /dev/null +++ b/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; +} diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningDetailService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningDetailService.java new file mode 100644 index 0000000..e75eae1 --- /dev/null +++ b/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> { + +} diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsProductDeviationWarningService.java new file mode 100644 index 0000000..150efc6 --- /dev/null +++ b/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); +} diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java index b57a72f..f8d709c 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java +++ b/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 diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningDetailServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningDetailServiceImpl.java new file mode 100644 index 0000000..4eced2e --- /dev/null +++ b/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 { + +} diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductDeviationWarningServiceImpl.java new file mode 100644 index 0000000..49865be --- /dev/null +++ b/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)); + } +} diff --git a/inspect-server/src/main/resources/mapper/InsProductDeviationWarningDetailMapper.xml b/inspect-server/src/main/resources/mapper/InsProductDeviationWarningDetailMapper.xml new file mode 100644 index 0000000..22c9732 --- /dev/null +++ b/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> diff --git a/inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml b/inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml new file mode 100644 index 0000000..26fa63d --- /dev/null +++ b/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> diff --git a/inspect-server/src/main/resources/mapper/InsProductMapper.xml b/inspect-server/src/main/resources/mapper/InsProductMapper.xml index e566513..4727424 100644 --- a/inspect-server/src/main/resources/mapper/InsProductMapper.xml +++ b/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 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/CodeGenerator.java b/ruoyi-admin/src/main/java/com/ruoyi/CodeGenerator.java index c78cf33..e9d4ba9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/CodeGenerator.java +++ b/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) -- Gitblit v1.9.3