| | |
| | | package com.yeshi.fanli.controller.wxmp.v1;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.IPUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.WXMPAcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.push.DeviceActive;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.FloatADService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.vo.homemodule.BannerVO;
|
| | | import com.yeshi.fanli.vo.homemodule.FloatImgDetailVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private DeviceActiveService deviceActiveService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | |
|
| | | @Resource
|
| | | private FloatADService floatADService;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | /**
|
| | | * 获取系统配置信息
|
| | |
| | | JSONArray array = new JSONArray();
|
| | | for (SystemClientParams params : systemClientParamsList) {
|
| | | JSONObject item = new JSONObject();
|
| | | item.put(params.getKey(), params.getValue());
|
| | | item.put("key", params.getKey());
|
| | | item.put("value", params.getValue());
|
| | | array.add(item);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(array));
|
| | | String ipInfo = IPUtil.getRemotIP(request) + ":" + request.getRemotePort();
|
| | |
| | | da.setMac(null);
|
| | | deviceActiveService.addDeviceActive(da);
|
| | | }
|
| | |
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getUserConfig", method = RequestMethod.POST)
|
| | | public void getUserConfig(WXMPAcceptData acceptData, PrintWriter out) {
|
| | | try {
|
| | | // 用户协议链接
|
| | | String serviceProtocol = configService.get(ConfigKeyEnum.serviceProtocolLink.getKey());
|
| | | // 隐私条款链接
|
| | | String privacyProtocol = configService.get(ConfigKeyEnum.privacyProtocolLink.getKey());
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("serviceProtocolLink", serviceProtocol);
|
| | | data.put("privacyProtocolLink", privacyProtocol);
|
| | |
|
| | | // 我的界面banner
|
| | | List<BannerVO> banner = swiperPictureService.getByBannerCardAndVersion("my_interface_banner",
|
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | | if (banner == null)
|
| | | banner = new ArrayList<BannerVO>();
|
| | | data.put("banner", JsonUtil.getApiCommonGson().toJson(banner));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 首页配置信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHomeConfig")
|
| | | public void getHomeConfigNew(WXMPAcceptData acceptData, Long uid, String callback, PrintWriter out) {
|
| | | if (uid != null && uid == 0L)
|
| | | uid = null;
|
| | |
|
| | | String platform = acceptData.getPlatform();
|
| | | String version = acceptData.getVersion();
|
| | |
|
| | | // 活动弹框
|
| | | List<FloatAD> listAD = new ArrayList<FloatAD>();
|
| | | List<FloatImgDetailVO> listVO = new ArrayList<FloatImgDetailVO>();
|
| | | List<FloatAD> list = floatADService.getValidFloatADCache(FloatAD.POSITION_INDEX, null, platform,
|
| | | Integer.parseInt(version));
|
| | | if (list != null && !list.isEmpty())
|
| | | listAD.addAll(list);
|
| | |
|
| | | for (int i = 0; i < listAD.size(); i++) {
|
| | | FloatAD floatAD = listAD.get(i);
|
| | | JumpDetailV2 jumpDetail = floatAD.getJumpDetail();
|
| | | if (jumpDetail != null) {
|
| | | jumpDetail = jumpDetailV2Service.selectByPrimaryKey(jumpDetail.getId());
|
| | | if (jumpDetail != null) {
|
| | | jumpDetail.setNeedLogin(floatAD.isJumpNeedLogin());
|
| | | }
|
| | | }
|
| | | FloatImgDetailVO floatImgVO = new FloatImgDetailVO();
|
| | | floatImgVO.setId(floatAD.getId().toString());
|
| | | floatImgVO.setImg(floatAD.getPicture());
|
| | | floatImgVO.setParams(floatAD.getParams());
|
| | | floatImgVO.setJumpDetail(jumpDetail);
|
| | | floatImgVO.setShowTime(floatAD.getShowMode());
|
| | | floatImgVO.setAccountLogin(floatAD.isJumpNeedLogin());
|
| | | if (floatAD.getPlaySound() != null)
|
| | | floatImgVO.setPlaySound(floatAD.getPlaySound());// 默认都播放音效
|
| | | else
|
| | | floatImgVO.setPlaySound(false);
|
| | | listVO.add(floatImgVO);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("listAD", JsonUtil.getApiCommonGson().toJson(listVO));
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | else
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | |
|
| | | }
|