UnionSettleUpdateConsumer.java
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.yoho.unions.server.mqconsumer;
import com.yoho.core.common.utils.JsonUtil;
import com.yoho.core.rabbitmq.YhConsumer;
import com.yoho.service.model.union.bo.ShareSettlementBo;
import com.yoho.unions.server.service.IUnionShareService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Created by mingdan.ge on 2018/5/10.
*/
@Component
public class UnionSettleUpdateConsumer implements YhConsumer {
private Logger logger = LoggerFactory.getLogger(UnionSettleUpdateConsumer.class);
@Autowired
private IUnionShareService unionShareService;
@Override
public void handleMessage(Object o) throws Exception{
logger.info("UnionSettleUpdateConsumer,handleMessage {}", o);
try {
if (null == o) {
return;
}
List<Object> list = JsonUtil.jsonToObject(o.toString(), List.class);
list.forEach(l->{
try {
ShareSettlementBo bo = JsonUtil.jsonToObject(l.toString(), ShareSettlementBo.class);
//TODO 提现结算单状态变更
unionShareService.updateSettlementStatus(bo);
} catch (Exception e) {
logger.warn("UnionSettleUpdateConsumer,handleMessage fail! obj is {}, e {}",l,e.getMessage());
}
});
} catch (Exception e) {
logger.warn("UnionSettleUpdateConsumer,handleMessage fail! obj is {}, e {}",o,e.getMessage());
}
}
}