|
|
@@ -0,0 +1,53 @@
|
|
|
+package com.uas.platform.b2c.common.lottery.service.impl;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.uas.platform.b2c.common.lottery.service.ActivityItemService;
|
|
|
+import com.uas.platform.b2c.core.config.SysConf;
|
|
|
+import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
+import com.uas.platform.b2c.trade.support.CodeType;
|
|
|
+import com.uas.platform.b2c.trade.support.ResultMap;
|
|
|
+import com.uas.platform.core.util.HttpUtil;
|
|
|
+import com.uas.platform.core.util.HttpUtil.Response;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by wangyc on 2018/9/12.
|
|
|
+ *
|
|
|
+ * @version 2018/9/12 14:47 wangyc
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class ActivityItemServiceImpl implements ActivityItemService {
|
|
|
+
|
|
|
+ // 获取单个用户信息路径
|
|
|
+ private static final String GET_USER_URL = "/activityItem/user";
|
|
|
+
|
|
|
+ private final SysConf sysConf;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public ActivityItemServiceImpl(SysConf sysConf) {
|
|
|
+ this.sysConf = sysConf;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultMap getActivityItems(String activityCode) {
|
|
|
+ if (StringUtils.isEmpty(activityCode)) {
|
|
|
+ return new ResultMap(CodeType.PARAMETER_ERROR, "活动信息不完全,请确认活动信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("useruu", SystemSession.getUser().getUserUU());
|
|
|
+ params.put("enuu", SystemSession.getUser().getEnterprise() == null ? 0 : SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ params.put("activityCode", activityCode);
|
|
|
+
|
|
|
+ try {
|
|
|
+ Response response = HttpUtil.sendGetRequest(sysConf.getLottery() + GET_USER_URL, params);
|
|
|
+ return JSON.parseObject(response.getResponseText(), ResultMap.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return new ResultMap(CodeType.ERROR_STATE, "获取等级信息错误,请重试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|