大屏接口

dev_0531
yechenhao 6 years ago
parent 7f960ef6ed
commit d5076cc7cd

@ -1,6 +1,8 @@
package com.kiisoo.ic.job; package com.kiisoo.ic.job;
import com.kiisoo.ic.customer.CustomerService; import com.kiisoo.ic.customer.CustomerService;
import com.kiisoo.ic.employee.entity.PrivilageCpUserDO;
import com.kiisoo.ic.employee.mapper.PrivilageCpUserDOMapper;
import com.kiisoo.ic.store.entity.PrivilageCpUserStoreDO; import com.kiisoo.ic.store.entity.PrivilageCpUserStoreDO;
import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper; import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper;
import com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper; import com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper;
@ -9,11 +11,9 @@ import com.lmax.disruptor.*;
import com.lmax.disruptor.dsl.Disruptor; import com.lmax.disruptor.dsl.Disruptor;
import com.lmax.disruptor.dsl.ProducerType; import com.lmax.disruptor.dsl.ProducerType;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.nio.ByteBuffer;
import java.util.List; import java.util.List;
import java.util.concurrent.*; import java.util.concurrent.*;
@ -31,6 +31,9 @@ public class CustomerDataJob {
private static final int THREAD_NUMBERS = 50; private static final int THREAD_NUMBERS = 50;
@Autowired
private PrivilageCpUserDOMapper privilageCpUserDOMapper;
@Autowired @Autowired
private PrivilageCpUserStoreDOMapper privilageCpUserStoreDOMapper; private PrivilageCpUserStoreDOMapper privilageCpUserStoreDOMapper;
@ -64,11 +67,11 @@ public class CustomerDataJob {
disruptor.start(); disruptor.start();
DTOMessageEventProducer producer = new DTOMessageEventProducer(ringBuffer, qwMailListManageService, customerService, poiStoreStaffDOMapper); DTOMessageEventProducer producer = new DTOMessageEventProducer(ringBuffer, qwMailListManageService, customerService, poiStoreStaffDOMapper);
List<PrivilageCpUserStoreDO> privilageCpUserStoreDOS = privilageCpUserStoreDOMapper.selectList(null); List<PrivilageCpUserDO> privilageCpUserDOS = privilageCpUserDOMapper.selectList(null);
int index =0; int index =0;
for (PrivilageCpUserStoreDO privilageCpUserStoreDO : privilageCpUserStoreDOS) { for (PrivilageCpUserDO privilageCpUserDO : privilageCpUserDOS) {
String cpUserId = privilageCpUserStoreDOMapper.selectCpUserIdByStoreId(privilageCpUserStoreDO.getStoreId()); Long storeId = privilageCpUserStoreDOMapper.selectOneByCpUserId(privilageCpUserDO.getCpUserId());
producer.produceData(index,privilageCpUserStoreDO, cpUserId); producer.produceData(index,storeId,privilageCpUserDO.getCpUserId());
index++; index++;
} }

@ -21,7 +21,7 @@ public class DTOMessage {
private int index; private int index;
private String id; private String id;
private String cpUserId; private String cpUserId;
private PrivilageCpUserStoreDO privilageCpUserStoreDO; private Long storeId;
private QWMailListManageService qwMailListManageService; private QWMailListManageService qwMailListManageService;
private CustomerService customerService; private CustomerService customerService;
private PoiStoreStaffDOMapper poiStoreStaffDOMapper; private PoiStoreStaffDOMapper poiStoreStaffDOMapper;

@ -23,14 +23,14 @@ public class DTOMessageEventProducer {
this.poiStoreStaffDOMapper = poiStoreStaffDOMapper; this.poiStoreStaffDOMapper = poiStoreStaffDOMapper;
} }
public void produceData(int index,PrivilageCpUserStoreDO privilageCpUserStoreDO, String cpUserId) { public void produceData(int index,Long storeId, String cpUserId) {
long seq = ringBuffer.next(); // 获得下一个Event槽的下标 long seq = ringBuffer.next(); // 获得下一个Event槽的下标
try { try {
// 给Event填充数据 // 给Event填充数据
//给这个区块放入 数据 如果此处不理解想想RingBuffer的结构图 //给这个区块放入 数据 如果此处不理解想想RingBuffer的结构图
ringBuffer.get(seq).setIndex(index); ringBuffer.get(seq).setIndex(index);
ringBuffer.get(seq).setCpUserId(cpUserId); ringBuffer.get(seq).setCpUserId(cpUserId);
ringBuffer.get(seq).setPrivilageCpUserStoreDO(privilageCpUserStoreDO); ringBuffer.get(seq).setStoreId(storeId);
ringBuffer.get(seq).setQwMailListManageService(qwMailListManageService); ringBuffer.get(seq).setQwMailListManageService(qwMailListManageService);
ringBuffer.get(seq).setCustomerService(customerService); ringBuffer.get(seq).setCustomerService(customerService);
ringBuffer.get(seq).setPoiStoreStaffDOMapper(poiStoreStaffDOMapper); ringBuffer.get(seq).setPoiStoreStaffDOMapper(poiStoreStaffDOMapper);

@ -39,8 +39,8 @@ public class DTOMessageHandler implements EventHandler<DTOMessage> {
CustomerService customerService = dtoMessage.getCustomerService(); CustomerService customerService = dtoMessage.getCustomerService();
PoiStoreStaffDOMapper poiStoreStaffDOMapper = dtoMessage.getPoiStoreStaffDOMapper(); PoiStoreStaffDOMapper poiStoreStaffDOMapper = dtoMessage.getPoiStoreStaffDOMapper();
QWMailListManageService qwMailListManageService = dtoMessage.getQwMailListManageService(); QWMailListManageService qwMailListManageService = dtoMessage.getQwMailListManageService();
PrivilageCpUserStoreDO cpUserStoreDO = dtoMessage.getPrivilageCpUserStoreDO(); Long storeId = dtoMessage.getStoreId();
List<Map<String,Object>> tagList = poiStoreStaffDOMapper.selectStaffTagByStoreId(cpUserStoreDO.getStoreId()); List<Map<String,Object>> tagList = poiStoreStaffDOMapper.selectStaffTagByStoreId(storeId);
Map<String,Long> tagMap = new HashMap<>(); Map<String,Long> tagMap = new HashMap<>();
for (Map<String,Object> map:tagList){ for (Map<String,Object> map:tagList){
tagMap.put((String)map.get("tag"),(Long)map.get("staffId")); tagMap.put((String)map.get("tag"),(Long)map.get("staffId"));

Loading…
Cancel
Save