Browse Source

处理bug问题

hulh 8 years ago
parent
commit
b5e8c3f525

+ 16 - 16
src/main/java/com/uas/platform/b2c/logistics/service/impl/AddressServiceImpl.java

@@ -75,48 +75,48 @@ public class AddressServiceImpl implements AddressService {
 		Long useruu = address.getUseruu();
 		int type = address.getType();
 		List<Address> addresses = null;
-		if(useruu != null) {
+		if (Type.Address_Shipping_Code.value() == address.getType()) {
 			addresses = addressDao.findByUseruuAndEnuuAndTypeAndUsetypeOrderByNumAsc(useruu, address.getEnuu(), type, (short)1);
-		}else {
+		} else {
 			addresses = addressDao.findByEnuuAndTypeAndUsetypeOrderByNumAsc(address.getEnuu(), type, (short)2);
 		}
 		int num = 1;
-		long modifyId = address.getId().longValue();
-		int modifyNum = address.getNum().intValue();
-		if (setTop){
+		long modifyId = address.getId();
+		int modifyNum = address.getNum();
+		if (setTop) {
 			for (Address add : addresses) {
-				if (add.getId().longValue() == modifyId) {
+				if (add.getId() == modifyId) {
 					add.setNum(1);
 				} else {
 					// 这里拿到的已经是排序了的,直接依次设置num即可
 					add.setNum(++num);
 				}
 			}
-		}else {
-			if (modifyNum == 1){ //取消默认地址
+		} else {
+			if (modifyNum == 1) { //取消默认地址
 				for (Address add : addresses) { //空出默认地址位置
 					add.setNum(++num);
 				}
-			}else {
+			} else {
 				int firstNum = addresses.get(0).getNum();
-				if (firstNum == 1){ //有默认地址情况
+				if (firstNum == 1) { //有默认地址情况
 					num++; //空出默认地址位置
 					for (Address add : addresses) {
-						if (add.getNum() != 1){
-							if (add.getId().longValue() != modifyId){
+						if (add.getNum() != 1) {
+							if (add.getId() != modifyId) {
 								//不是修改的地址或者默认地址,则重新排序
 								add.setNum(++num);
-							}else {
+							} else {
 								add.setNum(2);
 							}
 						}
 					}
-				}else { //没有默认地址情况
+				} else { //没有默认地址情况
 					num++; //空出默认地址位置
 					for (Address add : addresses) {
-						if (add.getId().longValue() != modifyId){
+						if (add.getId() != modifyId) {
 							add.setNum(++num);
-						}else {
+						} else {
 							add.setNum(2);
 						}
 					}

+ 3 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java

@@ -409,7 +409,9 @@ public class ProductServiceImpl implements ProductService {
                     //删除外键关联的匹配结果列表,不然删除product失败
                     Set<ProductMatchResult> productMatchResultSet =  product.getMatchresults();
                     productMatchResultDao.delete(productMatchResultSet);
-                    goodsService.deleteGoods(goodses);
+                    if (CollectionUtils.isNotEmpty(goodses)) {
+                        goodsService.deleteGoods(goodses);
+                    }
                     ProductPrivate productPrivate = productPrivateDao.findByPrId(product.getId());
                     if (productPrivate == null) {
                         productPrivate = new ProductPrivate();