From aa784ab65cc24caf45a4c38af7e5fdeb526eb393 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 14 五月 2019 14:49:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/QualityFactoryAdminController.java |  323 +++++++++++++++++++++++------------------------------
 1 files changed, 143 insertions(+), 180 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/QualityFactoryAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/QualityFactoryAdminController.java
index 3c4b0aa..327afbf 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/QualityFactoryAdminController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/QualityFactoryAdminController.java
@@ -39,7 +39,6 @@
 import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
 import com.yeshi.fanli.vo.quality.QualityFactoryVO;
 
-import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 
 @Controller
@@ -58,6 +57,7 @@
 	private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
 	@Resource
 	private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
+	
 
 	public static final int SALES_ASC = 1;
 	public static final int SALES_DESC = 2;
@@ -67,49 +67,11 @@
 
 	public static final int TKRATE_ASC = 5;
 	public static final int TKRATE_DESC = 6;
-
+	
+	
 	public static final int PROPOR_ASC = 7;
 	public static final int PROPOR_DESC = 8;
 
-	@RequestMapping(value = "addBatch")
-	public void addBatch(String callback, String auctionIds, String lableNames, HttpServletRequest request,
-			PrintWriter out) {
-
-		try {
-			// 鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛
-			AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
-			if (admin == null) {
-				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("褰撳墠璐︽埛澶辨晥,璇烽噸鏂扮櫥闄�")));
-				return;
-			}
-
-			if (StringUtil.isNullOrEmpty(auctionIds)) {
-				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇烽�夎�呮纭殑鍟嗗搧鍏ュ簱")));
-				return;
-			}
-
-			Gson gson = new Gson();
-			List<Long> auctionIdList = gson.fromJson(auctionIds, new TypeToken<ArrayList<Long>>() {
-			}.getType());
-			if (auctionIdList == null || auctionIdList.size() == 0) {
-				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇烽�夋嫨姝g‘鐨勫晢鍝佸叆搴�")));
-				return;
-			}
-
-			List<TaoBaoGoodsBrief> listTaoBaoGoods = new ArrayList<>();
-
-			JSONArray array = JSONArray.fromObject(auctionIds);
-
-			for (int i = 0; i < array.size(); i++) {
-				listTaoBaoGoods.add(TaoKeApiUtil.searchGoodsDetail(array.optLong(i)));
-			}
-			qualityFactoryService.addBatchTaoBaoGoods(listTaoBaoGoods, lableNames, admin);
-			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("娣诲姞鎴愬姛")));
-		} catch (Exception e) {
-			e.printStackTrace();
-			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")));
-		}
-	}
 
 	/**
 	 * 淇濆瓨淇敼绮惧搧搴撳晢鍝佸叧鑱斾俊鎭�
@@ -120,8 +82,7 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "saveModify")
-	public void saveModify(String callback, QualityFactory selectionGoods, HttpServletRequest request,
-			PrintWriter out) {
+	public void saveModify(String callback, QualityFactory selectionGoods, HttpServletRequest request, PrintWriter out) {
 
 		try {
 			AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
@@ -193,8 +154,7 @@
 		try {
 
 			Gson gson = new Gson();
-			List<String> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {
-			}.getType());
+			List<String> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {}.getType());
 
 			if (goodsIds == null || goodsIds.size() == 0) {
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鏈娴嬪埌绉婚櫎鍟嗗搧鏁版嵁")));
@@ -216,11 +176,10 @@
 
 	/**
 	 * 鏌ヨ
-	 * 
 	 * @param out
 	 */
 	@RequestMapping(value = "query")
-	public void query(String callback, Integer pageIndex, Integer pageSize, Integer sort,
+	public void query(String callback, Integer pageIndex,Integer pageSize,  Integer sort, 
 			QualityFactoryVO qualityFactoryVO, PrintWriter out) {
 
 		try {
@@ -258,19 +217,19 @@
 				case PROPOR_ASC:
 					propor = 1;
 					break;
-				case PROPOR_DESC:
+				case PROPOR_DESC:   
 					propor = 2;
 					break;
 				default:
 					break;
 				}
 			}
-
+			
 			qualityFactoryVO.setPrice(price);
 			qualityFactoryVO.setTkRate(tkRate);
 			qualityFactoryVO.setTotalSales(totalSales);
 			qualityFactoryVO.setPropor(propor);
-			qualityFactoryVO.setStart((pageIndex - 1) * pageSize);
+			qualityFactoryVO.setStart((pageIndex - 1) * pageSize);		
 			qualityFactoryVO.setCount(pageSize);
 
 			List<QualityFactory> selectionList = qualityFactoryService.query(qualityFactoryVO);
@@ -291,46 +250,47 @@
 
 			List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
 
-			/* 楠岃瘉缃戠粶: 鑾峰彇鍟嗗搧閾炬帴 鍥剧墖閾炬帴 */
+			/*  楠岃瘉缃戠粶: 鑾峰彇鍟嗗搧閾炬帴 鍥剧墖閾炬帴   */
 			List<TaoBaoGoodsBrief> goodsBriefList = new ArrayList<TaoBaoGoodsBrief>();
-
+			
 			StringBuffer idBuf = new StringBuffer();
 			StringBuffer auctionIdBuf = new StringBuffer();
-
+			
 			int j = 0;
-			for (int i = 0; i < selectionList.size(); i++) {
+			for (int i = 0; i < selectionList.size(); i++ ) {
 				QualityFactory selectionGoods = selectionList.get(i);
-
+				
 				TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
 				if (taoBaoGoodsBrief == null)
 					continue; // 涓虹┖缁撴潫鏈寰幆
-
+				
+				
 				Long id = taoBaoGoodsBrief.getId();
 				idBuf.append(id + ",");
-
+				
 				Long auctionId = taoBaoGoodsBrief.getAuctionId();
 				if (auctionId != null) {
 					j++;
 					auctionIdBuf.append(auctionId + ",");
 				}
-
+				
 				if (selectionList.size() <= 40) {
 					// 灏忎簬40涓弬鏁�
-					if (i == selectionList.size() - 1) {
+					if (i == selectionList.size()-1 ){
 						if (auctionIdBuf != null && auctionIdBuf.length() > 0) {
 							String auctionIds = auctionIdBuf.toString();
-							String ids = auctionIds.substring(0, auctionIds.length() - 1);
+							String ids = auctionIds.substring(0, auctionIds.length() -1);
 							List<TaoBaoGoodsBrief> list = null;
 							try {
 								list = TaoKeApiUtil.getBatchGoodsInfos(ids);
 							} catch (Exception e) {
 								e.printStackTrace();
 							}
-
+							
 							if (list != null && list.size() > 0) {
 								goodsBriefList.addAll(list);
 							}
-
+							
 							auctionIdBuf = new StringBuffer();
 						}
 					}
@@ -338,64 +298,66 @@
 					if (j == 40) {
 						// 澶т簬40鍙傛暟
 						String auctionIds = auctionIdBuf.toString();
-						String ids = auctionIds.substring(0, auctionIds.length() - 1);
+						String ids = auctionIds.substring(0, auctionIds.length() -1);
 						List<TaoBaoGoodsBrief> list = null;
 						try {
 							list = TaoKeApiUtil.getBatchGoodsInfos(ids);
 						} catch (Exception e) {
 							e.printStackTrace();
 						}
-
+						
 						if (list != null && list.size() > 0) {
 							goodsBriefList.addAll(list);
 						}
-
-						j = 0;
+						
+						j= 0;
 						auctionIdBuf = new StringBuffer();
-
-					} else if (i == selectionList.size() - 1) {
+						
+					} else if (i == selectionList.size()-1 ){
 						// 鏈�鍚庝竴涓�
 						String auctionIds = auctionIdBuf.toString();
-						String ids = auctionIds.substring(0, auctionIds.length() - 1);
+						String ids = auctionIds.substring(0, auctionIds.length() -1);
 						List<TaoBaoGoodsBrief> list = null;
 						try {
 							list = TaoKeApiUtil.getBatchGoodsInfos(ids);
 						} catch (Exception e) {
 							e.printStackTrace();
 						}
-
+						
 						if (list != null && list.size() > 0) {
 							goodsBriefList.addAll(list);
 						}
 						auctionIdBuf = new StringBuffer();
 					}
 				}
-
+				
 			}
-
+			
+			
 			for (QualityFactory selectionGoods : selectionList) {
 
 				TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
 				if (taoBaoGoodsBrief == null)
 					continue; // 涓虹┖缁撴潫鏈寰幆
 
+				
 				String auctionUrl = taoBaoGoodsBrief.getAuctionUrl();
 				if (auctionUrl != null && auctionUrl.trim().length() > 0 && auctionUrl.contains("id=null")) {
-					auctionUrl = auctionUrl.replace("id=null", "id=" + taoBaoGoodsBrief.getAuctionId());
+					auctionUrl =auctionUrl.replace("id=null","id="+ taoBaoGoodsBrief.getAuctionId());
 					taoBaoGoodsBrief.setAuctionUrl(auctionUrl);
 				}
-
+				
 				Map<String, Object> map = new HashMap<String, Object>();
-
+				
 				BoutiqueAutoRule boutiqueAutoRule = selectionGoods.getBoutiqueAutoRule();
 				if (boutiqueAutoRule == null) {
 					boutiqueAutoRule = new BoutiqueAutoRule();
 					selectionGoods.setBoutiqueAutoRule(boutiqueAutoRule);
 				}
-
+				
 				String reslutSource = "";
 				Integer gsSource = selectionGoods.getGoodsSource();
-				if (QualityFactory.SOURCE_TAOBAO == gsSource) {
+				if (QualityFactory.SOURCE_TAOBAO == gsSource ) {
 					reslutSource = "娣樺疂";
 				} else if (QualityFactory.SOURCE_TAOBAO_MATERIAL == gsSource) {
 					reslutSource = "娣樺疂鎺ㄨ崘";
@@ -410,9 +372,10 @@
 				} else if (QualityFactory.SOURCE_OTHER == gsSource) {
 					reslutSource = "鍟嗗姟鍚堜綔";
 				}
-
+				
 				map.put("goodsSource", reslutSource);
-
+				
+				
 				map.put("selectionGoods", selectionGoods);
 
 				/* 鍟嗗搧閿�鍞姸鎬侊細 0 鍦ㄥ敭 1鍋滃敭 */
@@ -420,16 +383,17 @@
 				Long auctionId = taoBaoGoodsBrief.getAuctionId();
 				if (auctionId != null) {
 					if (goodsBriefList != null && goodsBriefList.size() > 0) {
-						for (TaoBaoGoodsBrief tb : goodsBriefList) {
+						for (TaoBaoGoodsBrief tb :goodsBriefList) {
 							Long auctionIdTB = tb.getAuctionId();
 							if (auctionId.equals(auctionIdTB)) {
 								saleStae = 0;
 							}
 						}
-					}
+					} 
 				}
-
+				
 				map.put("saleStae", saleStae);
+				
 
 				/* 1 瀹氬悜璁″垝 2 钀ラ攢杩斿埄 銆侀珮浣� 3 鏅剑 */
 				Integer includeDxjh = taoBaoGoodsBrief.getIncludeDxjh();
@@ -454,8 +418,10 @@
 						map.put("yongjinType", 3);
 					}
 				}
-
-				/* 鍒稿悗浠�--璁$畻 */
+				
+				
+				
+				 /* 鍒稿悗浠�--璁$畻 */
 				BigDecimal couponPrice = TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief);
 				map.put("couponPrice", couponPrice);
 
@@ -467,22 +433,24 @@
 				BigDecimal estimateProfit = MoneyBigDecimalUtil.div(profit, new BigDecimal("100"));
 				// 棰勮鏀剁泭
 				map.put("estimateProfit", estimateProfit);
-
+				
+				
 				BigDecimal couponAmount = taoBaoGoodsBrief.getCouponAmount();
 				if (couponAmount != null && zkPrice != null) {
-					BigDecimal propors = couponAmount.divide(zkPrice, 10, BigDecimal.ROUND_HALF_DOWN);
+					BigDecimal propors = couponAmount.divide(zkPrice ,10 ,BigDecimal.ROUND_HALF_DOWN);
 					BigDecimal resultPropor = MoneyBigDecimalUtil.mul(propors, new BigDecimal("100"));
 					map.put("propor", resultPropor);
 				} else {
 					map.put("propor", 0);
 				}
+				
 
 				/* 鍟嗗搧鏍囩鍒楄〃 */
 				Long id = taoBaoGoodsBrief.getId();
 				int totalLabels = labelGoodsService.getCountQueryByGoodsId(id);
-
-				// List<LabelGoods> labelList = labelService.getByGoodsId(id);
-
+				
+				//List<LabelGoods> labelList = labelService.getByGoodsId(id);
+				
 				map.put("totalLabels", totalLabels);
 
 				listmap.add(map);
@@ -507,8 +475,7 @@
 	 * 鑾峰彇鍟嗗搧淇℃伅 浠ュ強瀵瑰簲鏍囩鍒楄〃锛涙鍟嗗搧鏍囩鍊欓�夐」
 	 * 
 	 * @param callback
-	 * @param id
-	 *            绮鹃�塱d
+	 * @param id 绮鹃�塱d
 	 * @param request
 	 * @param out
 	 */
@@ -529,7 +496,7 @@
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇ュ晢鍝佸凡涓嶅湪")));
 				return;
 			}
-
+			
 			// 鍟嗗搧鍥剧墖
 			List<String> imgList = TaoBaoUtil.getTbImg(taobao.getAuctionId() + "");
 
@@ -550,6 +517,7 @@
 
 	}
 
+
 	/**
 	 * 鍗曚釜鍟嗗搧璐翠笂鏍囩
 	 * 
@@ -565,11 +533,10 @@
 		try {
 			// 鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛
 			AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
-			// if (admin == null) {
-			// out.print(JsonUtil.loadJSONP(callback,
-			// JsonUtil.loadFalseResult("褰撳墠璐︽埛澶辨晥,璇烽噸鏂扮櫥闄嗐��")));
-			// return;
-			// }
+//			if (admin == null) {
+//				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("褰撳墠璐︽埛澶辨晥,璇烽噸鏂扮櫥闄嗐��")));
+//				return;
+//			}
 
 			if (id == null || labId == null) {
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭殑鍙傛暟")));
@@ -659,12 +626,11 @@
 
 		try {
 			AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
-			//
-			// if (admin == null) {
-			// out.print(JsonUtil.loadJSONP(callback,
-			// JsonUtil.loadFalseResult("褰撳墠璐︽埛宸插け鏁�,璇烽噸鏂扮櫥闄�")));
-			// return;
-			// }
+//
+//			if (admin == null) {
+//				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("褰撳墠璐︽埛宸插け鏁�,璇烽噸鏂扮櫥闄�")));
+//				return;
+//			} 
 
 			Long id = selectionGoods.getId();
 			QualityFactory resultObj = qualityFactoryService.selectByPrimaryKey(id);
@@ -684,6 +650,7 @@
 					out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("淇敼澶辫触")));
 				}
 			}
+			
 
 		} catch (QualityFactoryException e) {
 			e.printStackTrace();
@@ -693,32 +660,32 @@
 	}
 
 	@RequestMapping(value = "queryMyLabels")
-	public void queryMyLabels(String callback, Integer pageIndex, Integer pageSize, String ids,
-			HttpServletRequest request, PrintWriter out) {
+	public void queryMyLabels(String callback, Integer pageIndex, Integer pageSize, 
+			String ids, HttpServletRequest request, PrintWriter out) {
 
 		try {
-
+			
 			if (StringUtil.isNullOrEmpty(ids)) {
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭弬鏁�:101")));
 				return;
 			}
-
+			
 			Gson gson = new Gson();
-			List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
-			}.getType());
+			List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
 			if (idList == null || idList.size() == 0) {
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭弬鏁�:102")));
 				return;
 			}
-
+			
 			if (idList.size() > 1) {
 				// 鍙鐞嗗崟涓晢鍝�
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭弬鏁�:103")));
 				return;
 			}
-
+			
+			
 			Long id = idList.get(0);
-
+			
 			if (id == null) {
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭弬鏁�:104")));
 				return;
@@ -731,20 +698,21 @@
 				pageSize = Constant.PAGE_SIZE;
 
 			// 鍟嗗搧鏍囩鍒楄〃
-			List<LabelGoods> labelList = labelGoodsService.queryByGoodsId((pageIndex - 1) * pageSize, pageSize, id);
+			List<LabelGoods> labelList = labelGoodsService.queryByGoodsId((pageIndex - 1) * pageSize, 
+					pageSize, id);
 
 			if (labelList == null || labelList.size() == 0) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏍囩"));
 				return;
 			}
-
+			
 			int count = labelGoodsService.getCountQueryByGoodsId(id);
 
 			int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
 			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
 
 			GsonBuilder gsonBuilder = new GsonBuilder();
-			gsonBuilder.serializeNulls();
+			gsonBuilder.serializeNulls(); 
 			Gson rgson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
 
 			JSONObject data = new JSONObject();
@@ -771,8 +739,8 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "queryLabel")
-	public void queryLabel(String callback, Integer pageIndex, Integer pageSize, String key, String ids,
-			HttpServletRequest request, PrintWriter out) {
+	public void queryLabel(String callback, Integer pageIndex, Integer pageSize, String key, 
+			String ids, HttpServletRequest request, PrintWriter out) {
 
 		try {
 
@@ -780,30 +748,29 @@
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭弬鏁�:101")));
 				return;
 			}
-
+			
 			Gson gson = new Gson();
-			List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
-			}.getType());
+			List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
 			if (idList == null || idList.size() == 0) {
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭弬鏁�:102")));
 				return;
 			}
-
+			
 			int count = 0;
 			List<Label> labelList = null;
-
+			
 			if (pageIndex == null)
 				pageIndex = 1;
 
 			if (pageSize == null)
 				pageSize = Constant.PAGE_SIZE;
-
+			
 			if (idList.size() > 1) {
 				// 澶氫釜鍟嗗搧 鏌ヨ鎵�鏈夋爣绛�
-				labelList = labelService.query((pageIndex - 1) * pageSize, pageSize, key, null, null, null);
-
-				count = labelService.getQueryCount(key, null, null);
-
+				 labelList = labelService.query((pageIndex - 1) * pageSize, pageSize, key, null, null,null);
+				
+				 count = labelService.getQueryCount(key, null, null);
+				
 			} else {
 				// 鍗曚釜鍟嗗搧
 				Long id = idList.get(0);
@@ -816,12 +783,12 @@
 
 				count = labelService.getCountQueryGoodsCandidate(key, id);
 			}
-
+			
 			if (labelList == null || labelList.size() == 0) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏍囩"));
 				return;
 			}
-
+			
 			int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
 			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
 
@@ -851,8 +818,7 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "addBatchcGoodsLabel")
-	public void addBatchcGoodsLabel(String callback, String labIds, Long id, HttpServletRequest request,
-			PrintWriter out) {
+	public void addBatchcGoodsLabel(String callback, String labIds, Long id, HttpServletRequest request, PrintWriter out) {
 
 		try {
 			if (StringUtil.isNullOrEmpty(labIds)) {
@@ -874,7 +840,7 @@
 			}
 
 			TaoBaoGoodsBrief taoBaoGoodsBrief = taoBaoGoodsBriefService.selectByPrimaryKey(id);
-
+			
 			// 鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛
 			AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
 			labelGoodsService.addBatchByLabId(taoBaoGoodsBrief, labIdList, admin);
@@ -886,14 +852,14 @@
 			e.printStackTrace();
 		}
 	}
-
-	@RequestMapping(value = "updateGoodsBrief")
-	public void updateGoodsBrief(String callback, TaoBaoGoodsBrief tb, PrintWriter out) {
+	
+	@RequestMapping(value="updateGoodsBrief")
+	public void updateGoodsBrief(String callback, TaoBaoGoodsBrief tb, PrintWriter out){
 		try {
-
+			
 			// 瀹為檯鏈簿閫塈D
 			Long id = tb.getId();
-
+			
 			QualityFactory resultObj = qualityFactoryService.selectByPrimaryKey(id);
 
 			if (resultObj == null) {
@@ -906,72 +872,69 @@
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇ュ晢鍝佸凡涓嶅湪")));
 				return;
 			}
-
+			
 			String title = tb.getTitle();
 			String pictUrl = tb.getPictUrl();
-
-			if (!StringUtil.isNullOrEmpty(title))
+			
+			if (!StringUtil.isNullOrEmpty(title)) 
 				taobao.setTitle(title);
-
-			if (!StringUtil.isNullOrEmpty(pictUrl))
+			
+			if (!StringUtil.isNullOrEmpty(pictUrl)) 
 				taobao.setPictUrl(pictUrl);
-
-			if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite()))
+			
+			if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite())) 
 				taobao.setPictUrlWhite(tb.getPictUrlWhite());
-
+			
 			// 鏇存柊鍟嗗搧
 			taoBaoGoodsUpdateService.getUpdateTaoBaoGoodsBrief(taobao);
-
+			
 			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("淇敼鎴愬姛")));
-
+			
 		} catch (Exception e) {
 			e.printStackTrace();
 			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("淇敼澶辫触")));
 		}
-
+		
 	}
-
+	
+	
 	/**
 	 * 鎵归噺娣诲姞鏍囩 --- 绮惧搧搴擄紙闅忔満鏉冮噸锛�
-	 * 
 	 * @param callback
 	 * @param request
-	 * @param out
-	 * @param 鏉冮噸鑼冨洿
-	 *            澶у��
-	 * @param 浣i噾鑼冨洿
-	 *            灏忓��
+	 * @param out @param 		  鏉冮噸鑼冨洿 澶у��
+	 * @param 		  浣i噾鑼冨洿 灏忓��
 	 */
 	@RequestMapping(value = "setWeightBatch")
-	public void setWeightBatch(String callback, String ids, Integer weight, Integer weightSmall, Integer weightLarge,
-			HttpServletRequest request, PrintWriter out) {
+	public void setWeightBatch(String callback,String ids, Integer weight,Integer weightSmall, 
+			Integer weightLarge, HttpServletRequest request, PrintWriter out) {
 
-		try {
-
-			if (StringUtil.isNullOrEmpty(ids)) {
-				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鏈�夋嫨闇�鎿嶄綔鐨勫晢鍝�")));
-				return;
-			}
-
-			Gson gson = new Gson();
-			List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
-			}.getType());
-
-			if (idList == null || idList.size() == 0) {
-				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇烽�夋嫨闇�鎿嶄綔鐨勫晢鍝�")));
-				return;
-			}
-			// 鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛
-			AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
-
-			qualityFactoryService.setWeightBatch(idList, admin, weight, weightSmall, weightLarge);
-			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("璁剧疆鎴愬姛")));
-
-		} catch (Exception e) {
+		try {  
+		
+			 if (StringUtil.isNullOrEmpty(ids)) {
+				 out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鏈�夋嫨闇�鎿嶄綔鐨勫晢鍝�")));
+				 return;
+			 } 
+			 
+			 Gson gson = new Gson();
+			 List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
+			 
+			 if (idList == null || idList.size() == 0) {
+				 out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇烽�夋嫨闇�鎿嶄綔鐨勫晢鍝�")));
+				 return;
+			 } 
+				// 鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛
+			 AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
+			 
+			 qualityFactoryService.setWeightBatch(idList, admin, weight, weightSmall, weightLarge);
+			 out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("璁剧疆鎴愬姛")));
+	
+		} catch ( Exception e) {
 			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")));
 			e.printStackTrace();
 		}
 
 	}
-
+	
+	
 }

--
Gitblit v1.8.0