From beee6afac3f7d1b7fa30f768df91cd55e6c6d2db Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 24 六月 2019 11:28:18 +0800
Subject: [PATCH] 增加汽车户外,增加拼多多常量

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java |  138 ++++++++++++++++++++++++++--------------------
 1 files changed, 78 insertions(+), 60 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java
index cf7a051..99ff3d5 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ShareController.java
@@ -45,6 +45,7 @@
 import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
 import com.yeshi.fanli.service.inter.goods.ShareGoodsTextTemplateService;
 import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
+import com.yeshi.fanli.service.inter.monitor.BusinessEmergent110Service;
 import com.yeshi.fanli.service.inter.monitor.MonitorService;
 import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
 import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
@@ -74,7 +75,7 @@
 
 	@Resource(name = "taskExecutor")
 	private TaskExecutor executor;
-	
+
 	@Resource
 	private ShareGoodsService shareGoodsService;
 
@@ -110,19 +111,21 @@
 
 	@Resource
 	private ShareGoodsTextTemplateService shareGoodsTextTemplateService;
-	
+
 	@Resource
 	private SystemClientParamsService systemClientParamsService;
-	
+
 	@Resource
 	private DynamicInfoService dynamicInfoService;
 
 	@Resource
 	private UserInfoExtraService userInfoExtraService;
-	
+
 	@Resource
 	private SpreadUserImgService spreadUserImgService;
-	
+
+	@Resource
+	private BusinessEmergent110Service businessEmergent110Service;
 
 	// 鑾峰彇鍟嗗搧鍒嗕韩閾炬帴
 	@RequestMapping(value = "getGoodsShareUrl")
@@ -224,10 +227,10 @@
 			// 娣诲姞鍒嗕韩璁板綍
 			BigDecimal rate = hongBaoManageService.getShareRate();
 			BigDecimal shareMoney = TaoBaoUtil.getShareGoodsHongBaoInfo(taoBaoLink.getGoods(), rate);
-			
+
 			data.put("shareMoney", "楼" + shareMoney.toString());
 			try {
-				ShareGoodsRecordDTO shareRecord= userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId);
+				ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId);
 				data.put("shareId", shareRecord.getRedisKey());
 			} catch (Exception e) {
 				try {
@@ -242,7 +245,7 @@
 			com.yeshi.fanli.util.ThreadUtil.run(new Runnable() {
 				@Override
 				public void run() {
-					//寮傛鎿嶄綔 娣诲姞鍒嗕韩璁板綍
+					// 寮傛鎿嶄綔 娣诲姞鍒嗕韩璁板綍
 					UserShareGoodsHistory history = new UserShareGoodsHistory();
 					history.setUser(new UserInfo(uid));
 					history.setHongbao(shareMoney);
@@ -253,7 +256,7 @@
 					history.setQuanLink(taoBaoLink.getCouponLink());
 					history.setGoodsId(taoBaoLink.getGoods().getAuctionId());
 					history.setPostPicture(taoBaoLink.getGoods().getPictUrl());
-					
+
 					List<String> imgList = taoBaoLink.getGoods().getImgList();
 					if (imgList == null) {
 						imgList = new ArrayList<>();
@@ -263,13 +266,15 @@
 				}
 			});
 			return;
-		}
-		catch (ShareGoodsException e) {
+		} catch (ShareGoodsException e) {
+			LogHelper.errorDetailInfo(e, "鍒嗕韩鍑洪敊:uid:"+uid+"auctionId:"+auctionId, "");
+			// 鍒嗕韩鍑洪敊鎶ヨ
 			try {
 				monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, e.getCode(), 0, "鍒嗕韩鍑洪敊"));
 			} catch (Exception e1) {
 			}
 			out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
+			businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""));
 		}
 
 	}
@@ -410,7 +415,7 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "updaterecord", method = RequestMethod.POST)
-	public void updateRecord(AcceptData acceptData, String shareId, PrintWriter out) {
+	public void updateRecord(AcceptData acceptData, String shareId, String type, PrintWriter out) {
 		if (StringUtil.isNullOrEmpty(shareId)) {
 			out.print(JsonUtil.loadFalseResult("鍙傛暟涓嶆纭�"));
 		}
@@ -436,7 +441,7 @@
 				}
 			}
 		});
-		out.print(JsonUtil.loadTrueResult("鍒嗕韩鎴愬姛"));			
+		out.print(JsonUtil.loadTrueResult("鍒嗕韩鎴愬姛"));
 	}
 
 	/**
@@ -644,10 +649,9 @@
 		out.print(JsonUtil.loadTrueResult(configService.get("share_goods_template_rules")));
 	}
 
-	
-
 	/**
 	 * 鏌ヨ椤堕儴鍒嗙被
+	 * 
 	 * @param acceptData
 	 * @param page
 	 * @param cid
@@ -656,29 +660,28 @@
 	@RequestMapping(value = "shareDynamic", method = RequestMethod.POST)
 	public void shareDynamic(AcceptData acceptData, String id, Long uid, PrintWriter out) {
 		try {
-			
+
 			if (uid == null || uid <= 0) {
 				out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
 				return;
 			}
-			
+
 			if (StringUtil.isNullOrEmpty(id)) {
 				out.print(JsonUtil.loadFalseResult("鍙傛暟涓嶈兘涓虹┖"));
 				return;
 			}
-			
+
 			DynamicInfo dynamicInfo = dynamicInfoService.getById(id);
 			if (dynamicInfo == null) {
 				out.print(JsonUtil.loadFalseResult("璇ュ姩鎬佷俊鎭凡涓嶅瓨鍦�"));
 				return;
 			}
-			
-			
+
 			JSONObject data = new JSONObject();
 			// 鍒嗙被id
 			long cid = dynamicInfo.getClassId();
-			
-			if (cid == 1 || cid == 2) { 	// 1 鐑攢鍗曞搧    2 鎺ㄨ崘濂借揣
+
+			if (cid == 1 || cid == 2) { // 1 鐑攢鍗曞搧 2 鎺ㄨ崘濂借揣
 				if (cid == 1) {
 					List<GoodsPicture> imgs = dynamicInfo.getImgs();
 					GoodsPicture goodsPicture = imgs.get(0);
@@ -695,7 +698,7 @@
 						}
 					}
 				}
-				
+
 				// 鍒嗕韩鏂囧瓧
 				String title = null;
 				List<ClientTextStyleVO> listTitle = dynamicInfo.getTitle();
@@ -705,18 +708,23 @@
 						title += textStyleVO.getContent();
 					}
 				}
+				
+				
+				if(StringUtil.isNullOrEmpty(title)) {
+					title = "缁欎綘鎺ㄨ崘绮鹃�夊ソ鐗╀紭鎯犲埜锛岃喘鐗╁墠鍏堥鍒革紝鍒敊杩囦紭鎯犲摝~";
+				}
 				data.put("title", title);
 				data.put("content", "鎴戝湪杩斿埄鍒稿彂鐜颁簡涓�涓緢濂界殑鍟嗗搧锛屽揩鏉ョ湅鐪媬");
-				
+
 				// 鍒嗕韩濂栭噾
 				ClientTextStyleVO desc = dynamicInfo.getDesc();
 				String content = desc.getContent();
 				int index = content.indexOf("楼");
-				data.put("shareMoney", new BigDecimal(content.substring(index + 1, content.length())));
-			
+				data.put("shareMoney", new BigDecimal(content.substring(index + 1, content.length())).toString());
+
 				// 鍒嗕韩鎻愰啋
 				data.put("notifyDesc", configService.get("goods_share_notify"));
-				
+
 				// 鍒嗕韩鎻愮ず璇�
 				String imgs = configService.get("goods_share_notify_imgs");
 				JSONArray array = JSONArray.fromObject(imgs);
@@ -724,33 +732,37 @@
 				if (p < array.size()) {
 					data.put("notifyPicture", array.optString(p));
 				}
-				
+
 				// 鍒嗕韩鍑哄幓鐨勫浘鐗�
 				String pictUrl = dynamicInfo.getImgs().get(0).getUrl();
 				data.put("pictUrl", TbImgUtil.getTBSizeImg(pictUrl, 500));
-				
+
 				// 甯姪閾炬帴
-				data.put("helpLink","http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
-				
-				if (cid == 2) {   // 2 鎺ㄨ崘濂借揣
-					ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordDynamic(uid, dynamicInfo.getListGoodsBrief());
+				data.put("helpLink",
+						"http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
+
+				if (cid == 2) { // 2 鎺ㄨ崘濂借揣
+					ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordDynamic(uid,
+							dynamicInfo.getListGoodsBrief());
 					data.put("shareId", shareRecord.getRedisKey());
 					data.put("clickUrl", shareRecord.getShareUrl());
 				} else {
 					// 鍒嗕韩id
-					ShareGoodsRecordDTO shareRecord =  userShareGoodsRecordService.addRecordDynamic(uid, dynamicInfo.getListGoodsBrief());
+					ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordDynamic(uid,
+							dynamicInfo.getListGoodsBrief());
 					data.put("shareId", shareRecord.getRedisKey());
-					
+
 					Long auctionId = dynamicInfo.getImgs().get(0).getGoods().getAuctionId();
 					// 鍟嗗搧鍒嗕韩閾炬帴
 					String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
-							Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), auctionId + "");
+							Constant.systemCommonConfig.getShareGoodsPagePath(),
+							AESUtil.encrypt(uid + "", Constant.UIDAESKEY), auctionId + "");
 					String shortLink = HttpUtil.getShortLink(url);
 					if (!StringUtil.isNullOrEmpty(shortLink)) {
 						url = shortLink;
 					}
 					data.put("clickUrl", url);
-					
+
 					// 娣樺疂鍙d护
 					UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService.getByUid(uid);
 					String relationId = null;
@@ -761,9 +773,9 @@
 					TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId);
 					data.put("token", taoBaoLink.getTaoToken());
 				}
-				
+
 			} else if (cid == 4) { // 閭�璇峰垎浜�
-				
+
 				String inviteCode = null;
 				UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
 				if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
@@ -772,13 +784,13 @@
 					out.print(JsonUtil.loadFalseResult(9001, "閭�璇风爜鏈縺娲�"));
 					return;
 				}
-				
+
 				Integer showType = dynamicInfo.getShowType();
-				if (showType == 0) {  // 鏃犲浘鍒嗕韩
+				if (showType == 0) { // 鏃犲浘鍒嗕韩
 					String title = null;
 					List<ClientTextStyleVO> listTitle = dynamicInfo.getTitle();
 					if (listTitle != null && listTitle.size() > 0) {
-						title ="";
+						title = "";
 						for (ClientTextStyleVO textStyleVO : listTitle) {
 							title += textStyleVO.getContent();
 						}
@@ -786,50 +798,56 @@
 					title = title.replace("銆愰個璇风爜銆�", inviteCode);
 					title = title.replace("銆愰個璇烽摼鎺ャ��", UserUtil.getInviteShortLink(uid));
 					data.put("title", title);
-					
+
 				} else { // 鏈夊浘鍒嗕韩
 					List<GoodsPicture> imgs = dynamicInfo.getImgs();
-					
+
 					GoodsPicture goodsPicture = imgs.get(0);
 					String bgUrl = goodsPicture.getUrlOriginal();
-					
+
 					if (StringUtil.isNullOrEmpty(bgUrl)) {
 						out.print(JsonUtil.loadFalseResult("鍥剧墖璺緞涓嶅瓨鍦�"));
 						return;
 					}
-					
+
 					// 鐢ㄦ埛淇℃伅
 					UserInfo userInfo = userInfoService.selectByPKey(uid);
 					String portrait = userInfo.getPortrait();
 					// 鐢婚個璇峰浘鐗�
+
 					Long activityId = dynamicInfo.getActivityId();
 					if (activityId != null) {
-						Integer pX = goodsPicture.getPx();; 
-						Integer pY = goodsPicture.getPy();;
-						Integer size =  goodsPicture.getSize();
-						
-						String imgLink = spreadUserImgService.drawInviteQrCodeNew(bgUrl,uid, portrait,pX, pY, size, inviteCode);
+						Integer pX = goodsPicture.getPx();
+						;
+						Integer pY = goodsPicture.getPy();
+						;
+						Integer size = goodsPicture.getSize();
+
+						String imgLink = spreadUserImgService.drawInviteQrCodeNew(bgUrl, uid, portrait, pX, pY, size,
+								inviteCode);
+
 						data.put("imgLink", imgLink);
 					} else {
 						String title = imgs.get(0).getTitleOriginal();
-						String imgLink = spreadUserImgService.getInviteImgToGreet(bgUrl,uid, portrait, inviteCode, title, new Date());
+						String imgLink = spreadUserImgService.getInviteImgToGreet(bgUrl, uid, portrait, inviteCode,
+								title, new Date());
 						data.put("imgLink", imgLink);
 					}
-					
-					//  閭�璇疯鍒�
+
+					// 閭�璇疯鍒�
 					BusinessSystem system = new BusinessSystem();
 					system.setCreatetime(java.lang.System.currentTimeMillis());
 					system.setPlatform(1);
 					system.setId(4L);
 					String key = "inviteRules"; // key鍊�
-					SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, key);
+					SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
+							key);
 					String valueN = values.getValue();
 					String valueBr = valueN.replace("\n", "<br><br>");
 					data.put("inviteRules", valueBr);
-					
-					
+
 					// 閭�璇烽摼鎺�
-					String shortLink = HttpUtil.getShortLink("http://" + Constant.wxGZConfig.getLoginHost() + "/" 
+					String shortLink = HttpUtil.getShortLink("http://" + Constant.wxGZConfig.getLoginHost() + "/"
 							+ Constant.systemCommonConfig.getProjectName() + "/client/threeShareNew?uid=" + uid);
 					data.put("inviteLink", shortLink);
 					data.put("inviteCode", inviteCode);
@@ -837,7 +855,7 @@
 				}
 			}
 			out.print(JsonUtil.loadTrueResult(data));
-			
+
 			// 鏇存柊鍒嗕韩娆℃暟
 			executor.execute(new Runnable() {
 				@Override
@@ -847,7 +865,7 @@
 					dynamicInfoService.updateShareCount(dynamicInfo);
 				}
 			});
-			
+
 		} catch (Exception e) {
 			out.print(JsonUtil.loadFalseResult("鍒嗕韩璁板綍澶辫触"));
 			try {

--
Gitblit v1.8.0