ソースを参照

小程序详情分享业务逻辑修改,以及地图切换修改

hyq 6 年 前
コミット
5932c6cfdc

+ 1 - 0
kmall-api/pom.xml

@@ -48,6 +48,7 @@
                 <version>2.18.1</version>
                 <configuration>
                     <skipTests>true</skipTests>
+                    <argLine>-Dfile.encoding=UTF-8</argLine>
                 </configuration>
             </plugin>
         </plugins>

+ 1 - 0
kmall-api/src/main/java/com/kmall/api/api/ApiOrderController.java

@@ -242,6 +242,7 @@ public class ApiOrderController extends ApiBaseAction {
     public Object submit(@LoginUser UserVo loginUser) {
         Map resultObj = null;
         try {
+            loginUser.setId(getUserId());
             resultObj = orderService.submit(getJsonRequest(), loginUser, getStoreId());
             if (null != resultObj) {
                 return toResponsObject(MapUtils.getInteger(resultObj, "errno"), MapUtils.getString(resultObj, "errmsg"), resultObj.get("data"));

+ 13 - 1
kmall-api/src/main/java/com/kmall/api/service/ApiOrderService.java

@@ -257,8 +257,13 @@ public class ApiOrderService {
         userVo.setId(loginUser.getId());
         userVo.setIdNo(idNo);
         userVo.setUsername(userName);
+        logger.info("param userId:"+ loginUser.getId());
+        logger.info("param idNo:"+ idNo);
+        logger.info("param userName:"+ userName);
+        logger.info("query userId:"+ user.getId());
         if(user != null){
-            if(loginUser.getId() != user.getId()){
+            if(loginUser.getId().compareTo(user.getId()) != 0){
+                logger.info("该身份证信息已被绑定,登陆用户:"+ user.getId()+",查询用户:"+ user.getId());
                 resultObj.put("errno", 400);
                 resultObj.put("errmsg", "该身份证信息已被绑定");
                 return resultObj;
@@ -270,6 +275,7 @@ public class ApiOrderService {
         if(vo.getRespCode().equalsIgnoreCase("0000")){
             apiUserMapper.update(userVo);
         }else{
+            logger.info(vo.getRespMessage());
             resultObj.put("errno", 400);
             resultObj.put("errmsg", vo.getRespMessage());
             return resultObj;
@@ -285,6 +291,7 @@ public class ApiOrderService {
         if (null == checkedGoodsList) {
             resultObj.put("errno", 400);
             resultObj.put("errmsg", "请选择商品");
+            logger.error("请选择商品");
             return resultObj;
         }
         // 检查库存和更新库存
@@ -294,12 +301,14 @@ public class ApiOrderService {
             //取得规格的信息,判断规格库存
             GoodsVo goodsInfo = apiGoodsMapper.queryObjectByStoreId(goodsItem.getGoods_id(), storeId);
             if (null == goodsInfo || goodsInfo.getIs_delete() == 1 || goodsInfo.getIs_on_sale() == 0) {
+                logger.error("订单提交失败:商品不存在");
                 throw new RRException("订单提交失败:商品不存在");
             }
             ProductVo productInfo = apiProductMapper.queryByStoreId(goodsItem.getProduct_id(), storeId);
 
             synchronized (productInfo){
                 if (null == productInfo) {
+                    logger.error("订单提交失败:商品已下架");
                     throw new RRException("订单提交失败:商品已下架");
                 }
                 // TODO: 2019/3/5  普通商品不受共享库存影响,直接取门店配置库存
@@ -314,6 +323,7 @@ public class ApiOrderService {
                     stockNum = productInfo.getStock_num();
                 }
                 if (null == stockNum || stockNum < goodsItem.getNumber() || stockNum <= 0) {
+                    logger.error("订单提交失败:库存不足,仅剩余" + stockNum);
                     throw new RRException("订单提交失败:库存不足,仅剩余" + stockNum);
                 }else{
                     if(goodsInfo.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem())){
@@ -438,6 +448,7 @@ public class ApiOrderService {
             List<OrderProcessRecordEntity> processRecordEntityList = new ArrayList<>();
             for (OrderVo orderInfo : orderInfoList) {
                 if (null == orderInfo.getId()) {
+                    logger.error("订单提交失败");
                     throw new RRException("订单提交失败");
                 }
                 //新增订单详情
@@ -446,6 +457,7 @@ public class ApiOrderService {
                     if (orderInfo.getOrderBizType().equalsIgnoreCase(goodsItem.getGoodsBizType())) {
                         GoodsVo goodsVo = apiGoodsMapper.queryObjectByStoreId(goodsItem.getGoods_id(), storeId);
                         if(goodsVo==null){
+                            logger.error("订单提交失败:商品不存在");
                             throw new RRException("订单提交失败:商品不存在");
                         }
                         OrderGoodsVo orderGoodsVo = setOrderGoodsVo(orderInfo, goodsItem, goodsVo);

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

@@ -60,21 +60,26 @@
         left join mall_product c on c.goods_id = a.goods_id and c.id = a.product_id
         left join mall_product_store_rela psr on psr.product_id = c.id and psr.store_id = #{store_id}
         where 1 = 1  and b.is_delete = 0 and b.is_on_sale = 1
-        <if test="isStockShare == 1 and checkCart != null and checkCart == '00'">
+        <if test="checkCart == null">
+            <if test="isStockShare == 1">
+                and b.goods_number > 0
+            </if>
+            <if test="isStockShare == 0">
+                and psr.stock_num > 0
+            </if>
+        </if>
+        <if test="isStockShare == 1 and (checkCart != null and checkCart == '00')">
             and b.goods_number > 0
         </if>
-        <if test="isStockShare == 0 and checkCart != null and checkCart == '00'">
+        <if test="isStockShare == 0 and (checkCart != null and checkCart == '00')">
             and psr.stock_num > 0
         </if>
         <if test="checkCart != null and checkCart == '11'">
-            and psr.stock_num > 0
+            and psr.stock_num > 0 and b.goods_biz_type = '11'
         </if>
         <if test="checkCart != null and checkCart == '00'">
             and b.goods_biz_type != '11'
         </if>
-        <if test="checkCart != null and checkCart == '11'">
-            and b.goods_biz_type = '11'
-        </if>
         <if test="user_id != null">
             AND a.user_id = #{user_id}
         </if>

+ 7 - 4
kmall-api/src/main/resources/mybatis/mapper/ApiGoodsMapper.xml

@@ -158,7 +158,7 @@
             a.*
         </if>
         ,psr1.stock_num,psr1.category_id,psr1.brand_id,psr1.attribute_category,a.third_party_merch_code
-        ,a.goods_biz_type,a.goods_number,mb.is_stock_share isStockShare
+        ,a.goods_biz_type,a.goods_number,mb.is_stock_share isStockShare,psr1.store_id
         from mall_goods a
         LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id and a.merch_sn = psr1.merch_sn
         left join third_merchant_biz mb on a.third_party_merch_code = mb.third_party_merch_code and mb.merch_sn=a.merch_sn
@@ -196,9 +196,12 @@
                 #{item}
             </foreach>
         </if>
-        <if test="category_parent_id != null and category_parent_id != null">
+        <if test="category_parent_id != null and category_parent_id != null and category_parent_id != 0">
             and FIND_IN_SET(psr1.category_id, getCategoryChildLst(#{category_parent_id}))
         </if>
+        <if test="category_parent_id != null and category_parent_id != null and category_parent_id == 0">
+            and FIND_IN_SET(c.parent_id, getCategoryChildLst(#{category_parent_id}))
+        </if>
         <if test="goods_ids != null">
             and a.id in
             <foreach item="item" collection="goods_ids" open="(" separator="," close=")">
@@ -233,7 +236,7 @@
         ,a.goods_biz_type,
         a.goods_number,
         a.third_party_merch_code third_party_merch_code,
-        mb.is_stock_share isStockShare
+        mb.is_stock_share isStockShare,psr1.store_id
         from mall_goods a
         LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id and a.merch_sn = psr1.merch_sn
         left join third_merchant_biz mb on mb.third_party_merch_code = a.third_party_merch_code and mb.merch_sn=a.merch_sn
@@ -296,7 +299,7 @@
     <select id="queryCatalogProductList" resultMap="goodsMap">
         select a.id, a.name, a.list_pic_url,psr1.category_id,psr1.brand_id,psr1.attribute_category , psr1.market_price, psr1.retail_price, a.goods_brief, b.id AS product_id,
         psr1.stock_num,a.third_party_merch_code,a.goods_biz_type,a.goods_number,
-        mb.is_stock_share isStockShare
+        mb.is_stock_share isStockShare,psr1.store_id
         <if test="is_group != null and is_group == true">
            ,gg.id as group_id
         </if>