From d1f26741bddf6f512d62c0100d42c52be8d37e76 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 06 二月 2021 15:35:40 +0800
Subject: [PATCH] 工具类优化

---
 fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/ConfigController.java |  384 +++++++++++++++++++++++++++---------------------------
 1 files changed, 192 insertions(+), 192 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/ConfigController.java b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/ConfigController.java
index fc25f4a..3cddb12 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/ConfigController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/ConfigController.java
@@ -1,192 +1,192 @@
-package com.yeshi.fanli.controller.wxmp.v1;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-
-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;
-
-@Controller("WXMPConfigController")
-@RequestMapping("/wxmp/api/v1/config")
-public class ConfigController {
-
-	@Resource
-	private SystemClientParamsService systemClientParamsService;
-
-	@Resource
-	private BusinessSystemService businessSystemService;
-
-	@Resource
-	private DeviceActiveService deviceActiveService;
-
-	@Resource
-	private ConfigService configService;
-
-	@Resource
-	private SwiperPictureService swiperPictureService;
-
-	@Resource
-	private FloatADService floatADService;
-
-	@Resource
-	private JumpDetailV2Service jumpDetailV2Service;
-
-	/**
-	 * 鑾峰彇绯荤粺閰嶇疆淇℃伅
-	 * 
-	 * @param acceptData
-	 * @param out
-	 */
-	@RequestMapping("getSystemClientConfig")
-	public void getOpenId(WXMPAcceptData acceptData, HttpServletRequest request, PrintWriter out) {
-		BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
-				acceptData.getAppId());
-		if (system == null) {
-			out.print("绯荤粺涓嶅瓨鍦�");
-			return;
-		}
-		List<SystemClientParams> systemClientParamsList = systemClientParamsService
-				.getSystemClientParamsBySystemId(system.getId(), Integer.parseInt(acceptData.getVersion()));
-		if (systemClientParamsList == null || systemClientParamsList.size() == 0) {
-			out.print(JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"));
-			return;
-		}
-
-		JSONArray array = new JSONArray();
-		for (SystemClientParams params : systemClientParamsList) {
-			JSONObject item = new JSONObject();
-			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();
-		ThreadUtil.run(new Runnable() {
-
-			@Override
-			public void run() {
-				if (!StringUtil.isNullOrEmpty(acceptData.getDevice())) {
-					// 瀹夊崜骞冲彴娣诲姞璁惧娲昏穬璁板綍
-					DeviceActive da = new DeviceActive();
-					da.setDevice(acceptData.getDevice());
-					da.setPlatform(DeviceActive.PLATFORM_WXMP);
-					da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
-					da.setIpInfo(ipInfo);
-					da.setChannel("wxmp");
-					da.setMac(null);
-					deviceActiveService.addDeviceActive(da);
-				}
-			}
-		});
-	}
-
-	@RequestMapping(value = "getUserConfig", method = RequestMethod.POST)
-	public void getUserConfig(WXMPAcceptData acceptData, PrintWriter out) {
-		try {
-			// 鐢ㄦ埛鍗忚閾炬帴
-			String serviceProtocol = configService.getValue(ConfigKeyEnum.serviceProtocolLink.getKey(),acceptData.getSystem());
-			// 闅愮鏉℃閾炬帴
-			String privacyProtocol = configService.getValue(ConfigKeyEnum.privacyProtocolLink.getKey(),acceptData.getSystem());
-			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()),acceptData.getSystem());
-			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)));
-	}
-
-}
+package com.yeshi.fanli.controller.wxmp.v1;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+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;
+
+@Controller("WXMPConfigController")
+@RequestMapping("/wxmp/api/v1/config")
+public class ConfigController {
+
+	@Resource
+	private SystemClientParamsService systemClientParamsService;
+
+	@Resource
+	private BusinessSystemService businessSystemService;
+
+	@Resource
+	private DeviceActiveService deviceActiveService;
+
+	@Resource
+	private ConfigService configService;
+
+	@Resource
+	private SwiperPictureService swiperPictureService;
+
+	@Resource
+	private FloatADService floatADService;
+
+	@Resource
+	private JumpDetailV2Service jumpDetailV2Service;
+
+	/**
+	 * 鑾峰彇绯荤粺閰嶇疆淇℃伅
+	 * 
+	 * @param acceptData
+	 * @param out
+	 */
+	@RequestMapping("getSystemClientConfig")
+	public void getOpenId(WXMPAcceptData acceptData, HttpServletRequest request, PrintWriter out) {
+		BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
+				acceptData.getAppId(),acceptData.getSystem());
+		if (system == null) {
+			out.print("绯荤粺涓嶅瓨鍦�");
+			return;
+		}
+		List<SystemClientParams> systemClientParamsList = systemClientParamsService
+				.getSystemClientParamsBySystemId(system.getId(), Integer.parseInt(acceptData.getVersion()));
+		if (systemClientParamsList == null || systemClientParamsList.size() == 0) {
+			out.print(JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"));
+			return;
+		}
+
+		JSONArray array = new JSONArray();
+		for (SystemClientParams params : systemClientParamsList) {
+			JSONObject item = new JSONObject();
+			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();
+		ThreadUtil.run(new Runnable() {
+
+			@Override
+			public void run() {
+				if (!StringUtil.isNullOrEmpty(acceptData.getDevice())) {
+					// 瀹夊崜骞冲彴娣诲姞璁惧娲昏穬璁板綍
+					DeviceActive da = new DeviceActive();
+					da.setDevice(acceptData.getDevice());
+					da.setPlatform(DeviceActive.PLATFORM_WXMP);
+					da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
+					da.setIpInfo(ipInfo);
+					da.setChannel("wxmp");
+					da.setMac(null);
+					deviceActiveService.addDeviceActive(da);
+				}
+			}
+		});
+	}
+
+	@RequestMapping(value = "getUserConfig", method = RequestMethod.POST)
+	public void getUserConfig(WXMPAcceptData acceptData, PrintWriter out) {
+		try {
+			// 鐢ㄦ埛鍗忚閾炬帴
+			String serviceProtocol = configService.getValue(ConfigKeyEnum.serviceProtocolLink.getKey(),acceptData.getSystem());
+			// 闅愮鏉℃閾炬帴
+			String privacyProtocol = configService.getValue(ConfigKeyEnum.privacyProtocolLink.getKey(),acceptData.getSystem());
+			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()),acceptData.getSystem());
+			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),acceptData.getSystem());
+		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)));
+	}
+
+}

--
Gitblit v1.8.0