消息模块

pull/451/head
starrysky 2020-02-28 01:02:29 +08:00
parent 686bd25ed7
commit 1ef83f9e4a
12 changed files with 268 additions and 6 deletions

View File

@ -6,6 +6,12 @@ package me.zhengjie.modules.system.cons;
*/
public enum MessageModulePath {
CUSTOMER_ORDER_LIST("客户订单列表","order/customerOrder"),
DELIVERY_ORDER_INFO_LIST("销售发货单列表","order/deliveryOrderInfo"),
OUT_SOURCE_LIST("委外加工单列表","outSource/outSourceProcess"),
OUT_SOURCE_INSPECTION_CERTIFICATE_LIST("委外验收单列表","outSource/outSourceInspectionCertificate"),
PRODUCT_PURCHASE_LIST("产品采购单列表","purchase/productPurchase"),
CONSUMABLES_PURCHASE_LIST("耗材采购单列表","purchase/consumablesPurchase"),
QUALITY_CHECKSHEET_LIST("质量检验单列表","productQuality/qualityCheckSheet"),
;

View File

@ -6,7 +6,12 @@ package me.zhengjie.modules.system.cons;
*/
public enum MessageModuleType {
CUSTOMER_ORDER("客户订单", "CUSTOMER_ORDER"),
INVOICE("销售发货单", "INVOICE")
INVOICE("销售发货单", "INVOICE"),
OUT_SOURCE_PROCESS("委外加工单", "OUT_SOURCE_PROCESS"),
OUT_SOURCE_INSPECTION_CERTIFICATE("委外验收单", "OUT_SOURCE_INSPECTION_CERTIFICATE"),
PRODUCT_PURCHASE("产品采购单", "PRODUCT_PURCHASE"),
CONSUMABLES_PURCHASE("耗材采购单", "CONSUMABLES_PURCHASE"),
QUALITY_CHECK_SHEET("质量检验单", "QUALITY_CHECK_SHEET"),
;
private String name;

View File

@ -1,6 +1,5 @@
package me.zhengjie.modules.system.repository;
import me.zhengjie.modules.system.domain.Menu;
import me.zhengjie.modules.system.domain.Message;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

View File

@ -25,14 +25,14 @@ public class MessageController {
private MessageService messageService;
@ApiOperation(value = "我的消息列表")
@GetMapping(value = "/queryInvoiceList")
@GetMapping(value = "/queryMessageList")
@PreAuthorize("hasAnyRole('ADMIN','MESSAGE_ALL','MESSAGE_ALL')")
public ResponseEntity queryInvoiceList(MessageCriteria criteria){
public ResponseEntity queryMessageList(MessageCriteria criteria){
return new ResponseEntity(messageService.queryAll(criteria), HttpStatus.OK);
}
@Log("修改消息")
@PutMapping(value = "/menus")
@PutMapping(value = "/message")
@PreAuthorize("hasAnyRole('ADMIN','MESSAGE_ALL','MESSAGE_EDIT')")
public ResponseEntity update(@Validated(Menu.Update.class) @RequestBody Message resources){
messageService.update(resources);

View File

@ -3,7 +3,6 @@ package me.zhengjie.modules.system.service;
import me.zhengjie.modules.system.domain.Message;
import me.zhengjie.modules.system.service.dto.MessageCriteria;
import me.zhengjie.modules.system.service.dto.MessageDTO;
import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateQueryCriteria;
/**
* @author

View File

@ -250,6 +250,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService {
message.setModulePath(MessageModulePath.CUSTOMER_ORDER_LIST.getCode());
message.setModuleTypeName(MessageModuleType.CUSTOMER_ORDER.getCode());
message.setReadStatus(MessageReadStatus.NO_READ.getStatus());
message.setInitCode(customerOrderCode);
messageList.add(message);
}
messageRepository.saveAll(messageList);

View File

@ -1,6 +1,15 @@
package me.zhengjie.modules.wms.invoice.service.impl;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.cons.MessageModulePath;
import me.zhengjie.modules.system.cons.MessageModuleType;
import me.zhengjie.modules.system.cons.MessageReadStatus;
import me.zhengjie.modules.system.domain.Message;
import me.zhengjie.modules.system.repository.MessageRepository;
import me.zhengjie.modules.system.service.UserService;
import me.zhengjie.modules.system.service.dto.UserDTO;
import me.zhengjie.modules.system.service.dto.UserQueryCriteria;
import me.zhengjie.modules.wms.bd.domain.CustomerInfo;
import me.zhengjie.modules.wms.bd.domain.ProductInfo;
import me.zhengjie.modules.wms.bd.repository.CustomerInfoRepository;
@ -53,6 +62,7 @@ import javax.persistence.criteria.Root;
* @author jie
* @date 2019-08-27
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class InvoiceServiceImpl implements InvoiceService {
@ -75,6 +85,12 @@ public class InvoiceServiceImpl implements InvoiceService {
@Autowired
private ProductInfoRepository productInfoRepository;
@Autowired
private MessageRepository messageRepository;
@Autowired
private UserService userService;
@Override
public Object queryAll(InvoiceQueryCriteria criteria, Pageable pageable){
Specification<Invoice> specification = new Specification<Invoice>() {
@ -261,6 +277,33 @@ public class InvoiceServiceImpl implements InvoiceService {
InvoiceDetailDTO invoiceDetailDTO = new InvoiceDetailDTO();
BeanUtils.copyProperties(invoiceDTO, invoiceDetailDTO);
invoiceDetailDTO.setInvoiceProductDTOList(invoiceProductDTOList);
/**
*
*/
try {
// 查看所有用户
UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
List<UserDTO> userDTOList =(List<UserDTO>)userService.queryAll(userQueryCriteria);
if(!CollectionUtils.isEmpty(userDTOList)){
List<Message> messageList = new ArrayList<>();
for(UserDTO userDTO : userDTOList){
Message message = new Message();
message.setUserIdAccept(userDTO.getId());
String messageContent = MessageModuleType.INVOICE.getName() + "(" + saleInvoiceCode + ")";
message.setMessContent(messageContent);
message.setModulePath(MessageModulePath.DELIVERY_ORDER_INFO_LIST.getCode());
message.setModuleTypeName(MessageModuleType.INVOICE.getCode());
message.setReadStatus(MessageReadStatus.NO_READ.getStatus());
message.setInitCode(saleInvoiceCode);
messageList.add(message);
}
messageRepository.saveAll(messageList);
}
}catch (Exception e){
log.error("单据编号:插入消息失败!");
}
return invoiceDetailDTO;
}

View File

@ -1,6 +1,15 @@
package me.zhengjie.modules.wms.outSourceProductSheet.service.impl;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.cons.MessageModulePath;
import me.zhengjie.modules.system.cons.MessageModuleType;
import me.zhengjie.modules.system.cons.MessageReadStatus;
import me.zhengjie.modules.system.domain.Message;
import me.zhengjie.modules.system.repository.MessageRepository;
import me.zhengjie.modules.system.service.UserService;
import me.zhengjie.modules.system.service.dto.UserDTO;
import me.zhengjie.modules.system.service.dto.UserQueryCriteria;
import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificate;
import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificateProduct;
import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceProcessSheet;
@ -43,6 +52,7 @@ import javax.persistence.criteria.Root;
* @author jie
* @date 2019-10-01
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class OutSourceInspectionCertificateServiceImpl implements OutSourceInspectionCertificateService {
@ -60,6 +70,12 @@ public class OutSourceInspectionCertificateServiceImpl implements OutSourceInspe
@Autowired
private OutSourceInspectionCertificateProductMapper outSourceInspectionCertificateProductMapper;
@Autowired
private MessageRepository messageRepository;
@Autowired
private UserService userService;
@Override
public Object queryAll(OutSourceInspectionCertificateQueryCriteria criteria, Pageable pageable){
Specification<OutSourceInspectionCertificate> specification = new Specification<OutSourceInspectionCertificate>() {
@ -170,6 +186,31 @@ public class OutSourceInspectionCertificateServiceImpl implements OutSourceInspe
outSourceInspectionCertificateDTO.setOutSourceInspectionCertificateProductList(outSourceInspectionCertificateProductDTOList);
}
/**
*
*/
try {
// 查看所有用户
UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
List<UserDTO> userDTOList =(List<UserDTO>)userService.queryAll(userQueryCriteria);
if(!CollectionUtils.isEmpty(userDTOList)){
List<Message> messageList = new ArrayList<>();
for(UserDTO userDTO : userDTOList){
Message message = new Message();
message.setUserIdAccept(userDTO.getId());
String messageContent = MessageModuleType.OUT_SOURCE_INSPECTION_CERTIFICATE.getName() + "(" + outSourceInspectionCertificateCode + ")";
message.setMessContent(messageContent);
message.setModulePath(MessageModulePath.OUT_SOURCE_INSPECTION_CERTIFICATE_LIST.getCode());
message.setModuleTypeName(MessageModuleType.OUT_SOURCE_INSPECTION_CERTIFICATE.getCode());
message.setReadStatus(MessageReadStatus.NO_READ.getStatus());
message.setInitCode(outSourceInspectionCertificateCode);
messageList.add(message);
}
messageRepository.saveAll(messageList);
}
}catch (Exception e){
log.error("单据编号:插入消息失败!");
}
return outSourceInspectionCertificateDTO;
}

View File

@ -1,6 +1,15 @@
package me.zhengjie.modules.wms.outSourceProductSheet.service.impl;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.cons.MessageModulePath;
import me.zhengjie.modules.system.cons.MessageModuleType;
import me.zhengjie.modules.system.cons.MessageReadStatus;
import me.zhengjie.modules.system.domain.Message;
import me.zhengjie.modules.system.repository.MessageRepository;
import me.zhengjie.modules.system.service.UserService;
import me.zhengjie.modules.system.service.dto.UserDTO;
import me.zhengjie.modules.system.service.dto.UserQueryCriteria;
import me.zhengjie.modules.wms.invoice.domain.Invoice;
import me.zhengjie.modules.wms.invoice.domain.InvoiceProduct;
import me.zhengjie.modules.wms.invoice.service.dto.InvoiceDTO;
@ -55,6 +64,7 @@ import javax.persistence.criteria.Root;
* @author jie
* @date 2019-08-17
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class OutSourceProcessSheetServiceImpl implements OutSourceProcessSheetService {
@ -71,6 +81,12 @@ public class OutSourceProcessSheetServiceImpl implements OutSourceProcessSheetSe
@Autowired
private OutSourceProcessSheetProductMapper outSourceProcessSheetProductMapper;
@Autowired
private MessageRepository messageRepository;
@Autowired
private UserService userService;
@Override
public Object queryAll(OutSourceProcessSheetQueryCriteria criteria, Pageable pageable){
Specification<OutSourceProcessSheet> specification = new Specification<OutSourceProcessSheet>() {
@ -198,6 +214,32 @@ public class OutSourceProcessSheetServiceImpl implements OutSourceProcessSheetSe
outSourceProcessSheetDTO.setOutSourceProcessSheetProductList(outSourceProcessSheetProductDTOList);
}
/**
*
*/
try {
// 查看所有用户
UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
List<UserDTO> userDTOList =(List<UserDTO>)userService.queryAll(userQueryCriteria);
if(!CollectionUtils.isEmpty(userDTOList)){
List<Message> messageList = new ArrayList<>();
for(UserDTO userDTO : userDTOList){
Message message = new Message();
message.setUserIdAccept(userDTO.getId());
String messageContent = MessageModuleType.OUT_SOURCE_PROCESS.getName() + "(" + outSourceProcessSheetCode + ")";
message.setMessContent(messageContent);
message.setModulePath(MessageModulePath.OUT_SOURCE_LIST.getCode());
message.setModuleTypeName(MessageModuleType.OUT_SOURCE_PROCESS.getCode());
message.setReadStatus(MessageReadStatus.NO_READ.getStatus());
message.setInitCode(outSourceProcessSheetCode);
messageList.add(message);
}
messageRepository.saveAll(messageList);
}
}catch (Exception e){
log.error("单据编号:插入消息失败!");
}
return outSourceProcessSheetDTO;
}

View File

@ -1,6 +1,15 @@
package me.zhengjie.modules.wms.purchase.service.impl;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.cons.MessageModulePath;
import me.zhengjie.modules.system.cons.MessageModuleType;
import me.zhengjie.modules.system.cons.MessageReadStatus;
import me.zhengjie.modules.system.domain.Message;
import me.zhengjie.modules.system.repository.MessageRepository;
import me.zhengjie.modules.system.service.UserService;
import me.zhengjie.modules.system.service.dto.UserDTO;
import me.zhengjie.modules.system.service.dto.UserQueryCriteria;
import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceProcessSheet;
import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceProcessSheetProduct;
import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceProcessSheetDTO;
@ -47,6 +56,7 @@ import javax.persistence.criteria.Root;
* @author jie
* @date 2019-10-06
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class ConsumablesPurchaseOrderServiceImpl implements ConsumablesPurchaseOrderService {
@ -63,6 +73,12 @@ public class ConsumablesPurchaseOrderServiceImpl implements ConsumablesPurchaseO
@Autowired
private ConsumablesPurchaseOrderProductMapper consumablesPurchaseOrderProductMapper;
@Autowired
private MessageRepository messageRepository;
@Autowired
private UserService userService;
@Override
public Object queryAll(ConsumablesPurchaseOrderQueryCriteria criteria, Pageable pageable){
Specification<ConsumablesPurchaseOrder> specification = new Specification<ConsumablesPurchaseOrder>() {
@ -189,6 +205,32 @@ public class ConsumablesPurchaseOrderServiceImpl implements ConsumablesPurchaseO
consumablesPurchaseOrderDTO.setConsumablesPurchaseOrderProductList(consumablesPurchaseOrderProductDTOList);
}
/**
*
*/
try {
// 查看所有用户
UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
List<UserDTO> userDTOList =(List<UserDTO>)userService.queryAll(userQueryCriteria);
if(!CollectionUtils.isEmpty(userDTOList)){
List<Message> messageList = new ArrayList<>();
for(UserDTO userDTO : userDTOList){
Message message = new Message();
message.setUserIdAccept(userDTO.getId());
String messageContent = MessageModuleType.CONSUMABLES_PURCHASE.getName() + "(" + consumablesPurchaseOrderCode + ")";
message.setMessContent(messageContent);
message.setModulePath(MessageModulePath.CONSUMABLES_PURCHASE_LIST.getCode());
message.setModuleTypeName(MessageModuleType.CONSUMABLES_PURCHASE.getCode());
message.setReadStatus(MessageReadStatus.NO_READ.getStatus());
message.setInitCode(consumablesPurchaseOrderCode);
messageList.add(message);
}
messageRepository.saveAll(messageList);
}
}catch (Exception e){
log.error("单据编号:插入消息失败!");
}
return consumablesPurchaseOrderDTO;
}

View File

@ -1,6 +1,15 @@
package me.zhengjie.modules.wms.purchase.service.impl;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.cons.MessageModulePath;
import me.zhengjie.modules.system.cons.MessageModuleType;
import me.zhengjie.modules.system.cons.MessageReadStatus;
import me.zhengjie.modules.system.domain.Message;
import me.zhengjie.modules.system.repository.MessageRepository;
import me.zhengjie.modules.system.service.UserService;
import me.zhengjie.modules.system.service.dto.UserDTO;
import me.zhengjie.modules.system.service.dto.UserQueryCriteria;
import me.zhengjie.modules.wms.purchase.cons.AuditStatus;
import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrder;
import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrder;
@ -48,6 +57,7 @@ import javax.persistence.criteria.Root;
* @author jie
* @date 2019-10-06
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class ProductPurchaseOrderServiceImpl implements ProductPurchaseOrderService {
@ -64,6 +74,12 @@ public class ProductPurchaseOrderServiceImpl implements ProductPurchaseOrderServ
@Autowired
private ProductPurchaseOrderProductMapper productPurchaseOrderProductMapper;
@Autowired
private MessageRepository messageRepository;
@Autowired
private UserService userService;
@Override
public Object queryAll(ProductPurchaseOrderQueryCriteria criteria, Pageable pageable){
Specification<ProductPurchaseOrder> specification = new Specification<ProductPurchaseOrder>() {
@ -189,6 +205,32 @@ public class ProductPurchaseOrderServiceImpl implements ProductPurchaseOrderServ
productPurchaseOrderDTO.setProductPurchaseOrderProductList(productPurchaseOrderProductDTOList);
}
/**
*
*/
try {
// 查看所有用户
UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
List<UserDTO> userDTOList =(List<UserDTO>)userService.queryAll(userQueryCriteria);
if(!CollectionUtils.isEmpty(userDTOList)){
List<Message> messageList = new ArrayList<>();
for(UserDTO userDTO : userDTOList){
Message message = new Message();
message.setUserIdAccept(userDTO.getId());
String messageContent = MessageModuleType.PRODUCT_PURCHASE.getName() + "(" + productPurchaseOrderCode + ")";
message.setMessContent(messageContent);
message.setModulePath(MessageModulePath.PRODUCT_PURCHASE_LIST.getCode());
message.setModuleTypeName(MessageModuleType.PRODUCT_PURCHASE.getCode());
message.setReadStatus(MessageReadStatus.NO_READ.getStatus());
message.setInitCode(productPurchaseOrderCode);
messageList.add(message);
}
messageRepository.saveAll(messageList);
}
}catch (Exception e){
log.error("单据编号:插入消息失败!");
}
return productPurchaseOrderDTO;
}

View File

@ -1,6 +1,15 @@
package me.zhengjie.modules.wms.qualityCheckSheet.service.impl;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.cons.MessageModulePath;
import me.zhengjie.modules.system.cons.MessageModuleType;
import me.zhengjie.modules.system.cons.MessageReadStatus;
import me.zhengjie.modules.system.domain.Message;
import me.zhengjie.modules.system.repository.MessageRepository;
import me.zhengjie.modules.system.service.UserService;
import me.zhengjie.modules.system.service.dto.UserDTO;
import me.zhengjie.modules.system.service.dto.UserQueryCriteria;
import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificate;
import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificateProduct;
import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceProcessSheet;
@ -56,6 +65,7 @@ import javax.persistence.criteria.Root;
* @author huangxingxing
* @date 2019-11-12
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class QualityCheckSheetServiceImpl implements QualityCheckSheetService {
@ -72,6 +82,12 @@ public class QualityCheckSheetServiceImpl implements QualityCheckSheetService {
@Autowired
private QualityCheckSheetProductMapper qualityCheckSheetProductMapper;
@Autowired
private MessageRepository messageRepository;
@Autowired
private UserService userService;
@Override
public Object queryAll(QualityCheckSheetQueryCriteria criteria, Pageable pageable){
Specification<QualityCheckSheet> specification = new Specification<QualityCheckSheet>() {
@ -197,6 +213,32 @@ public class QualityCheckSheetServiceImpl implements QualityCheckSheetService {
qualityCheckSheetDTO.setQualityCheckSheetProductList(qualityCheckSheetProductDTOList);
}
/**
*
*/
try {
// 查看所有用户
UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
List<UserDTO> userDTOList =(List<UserDTO>)userService.queryAll(userQueryCriteria);
if(!CollectionUtils.isEmpty(userDTOList)){
List<Message> messageList = new ArrayList<>();
for(UserDTO userDTO : userDTOList){
Message message = new Message();
message.setUserIdAccept(userDTO.getId());
String messageContent = MessageModuleType.QUALITY_CHECK_SHEET.getName() + "(" + qualityCheekSheetCode + ")";
message.setMessContent(messageContent);
message.setModulePath(MessageModulePath.QUALITY_CHECKSHEET_LIST.getCode());
message.setModuleTypeName(MessageModuleType.QUALITY_CHECK_SHEET.getCode());
message.setReadStatus(MessageReadStatus.NO_READ.getStatus());
message.setInitCode(qualityCheekSheetCode);
messageList.add(message);
}
messageRepository.saveAll(messageList);
}
}catch (Exception e){
log.error("单据编号:插入消息失败!");
}
return qualityCheckSheetDTO;
}