Merge branch 'qms/develop' into qms/yf
This commit is contained in:
commit
75f1df3ab5
|
|
@ -206,6 +206,12 @@
|
|||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>8.5.17</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>bcprov-jdk18on</artifactId>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- ==================== OnlyOffice JWT ==================== -->
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
package com.nflg.qms.admin.controller;
|
||||
|
||||
import com.nflg.qms.admin.service.BasdeSerialNumberControllerService;
|
||||
import com.nflg.qms.admin.service.ISendMessageService;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.repository.entity.QmsTodoItem;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 测试
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/test")
|
||||
public class TestController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private List<ISendMessageService> sendMessageServices;
|
||||
|
||||
@Resource
|
||||
private BasdeSerialNumberControllerService basdeSerialNumberControllerService;
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*/
|
||||
@GetMapping("/sendMessage")
|
||||
public ApiResult<Void> sendMessage() {
|
||||
QmsTodoItem qmsTodoItem = new QmsTodoItem()
|
||||
.setCode(basdeSerialNumberControllerService.generateSerialNumber(32))
|
||||
.setIsRead(false)
|
||||
.setSourceTypeId(2046157760401182721L)
|
||||
.setSourceId(0L)
|
||||
.setCreateUserId(UserUtil.getUserId())
|
||||
.setCreateUserName(UserUtil.getUserName())
|
||||
.setCreateTime(java.time.LocalDateTime.now());
|
||||
sendMessageServices.forEach(service -> service.sendSystemMessage(qmsTodoItem));
|
||||
return ApiResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.nflg.qms.admin.service;
|
||||
|
||||
import com.nflg.wms.repository.entity.QmsTodoItem;
|
||||
|
||||
public interface ISendMessageService {
|
||||
|
||||
/**
|
||||
* 发送待办消息
|
||||
* @param item 待办事项
|
||||
*/
|
||||
void sendSystemMessage(QmsTodoItem item);
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
package com.nflg.qms.admin.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.wms.common.constant.Constant;
|
||||
import com.nflg.wms.common.exception.NflgException;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.qo.QmsInspectionStandardAddQO;
|
||||
|
|
@ -13,15 +15,10 @@ import com.nflg.wms.common.pojo.vo.QmsInspectionStandardItemContentVO;
|
|||
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardItemVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardVO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.repository.entity.QmsInspectionStandard;
|
||||
import com.nflg.wms.repository.entity.QmsInspectionStandardItem;
|
||||
import com.nflg.wms.repository.entity.QmsInspectionStandardItemContent;
|
||||
import com.nflg.wms.repository.entity.QmsQcMaterial;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.*;
|
||||
import com.nflg.wms.repository.mapper.QmsInspectionStandardMapper;
|
||||
import com.nflg.wms.repository.service.IQmsInspectionStandardItemContentService;
|
||||
import com.nflg.wms.repository.service.IQmsInspectionStandardItemService;
|
||||
import com.nflg.wms.repository.service.IQmsInspectionStandardService;
|
||||
import com.nflg.wms.repository.service.IQmsQcMaterialService;
|
||||
import com.nflg.wms.repository.service.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -30,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -54,6 +52,9 @@ public class QmsInspectionStandardControllerService {
|
|||
@Resource
|
||||
private IQmsQcMaterialService qmsQcMaterialService;
|
||||
|
||||
@Resource
|
||||
private IDictionaryItemService dictionaryItemService;
|
||||
|
||||
/**
|
||||
* 分页查询检验标准
|
||||
*/
|
||||
|
|
@ -79,7 +80,7 @@ public class QmsInspectionStandardControllerService {
|
|||
|
||||
/**
|
||||
* 启用/禁用检验标准(单条)
|
||||
* @param id 检验标准ID
|
||||
* @param id 检验标准ID
|
||||
* @param enable 是否启用
|
||||
*/
|
||||
public void enable(Long id, Boolean enable) {
|
||||
|
|
@ -105,8 +106,8 @@ public class QmsInspectionStandardControllerService {
|
|||
|
||||
// 2. 已发布的标准不允许删除
|
||||
if (standard.getPublishStatus() != null && standard.getPublishStatus() == 1) {
|
||||
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError,
|
||||
"已发布的检验标准不允许删除,ID: " + id);
|
||||
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError,
|
||||
"已发布的检验标准不允许删除,ID: " + id);
|
||||
}
|
||||
|
||||
// 3. 查询该检验标准下所有检测项
|
||||
|
|
@ -152,7 +153,7 @@ public class QmsInspectionStandardControllerService {
|
|||
if (detail == null) {
|
||||
detail = new QmsInspectionStandardDetailVO();
|
||||
}
|
||||
|
||||
|
||||
// 填充基础字段
|
||||
detail.setId(standard.getId());
|
||||
detail.setMaterialId(standard.getMaterialId());
|
||||
|
|
@ -182,21 +183,21 @@ public class QmsInspectionStandardControllerService {
|
|||
List<QmsInspectionStandardItemVO> itemVOs = new ArrayList<>();
|
||||
for (QmsInspectionStandardItem item : items) {
|
||||
QmsInspectionStandardItemVO itemVO = convertToItemVO(item);
|
||||
|
||||
|
||||
// 查询检测项内容列表
|
||||
List<QmsInspectionStandardItemContent> contents = inspectionStandardItemContentService.lambdaQuery()
|
||||
.eq(QmsInspectionStandardItemContent::getInspectionStandardItemId, item.getId())
|
||||
.orderByAsc(QmsInspectionStandardItemContent::getSortNo)
|
||||
.list();
|
||||
|
||||
|
||||
List<QmsInspectionStandardItemContentVO> contentVOs = contents.stream()
|
||||
.map(this::convertToContentVO)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
itemVO.setContents(contentVOs);
|
||||
itemVOs.add(itemVO);
|
||||
}
|
||||
|
||||
|
||||
detail.setItems(itemVOs);
|
||||
return detail;
|
||||
}
|
||||
|
|
@ -330,6 +331,13 @@ public class QmsInspectionStandardControllerService {
|
|||
if (standard.getPublishStatus() != null && standard.getPublishStatus() == 1) {
|
||||
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError, "已发布的检验标准不允许修改");
|
||||
}
|
||||
VUtil.trueThrowBusinessError(
|
||||
inspectionStandardService.lambdaQuery()
|
||||
.ne(QmsInspectionStandard::getId, qo.getId())
|
||||
.eq(QmsInspectionStandard::getMaterialId, qo.getMaterialId())
|
||||
.eq(QmsInspectionStandard::getVersion, qo.getVersion())
|
||||
.exists()
|
||||
).throwMessage("存在相同版本的检验标准");
|
||||
|
||||
Long userId = UserUtil.getUserId();
|
||||
String userName = UserUtil.getUserName();
|
||||
|
|
@ -353,18 +361,19 @@ public class QmsInspectionStandardControllerService {
|
|||
/**
|
||||
* 处理检测项列表(新增、更新、删除)
|
||||
* @param inspectionStandardId 检验标准ID
|
||||
* @param items 检测项列表
|
||||
* @param userId 用户ID
|
||||
* @param userName 用户名
|
||||
* @param now 当前时间
|
||||
* @param items 检测项列表
|
||||
* @param userId 用户ID
|
||||
* @param userName 用户名
|
||||
* @param now 当前时间
|
||||
*/
|
||||
private void processItems(Long inspectionStandardId,
|
||||
private void processItems(List<DictionaryItem> dictionaryItems,
|
||||
Long inspectionStandardId,
|
||||
List<QmsInspectionStandardSaveQO.InspectionStandardItemQO> items,
|
||||
Long userId, String userName, LocalDateTime now) {
|
||||
if (items == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 获取该检验标准下所有现有的检测项ID
|
||||
List<Long> existingItemIds = inspectionStandardItemService.lambdaQuery()
|
||||
.eq(QmsInspectionStandardItem::getInspectionStandardId, inspectionStandardId)
|
||||
|
|
@ -376,15 +385,30 @@ public class QmsInspectionStandardControllerService {
|
|||
// 处理传入的检测项
|
||||
List<Long> newItemIds = new ArrayList<>();
|
||||
for (QmsInspectionStandardSaveQO.InspectionStandardItemQO itemQO : items) {
|
||||
DictionaryItem dictionaryItem = dictionaryItems.stream()
|
||||
.filter(item -> item.getId().equals(itemQO.getSamplingMethodDictItemId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(dictionaryItem)).throwMessage("检测项【" + itemQO.getName() + "】设置的抽样方式不存在");
|
||||
if (StrUtil.equals(dictionaryItem.getCode(), "抽样")) {
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(itemQO.getSamplingPlanId()))
|
||||
.throwMessage("检测项【" + itemQO.getName() + "】设置的抽样方式为【抽样】时,抽样方案不能为空");
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(itemQO.getInspectionLevelDictItemId()))
|
||||
.throwMessage("检测项【" + itemQO.getName() + "】设置的抽样方式为【抽样】时,检验水平不能为空");
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(itemQO.getAqlPriorityValueId()))
|
||||
.throwMessage("检测项【" + itemQO.getName() + "】设置的抽样方式为【抽样】时,AQL值不能为空");
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(itemQO.getAqlTypeDictItemId()))
|
||||
.throwMessage("检测项【" + itemQO.getName() + "】设置的抽样方式为【抽样】时,AQL类型不能为空");
|
||||
}
|
||||
QmsInspectionStandardItem item;
|
||||
|
||||
|
||||
if (itemQO.getId() != null) {
|
||||
// 更新现有检测项
|
||||
item = inspectionStandardItemService.getById(itemQO.getId());
|
||||
if (item == null) {
|
||||
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError, "检测项不存在:" + itemQO.getId());
|
||||
}
|
||||
|
||||
|
||||
// 更新字段
|
||||
updateItemFields(item, itemQO, userId, userName, now);
|
||||
inspectionStandardItemService.updateById(item);
|
||||
|
|
@ -395,7 +419,7 @@ public class QmsInspectionStandardControllerService {
|
|||
updateItemFields(item, itemQO, userId, userName, now);
|
||||
inspectionStandardItemService.save(item);
|
||||
}
|
||||
|
||||
|
||||
newItemIds.add(item.getId());
|
||||
|
||||
// 处理检测项内容
|
||||
|
|
@ -406,13 +430,13 @@ public class QmsInspectionStandardControllerService {
|
|||
List<Long> itemsToDelete = existingItemIds.stream()
|
||||
.filter(id -> !newItemIds.contains(id))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
if (!itemsToDelete.isEmpty()) {
|
||||
// 先删除检测项内容
|
||||
inspectionStandardItemContentService.lambdaUpdate()
|
||||
.in(QmsInspectionStandardItemContent::getInspectionStandardItemId, itemsToDelete)
|
||||
.remove();
|
||||
|
||||
|
||||
// 再删除检测项
|
||||
inspectionStandardItemService.removeByIds(itemsToDelete);
|
||||
}
|
||||
|
|
@ -439,13 +463,14 @@ public class QmsInspectionStandardControllerService {
|
|||
String userName = UserUtil.getUserName();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
// 2. 处理检测项列表
|
||||
processItems(qo.getInspectionStandardId(), qo.getItems(), userId, userName, now);
|
||||
processItems(dictionaryItemService.getListByDictionaryCode(Constant.DICTIONARY_INSPECTION_STANDARD_SAMPLING_METHOD),
|
||||
qo.getInspectionStandardId(), qo.getItems(), userId, userName, now);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新检测项字段
|
||||
*/
|
||||
private void updateItemFields(QmsInspectionStandardItem item,
|
||||
private void updateItemFields(QmsInspectionStandardItem item,
|
||||
QmsInspectionStandardSaveQO.InspectionStandardItemQO qo,
|
||||
Long userId, String userName, LocalDateTime now) {
|
||||
if (qo.getName() != null) {
|
||||
|
|
@ -478,11 +503,11 @@ public class QmsInspectionStandardControllerService {
|
|||
if (qo.getPdfDrawing() != null) {
|
||||
item.setPdfDrawing(qo.getPdfDrawing());
|
||||
}
|
||||
|
||||
|
||||
item.setUpdateUserId(userId);
|
||||
item.setUpdateUserName(userName);
|
||||
item.setUpdateTime(now);
|
||||
|
||||
|
||||
// 新增时设置创建信息
|
||||
if (item.getCreateUserId() == null) {
|
||||
item.setCreateUserId(userId);
|
||||
|
|
@ -494,7 +519,7 @@ public class QmsInspectionStandardControllerService {
|
|||
/**
|
||||
* 处理检测项内容(新增、更新、删除)
|
||||
*/
|
||||
private void processItemContents(Long itemId,
|
||||
private void processItemContents(Long itemId,
|
||||
List<QmsInspectionStandardSaveQO.InspectionStandardItemContentQO> contents,
|
||||
Long userId, String userName, LocalDateTime now) {
|
||||
// 获取现有的内容ID列表
|
||||
|
|
@ -506,18 +531,18 @@ public class QmsInspectionStandardControllerService {
|
|||
.collect(Collectors.toList());
|
||||
|
||||
List<Long> newContentIds = new ArrayList<>();
|
||||
|
||||
|
||||
if (contents != null && !contents.isEmpty()) {
|
||||
for (QmsInspectionStandardSaveQO.InspectionStandardItemContentQO contentQO : contents) {
|
||||
QmsInspectionStandardItemContent content;
|
||||
|
||||
|
||||
if (contentQO.getId() != null) {
|
||||
// 更新现有内容
|
||||
content = inspectionStandardItemContentService.getById(contentQO.getId());
|
||||
if (content == null) {
|
||||
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError, "检测项内容不存在:" + contentQO.getId());
|
||||
}
|
||||
|
||||
|
||||
updateContentFields(content, contentQO, userId, userName, now);
|
||||
inspectionStandardItemContentService.updateById(content);
|
||||
} else {
|
||||
|
|
@ -527,7 +552,7 @@ public class QmsInspectionStandardControllerService {
|
|||
updateContentFields(content, contentQO, userId, userName, now);
|
||||
inspectionStandardItemContentService.save(content);
|
||||
}
|
||||
|
||||
|
||||
newContentIds.add(content.getId());
|
||||
}
|
||||
}
|
||||
|
|
@ -536,7 +561,7 @@ public class QmsInspectionStandardControllerService {
|
|||
List<Long> contentsToDelete = existingContentIds.stream()
|
||||
.filter(id -> !newContentIds.contains(id))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
if (!contentsToDelete.isEmpty()) {
|
||||
inspectionStandardItemContentService.removeByIds(contentsToDelete);
|
||||
}
|
||||
|
|
@ -566,11 +591,11 @@ public class QmsInspectionStandardControllerService {
|
|||
if (qo.getJudgmentTypeDictItemId() != null) {
|
||||
content.setJudgmentTypeDictItemId(qo.getJudgmentTypeDictItemId());
|
||||
}
|
||||
|
||||
|
||||
content.setUpdateUserId(userId);
|
||||
content.setUpdateUserName(userName);
|
||||
content.setUpdateTime(now);
|
||||
|
||||
|
||||
// 新增时设置创建信息
|
||||
if (content.getCreateUserId() == null) {
|
||||
content.setCreateUserId(userId);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.nflg.qms.admin.service.impl;
|
||||
|
||||
import com.nflg.qms.admin.service.ISendMessageService;
|
||||
import com.nflg.wms.repository.entity.QmsTodoItem;
|
||||
import com.nflg.wms.starter.service.EmailService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 邮件消息实现类
|
||||
*/
|
||||
@Service
|
||||
public class EmailMessageImpl implements ISendMessageService {
|
||||
|
||||
@Resource
|
||||
private EmailService emailService;
|
||||
|
||||
@Override
|
||||
public void sendSystemMessage(QmsTodoItem item) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.nflg.qms.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.qms.admin.service.ISendMessageService;
|
||||
import com.nflg.qms.admin.service.RtxSendService;
|
||||
import com.nflg.wms.common.pojo.vo.DictionaryItemTranslateVO;
|
||||
import com.nflg.wms.common.util.MultilingualUtil;
|
||||
import com.nflg.wms.repository.entity.QmsTodoItem;
|
||||
import com.nflg.wms.repository.entity.UserInterior;
|
||||
import com.nflg.wms.repository.service.IDictionaryItemTranslateService;
|
||||
import com.nflg.wms.repository.service.IUserInteriorService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 腾讯RTX消息实现类
|
||||
*/
|
||||
@Service
|
||||
public class RtxMessageImpl implements ISendMessageService {
|
||||
|
||||
@Resource
|
||||
private RtxSendService rtxSendService;
|
||||
|
||||
@Resource
|
||||
private IUserInteriorService userInteriorService;
|
||||
|
||||
@Resource
|
||||
private IDictionaryItemTranslateService dictionaryItemTranslateService;
|
||||
|
||||
@Override
|
||||
public void sendSystemMessage(QmsTodoItem item) {
|
||||
UserInterior userInterior = userInteriorService.lambdaQuery()
|
||||
.eq(UserInterior::getUserId, item.getCreateUserId())
|
||||
.one();
|
||||
if (Objects.nonNull(userInterior) && StrUtil.isNotBlank(userInterior.getRtxCode())) {
|
||||
DictionaryItemTranslateVO dictionaryItemTranslateVO = dictionaryItemTranslateService.getByDictionaryItemId(item.getSourceTypeId(), MultilingualUtil.getLanguage());
|
||||
if (Objects.nonNull(dictionaryItemTranslateVO)) {
|
||||
rtxSendService.sendNotify(List.of(userInterior.getRtxCode()),
|
||||
dictionaryItemTranslateVO.getValue(),
|
||||
switch (dictionaryItemTranslateVO.getDictionaryItemCode()) {
|
||||
default -> "未定义的待办事项:" + dictionaryItemTranslateVO.getDictionaryItemCode();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.nflg.qms.admin.service.impl;
|
||||
|
||||
import com.nflg.qms.admin.service.ISendMessageService;
|
||||
import com.nflg.wms.repository.entity.QmsTodoItem;
|
||||
import com.nflg.wms.repository.service.IQmsTodoItemService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 待办事项消息实现类
|
||||
*/
|
||||
@Service
|
||||
public class TodoItemMessageImpl implements ISendMessageService {
|
||||
|
||||
@Resource
|
||||
private IQmsTodoItemService todoItemService;
|
||||
|
||||
@Override
|
||||
public void sendSystemMessage(QmsTodoItem item) {
|
||||
todoItemService.save(item);
|
||||
}
|
||||
}
|
||||
|
|
@ -39,4 +39,6 @@ public class Constant {
|
|||
public static final String DICTIONARY_AD_TYPE ="AdvertisementType";
|
||||
|
||||
public static final String DICTIONARY_AD_POSITION ="AdvertisementPosition";
|
||||
|
||||
public static final String DICTIONARY_INSPECTION_STANDARD_SAMPLING_METHOD ="InspectionStandardSamplingMethod";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EmailConfig {
|
||||
|
||||
//SMTP 服务器地址
|
||||
private String host;
|
||||
|
||||
//SMTP 服务器端口
|
||||
private Integer port;
|
||||
|
||||
//发件人用户名
|
||||
private String username;
|
||||
|
||||
//发件人密码
|
||||
private String password;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -38,21 +39,24 @@ public class QmsInspectionStandardSaveQO {
|
|||
/**
|
||||
* 检测项名称
|
||||
*/
|
||||
@NotBlank(message = "检测项名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
private Integer sortNo;
|
||||
private Integer sortNo = 0;
|
||||
|
||||
/**
|
||||
* 检测方式,关联字典项id
|
||||
*/
|
||||
@NotNull(message = "检测方式不能为空")
|
||||
private Long testingMethodDictItemId;
|
||||
|
||||
/**
|
||||
* 抽样方式,关联字典项id
|
||||
*/
|
||||
@NotNull(message = "抽样方式不能为空")
|
||||
private Long samplingMethodDictItemId;
|
||||
|
||||
/**
|
||||
|
|
@ -78,6 +82,7 @@ public class QmsInspectionStandardSaveQO {
|
|||
/**
|
||||
* 检验标准项类型:0-标准检测项,1-尺寸检测项
|
||||
*/
|
||||
@NotNull(message = "检验标准项类型不能为空")
|
||||
private Short itemType;
|
||||
|
||||
/**
|
||||
|
|
@ -106,16 +111,18 @@ public class QmsInspectionStandardSaveQO {
|
|||
/**
|
||||
* 排序号
|
||||
*/
|
||||
private Integer sortNo;
|
||||
private Integer sortNo=0;
|
||||
|
||||
/**
|
||||
* 检测项名称
|
||||
*/
|
||||
@NotBlank(message = "检测项内容不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 检测标准
|
||||
*/
|
||||
@NotBlank(message = "检测标准不能为空")
|
||||
private String testStandard;
|
||||
|
||||
/**
|
||||
|
|
@ -131,6 +138,7 @@ public class QmsInspectionStandardSaveQO {
|
|||
/**
|
||||
* 判定类型,关联字典项id
|
||||
*/
|
||||
@NotNull(message = "判定类型不能为空")
|
||||
private Long judgmentTypeDictItemId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,6 @@ public class QmsTodoItem implements Serializable {
|
|||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 来源类型ID,关联dictionary_item表(字典编码MessageType)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -44,4 +44,9 @@ public class UserInterior implements Serializable {
|
|||
* 职位id
|
||||
*/
|
||||
private Long positionId;
|
||||
|
||||
/**
|
||||
* rtx账号
|
||||
*/
|
||||
private String rtxCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,6 @@ public interface DictionaryItemTranslateMapper extends BaseMapper<DictionaryItem
|
|||
String getValueByCode(String dictionaryCode, String dictionaryItemCode, String language);
|
||||
|
||||
List<DictionaryItemTranslate> getByDictionaryCode(String dictionaryCode);
|
||||
|
||||
DictionaryItemTranslateVO getByDictionaryItemId(Long id, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ public interface IDictionaryItemTranslateService extends IService<DictionaryItem
|
|||
|
||||
List<DictionaryItemTranslateVO> getListByDictionaryItemId(Long id);
|
||||
|
||||
DictionaryItemTranslateVO getByDictionaryItemId(Long id, String language);
|
||||
|
||||
Long getId(Long dictionaryItemId, String code);
|
||||
|
||||
List<DictionaryItemTranslateVO> getAllByDictionaryCode(String code, String language);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ public class DictionaryItemTranslateServiceImpl extends ServiceImpl<DictionaryIt
|
|||
return datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictionaryItemTranslateVO getByDictionaryItemId(Long id, String language) {
|
||||
return baseMapper.getByDictionaryItemId(id, language);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId(Long dictionaryItemId, String code) {
|
||||
DictionaryItemTranslate translate = lambdaQuery()
|
||||
|
|
|
|||
|
|
@ -37,4 +37,12 @@
|
|||
WHERE d.code=#{dictionaryCode}
|
||||
ORDER BY dit.id
|
||||
</select>
|
||||
|
||||
<select id="getByDictionaryItemId" resultType="com.nflg.wms.common.pojo.vo.DictionaryItemTranslateVO">
|
||||
SELECT t.id,l.code,l.name,t.value,t.dictionary_item_id,di.name as "dictionaryItemName",di.code as "dictionaryItemCode"
|
||||
FROM dictionary_item_translate t
|
||||
LEFT JOIN dictionary_item di ON di.id=t.dictionary_item_id
|
||||
LEFT JOIN language l ON t.language_code=l.code
|
||||
WHERE t.dictionary_item_id=#{id} AND t.language_code=#{language}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@
|
|||
s.update_time AS updateTime
|
||||
FROM qms_inspection_standard s
|
||||
LEFT JOIN qms_qc_material m ON s.material_id = m.id
|
||||
LEFT JOIN qms_quality_inspector iqe ON m.id = iqe.material_id AND iqe.inspection_type = 1 AND iqe.enable = true
|
||||
LEFT JOIN qms_inspector_material_item imi ON imi.material_id = m.id
|
||||
LEFT JOIN qms_quality_inspector iqe ON imi.inspector_id = iqe.id AND iqe.inspection_type = 1 AND iqe.enable = true
|
||||
LEFT JOIN "user" iqe_user ON iqe.user_id = iqe_user.id
|
||||
<where>
|
||||
<if test="request.materialNo != null and request.materialNo != ''">
|
||||
|
|
@ -58,9 +59,8 @@
|
|||
m.material_category_code_path_name AS materialCategoryCodePathName,
|
||||
m.material_desc AS materialDesc,
|
||||
m.drawing_no_ver AS drawingNoVer,
|
||||
s.inspection_task_item_id AS inspectionTaskItemId,
|
||||
s.drawing_url AS drawingUrl,
|
||||
s.version_no AS versionNo,
|
||||
s.version AS versionNo,
|
||||
s.is_enabled AS isEnabled,
|
||||
s.packaging_method_id AS packagingMethodId,
|
||||
s.inspection_cycle AS inspectionCycle,
|
||||
|
|
@ -77,11 +77,12 @@
|
|||
s.update_time AS updateTime
|
||||
FROM qms_inspection_standard s
|
||||
LEFT JOIN qms_qc_material m ON s.material_id = m.id
|
||||
LEFT JOIN qms_quality_inspector iqe ON m.id = iqe.material_id AND iqe.inspection_type = 1 AND iqe.enable = true
|
||||
LEFT JOIN qms_inspector_material_item imi ON imi.material_id = m.id
|
||||
LEFT JOIN qms_quality_inspector iqe ON m.id = imi.inspector_id AND iqe.inspection_type = 1 AND iqe.enable = true
|
||||
LEFT JOIN "user" iqe_user ON iqe.user_id = iqe_user.id
|
||||
WHERE s.id = #{id}
|
||||
GROUP BY s.id, s.material_id, m.material_no, m.material_category_code_path_name, m.material_desc, m.drawing_no_ver,
|
||||
s.inspection_task_item_id, s.drawing_url, s.version_no, s.is_enabled, s.packaging_method_id,
|
||||
s.drawing_url, s.version, s.is_enabled, s.packaging_method_id,
|
||||
s.inspection_cycle, s.publish_status, s.publish_user_id, s.publish_user_name, s.publish_time,
|
||||
s.create_user_id, s.create_user_name, s.create_time, s.update_user_id, s.update_user_name, s.update_time
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -117,6 +117,15 @@
|
|||
<artifactId>s3</artifactId>
|
||||
<version>2.39.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package com.nflg.wms.starter.service;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.nflg.wms.common.pojo.dto.EmailConfig;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.ParamConfig;
|
||||
import com.nflg.wms.repository.service.IParamConfigService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.mail.*;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class EmailService {
|
||||
|
||||
@Resource
|
||||
private IParamConfigService paramConfigService;
|
||||
|
||||
public void sendEmail(String to,String subject, String content) throws MessagingException {
|
||||
log.info("准备发送邮件,to:{},subject:{},content:{}",to,subject,content);
|
||||
ParamConfig config = paramConfigService.lambdaQuery().eq(ParamConfig::getCode, "EmailSet").one();
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(config)).throwMessage("未配置邮件参数");
|
||||
EmailConfig emailConfig= JSONUtil.toBean(config.getValue(), EmailConfig.class);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(emailConfig)).throwMessage("邮件参数解析失败");
|
||||
Properties properties = new Properties();
|
||||
properties.put("mail.smtp.host", emailConfig.getHost());
|
||||
properties.put("mail.smtp.port", emailConfig.getPort().toString());
|
||||
properties.put("mail.smtp.auth", "true");
|
||||
properties.put("mail.smtp.ssl.enable", "true");
|
||||
// 设置超时时间(单位:毫秒)
|
||||
properties.put("mail.smtp.connectiontimeout", "5000"); // 连接超时
|
||||
properties.put("mail.smtp.timeout", "5000"); // 读取超时
|
||||
properties.put("mail.smtp.writetimeout", "5000"); // 写入超时
|
||||
Session session = Session.getInstance(properties, new Authenticator() {
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(emailConfig.getUsername(), emailConfig.getPassword());
|
||||
}
|
||||
});
|
||||
MimeMessage message = new MimeMessage(session);
|
||||
message.setFrom(new InternetAddress(emailConfig.getUsername()));
|
||||
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
|
||||
message.setSubject(subject);
|
||||
message.setContent(content, "text/html; charset=UTF-8");
|
||||
Transport.send(message);
|
||||
log.info("发送邮件完成,to:{},subject:{},content:{}",to,subject,content);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue