|
@@ -26,8 +26,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -70,20 +72,10 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getBalance(String card) {
|
|
|
- MsgLog msgLog = new MsgLog();
|
|
|
- msgLog.setBusinessId(String.format("%s%s", MsgLogBusinessCode.BALANCE,card));
|
|
|
- msgLog.setExchange(CartGetConsumeConfig.NAME);
|
|
|
- msgLog.setRoutingKey(CartGetConsumeConfig.NAME);
|
|
|
- msgLog.setRemark("获取卡余额");
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- map.put("card",card);
|
|
|
- msgLog.setMsg(JSON.toJSONString(map));
|
|
|
- msgLogService.addOrUpdate(msgLog);
|
|
|
- map.put("seq",msgLog.getId());
|
|
|
- CorrelationData correlationData = new CorrelationData(msgLog.getId().toString());
|
|
|
- rabbitTemplate.convertAndSend(msgLog.getExchange(), msgLog.getRoutingKey(), map,correlationData);
|
|
|
- return msgLog.getId().toString();
|
|
|
+ public BigDecimal getBalance(String card) {
|
|
|
+ Staff staff = this.one(null, null, card);
|
|
|
+ Optional.ofNullable(staff).orElseThrow(() -> new CustomException("用户信息不存在"));
|
|
|
+ return staff.getBalance();
|
|
|
}
|
|
|
|
|
|
@Override
|