Commit 40a43d14 by huangZW

新增店长

parent c673f517
...@@ -72,6 +72,12 @@ ...@@ -72,6 +72,12 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>haoban-task-api</artifactId>
<version>${haoban-task-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-api</artifactId> <artifactId>haoban-contacts-api</artifactId>
<version>${haoban-contacts-api}</version> <version>${haoban-contacts-api}</version>
</dependency> </dependency>
......
...@@ -4,7 +4,10 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,7 +4,10 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.binlog.base.entity.GicField; import com.gic.binlog.base.entity.GicField;
import com.gic.binlog.base.entity.GicRecord; import com.gic.binlog.base.entity.GicRecord;
import com.gic.binlog.base.entity.enums.GicRecordType; import com.gic.binlog.base.entity.enums.GicRecordType;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.dubbo.entity.ProviderLocalTag; import com.gic.dubbo.entity.ProviderLocalTag;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.contacts.manage.api.enums.StatusEnum; import com.gic.haoban.contacts.manage.api.enums.StatusEnum;
...@@ -16,6 +19,11 @@ import com.gic.haoban.manage.service.pojo.BinlogBasePojo; ...@@ -16,6 +19,11 @@ import com.gic.haoban.manage.service.pojo.BinlogBasePojo;
import com.gic.haoban.manage.service.pojo.ClerkSyncPojo; import com.gic.haoban.manage.service.pojo.ClerkSyncPojo;
import com.gic.haoban.manage.service.service.StaffClerkBindLogService; import com.gic.haoban.manage.service.service.StaffClerkBindLogService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.task.api.dto.MqMessageQo;
import com.gic.mq.sdk.exception.RouterException;
import com.gic.qcloud.cmq.CMQClientException;
import com.gic.qcloud.cmq.CMQServerException;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecord;
...@@ -47,8 +55,10 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -47,8 +55,10 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
@Autowired @Autowired
private StaffClerkRelationApiService staffClerkRelationApiService; private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
private ClerkService clerkService;
@Override @Override
public void onMessage(ConsumerRecord<String, GicRecord> record) { public void onMessage(ConsumerRecord<String, GicRecord> record) {
...@@ -65,6 +75,28 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -65,6 +75,28 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
if (record.value().getTableName().equals(CLERK)) { if (record.value().getTableName().equals(CLERK)) {
dealClerk((ClerkSyncPojo)pojo); dealClerk((ClerkSyncPojo)pojo);
//TODO 发消息处理新增店长,任务重新分配问题
ClerkSyncPojo syncPojo = (ClerkSyncPojo)pojo;
GicRecordType gicRecordType = GicRecordType.valueOf(syncPojo.getRecordType());
if(gicRecordType.equals(GicRecordType.INSERT)){
//新增店长
String clerkId = syncPojo.getClerkId();
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
Integer clerkType = clerkDTO.getClerkType();
if(clerkType != null && clerkType.intValue() == 1){
//TODO 发消息处理新增店长,任务重新分配问题
try {
MqMessageQo mqMessageQo = new MqMessageQo();
mqMessageQo.setType(MqMessageQo.DISTRIBUTE_TASK);
mqMessageQo.setData(clerkId);
String s = JSONObject.toJSONString(mqMessageQo);
GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, s,
"com.gic.haoban.task.api.service.MqAsynApiService", "run");
} catch (Exception e) {
e.printStackTrace();
}
}
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment