Просмотр исходного кода

Merge remote-tracking branch 'origin/dev' into function_vendor_modify

hulh 8 лет назад
Родитель
Сommit
1c1a6a6363

+ 3 - 0
src/main/java/com/uas/platform/b2c/common/account/controller/UserController.java

@@ -101,6 +101,9 @@ public class UserController {
 	 */
 	@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
 	public ResponseEntity<String> updatePassword(HttpSession session, String password, String newPassword) {
+		if (password.equals(newPassword)){
+			throw new IllegalOperatorException("新密码与旧密码相同");
+		}
 		User sysUser = SystemSession.getUser();
 		User user = userService.findUserPwdByUserUU(sysUser.getUserUU());
 		Enterprise enterprise = user.getEnterprise();

+ 24 - 15
src/main/java/com/uas/platform/b2c/trade/presale/controller/CollectionController.java

@@ -136,13 +136,20 @@ public class CollectionController {
 		while (it.hasNext()){
 			String uuid = it.next();
 			ComponentInfo componentInfo = componentInfoDao.findByUuid(uuid);
-			Collection store = new Collection();
-			store.setComponentid(componentInfo.getId());
-			store.setUseruu(SystemSession.getUser().getUserUU());
-			store.setEnuu(SystemSession.getUser().getEnterprise().getUu());
-			store.setCreatetime(new Date());
-			store.setKind(2);
-			storeList.add(store);
+			if (componentInfo != null){
+				Collection store = new Collection();
+				store.setComponentid(componentInfo.getId());
+				store.setUseruu(SystemSession.getUser().getUserUU());
+				if (SystemSession.getUser().getEnterprise() != null){
+					store.setDissociative(Type.ENTERPRISING.value());
+					store.setEnuu(SystemSession.getUser().getEnterprise().getUu());
+				}else {
+					store.setDissociative(Type.PERSONAL.value());
+				}
+				store.setCreatetime(new Date());
+				store.setKind(2);
+				storeList.add(store);
+			}
 		}
 		collectionService.save(storeList);
 		return "success";
@@ -160,15 +167,17 @@ public class CollectionController {
 		String result = "success";
 		if (StringUtils.hasText(str)) {
 			Collection store = FastjsonUtils.fromJson(str, Collection.class);
-			store.setUseruu(SystemSession.getUser().getUserUU());
-			if (SystemSession.getUser().getEnterprise() != null) {
-				store.setDissociative(Type.ENTERPRISING.value());
-				store.setEnuu(SystemSession.getUser().getEnterprise().getUu());
-			} else {
-				store.setDissociative(Type.PERSONAL.value());
+			if (store.getComponentid() != null){
+				store.setUseruu(SystemSession.getUser().getUserUU());
+				if (SystemSession.getUser().getEnterprise() != null) {
+					store.setDissociative(Type.ENTERPRISING.value());
+					store.setEnuu(SystemSession.getUser().getEnterprise().getUu());
+				} else {
+					store.setDissociative(Type.PERSONAL.value());
+				}
+				store.setCreatetime(new Date());
+				result = collectionService.save(store);
 			}
-			store.setCreatetime(new Date());
-			result = collectionService.save(store);
 		}
 		System.out.println("result = " + result);
 		return result;

+ 11 - 0
src/main/java/com/uas/platform/b2c/trade/presale/dao/CollectionDao.java

@@ -85,4 +85,15 @@ public interface CollectionDao extends JpaRepository<Collection, Long>, JpaSpeci
 	 * List<Collection> 返回收藏记录列表
 	 */
 	List<Collection> findStoreByUseruuAndEnuuAndKindAndComponentid(Long useruu, Long enuu, int kind, Long componentid);
+
+	/**
+	 * 获取指定的store 判断器件是否存在
+	 *
+	 * @param useruu 个人uu
+	 * @param dissociative 是否为个人用户
+	 * @param kind 收藏类型,品牌或者器件
+	 * @param componentid 器件id
+	 * @return
+	 */
+	List<Collection> findStoreByUseruuAndDissociativeAndKindAndComponentid(Long useruu, Integer dissociative, int kind, Long componentid);
 }

+ 7 - 3
src/main/java/com/uas/platform/b2c/trade/presale/service/impl/CollectionServiceImpl.java

@@ -79,9 +79,13 @@ public class CollectionServiceImpl implements CollectionService {
 				return "repeat";
 			}
 		} else if (store.getKind() == 2) {
-			List<Collection> storelist = collectionDao.findStoreByUseruuAndEnuuAndKindAndComponentid(
-					SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu(), 2, store.getComponentid());
-			if (storelist.size() == 0) {
+			if (SystemSession.getUser().getEnterprise() != null){
+				storeList = collectionDao
+						.findStoreByUseruuAndEnuuAndKindAndComponentid(SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu(), 2, store.getComponentid());
+			} else {
+				storeList = collectionDao.findStoreByUseruuAndDissociativeAndKindAndComponentid(SystemSession.getUser().getUserUU(), Type.PERSONAL.value(), 2, store.getComponentid());
+			}
+			if (storeList.size() == 0) {
 				collectionDao.save(store);
 			}else {
 				return "repeat";

+ 4 - 0
src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js

@@ -439,6 +439,10 @@ define(['app/app'], function(app) {
 
 		//修改密码
 		$scope.ok = function () {
+			if($scope.user.newPassword == $scope.user.password){
+				toaster.pop('error', '错误', '新密码与原密码相同');
+				return;
+			}
 			if($scope.user.newPassword == $scope.user.newPassword1) {//验证重复密码相等
 				User.updatePassword({password: $scope.user.password, newPassword: $scope.user.newPassword}, {}, function(){
 					toaster.pop('success', '成功', '修改密码成功,请牢记您的新密码。');

+ 4 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_account_management_ctrl.js

@@ -365,6 +365,10 @@ define(['app/app'], function(app) {
 
 		//修改密码
 		$scope.ok = function () {
+			if($scope.user.newPassword == $scope.user.password){
+				toaster.pop('error', '错误', '新密码与原密码相同');
+				return;
+			}
 			if($scope.user.newPassword == $scope.user.newPassword1) {//验证重复密码相等
 				User.updatePassword({password: $scope.user.password, newPassword: $scope.user.newPassword}, {}, function(){
 					toaster.pop('success', '成功', '修改密码成功,请牢记您的新密码。');

+ 6 - 3
src/main/webapp/resources/view/vendor/forstore/vendor_store_info.html

@@ -638,9 +638,10 @@
 				</div>
 			</div>
 			<!-- 简介不正确提示信息 -->
-			<div class="row com_row" ng-show="storeInfoForm.description.$dirty && storeInfoForm.description.$invalid && !storeInfoForm.description.$error.required">
+			<div class="row com_row" ng-show="storeInfoForm.description.$dirty && storeInfoForm.description.$invalid">
 				<div class="col-md-2 custom_col"></div>
 				<div class="col-md-10 custom_col">
+					<span style="color: #ff0000;" ng-show="storeInfoForm.description.$error.required">简介信息必填</span>
 					<span style="color: #ff0000;" ng-show="storeInfoForm.description.$error.maxlength">请勿超过500个字</span>
 				</div>
 			</div>
@@ -655,9 +656,10 @@
 				</div>
 			</div>
 			<!-- 官网地址不正确提示信息 -->
-			<div class="row com_row" ng-show="storeInfoForm.enUrl.$dirty && storeInfoForm.enUrl.$invalid && !storeInfoForm.enUrl.$error.required">
+			<div class="row com_row" ng-show="storeInfoForm.enUrl.$dirty && storeInfoForm.enUrl.$invalid">
 				<div class="col-md-2 custom_col"></div>
 				<div class="col-md-10 custom_col">
+					<span style="color: #ff0000;" ng-show="storeInfoForm.description.$error.required">官网地址必填</span>
 					<span style="color: #ff0000;" ng-show="storeInfoForm.enUrl.$error.maxlength">请勿超过30个字</span>
 				</div>
 			</div>
@@ -681,9 +683,10 @@
 				</div>
 			</div>
 			<!-- 地址不正确提示信息 -->
-			<div class="row com_row" ng-show="storeInfoForm.address.$dirty && storeInfoForm.address.$invalid && !storeInfoForm.address.$error.required">
+			<div class="row com_row" ng-show="storeInfoForm.address.$dirty && storeInfoForm.address.$invalid">
 				<div class="col-md-2 custom_col"></div>
 				<div class="col-md-10 custom_col">
+					<span style="color: #ff0000;" ng-show="storeInfoForm.description.$error.required">地址信息必填</span>
 					<span style="color: #ff0000;" ng-show="storeInfoForm.address.$error.maxlength">请勿超过30个字</span>
 				</div>
 			</div>