Browse Source

开通卖家中心 逻辑优化

wangdy 8 years ago
parent
commit
cbfb7e7d38

+ 13 - 3
src/main/java/com/uas/platform/b2c/common/account/controller/EnterpriseController.java

@@ -117,7 +117,7 @@ public class EnterpriseController {
 	 */
 	@RequestMapping(value = "/openVendor/{enUU}", method = RequestMethod.POST)
 	public void openVendor(@PathVariable("enUU") long enUU) {
-		enterpriseService.openVendor(enUU,true);
+		enterpriseService.openVendor(enUU,true, true);
 	}
 
 	/**
@@ -126,8 +126,18 @@ public class EnterpriseController {
 	 * @param enUU
 	 */
 	@RequestMapping(value = "/openVendorSetRead/{enUU}", method = RequestMethod.POST)
-	public void getOpenVendor(@PathVariable("enUU") long enUU) {
-		enterpriseService.openVendor(enUU,false);
+	public void setOpenVendor(@PathVariable("enUU") long enUU) {
+		enterpriseService.openVendor(enUU,true,false);
+	}
+
+	/**
+	 * 设置卖家中心非预开通状态
+	 *
+	 * @param enUU
+	 */
+	@RequestMapping(value = "/openVendorSetNotRead/{enUU}", method = RequestMethod.POST)
+	public void setOpenNotVendor(@PathVariable("enUU") long enUU) {
+		enterpriseService.openVendor(enUU,false,false);
 	}
 
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/common/account/service/EnterpriseService.java

@@ -49,5 +49,5 @@ public interface EnterpriseService {
 	 * 开启企业卖家功能
 	 * @return 企业
 	 */
-	Enterprise openVendor(Long enUU , boolean isRead);
+	Enterprise openVendor(Long enUU , boolean isRead , boolean isOpen);
 }

+ 8 - 5
src/main/java/com/uas/platform/b2c/common/account/service/impl/EnterpriseServiceImpl.java

@@ -200,16 +200,19 @@ public class EnterpriseServiceImpl implements EnterpriseService{
 	}
 
 	@Override
-	public Enterprise openVendor(Long enUU , boolean isRead) {
+	public Enterprise openVendor(Long enUU , boolean isRead , boolean isOpen) {
 		Enterprise existEnterprise = enterpriseDao.findOne(enUU);
-		if (isRead) {
+		if (isOpen){
 			existEnterprise.setEnMallVendorStatus((short) Status.ENABLED.value());
-		}else{
+			Enterprise enterprise = enterpriseDao.save(existEnterprise);
+			return null;
+		}
+		if (isRead) {
 			existEnterprise.setEnMallVendorStatus((short) Status.ISREAD.value());
+		}else{
+			existEnterprise.setEnMallVendorStatus(null);
 		}
-
 		Enterprise enterprise = enterpriseDao.save(existEnterprise);
-
 		return null;
 	}
 }

+ 2 - 2
src/main/webapp/resources/view/common/site-nav.html

@@ -160,8 +160,8 @@
         </li>
         <li><a href=".">商城首页</a></li>
         <li ng-if="userInfo"><a href="user">买家中心</a></li>
-        <li ng-if="userInfo.enterprise"><a href="vendor">卖家中心</a></li>
-        <li ng-if="!userInfo.enterprise"><a href="./register-saler">卖家中心</a></li>
+        <li ng-if="userInfo.enterprise && userInfo.enterprise.isVendor == 313"><a href="vendor">卖家中心</a></li>
+        <li ng-if="!userInfo.enterprise || userInfo.enterprise.isVendor != 313"><a href="./register-saler">卖家中心</a></li>
         <li><a href="help/home" target="_blank">帮助中心</a></li>
         <!-- <li><a href="http://wpa.qq.com/msgrd?v=3&uin=3432892085&site=www.ubtoc.com&menu=yes" target="_blank">在线客服</a></li> -->
        <!-- <li><a href="javascript:void(0)">服务电话:400-830-1818</a></li>-->