Ver código fonte

小程序管理后端修改

hyq 6 anos atrás
pai
commit
844f68526a

+ 59 - 5
kmall-api/src/main/java/com/kmall/api/api/ApiCartController.java

@@ -8,6 +8,7 @@ import com.kmall.api.service.*;
 import com.kmall.api.util.ApiBaseAction;
 import com.kmall.common.utils.MapUtils;
 import com.qiniu.util.StringUtils;
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -100,6 +101,9 @@ public class ApiCartController extends ApiBaseAction {
         BigDecimal goodsAmount = new BigDecimal(0.00);
         Integer checkedGoodsCount = 0;
         BigDecimal checkedGoodsAmount = new BigDecimal(0.00);
+        List<CartVo> cart00List = new ArrayList<>();
+        List<CartVo> cart02List = new ArrayList<>();
+        List<CartVo> cart11List = new ArrayList<>();
         for (CartVo cartItem : cartList) {
             goodsCount += cartItem.getNumber();
             goodsAmount = goodsAmount.add(cartItem.getRetail_price().multiply(new BigDecimal(cartItem.getNumber())));
@@ -108,10 +112,24 @@ public class ApiCartController extends ApiBaseAction {
                 checkedGoodsAmount = checkedGoodsAmount.add(cartItem.getRetail_price().multiply(new BigDecimal(cartItem.getNumber())));
             }
             if(org.apache.commons.lang.StringUtils.isNotEmpty(cartItem.getGoodsBizType())){
-                cartItem.setGoodsBizType(Dict.orderBizType.valueOf("item_"+ cartItem.getGoodsBizType()).getItemName());
+                cartItem.setGoodsBizTypeName(Dict.orderBizType.valueOf("item_"+ cartItem.getGoodsBizType()).getItemName());
             }else{
-                cartItem.setGoodsBizType("");
+                cartItem.setGoodsBizTypeName("");
             }
+
+            if(Dict.orderBizType.item_00.getItem().equalsIgnoreCase(cartItem.getGoodsBizType())){
+                CartVo cartVo00= cartItem;
+                cart00List.add(cartVo00);
+            }
+            if(Dict.orderBizType.item_02.getItem().equalsIgnoreCase(cartItem.getGoodsBizType())){
+                CartVo cartVo02= cartItem;
+                cart02List.add(cartVo02);
+            }
+            if(Dict.orderBizType.item_11.getItem().equalsIgnoreCase(cartItem.getGoodsBizType())){
+                CartVo cartVo11= cartItem;
+                cart11List.add(cartVo11);
+            }
+
         }
         // 获取优惠信息提示 邮费
         CouponVo shippingCoupon = apiCouponService.matchShippingSign(loginUser.getId(), checkedGoodsAmount);
@@ -128,6 +146,10 @@ public class ApiCartController extends ApiBaseAction {
         }
 
         resultObj.put("couponInfoList", couponInfoList);
+
+        resultObj.put("cart00List", cart00List);//{'cartList':{'type': '保税备货','data':{}}}
+        resultObj.put("cart02List", cart02List);
+        resultObj.put("cart11List", cart11List);
         resultObj.put("cartList", cartList);
         //
         Map<String, Object> cartTotal = new HashMap();
@@ -405,10 +427,21 @@ public class ApiCartController extends ApiBaseAction {
         JSONObject jsonParam = getJsonRequest();
         String productIds = jsonParam.getString("productIds");
         Integer isChecked = jsonParam.getInteger("isChecked");
-        if (StringUtils.isNullOrEmpty(productIds)) {
-            return this.toResponsFail("删除出错");
+        String goodsBizType = jsonParam.getString("goodsBizType");
+        String[] productIdArray = null;
+        if(StringUtils.isNullOrEmpty(goodsBizType)) {
+            if (StringUtils.isNullOrEmpty(productIds)) {//点击全选时
+                return this.toResponsFail("删除出错");
+            }
+            productIdArray = productIds.split(",");
+        }else{
+            //根据业务类型查询购物车
+            List<CartVo> cartVoList = cartService.queryCartByGoodsBizType(goodsBizType);
+            productIdArray = new String[cartVoList.size()];
+            for (int i = 0;i< cartVoList.size();i++){
+                productIdArray[i] =cartVoList.get(i).getProduct_id()+"";
+            }
         }
-        String[] productIdArray = productIds.split(",");
         cartService.updateCheck(productIdArray, isChecked, loginUser.getId(), getStoreId());
         return toResponsSuccess(getCart());
     }
@@ -553,4 +586,25 @@ public class ApiCartController extends ApiBaseAction {
         List<UserCouponVo> couponVos = apiUserCouponService.signUserCouponList(loginUser.getId(), checkedGoodsAmount);
         return toResponsSuccess(couponVos);
     }
+
+//    select checked from mall_cart where goods_biz_type ='00'
+
+    @PostMapping("getCheckedDataByType")
+    public Object getCheckedDataByType() {
+
+        JSONObject jsonParam = getJsonRequest();
+        String goodsBizType = jsonParam.getString("goodsBizType");
+        List<CartVo> cartVoList = cartService.queryCartByGoodsBizType(goodsBizType);
+        for (int i=0;i<cartVoList.size();i++){
+            if(cartVoList.get(i).getChecked()==0){//未选中
+                Map map=new HashMap();
+                map.put("isChecked",false);
+                return toResponsSuccess(map);
+            }
+        }
+        Map map=new HashMap();
+        map.put("isChecked",true);
+        return toResponsSuccess(map);
+    }
+
 }

+ 28 - 5
kmall-api/src/main/java/com/kmall/api/api/ApiCouponController.java

@@ -10,6 +10,8 @@ import com.kmall.api.service.ApiCouponService;
 import com.kmall.api.service.ApiUserCouponService;
 import com.kmall.api.service.ApiUserService;
 import com.kmall.api.util.ApiBaseAction;
+import com.kmall.common.entity.SysSmsLogEntity;
+import com.kmall.common.service.SysSmsLogService;
 import com.kmall.common.utils.enums.CouponTypeEnum;
 import com.qiniu.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,6 +38,8 @@ public class ApiCouponController extends ApiBaseAction {
     private ApiCouponService apiCouponService;
     @Autowired
     private ApiUserCouponService apiUserCouponService;
+    @Autowired
+    private SysSmsLogService sysSmsLogService;
 
     /**
      * 是否有可以参加的活动
@@ -137,7 +141,7 @@ public class ApiCouponController extends ApiBaseAction {
     }
 
     /**
-     *   填写手机号码,领券
+     *   手机号绑定
      */
     @PostMapping("newuser")
     public Object newuser(@LoginUser UserVo loginUser) {
@@ -146,10 +150,13 @@ public class ApiCouponController extends ApiBaseAction {
         String phone = jsonParam.getString("phone");
         String smscode = jsonParam.getString("smscode");
         // 校验短信码
-        SmsLogVo smsLogVo = apiUserService.querySmsCodeByUserId(loginUser.getId());
-        if (null != smsLogVo && !smsLogVo.getSms_code().equals(smscode)) {
+        SysSmsLogEntity smsLogVo = sysSmsLogService.querySmsCodeByUserId(loginUser.getId());
+        if (null != smsLogVo && !smsLogVo.getSmsCode().equals(smscode)) {
             return toResponsFail("短信校验失败");
         }
+//        if(org.apache.commons.lang.StringUtils.isNotEmpty(smsLogVo.getReturnMsg())){
+//            return toResponsFail("短信校验失败:"+smsLogVo.getReturnMsg());
+//        }
         // 更新手机号码
         if (!StringUtils.isNullOrEmpty(phone)) {
             if (!phone.equals(loginUser.getMobile())) {
@@ -157,13 +164,13 @@ public class ApiCouponController extends ApiBaseAction {
                 apiUserService.update(loginUser);
             }
         }
-        // 判断是否是新用户
+        /*// 判断是否是新用户
         if (!StringUtils.isNullOrEmpty(loginUser.getMobile())) {
             return toResponsFail("当前优惠券只能新用户领取");
         } else {
             loginUser.setMobile(phone);
             apiUserService.update(loginUser);
-        }
+        }*/
         // 是否领取过了
         Map params = new HashMap();
         params.put("user_id", loginUser.getId());
@@ -183,6 +190,22 @@ public class ApiCouponController extends ApiBaseAction {
             return toResponsFail("领取失败");
         }
     }
+    /**
+     *  校验是否领取
+     */
+    @GetMapping("checkActivit")
+    public Object checkActivit(@LoginUser UserVo loginUser) {
+        // 是否领取过了
+        Map params = new HashMap();
+        params.put("user_id", loginUser.getId());
+        params.put("send_type", 4);
+        List<CouponVo> couponVos = apiCouponService.queryUserCoupons(params);
+        if (null != couponVos && couponVos.size() > 0) {
+            return toResponsObject(2, "已经领取过,不能重复领取", couponVos);
+        }
+
+        return toResponsSuccess(couponVos);
+    }
 
     /**
      *   转发领取红包

+ 5 - 3
kmall-api/src/main/java/com/kmall/api/api/ApiGoodsController.java

@@ -117,7 +117,7 @@ public class ApiGoodsController extends ApiBaseAction {
 
     /**
      * 商品详情页数据
-     */
+     * */
     @GetMapping("detail")
     public Object detail(Long id, Long referrer) {
         Map<String, Object> resultObj = new HashMap();
@@ -273,7 +273,7 @@ public class ApiGoodsController extends ApiBaseAction {
      */
     @GetMapping("list")
     public Object list(@LoginUser UserVo loginUser, Integer categoryId,
-                       Integer brandId, String keyword, Integer isNew, Integer isHot,
+                       Integer brandId, String keyword, Integer isNew, Integer isHot,String goodsBizType,
                        @RequestParam(value = "page", defaultValue = "1") Integer
                                page, @RequestParam(value = "size", defaultValue = "10") Integer size,
                        String sort, String order) {
@@ -286,6 +286,7 @@ public class ApiGoodsController extends ApiBaseAction {
         params.put("limit", size);
         params.put("order", sort);
         params.put("sidx", order);
+        params.put("goodsBizType", goodsBizType);
         params.put("store_id", getStoreId());
         //
         if (null != sort && sort.equals("price")) {
@@ -537,7 +538,7 @@ public class ApiGoodsController extends ApiBaseAction {
     @IgnoreAuth
     @GetMapping("productlist")
     public Object productlist(@LoginUser UserVo loginUser, Integer categoryId,
-                              Integer isNew, Integer discount,
+                              Integer isNew, Integer discount,String goodsBizType,
                               @RequestParam(value = "page", defaultValue = "1") Integer
                                       page, @RequestParam(value = "size", defaultValue = "10") Integer size,
                               String sort, String order) {
@@ -565,6 +566,7 @@ public class ApiGoodsController extends ApiBaseAction {
         } else if (null != discount && discount == 2) {
             params.put("is_group", true);
         }
+        params.put("goodsBizType", goodsBizType);
         params.put("category_parent_id", categoryId);
         //查询列表数据
         Query query = new Query(params);

+ 7 - 4
kmall-api/src/main/java/com/kmall/api/api/ApiPayController.java

@@ -23,10 +23,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
+import java.util.*;
 
 /**
  * 作者: @author Scott <br>
@@ -59,6 +56,12 @@ public class ApiPayController extends ApiBaseAction {
     @GetMapping("pay_prepay")
     public Object payPrepay(@LoginUser UserVo loginUser, Long orderId) {
         //
+//        List<Long> orderIdList=new ArrayList<>();
+//        List<OrderVo> orderList=new ArrayList<>();
+//        for(int i=0;i<orderIds.length;i++){
+//            orderIdList.add(orderIds[i]);
+//            OrderVo orderInfo = orderService.queryObject(orderIds[i]);
+//        }
         OrderVo orderInfo = orderService.queryObject(orderId);
 
         if (null == orderInfo) {

+ 28 - 4
kmall-api/src/main/java/com/kmall/api/api/ApiUserController.java

@@ -1,14 +1,19 @@
 package com.kmall.api.api;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.google.gson.JsonObject;
 import com.kmall.api.annotation.IgnoreAuth;
 import com.kmall.api.annotation.LoginUser;
+import com.kmall.api.dto.SendMsgVo;
+import com.kmall.api.util.SendMsgUtil;
 import com.kmall.common.entity.SysSmsLogEntity;
 import com.kmall.api.entity.UserVo;
 import com.kmall.api.service.ApiUserService;
 import com.kmall.common.service.SysSmsLogService;
 import com.kmall.api.util.ApiBaseAction;
 import com.kmall.common.utils.CharUtil;
+import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -26,6 +31,7 @@ import java.util.Map;
 @RestController
 @RequestMapping("/api/user")
 public class ApiUserController extends ApiBaseAction {
+    protected Logger log = Logger.getLogger(ApiUserController.class);
     @Autowired
     private ApiUserService userService;
     @Autowired
@@ -49,20 +55,38 @@ public class ApiUserController extends ApiBaseAction {
     @PostMapping("smscode")
     public Object smscode(@LoginUser UserVo loginUser) {
         JSONObject jsonParams = getJsonRequest();
-        String sms_code = CharUtil.getRandomNum(4);
+        String sms_code = SendMsgUtil.createRandomVcode();
         String phone = jsonParams.getString("phone");
-        String msgContent = "验证码:" + sms_code + ",您正在进行身份验证。";
+        String msgContent = "您正在进行微信小程序手机号绑定操作,验证码"+sms_code+",请在10分钟内输入。请勿告诉其他人。";
 
+        System.out.println("msgContent:"+msgContent);
         // 一分钟之内不能重复发送短信
         SysSmsLogEntity smsLogVo = smsLogService.querySmsCodeByUserId(loginUser.getId());
         if (null != smsLogVo && (System.currentTimeMillis() - smsLogVo.getStime().getTime()) / 1000 < 1 * 60) {
             return toResponsFail("短信已发送");
         }
 
+//        try{
+//            //发送验证码到手机
+//            String result = SendMsgUtil.sendMsg(phone,msgContent);
+//            SendMsgVo vo = JSON.parseObject(result,SendMsgVo.class);
+//            System.out.println(result);
+////            if(vo.getCode().equalsIgnoreCase("1")){
+////                return toResponsSuccess("短信发送成功");
+////            }else{
+////                return toResponsFail(vo.getMsg());
+////            }
+//            return toResponsSuccess("短信发送成功");
+//        }catch (Exception e){
+//            e.printStackTrace();
+//            return toResponsFail("短信发送失败");
+//        }
+
         SysSmsLogEntity smsLog = new SysSmsLogEntity();
         smsLog.setUserId(loginUser.getId());
         smsLog.setMobile(phone);
         smsLog.setContent(msgContent);
+        smsLog.setSmsCode(sms_code);
         SysSmsLogEntity result = smsLogService.sendSms(smsLog);
 
         if (null == result || result.getSendStatus() != 0) {
@@ -79,9 +103,9 @@ public class ApiUserController extends ApiBaseAction {
      */
     @PostMapping("getCurUser")
     public Object getUserLevel() {
-        UserVo userInfo =new UserVo();
         Long userId = getUserId();
-        String userLevel = userService.getUserLevel(userService.queryObject(userId));
+        UserVo userInfo = userService.queryObject(userId);
+        String userLevel = userService.getUserLevel(userInfo);
         userInfo.setUserLevel(userLevel);
         return toResponsSuccess(userInfo);
     }

+ 4 - 0
kmall-api/src/main/java/com/kmall/api/dao/ApiCartMapper.java

@@ -5,6 +5,8 @@ import org.apache.ibatis.annotations.Param;
 import com.kmall.common.dao.BaseDao;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 /**
  * @author Scott
  * @email
@@ -18,4 +20,6 @@ public interface ApiCartMapper extends BaseDao<CartVo> {
     void deleteByProductIds(@Param("productIds") String[] productIds, @Param("store_id") Long store_id);
 
     void deleteByCart(@Param("user_id") Long user_id, @Param("store_id") Long store_id, @Param("checked") Integer checked);
+
+    List<CartVo> queryCartByGoodsBizType(@Param("goodsBizType") String goodsBizType);
 }

+ 38 - 0
kmall-api/src/main/java/com/kmall/api/dto/SendMsgVo.java

@@ -0,0 +1,38 @@
+package com.kmall.api.dto;
+
+/**
+ * @author huangyaqin
+ * @version 1.0
+ * 2018-10-16 14:23
+ */
+public class SendMsgVo {
+    private String code;
+
+    private String msg;
+
+    private String result;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public String getResult() {
+        return result;
+    }
+
+    public void setResult(String result) {
+        this.result = result;
+    }
+}

+ 10 - 0
kmall-api/src/main/java/com/kmall/api/entity/CartVo.java

@@ -51,6 +51,8 @@ public class CartVo implements Serializable {
     private String sku;
     private String goodsBizType;
 
+    private String goodsBizTypeName;
+
     private String createrSn;
 
     private Date createTime;
@@ -61,6 +63,14 @@ public class CartVo implements Serializable {
 
     private Date tstm;
 
+    public String getGoodsBizTypeName() {
+        return goodsBizTypeName;
+    }
+
+    public void setGoodsBizTypeName(String goodsBizTypeName) {
+        this.goodsBizTypeName = goodsBizTypeName;
+    }
+
     public String getSku() {
         return sku;
     }

+ 35 - 23
kmall-api/src/main/java/com/kmall/api/entity/SmsLogVo.java

@@ -1,10 +1,11 @@
 package com.kmall.api.entity;
 
 import java.io.Serializable;
+import java.util.Date;
 
 
 /**
- * 实体表名 mall_sms_log
+ * 实体表名 sys_sms_log
  *
  * @author Scott
  * @email
@@ -18,15 +19,25 @@ public class SmsLogVo implements Serializable {
     //
     private Long user_id;
     //
-    private String phone;
+    private String mobile;
     //
-    private Long log_date;
+    private Date stime;
     // 发送模板
     private String sms_code;
     // 1成功 0失败
     private Integer send_status;
     //
-    private String sms_text;
+    private String content;
+
+    private String smsCode;
+
+    public String getSmsCode() {
+        return smsCode;
+    }
+
+    public void setSmsCode(String smsCode) {
+        this.smsCode = smsCode;
+    }
 
     public Long getId() {
         return id;
@@ -44,21 +55,6 @@ public class SmsLogVo implements Serializable {
         this.user_id = user_id;
     }
 
-    public String getPhone() {
-        return phone;
-    }
-
-    public void setPhone(String phone) {
-        this.phone = phone;
-    }
-
-    public Long getLog_date() {
-        return log_date;
-    }
-
-    public void setLog_date(Long log_date) {
-        this.log_date = log_date;
-    }
 
     public String getSms_code() {
         return sms_code;
@@ -76,11 +72,27 @@ public class SmsLogVo implements Serializable {
         this.send_status = send_status;
     }
 
-    public String getSms_text() {
-        return sms_text;
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public Date getStime() {
+        return stime;
+    }
+
+    public void setStime(Date stime) {
+        this.stime = stime;
+    }
+
+    public String getContent() {
+        return content;
     }
 
-    public void setSms_text(String sms_text) {
-        this.sms_text = sms_text;
+    public void setContent(String content) {
+        this.content = content;
     }
 }

+ 4 - 0
kmall-api/src/main/java/com/kmall/api/service/ApiCartService.java

@@ -163,4 +163,8 @@ public class ApiCartService {
         save(cartInfo);
         return resultObj;
     }
+
+    public List<CartVo> queryCartByGoodsBizType(String goodsBizType) {
+        return cartDao.queryCartByGoodsBizType(goodsBizType);
+    }
 }

+ 3 - 3
kmall-api/src/main/java/com/kmall/api/service/ApiUserService.java

@@ -86,9 +86,9 @@ public class ApiUserService {
     }
 
 
-    public int saveSmsCodeLog(SmsLogVo smsLogVo) {
-        return userDao.saveSmsCodeLog(smsLogVo);
-    }
+//    public int saveSmsCodeLog(SmsLogVo smsLogVo) {
+//        return userDao.saveSmsCodeLog(smsLogVo);
+//    }
 
     public String getUserLevel(UserVo loginUser) {
         String result = "普通用户";

+ 135 - 0
kmall-api/src/main/java/com/kmall/api/util/HttpRequestUtil.java

@@ -0,0 +1,135 @@
+package com.kmall.api.util;
+
+import java.io.IOException;
+import java.util.Map;
+
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.SimpleHttpConnectionManager;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+/**
+ * @author huangyaqin
+ * @version 1.0
+ * 2018-10-16 11:28
+ */
+public class HttpRequestUtil {
+    /**
+     * HttpClient 模拟POST请求
+     * @param url
+     * @param params
+     * @return
+     */
+    public static String postRequest(String url, Map<String, String> params) {
+        //构造HttpClient的实例
+        HttpClient httpClient = new HttpClient();
+
+
+        //创建POST方法的实例
+        PostMethod postMethod = new PostMethod(url);
+
+
+        //设置请求头信息
+        postMethod.setRequestHeader("Connection", "close");
+
+
+        //添加参数
+        for (Map.Entry<String, String> entry : params.entrySet()) {
+            postMethod.addParameter(entry.getKey(), entry.getValue());
+        }
+
+
+        //使用系统提供的默认的恢复策略,设置请求重试处理,用的是默认的重试处理:请求三次
+        httpClient.getParams().setBooleanParameter("http.protocol.expect-continue", false);
+
+
+        //接收处理结果
+        String result = null;
+        try {
+            //执行Http Post请求
+            httpClient.executeMethod(postMethod);
+
+
+            //返回处理结果
+            result = postMethod.getResponseBodyAsString();
+        } catch (HttpException e) {
+            // 发生致命的异常,可能是协议不对或者返回的内容有问题
+            System.out.println("请检查输入的URL!");
+            e.printStackTrace();
+        } catch (IOException e) {
+            // 发生网络异常
+            System.out.println("发生网络异常!");
+            e.printStackTrace();
+        } finally {
+            //释放链接
+            postMethod.releaseConnection();
+
+
+            //关闭HttpClient实例
+            if (httpClient != null) {
+                ((SimpleHttpConnectionManager) httpClient.getHttpConnectionManager()).shutdown();
+                httpClient = null;
+            }
+        }
+        return result;
+    }
+
+
+    /**
+     *  HttpClient 模拟GET请求
+     * 方法说明
+     * @Discription:扩展说明
+     * @param url
+     * @param params
+     * @return String
+     */
+    public static String getRequest(String url, Map<String, String> params) {
+        //构造HttpClient实例
+        HttpClient client = new HttpClient();
+
+
+        //拼接参数
+        String paramStr = "";
+        for (String key : params.keySet()) {
+            paramStr = paramStr + "&" + key + "=" + params.get(key);
+        }
+        paramStr = paramStr.substring(1);
+
+
+        //创建GET方法的实例
+        GetMethod method = new GetMethod(url + "?" + paramStr);
+
+
+        //接收返回结果
+        String result = null;
+        try {
+            //执行HTTP GET方法请求
+            client.executeMethod(method);
+
+
+            //返回处理结果
+            result = method.getResponseBodyAsString();
+        } catch (HttpException e) {
+            // 发生致命的异常,可能是协议不对或者返回的内容有问题
+            System.out.println("请检查输入的URL!");
+            e.printStackTrace();
+        } catch (IOException e) {
+            // 发生网络异常
+            System.out.println("发生网络异常!");
+            e.printStackTrace();
+        } finally {
+            //释放链接
+            method.releaseConnection();
+
+
+            //关闭HttpClient实例
+            if (client != null) {
+                ((SimpleHttpConnectionManager) client.getHttpConnectionManager()).shutdown();
+                client = null;
+            }
+        }
+        return result;
+    }
+}

+ 79 - 0
kmall-api/src/main/java/com/kmall/api/util/SendMsgUtil.java

@@ -0,0 +1,79 @@
+package com.kmall.api.util;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author huangyaqin
+ * @version 1.0
+ * 2018-10-16 11:27
+ */
+public class SendMsgUtil {
+    /**
+     * 发送短信消息
+     * 方法说明
+     * @Discription:扩展说明
+     * @param phones
+     * @param content
+     * @return
+     * @return String
+     */
+    @SuppressWarnings("deprecation")
+    public static String sendMsg(String phones,String content) {
+        try {
+            content = java.net.URLEncoder.encode(content,"utf-8");
+            System.out.println(content);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        String sendMsgapiKey = "d6d33c8e7ad847cc3f3d7e9f75d0abb1";
+        //短信接口URL提交地址
+        String url = "https://api.dingdongcloud.com/v1/sms/sendyzm";
+
+        Map<String, String> params = new HashMap<String, String>();
+
+        params.put("name", "13530612313");
+        params.put("pwd", "nm81875o");
+//        params.put("dxlbid", "短信类别编号");
+//        params.put("extno", "扩展编号");
+        params.put("apikey", sendMsgapiKey);
+
+        //手机号码,多个号码使用英文逗号进行分割
+        params.put("mobile", phones);
+        //将短信内容进行URLEncoder编码
+        params.put("content", URLEncoder.encode(content));
+        params.put("sendTs", "");
+
+        return HttpRequestUtil.postRequest(url, params);
+    }
+
+    /**
+     * 随机生成6位随机验证码
+     * 方法说明
+     * @Discription:扩展说明
+     * @return
+     * @return String
+     */
+    public static String createRandomVcode(){
+        //验证码
+        String vcode = "";
+        for (int i = 0; i < 6; i++) {
+            vcode = vcode + (int)(Math.random() * 9);
+        }
+        return vcode;
+    }
+    /**
+     * 测试
+     * 方法说明
+     * @Discription:扩展说明
+     * @param args
+     * @return void
+     */
+    public static void main(String[] args) {
+//      System.out.println(SendMsgUtil.createRandomVcode());
+//      System.out.println("&ecb=12".substring(1));
+        System.out.println(sendMsg("18201150549", "【签名】尊敬的用户,您的验证码为" + SendMsgUtil.createRandomVcode() + ",请在10分钟内输入。请勿告诉其他人!"));
+    }
+}

+ 4 - 1
kmall-api/src/main/resources/mybatis/mapper/ApiCartMapper.xml

@@ -37,7 +37,10 @@
 		select
         <include refid="Base_Column_List" /> from mall_cart where id = #{value}
 	</select>
-
+    <select id="queryCartByGoodsBizType" resultMap="cartMap">
+        select
+        <include refid="Base_Column_List" /> from mall_cart where goods_biz_type = #{goodsBizType}
+    </select>
     <select id="queryList" resultMap="cartMap">
         select a.*,
         b.list_pic_url as list_pic_url,

+ 11 - 0
kmall-api/src/main/resources/mybatis/mapper/ApiGoodsMapper.xml

@@ -129,6 +129,9 @@
         <if test="is_delete != null">
             and a.is_delete = #{is_delete}
         </if>
+        <if test="goodsBizType != null">
+            and a.goods_biz_type = #{goodsBizType}
+        </if>
         <if test="categoryIds != null">
             and a.category_id in
             <foreach item="item" collection="categoryIds" open="(" separator="," close=")">
@@ -271,6 +274,11 @@
         <if test="store_id != null and store_id != ''">
             and psr1.store_id = #{store_id}
         </if>
+
+        <if test="goodsBizType != null and goodsBizType != ''">
+            and a.goods_biz_type = #{goodsBizType}
+        </if>
+
         group by a.id, a.name, a.list_pic_url, psr1.market_price, psr1.retail_price, a.goods_brief, b.id
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
@@ -326,5 +334,8 @@
         <if test="store_id != null and store_id != ''">
             and s.store_id = #{store_id}
         </if>
+        <if test="goodsBizType != null and goodsBizType != ''">
+            and a.goods_biz_type = #{goodsBizType}
+        </if>
     </select>
 </mapper>

+ 11 - 11
kmall-api/src/main/resources/mybatis/mapper/ApiUserMapper.xml

@@ -183,25 +183,25 @@
     <resultMap type="com.kmall.api.entity.SmsLogVo" id="smslogMap">
         <result property="id" column="id"/>
         <result property="user_id" column="user_id"/>
-        <result property="phone" column="phone"/>
-        <result property="log_date" column="log_date"/>
+        <result property="mobile" column="mobile"/>
+        <result property="stime" column="stime"/>
         <result property="sms_code" column="sms_code"/>
         <result property="send_status" column="send_status"/>
-        <result property="sms_text" column="sms_text"/>
+        <result property="content" column="content"/>
+        <result property="smsode" column="sms_code"/>
     </resultMap>
 
     <select id="querySmsCodeByUserId" resultMap="smslogMap">
-        select
-        a.id,
+         a.id,
         a.user_id,
-        a.phone,
-        a.log_date,
+        a.mobile,
+        a.stime,
         a.sms_code,
         a.send_status,
-        a.sms_text
-        from mall_sms_log a
-        left join mall_sms_log b on a.user_id = b.user_id and b.log_date > a.log_date
-        where a.user_id = #{id} and b.id is null
+        a.content
+        from sys_sms_log a
+        left join sys_user b on a.user_id = b.user_id
+        where a.user_id = #{id}  ORDER BY stime desc limit 1
     </select>
 
     <insert id="saveSmsCodeLog" parameterType="com.kmall.api.entity.SmsLogVo">