Browse Source

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

yangc 8 years ago
parent
commit
908b636711

+ 1 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/constant/ErrorInfoConstant.java

@@ -6,6 +6,7 @@ package com.uas.platform.b2c.prod.commodity.constant;
  * @author hulh
  */
 public enum  ErrorInfoConstant {
+    REPEAT_INFO("产品库已存在该产品"),
     CODE_PATTERN_INFO("A列:请勿输入中文或中文特殊字符"),
     CODE_LENGTH_INFO("A列:产品型号不能超过100字符"),
     CODE_EMPTY_INFO("A列:产品型号不能为空"),

+ 10 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductDao.java

@@ -67,6 +67,16 @@ public interface ProductDao extends JpaSpecificationExecutor<Product>, JpaReposi
      */
     List<Product> findProductByPcmpcodeAndPbrandenAndEnUU(String pcmpcode, String pbranden, Long enUU);
 
+    /**
+     *
+     * @param enUU 企业enuu
+     * @param pcmpcode 型号
+     * @param pbranden 品牌
+     * @param b2cEnabled 启用
+     * @return
+     */
+    List<Product> findByEnUUAndPcmpcodeAndPbrandenAndB2cEnabled(Long enUU, String pcmpcode, String pbranden, Integer b2cEnabled);
+
 
     /**
      * 根据器件型号,品牌 、enuu

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ReleaseProductByBatchDao.java

@@ -71,7 +71,7 @@ public interface ReleaseProductByBatchDao
      * @param publisherUu the publisher uu 发布人
      * @param batchid     the batchid 批次号
      */
-    @Procedure(procedureName = "PRODUCT_RELEASE_VALID_V1")
+    @Procedure(procedureName = "PRODUCT_RELEASE_VALID_V2")
 	public void callValidProcedure(Long publisherUu, String batchid);
 
     /**

+ 3 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/model/ReleaseProductByBatch.java

@@ -8,6 +8,7 @@ import com.uas.platform.b2c.core.utils.StringUtilB2C;
 import com.uas.platform.b2c.prod.commodity.constant.DoubleConstant;
 import com.uas.platform.b2c.prod.commodity.constant.ErrorInfoConstant;
 import com.uas.platform.b2c.prod.commodity.type.ReleaseConstant;
+import com.uas.platform.b2c.prod.commodity.util.GoodsUtil;
 import com.uas.platform.b2c.trade.order.StringConstant.Currency;
 import org.apache.commons.collections.CollectionUtils;
 import org.codehaus.jackson.annotate.JsonIgnore;
@@ -486,7 +487,8 @@ public class ReleaseProductByBatch implements Serializable {
 		if (!minPackageStr.equals(that.minPackageStr)) return false;
 		if (!packaging.equals(that.packaging)) return false;
 		if (!selfMaxDeliveryStr.equals(that.selfMaxDeliveryStr)) return false;
-		return selfMinDeliveryStr.equals(that.selfMinDeliveryStr);
+		if (!selfMinDeliveryStr.equals(that.selfMinDeliveryStr)) return false;
+		return GoodsUtil.compareWithQtyPrice(prices, that.getPrices(), that.getCurrency());
 
 	}
 

+ 24 - 29
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsServiceImpl.java

@@ -564,7 +564,8 @@ public class GoodsServiceImpl implements GoodsService {
         goods.setTaxRate();
 
         if (goods.getReturnInWeek() == null) {
-            goods.setReturnInWeek((short) 0);// 若无设置,默认不支持7天无理由退货
+            // 若无设置,默认不支持7天无理由退货
+            goods.setReturnInWeek((short) 0);
         }
         // 若B2C上架的商品必须有发布人姓名和发布人联系电话
         if (goods.getSourceId() == null) {
@@ -586,16 +587,12 @@ public class GoodsServiceImpl implements GoodsService {
         if (StringUtils.isEmpty(goods.getImg())) {
             Long goodsProductid = goods.getProductid();
             if (goodsProductid != null) {
-                Product product = productDao.findOne
-                        (goodsProductid);
+                Product product = productDao.findOne(goodsProductid);
                 if (product != null) {
                     if (StringUtils.isEmpty(product.getCmpImg())) {
                         String cmpUuId = product.getCmpUuId();
-                        if (!StringUtils.isEmpty
-                                (cmpUuId)) {
-                            Component component = componentDao
-                                    .findByUuid
-                                            (cmpUuId);
+                        if (!StringUtils.isEmpty(cmpUuId)) {
+                            Component component = componentDao.findByUuid(cmpUuId);
                             if (component != null) {
                                 goods.setImg(component.getImg());
                             }
@@ -622,8 +619,13 @@ public class GoodsServiceImpl implements GoodsService {
                 throw new IllegalOperatorException("器件" + goods.getCode() + "品牌" + goods.getBrandNameEn() + "关联的物料库信息丢失");
             }
             List<Goods> goodses = goodsDao.findRepeatGoodsInProductId(goods.getProductid(), goods.getProduceDate(), goods.getPackaging(), goods.getMinPackQty(), goods.getMinBuyQty(), goods.getMaxDelivery(), goods.getMinDelivery(), goods.getUnit());
-            if ((goods.getId() == null && goodses.size() > 0) || (goodses.size() > 1)) {
-                throw new IllegalOperatorException("该物料已存在(包装、日期、最小包装量、最小起订量、交期、单位)相同的信息");
+            if (!CollectionUtils.isEmpty(goodses)) {
+                for (Goods goods1 : goodses) {
+                    if (!goods1.getId().equals(goods.getId())
+                            && GoodsUtil.compareWithQtyPrice(goods1.getPrices(), goods.getPrices(), goods.getCurrencyName())) {
+                        throw new IllegalOperatorException("该物料已存在(包装、日期、最小包装量、最小起订量、交期、单位、价格)相同的信息");
+                    }
+                }
             }
             //判断自定义标签是否重复
             if (StringUtils.isEmpty(goods.getTag())) {
@@ -633,13 +635,12 @@ public class GoodsServiceImpl implements GoodsService {
                 throw new IllegalOperatorException("传入的产品信息缺失,请重新操作");
             }
             List<Goods> goodsList = goodsDao.findGoodsByProductidAndTag(goods.getProductid(), goods.getTag());
-            if ((goods.getId() == null) &&
-                    (goodsList.size() > 0)) {
+            if ((goods.getId() == null) && (goodsList.size() > 0)) {
                 throw new IllegalOperatorException("该产品下已存在相同的自定义标签");
             } else {
                 for (Goods goods1 : goodsList) {
-                    if (goods.getTag().equals(goods1.getTag()) &&
-                            (goods1.getId().longValue() != goods.getId().longValue())) {
+                    if (goods.getTag().equals(goods1.getTag())
+                            && (goods1.getId().longValue() != goods.getId().longValue())) {
                         throw new IllegalOperatorException("该产品下已存在相同的自定义标签");
                     }
                 }
@@ -1247,26 +1248,20 @@ public class GoodsServiceImpl implements GoodsService {
         if (nowGoods.getReserve().doubleValue() != goods.getOldReserve().doubleValue()) {
             return new ResultMap(CodeType.INFO_UPDATE.code(), "该库存的信息已经被修改了,请刷新界面之后重新操作。");
         }
-        if(StringUtils.isEmpty(goods.getTag())) {
+        if (StringUtils.isEmpty(goods.getTag())) {
             return new ResultMap(CodeType.NOT_PERMIT.code(), "产品自定义标签必须填写");
         }
         List<Goods> tagInTheProdNums = goodsDao.findSameTagInTheProdNum(goods.getProdNum(), goods.getTag());
         for (Goods tagInTheProdNum : tagInTheProdNums) {
-            if(goods.getTag().equals(tagInTheProdNum.getTag())&&(goods.getId().longValue() != tagInTheProdNum.getId().longValue())) {
+            if (goods.getTag().equals(tagInTheProdNum.getTag()) && (goods.getId().longValue() != tagInTheProdNum.getId().longValue())) {
                 return new ResultMap(CodeType.NOT_PERMIT.code(), "标签不能与该器件现有产品的标签重复");
             }
         }
-//		ProductStandardPutOnInfo putOnInfo = productStandardPutOnInfoDao.findOne(goods.getStandprodid());
-//		if(putOnInfo != null) {
-//			if(nowGoods.validProductStandardPutOnInfoAndGoodsSameData(putOnInfo)) {
-//				return new ResultMap(CodeType.INFO_UPDATE.code(), "数据已经被更新了请刷新之后重新操作");
-//			}
-//		}
         List<Goods> repeatGoodsInProductId = goodsDao.findRepeatGoodsInProductId(goods.getProductid(), goods.getProduceDate(), goods.getPackaging(), goods.getMinPackQty(), goods.getMinBuyQty(), goods.getMaxDelivery(), goods.getMinDelivery(), goods.getUnit());
         for (Goods goods1 : repeatGoodsInProductId) {
-            if(goods1.getId().longValue() !=
-                    goods.getId().longValue()) {
-                throw new IllegalOperatorException("该物料已存在(包装、日期、最小包装量、最小起订量、交期、单位)相同的信息");
+            if (!goods1.getId().equals(goods.getId())
+                    && GoodsUtil.compareWithQtyPrice(goods1.getPrices(), goods.getPrices(), goods.getCurrencyName())) {
+                throw new IllegalOperatorException("该物料已存在(包装、日期、最小包装量、最小起订量、交期、单位、价格)相同的信息");
             }
         }
         resultGoods = updateGoods(nowGoods, goods);
@@ -1278,7 +1273,7 @@ public class GoodsServiceImpl implements GoodsService {
     @Override
     public ResultMap putOn(Long id) {
         Goods goods = goodsDao.findOne(id);
-        if(goods != null) {
+        if (goods != null) {
             setGoodsDefault(goods);
             ResultMap resultMap = checkGoods(goods);
             if (resultMap.getCode() != CodeType.OK.code()) {
@@ -1290,11 +1285,11 @@ public class GoodsServiceImpl implements GoodsService {
             goodsHistoryDao.save(goodsHistory);
             // TODO huxz 添加或修改商品价格信息
             if (goods.getUuid() != null) {
-                saveOrUpdatePriceInfos(goods, "NOMAL");
+//                saveOrUpdatePriceInfos(goods, "NOMAL");
                 updateComponentTradeInfos(goods.getUuid());
             }
             return ResultMap.success(persistGoods);
-        }else {
+        } else {
             return new ResultMap(CodeType.NO_INFO, "找不到对应的在售产品信息");
         }
     }
@@ -1308,7 +1303,7 @@ public class GoodsServiceImpl implements GoodsService {
     @Transactional
     @Override
     public ResultMap addGoods(Goods goods) {
-        if(goods == null) {
+        if (goods == null) {
             throw new IllegalOperatorException("传入的需要添加的产品信息为空");
         }
         if (Integer.valueOf(goods.getSelfSale()).equals(IntegerConstant.B2C_SALE)) {

+ 33 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -176,6 +176,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		}
 		List<ReleaseProductByBatch> addList = new ArrayList<>(releaseProductByBatchs.size());
 		addList.addAll(releaseProductByBatchs);
+		resetRepeatData(addList);
 		commonDao.save(addList, ReleaseProductByBatch.class);
 		Long userUU = SystemSession.getUser().getUserUU();
 		Long enUU = SystemSession.getUser().getEnterprise().getUu();
@@ -191,6 +192,38 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		return modelMap;
 	}
 
+	/**
+	 * 判断是否重复,重复则重设状态
+	 * @param data
+	 */
+	private void resetRepeatData(List<ReleaseProductByBatch> data) {
+		Long enuu = SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null;
+		if (enuu == null) {
+			throw new IllegalOperatorException("企业enuu丢失");
+		}
+		for (ReleaseProductByBatch each : data) {
+			List<Product> standardList = productDao.findMatchStandard(enuu, each.getBrandNameEn(), each.getCode(), IntegerConstant.YES_SHORT);
+			if (!CollectionUtils.isEmpty(standardList)) {
+				each.setB2cBranden(standardList.get(0).getPbranden());
+				each.setB2cCode(standardList.get(0).getPcmpcode());
+			}
+			List<Product> productList = productDao.findByEnUUAndPcmpcodeAndPbrandenAndB2cEnabled(enuu, each.getB2cCode(), each.getB2cBranden(), IntegerConstant.YES_SHORT);
+			if (!CollectionUtils.isEmpty(productList)) {
+				List<Goods> goodsList = goodsDao.findRepeatGoodsInProductId(productList.get(0).getId(), each.getProductDate(), each.getPackaging(), each.getMinPackage(), each.getMinBuyQty(), each.getSelfMaxDelivery(), each.getSelfMinDelivery(), each.getUnit());
+				if (!CollectionUtils.isEmpty(goodsList)) {
+					for (Goods goods1 : goodsList) {
+						if (GoodsUtil.compareWithQtyPrice(each.getPrices(), goods1.getPrices(), each.getCurrency())) {
+							each.setErrmsg(ErrorInfoConstant.REPEAT_INFO.getInfo());
+							each.setReleaseCode(ReleaseStatus.had_exists.value());
+							each.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
+							break;
+						}
+					}
+				}
+			}
+		}
+	}
+
 	/**
 	 * 验证该产品自定义标签是否重复
 	 * @param aProduct 单个产品

+ 42 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/util/GoodsUtil.java

@@ -1,6 +1,7 @@
 package com.uas.platform.b2c.prod.commodity.util;
 
 import com.uas.platform.b2c.prod.commodity.model.GoodsQtyPrice;
+import com.uas.platform.b2c.trade.order.StringConstant.Currency;
 import org.apache.commons.collections.CollectionUtils;
 
 import java.util.List;
@@ -95,4 +96,45 @@ public class GoodsUtil {
 		return maxPrice;
 	}
 
+	/**
+	 比较分段价格是否一致
+	 * @param qtyPriceList 分段价格列表
+	 * @param targetList  比较价格列表
+	 * @param currency 币别
+	 * @return
+	 */
+	public static Boolean compareWithQtyPrice(List<GoodsQtyPrice> qtyPriceList, List<GoodsQtyPrice> targetList, String currency) {
+		if (qtyPriceList.size() != targetList.size()) {
+			return false;
+		}
+		for (int i = 0; i < qtyPriceList.size(); i++) {
+			if (!compareWithPrice(qtyPriceList.get(i), targetList.get(i), currency)) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * 判断分段价格是否相等
+	 * @param first	分段价格1
+	 * @param second 分段价格2
+	 * @param currency 币别
+	 * @return
+	 */
+	public static Boolean compareWithPrice(GoodsQtyPrice first, GoodsQtyPrice second, String currency) {
+		if (!first.getStart().equals(second.getStart()) || !first.getEnd().equals(second.getEnd())) {
+			return false;
+		}
+		if (Currency.RMB.equals(currency)) {
+			if (!first.getRMBPrice().equals(second.getRMBPrice())) {
+				return false;
+			}
+		} else if (Currency.USD.equals(currency)) {
+			if (!first.getRMBPrice().equals(second.getRMBPrice())) {
+				return false;
+			}
+		}
+		return true;
+	}
 }

+ 13 - 37
src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderServiceImpl.java

@@ -1,10 +1,5 @@
 package com.uas.platform.b2c.trade.order.service.impl;
 
-import static com.uas.platform.b2c.trade.aftersale.model.AfterSaleStatus.BUYER_TO_MALL;
-import static com.uas.platform.b2c.trade.aftersale.model.AfterSaleStatus.MALL_TO_SUP;
-import static com.uas.platform.b2c.trade.aftersale.model.AfterSaleStatus.SUP_TO_MALL;
-import static com.uas.platform.b2c.trade.util.Preconditions.checkNotNull;
-
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.uas.api.b2c_erp.buyer.model.B2cOrder;
@@ -39,12 +34,7 @@ import com.uas.platform.b2c.logistics.dao.AddressDao;
 import com.uas.platform.b2c.logistics.dao.InvoiceFOrderDao;
 import com.uas.platform.b2c.logistics.dao.InvoiceFPurchaseDao;
 import com.uas.platform.b2c.logistics.dao.PickUpAddressDao;
-import com.uas.platform.b2c.logistics.model.Address;
-import com.uas.platform.b2c.logistics.model.InvoiceFOrder;
-import com.uas.platform.b2c.logistics.model.InvoiceFOrderDetail;
-import com.uas.platform.b2c.logistics.model.InvoiceFPurchase;
-import com.uas.platform.b2c.logistics.model.InvoiceFPurchaseDetail;
-import com.uas.platform.b2c.logistics.model.PickUpAddress;
+import com.uas.platform.b2c.logistics.model.*;
 import com.uas.platform.b2c.logistics.service.InvoiceFPurchaseService;
 import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
 import com.uas.platform.b2c.prod.commodity.dao.GoodsHistoryDao;
@@ -69,14 +59,7 @@ import com.uas.platform.b2c.trade.order.dao.OrderDao;
 import com.uas.platform.b2c.trade.order.dao.OrderDetailDao;
 import com.uas.platform.b2c.trade.order.dao.OrderIndexDetailDao;
 import com.uas.platform.b2c.trade.order.dao.PurchaseDao;
-import com.uas.platform.b2c.trade.order.model.Order;
-import com.uas.platform.b2c.trade.order.model.OrderDetail;
-import com.uas.platform.b2c.trade.order.model.OrderIndex;
-import com.uas.platform.b2c.trade.order.model.OrderIndexDetail;
-import com.uas.platform.b2c.trade.order.model.OrderSimpleInfo;
-import com.uas.platform.b2c.trade.order.model.Purchase;
-import com.uas.platform.b2c.trade.order.model.PurchaseDetail;
-import com.uas.platform.b2c.trade.order.model.TradeProofing;
+import com.uas.platform.b2c.trade.order.model.*;
 import com.uas.platform.b2c.trade.order.service.OrderDetailService;
 import com.uas.platform.b2c.trade.order.service.OrderService;
 import com.uas.platform.b2c.trade.order.service.PurchaseService;
@@ -105,22 +88,6 @@ import com.uas.platform.core.util.serializer.FlexJsonUtils;
 import com.uas.search.model.BaseOrder;
 import com.uas.search.model.PageParams;
 import com.uas.search.model.SPage;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
 import org.apache.commons.collections.map.HashedMap;
 import org.apache.commons.lang.time.DateUtils;
 import org.springframework.beans.BeanUtils;
@@ -134,6 +101,15 @@ import org.springframework.ui.ModelMap;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.util.*;
+
+import static com.uas.platform.b2c.trade.aftersale.model.AfterSaleStatus.*;
+import static com.uas.platform.b2c.trade.util.Preconditions.checkNotNull;
+
 /**
  * 订单业务实现类
  *
@@ -811,8 +787,8 @@ public class OrderServiceImpl implements OrderService {
 
             or.setDeliverytype(Integer.parseInt(rule.getString("method")));
             or.setFare(Double.parseDouble(rule.getString("fare")));
-            ensurePrices += or.getFare();
-            transationPrice += or.getFare();
+            ensurePrices = NumberUtil.add(ensurePrices, or.getFare());
+            transationPrice = NumberUtil.add(transationPrice, or.getFare());
 
             or.setBatchQty(newOrderDetails.size());
             or.setEnsurePrice(NumberUtil.fractionNumCeil(ensurePrices, 2));

+ 3 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js

@@ -136,9 +136,9 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
             //获取店铺的信息
             StoreInfo.getStoreInfoByEnuu({enUU : $rootScope.userInfo.enterprise.uu}, function(data) {
                 $scope.storeInfo = data;
-				if(!$scope.storeInfo || $scope.storeInfo.status != 'OPEN' || $scope.storeInfo.storeName.indexOf('优软测试二') > 0 || $scope.storeInfo.storeName.indexOf('优软商城') > 0) {
+				if (!$scope.storeInfo || $scope.storeInfo.status != 'OPENED' || $scope.storeInfo.storeName.indexOf('优软测试二') > 0 || $scope.storeInfo.storeName.indexOf('优软商城') > 0) {
 					$scope.$$nonProduct.canSelfSale = false;
-				}else {
+				} else {
 					$scope.$$nonProduct.canSelfSale = true;
 				}
             }, function(response) {
@@ -1744,6 +1744,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 				$scope.goods.productid = material.id;
 				$scope.goods.prodNum = material.prodNum;
 				$scope.goods.editPrices = [];
+				$scope.goods.editSelfSale = $scope.$$nonProduct.canSelfSale ? 1 : 2;
 				$scope.goods.editPrices.push({start : $scope.minReserve, end : $scope.maxReserve});
 				// $scope.goods.isSelfSupport = $scope.store.status == 'OPENED' ? 1 : 0;
 				material.selected = true;

+ 24 - 35
src/test/java/com/uas/platform/b2c/DesTest.java

@@ -6,46 +6,35 @@ import org.junit.Test;
 public class DesTest {
     @Test
     public void test(){
+        // 测试
+        prindHexString("jdbc:mysql://192.168.253.12:3306/mall_test_dev?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true");
+        prindHexString("root");
+        prindHexString("select111***");
+
+        // 正式
+        prindHexString("jdbc:mysql://10.10.0.208:8066/mall_prod?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true");
+        prindHexString("sa");
+        prindHexString("Select123!#%*(");
+
+        // 正式旧版
+        prindHexString("jdbc:mysql://10.10.100.18:3306/mall_prod?characterEncoding=UTF-8");
+        prindHexString("root");
+        prindHexString("select");
+    }
+
+    /**
+     * 打印加密后的字符串
+     * @param s 明文
+     */
+    public void prindHexString(String s) {
         try {
             Des des = new Des();
-            byte b[] = des.encrypt("root", "10101010");
-            System.out.println(des.toHexString(b));
-
-            b = des.encrypt("jdbc:mysql://192.168.253.12:3306/mall_test_dev?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true", "10101010");
-            System.out.println(des.toHexString(b));
-            //System.out.println(des.decrypt(des.toHexString(b), "10101010"));
-
-            b = des.encrypt("select111***", "10101010");
-            System.out.println(des.toHexString(b));
-
-            //正式
-            b = des.encrypt("sa", "10101010");
-            System.out.println(des.toHexString(b));
-
-            b = des.encrypt("jdbc:mysql://10.10.0.208:8066/mall_prod?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true", "10101010");
-            System.out.println(des.toHexString(b));
-            //System.out.println(des.decrypt(des.toHexString(b), "10101010"));
-
-            b = des.encrypt("Select123!#%*(", "10101010");
-            System.out.println(des.toHexString(b));
-
-            //旧版正式
-            b = des.encrypt("root", "10101010");
+            String key = "10101010";
+            byte b[] = des.encrypt(s, key);
             System.out.println(des.toHexString(b));
-
-            b = des.encrypt("jdbc:mysql://10.10.100.18:3306/mall_prod?characterEncoding=UTF-8", "10101010");
-            System.out.println(des.toHexString(b));
-            //System.out.println(des.decrypt(des.toHexString(b), "10101010"));
-
-            b = des.encrypt("select", "10101010");
-            System.out.println(des.toHexString(b));
-
-
-
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
-
     }
 }