浏览代码

Merge remote-tracking branch 'remotes/origin/developer' into developerB

plf 3 年之前
父节点
当前提交
5e5595163a

+ 11 - 1
src/main/java/com/caimei/modules/info/web/InfoController.java

@@ -148,12 +148,22 @@ public class InfoController extends BaseController {
 				info.setBasePv((long)(random.nextInt(191)+10));
 			}
 		}
+		boolean flag = false;
+		if (StringUtils.isBlank(info.getId())) {
+			flag = true;
+		}
+		// 保存成功返回info.id
 		infoService.save(info,request);
 		addMessage(redirectAttributes, "保存信息成功");
 		// 更新索引
 		coreServiceUitls.updateArticleIndex(Integer.valueOf(info.getId()));
-		if(StringUtils.equals("1", ltype))
+		if (flag) {
+			// 新增文章 百度链接实时推送
+			generateUtils.pushBaiduLink("https://www.caimei365.com/info/detail-"+info.getId()+"-1.html");
+		}
+		if(StringUtils.equals("1", ltype)) {
 			return "redirect:"+Global.getAdminPath()+"/info/infoLabel/list";
+		}
 		return "redirect:"+Global.getAdminPath()+"/info/info/list?repage";
 	}
 

+ 30 - 20
src/main/java/com/caimei/modules/opensearch/CoreServiceUitls.java

@@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestClientException;
 import org.springframework.web.client.RestTemplate;
 
 /**
@@ -46,29 +47,38 @@ public class CoreServiceUitls {
     }
 
     private void updateIndexPost(String path){
-        // 获取core服务器地址
-        String coreServer = Global.getConfig("caimei.core");
-        RestTemplate restTemplate = new RestTemplate();
-        String uri = coreServer + "/commodity/search/index" + path;
-        // 打印参数
-        logger.info("更新索引uri:" + uri);
-        // 发起Post请求
-        MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>();
-        String result = restTemplate.postForObject(uri, paramMap, String.class);
-        logger.info("更新索引result:" + result);
+        try {
+            // 获取core服务器地址
+            String coreServer = Global.getConfig("caimei.core");
+            RestTemplate restTemplate = new RestTemplate();
+            String uri = coreServer + "/commodity/search/index" + path;
+            // 打印参数
+            logger.info("更新索引uri:" + uri);
+            // 发起Post请求
+            MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>();
+            String result = restTemplate.postForObject(uri, paramMap, String.class);
+            logger.info("更新索引result:" + result);
+        } catch (RestClientException e) {
+            logger.info("更新索引出现异常!" + e);
+        }
     }
 
     public String queryLogisticsGet(String number, String companyCode, String mobile){
-        // 获取core服务器地址
-        String coreServer = Global.getConfig("caimei.core");
-        RestTemplate restTemplate = new RestTemplate();
-        String uri = coreServer + "/tools/query/logistics?number" + number + "&companyCode=" + companyCode + "&mobile=" + mobile;
-        // 打印参数
-        logger.info("查询物流uri:" + uri);
-        // 发起Get请求
-        String result = restTemplate.getForObject(uri, String.class);
-        logger.info("查询物流result:" + result);
-        return result;
+        try {
+            // 获取core服务器地址
+            String coreServer = Global.getConfig("caimei.core");
+            RestTemplate restTemplate = new RestTemplate();
+            String uri = coreServer + "/tools/query/logistics?number" + number + "&companyCode=" + companyCode + "&mobile=" + mobile;
+            // 打印参数
+            logger.info("查询物流uri:" + uri);
+            // 发起Get请求
+            String result = restTemplate.getForObject(uri, String.class);
+            logger.info("查询物流result:" + result);
+            return result;
+        } catch (RestClientException e) {
+            logger.info("查询物流出现异常!" + e);
+            return "";
+        }
     }
 
 

+ 54 - 0
src/main/java/com/caimei/modules/opensearch/GenerateUtils.java

@@ -8,6 +8,13 @@ import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+
 /**
  * www静态页面生成utils
  *
@@ -58,4 +65,51 @@ public class GenerateUtils {
         }
     }
 
+    /**
+     * 百度链接实时推送
+     */
+    public void pushBaiduLink(String param) {
+        String result = "";
+        PrintWriter out = null;
+        BufferedReader in = null;
+        try {
+            //建立URL之间的连接
+            URLConnection conn = new URL("http://data.zz.baidu.com/urls?site=https://www.caimei365.com&token=hgKJrx3lqsPPCf73").openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("User-Agent", "curl/7.12.1");
+            conn.setRequestProperty("Host", "data.zz.baidu.com");
+            conn.setRequestProperty("Content-Type", "text/plain");
+            conn.setRequestProperty("Content-Length", "83");
+            //发送POST请求必须设置如下两行
+            conn.setDoInput(true);
+            conn.setDoOutput(true);
+            //获取conn对应的输出流
+            out = new PrintWriter(conn.getOutputStream());
+            //发送请求参数
+            out.print(param.trim());
+            //进行输出流的缓冲
+            out.flush();
+            //通过BufferedReader输入流来读取Url的响应
+            in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+            String line;
+            while((line=in.readLine()) != null){
+                result += line;
+            }
+        } catch (Exception e) {
+            logger.info("百度链接实时推送出现异常!" + e);
+        } finally {
+            try{
+                if(out != null) {
+                    out.close();
+                }
+                if(in != null) {
+                    in.close();
+                }
+            } catch(IOException ex) {
+                ex.printStackTrace();
+                logger.info("百度链接实时推送关闭连接异常!" + ex);
+            }
+        }
+        logger.info("百度链接实时推送:"+result);
+    }
 }

+ 0 - 3
src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java

@@ -615,9 +615,6 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                     beansHistory.setPushStatus(0);
                     newCmClubDao.insertBeansHistory(beansHistory);
                     userBeans = userBeans - num;
-                    if (userBeans < 0) {
-                        userBeans = 0;
-                    }
                     cmUserDao.updateUserBeans(newOrder.getUserID(), userBeans);
                 }
             }

+ 9 - 0
src/main/java/com/caimei/modules/product/entity/CmSecondHandDetail.java

@@ -91,6 +91,7 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
     private String image4;
     private String image5;
     private String editFlag;//编辑标记,1是编辑,其他都不是
+    private String visibility;     //商品可见度:(3:所有人可见,2:普通机构可见,1:会员机构可见)
 
 
     public CmSecondHandDetail() {
@@ -662,4 +663,12 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
     public void setUrl(String url) {
         this.url = url;
     }
+
+    public String getVisibility() {
+        return visibility;
+    }
+
+    public void setVisibility(String visibility) {
+        this.visibility = visibility;
+    }
 }

+ 19 - 11
src/main/java/com/caimei/modules/product/web/CmSecondHandDetailController.java

@@ -119,17 +119,17 @@ public class CmSecondHandDetailController extends BaseController {
         // 构造类型
         List<BigType> typeList = new ArrayList<>();
         BigType bigType = new BigType();
-        BigType bigType1 = new BigType();
-        BigType bigType2 = new BigType();
+        /*BigType bigType1 = new BigType();
+        BigType bigType2 = new BigType();*/
         bigType.setId("1");
-        bigType.setName("轻光电");
-        bigType1.setId("2");
+        bigType.setName("美容仪器");
+/*        bigType1.setId("2");
         bigType1.setName("重光电");
         bigType2.setId("3");
-        bigType2.setName("耗材配件");
+        bigType2.setName("耗材配件");*/
         typeList.add(bigType);
-        typeList.add(bigType1);
-        typeList.add(bigType2);
+        /*typeList.add(bigType1);
+        typeList.add(bigType2);*/
         model.addAttribute("typeList", typeList);
 
         //初始化城市信息
@@ -213,6 +213,7 @@ public class CmSecondHandDetailController extends BaseController {
         product.setShopID(1252);
         product.setName(cmSecondHandDetail.getName());
         product.setAliasName(cmSecondHandDetail.getName());
+        product.setVisibility(cmSecondHandDetail.getVisibility());
         String normalPrice = cmSecondHandDetail.getNormalPrice();
         if (StringUtils.isNotEmpty(normalPrice)) {
             product.setNormalPrice(Float.parseFloat(normalPrice));
@@ -273,7 +274,6 @@ public class CmSecondHandDetailController extends BaseController {
             String imageUrl = getImageUrl(image1);
             product.setMainImage(imageUrl);
         }
-        product.setVisibility("3");
         cmSecondHandDetailService.saveProduct(product);
 
         String payStatus = cmSecondHandDetail.getPayStatus();
@@ -434,11 +434,19 @@ public class CmSecondHandDetailController extends BaseController {
      * 有数据变动时需要清除缓存
      */
     public void cleanRedisCache() {
-        // 首页缓存
-        String homeData = "getHomeData*";
-        redisService.removePattern(homeData);
+        //首页缓存
+        redisService.removePattern("getNavMenu*");
+        redisService.removePattern("getClassify*");
+        redisService.removePattern("getCommodityClassify*");
+        redisService.removePattern("getHomeData*");
         redisService.removePattern("getHomeCommodityData*");
+        //清除产品仪器缓存
+        redisService.removePattern("instrumentData*");
+        redisService.removePattern("insCommodityData*");
         // 重新生成静态首页
         generateUtils.generateHome();
+        // 重新生成静态产品仪器页
+        generateUtils.generateProductType(286);
+        generateUtils.generateProductType(287);
     }
 }

+ 2 - 2
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -191,10 +191,10 @@ public class ProductNewController extends BaseController {
                     String instrumentType = p.getInstrumentType();
                     if (StringUtils.isNotEmpty(instrumentType)) {
                         if (instrumentType.contains(",")) {
-                            String replace = instrumentType.replace(",", "-").replace("1", "轻光电").replace("2", "重光电").replace("3", "耗材配件");
+                            String replace = instrumentType.replace(",", "-").replace("1", "美容仪器");
                             p.setInstrumentType(replace);
                         } else {
-                            p.setInstrumentType("1".equals(p.getInstrumentType()) ? "轻光电" : "2".equals(p.getInstrumentType()) ? "重光电" : "3".equals(p.getInstrumentType()) ? "耗材配件" : "其他");
+                            p.setInstrumentType("1".equals(p.getInstrumentType()) ? "美容仪器" : "");
                         }
                     }
                 }

+ 3 - 3
src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java

@@ -530,7 +530,7 @@ public class AgencyController extends BaseController {
                 companyUser.setUserIdentity(2);
                 smsMessage = "恭喜您成功升级为会员机构!立马登录采美365网享受享受更多更好的服务吧~";
                 int userBeans = companyUser.getUserBeans() == null ? 0 : companyUser.getUserBeans();
-                companyUser.setUserBeans(userBeans + 20);
+                companyUser.setUserBeans(userBeans + 500);
             } else {
                 //审核未通过,普通机构权限
                 userPermission = 5;
@@ -561,12 +561,12 @@ public class AgencyController extends BaseController {
             String messageContent = "";
             if (auditStatus.equals("1")) {
                 messageContent = "恭喜您," + title + "【已通过】,恭喜您成功加入采美,祝您开启愉快的采购之旅。";
-                //升级为机构成功,送20采美豆
+                //升级为机构成功,送500采美豆
                 UserBeansHistory beansHistory = new UserBeansHistory();
                 beansHistory.setUserId(companyUser.getUserID());
                 beansHistory.setBeansType(2);
                 beansHistory.setType(1);
-                beansHistory.setNum(20);
+                beansHistory.setNum(500);
                 beansHistory.setPushStatus(0);
                 beansHistory.setAddTime(new Date());
                 newCmClubService.insertBeansHistory(beansHistory);

+ 2 - 1
src/main/resources/mappings/modules/product/CmSecondHandDetailMapper.xml

@@ -49,7 +49,8 @@
 		p.brandID AS "brandID",
 		p.costPrice as "costPrice",
 		p.costCheckFlag AS "costCheckFlag",
-		p.costProportional AS "costProportional"
+		p.costProportional AS "costProportional",
+		p.visibility AS "visibility"
 	</sql>
 
 	<sql id="cmSecondHandDetailJoins">

+ 1 - 0
src/main/resources/mappings/modules/product/ProductNewMapper.xml

@@ -291,6 +291,7 @@
                 ${sqlMap.dsf}
             </if>
             AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            AND a.productID NOT IN (6060, 6061, 6062, 6063, 6064,6065, 6066, 6067, 6068, 6069)
         </where>
         <choose>
             <when test="page !=null and page.orderBy != null and page.orderBy != ''">

+ 2 - 6
src/main/webapp/WEB-INF/views/modules/product-new/secondHand.jsp

@@ -47,9 +47,7 @@
                 <label>二级分类:</label>
                 <form:select path="instrumentType" class="input-medium" id="instrumentType">
                     <form:option value="" label="请选择"/>
-                    <form:option value="1" label="轻光电"/>
-                    <form:option value="2" label="重光电"/>
-                    <form:option value="3" label="耗材配件"/>
+                    <form:option value="1" label="美容仪器"/>
                 </form:select>
             </div>
             <div class="item">
@@ -519,9 +517,7 @@
                 $("#instrumentType").find("option").remove();
                 $(".select2-chosen").eq(1).html("请选择");
                 $("#instrumentType").append("<option value=''>请选择</option>")
-                $("#instrumentType").append("<option value='1'>轻光电</option>")
-                $("#instrumentType").append("<option value='2'>重光电</option>")
-                $("#instrumentType").append("<option value='3'>耗材配件</option>")
+                $("#instrumentType").append("<option value='1'>美容仪器</option>")
             }
         }else {
             $("#instrumentType").html();

+ 18 - 15
src/main/webapp/WEB-INF/views/modules/product/cmSecondHandDetailForm.jsp

@@ -344,7 +344,16 @@
 			<form:checkboxes path="bigTypeList"  items="${typeList}" itemLabel="name" itemValue="id" htmlEscape="false" class="input-small  stylema required"/>
 		</div>
 	</div>
-
+	<div class="control-group">
+		<label class="control-label"><font color="red">*</font>商品可见度:</label>
+		<div class="controls">
+			<form:select path="visibility" class="input-large required" id="visibility">
+				<form:option value="3" label="所有人可见"/>
+				<form:option value="2" label="所有机构可见"/>
+				<form:option value="1" label="仅会员机构可见"/>
+			</form:select>
+		</div>
+	</div>
 	<div class="control-group">
 		<label class="control-label"><font color="red">*</font>商品品牌:</label>
 		<div class="controls">
@@ -875,12 +884,13 @@
 			dataType: 'json',
 			url: '/area/loadProvince',
 			success: function(data) {
+				$("#s2id_province .select2-chosen").html("市");
 				$("#province").html("");
 				$("#province").append("<option value=''>省</option>");
 				for(var i=0; i<data.length; i++) {
 					if(curProvince != '' && curProvince != null && typeof(curProvince) != "undefined" && curProvince == data[i].name) {
 						$("#province").append("<option value='" + data[i].name + "' provinceId=" + data[i].id +" selected>" + data[i].name +"</option>");
-						$(".select2-chosen").eq(2).html(curProvince);
+						$("#s2id_province .select2-chosen").html(curProvince);
 						loadCity($("#curCity").val());
 					} else {
 						$("#province").append("<option value='" + data[i].name + "' provinceId=" + data[i].id +">" + data[i].name +"</option>");
@@ -896,25 +906,20 @@
 	 */
 	function loadCity(curCity) {
 		var provinceId = $("#province option:selected").attr("provinceId");
-
-		$("#town").html("");
-		$(".select2-chosen").eq(4).html("区");
-		$("#town").append("<option value=''>区</option>");
-
-		if(typeof(provinceId) != "undefined") {
+		if(typeof(provinceId) != "undefined" && provinceId*1>0) {
 			$.ajax({
 				type: 'POST',
 				dataType: 'json',
 				data: {'provinceId':provinceId},
 				url: '/area/loadCity',
 				success: function(data) {
-					$(".select2-chosen").eq(3).html("市");
+					$("#s2id_city .select2-chosen").html("市");
 					$("#city").html("");
 					$("#city").append("<option value=''>市</option>");
 					for(var i=0; i<data.length; i++) {
 						if(curCity != null && typeof(curCity) != "undefined" && curCity == data[i].name) {
 							$("#city").append("<option value='" + data[i].name + "' selected cityId=" + data[i].id +">" + data[i].name +"</option>");
-							$(".select2-chosen").eq(3).html(curCity);
+							$("#s2id_city .select2-chosen").html(curCity);
 							loadTown($("#curTown").val());
 						} else {
 							$("#city").append("<option value='" + data[i].name + "' cityId=" + data[i].id +">" + data[i].name +"</option>");
@@ -942,25 +947,23 @@
 	 */
 	function loadTown(curTown) {
 		var cityId = $("#city option:selected").attr("cityId");
-		if(typeof(cityId) != "undefined") {
+		if(typeof(cityId) != "undefined" && cityId*1>0) {
 			$.ajax({
 				type: 'POST',
 				dataType: 'json',
 				data: {'cityId':cityId},
 				url: '/area/loadTown',
 				success: function(data) {
-					$(".select2-chosen").eq(4).html("区");
+					$("#s2id_town .select2-chosen").html("区");
 					$("#town").html("");
 					$("#town").append("<option value='' >区</option>");
 					for(var i=0; i<data.length; i++) {
 						if(curTown != null && typeof(curTown) != "undefined" && curTown == data[i].name) {
 							$("#town").append("<option value='" + data[i].name + "' selected townId=" + data[i].id +">" + data[i].name +"</option>");
-							$(".select2-chosen").eq(4).html(curTown);
+							$("#s2id_town .select2-chosen").html(curTown);
 						} else {
 							$("#town").append("<option value='" + data[i].name + "' townId=" + data[i].id +">" + data[i].name +"</option>");
 						}
-
-
 					}
 				}
 

+ 4 - 0
src/main/webapp/WEB-INF/views/modules/user/cmUserbeanshistoryList.jsp

@@ -50,6 +50,7 @@
 				<form:option value="9" label="抵用退回"/>
 				<form:option value="10" label="抵用运费"/>
 				<form:option value="11" label="退款回收"/>
+				<form:option value="12" label="登录奖励"/>
 			</form:select>
 			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
 			<div class="clearfix"></div>
@@ -108,6 +109,9 @@
 					<c:if test="${userBeansHistory.beansType eq 11}">
 						<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecord?id=${userBeansHistory.returnedId}&orderID=${userBeansHistory.orderId}">退款回收</a>
 					</c:if>
+					<c:if test="${userBeansHistory.beansType eq 12}">
+						登录奖励
+					</c:if>
 				</td>
 			</tr>
 		</c:forEach>