Explorar el Código

Merge branch 'master' of hyq/kmall-pt into master

黄亚琴 hace 6 años
padre
commit
9a2e79ae8e

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/BrandDao.java

@@ -14,5 +14,5 @@ import java.util.List;
  * @date 2017-08-19 17:59:15
  */
 public interface BrandDao extends BaseDao<BrandEntity> {
-    BrandEntity queryObjectByName(@Param("brandName")String brandName);
+    BrandEntity queryObjectByName(@Param("brandName")String brandName,@Param("merchSn")String merchSn);
 }

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/CategoryDao.java

@@ -14,6 +14,6 @@ import java.util.List;
  * @date 2017-08-21 15:32:31
  */
 public interface CategoryDao extends BaseDao<CategoryEntity> {
-    CategoryEntity queryObjectByName(@Param("cateGoryName") String cateGoryName);
+    CategoryEntity queryObjectByName(@Param("cateGoryName") String cateGoryName,@Param("merchSn")String merchSn);
 
 }

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/FreightDao.java

@@ -20,5 +20,5 @@ public interface FreightDao extends BaseDao<FreightEntity> {
 
     List<FreightEntity> queryEntity(Map<String, Object> map);
 
-    FreightEntity queryObjectByName(@Param("defaultFreight")String defaultFreight);
+    FreightEntity queryObjectByName(@Param("defaultFreight")String defaultFreight,@Param("merchSn")String merchSn);
 }

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/SupplierDao.java

@@ -14,5 +14,5 @@ import java.util.List;
  * @date 2018-11-26 15:14:24
  */
 public interface SupplierDao extends BaseDao<SupplierEntity> {
-    SupplierEntity queryObjectByName(@Param("supplierName")String supplierName);
+    SupplierEntity queryObjectByName(@Param("supplierName")String supplierName,@Param("merchSn")String merchSn);
 }

+ 8 - 8
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java

@@ -611,7 +611,7 @@ public class GoodsServiceImpl implements GoodsService {
                     }
                 }
                 //商品配置校验
-                CategoryEntity categoryEntity = categoryDao.queryObjectByName(goodsDto.getCategoryName());
+                CategoryEntity categoryEntity = categoryDao.queryObjectByName(goodsDto.getCategoryName(),goodsDto.getMerchSn());
                 if(categoryEntity==null){
                     isSuccess = true;
                     failCateGoodsSnList.add(goodsDto.getGoodsSn());
@@ -624,7 +624,7 @@ public class GoodsServiceImpl implements GoodsService {
                         failCateL2GoodsSnList.add(goodsDto.getGoodsSn());
                     }
                 }
-                BrandEntity brandEntity = brandDao.queryObjectByName(goodsDto.getBrandName());
+                BrandEntity brandEntity = brandDao.queryObjectByName(goodsDto.getBrandName(),goodsDto.getMerchSn());
                 if (brandEntity == null) {
                     isSuccess = true;
                     failBrandGoodsSnList.add(goodsDto.getGoodsSn());
@@ -632,7 +632,7 @@ public class GoodsServiceImpl implements GoodsService {
                     goodsEntity.setBrandId(brandEntity.getId());
                 }
                 //运费
-                FreightEntity freightEntity = freightDao.queryObjectByName(goodsDto.getDefaultFreight());
+                FreightEntity freightEntity = freightDao.queryObjectByName(goodsDto.getDefaultFreight(),goodsDto.getMerchSn());
                 if(freightEntity==null){
                     isSuccess = true;
                     failFreightGoodsSnList.add(goodsDto.getGoodsSn());
@@ -641,7 +641,7 @@ public class GoodsServiceImpl implements GoodsService {
                     goodsEntity.setFreightId(freightEntity.getId());
                 }
                 if (!Dict.orderBizType.item_11.getItem().equals(goodsDto.getGoodsBizType())) {
-                    SupplierEntity supplierEntity = supplierDao.queryObjectByName(goodsDto.getSupplierName());
+                    SupplierEntity supplierEntity = supplierDao.queryObjectByName(goodsDto.getSupplierName(),goodsDto.getMerchSn());
                     if (supplierEntity == null) {
                         isSuccess = true;
                         failSuppGoodsSnList.add(goodsDto.getGoodsSn());
@@ -791,7 +791,7 @@ public class GoodsServiceImpl implements GoodsService {
                 throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failCateGoodsSnList != null && failCateGoodsSnList.size() > 0){
-                exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中维护,不存在的商品编码【"+failCateGoodsSnList+"】");
+                exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中维护,商品分类与商户信息对应,请检查该商品商户信息下的分类是否维护,不存在的商品编码【"+failCateGoodsSnList+"】");
                 exportExceptionDataDao.save(exportExceptionDataEntity);
                 throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
@@ -801,17 +801,17 @@ public class GoodsServiceImpl implements GoodsService {
                 throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failBrandGoodsSnList != null && failBrandGoodsSnList.size() > 0){
-                exportExceptionDataEntity.setExportExceptionData("品牌信息请在商城配置》品牌制造商中维护,不存在的商品编码【" + failBrandGoodsSnList + "】");
+                exportExceptionDataEntity.setExportExceptionData("品牌信息请在商城配置》品牌制造商中维护,品牌与商户信息对应,请检查该商品商户信息下的品牌是否维护,不存在的商品编码【" + failBrandGoodsSnList + "】");
                 exportExceptionDataDao.save(exportExceptionDataEntity);
                 throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failFreightGoodsSnList != null && failFreightGoodsSnList.size() > 0){
-                exportExceptionDataEntity.setExportExceptionData("运费信息请在商城配置》运费模板中维护,不存在的商品编码【"+failFreightGoodsSnList+"】,运费【"+failFreightList+"】");
+                exportExceptionDataEntity.setExportExceptionData("运费信息请在商城配置》运费模板中维护,运费与商户信息对应,请检查该商品商户信息下的运费是否维护,不存在的商品编码【"+failFreightGoodsSnList+"】,运费【"+failFreightList+"】");
                 exportExceptionDataDao.save(exportExceptionDataEntity);
                 throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failSuppGoodsSnList != null && failSuppGoodsSnList.size() > 0){
-                exportExceptionDataEntity.setExportExceptionData("供应商信息请在商城配置》商品供应商中维护,不存在的商品编码【" + failSuppGoodsSnList + "】");
+                exportExceptionDataEntity.setExportExceptionData("供应商信息请在商城配置》商品供应商中维护,供应商与商户信息对应,请检查该商品商户信息下的供应商是否维护,不存在的商品编码【" + failSuppGoodsSnList + "】");
                 exportExceptionDataDao.save(exportExceptionDataEntity);
                 throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }

+ 3 - 0
kmall-admin/src/main/resources/mybatis/mapper/BrandDao.xml

@@ -58,6 +58,9 @@
         `new_sort_order`
         from mall_brand
         where `name` = #{brandName}
+        <if test="merchSn != null and merchSn.trim() != ''">
+            AND merch_sn = #{merchSn}
+        </if>
     </select>
 
     <select id="queryList" resultType="com.kmall.admin.entity.BrandEntity">

+ 4 - 1
kmall-admin/src/main/resources/mybatis/mapper/CategoryDao.xml

@@ -67,7 +67,10 @@
 		`front_name`,
 		`is_show` as `show`
 		from mall_category
-		where name = #{cateGoryName} and is_show = 1
+		where name = #{cateGoryName}
+		<if test="merchSn != null and merchSn.trim() != ''">
+			AND merch_sn = #{merchSn}
+		</if> and is_show = 1
 	</select>
 
 	<select id="queryList" resultType="com.kmall.admin.entity.CategoryEntity">

+ 3 - 0
kmall-admin/src/main/resources/mybatis/mapper/FreightDao.xml

@@ -40,6 +40,9 @@
 		`is_default`
 		from mall_freight
 		where default_freight = #{defaultFreight}
+		<if test="merchSn != null and merchSn.trim() != ''">
+			AND merch_sn = #{merchSn}
+		</if>
 	</select>
 
 	<select id="queryList" resultType="com.kmall.admin.entity.FreightEntity">

+ 3 - 0
kmall-admin/src/main/resources/mybatis/mapper/SupplierDao.xml

@@ -37,6 +37,9 @@
 		`is_show`
 		from mall_supplier
 		where child_supplier_name = #{supplierName}
+		<if test="merchSn != null and merchSn.trim() != ''">
+			AND level_merch_sn = #{merchSn}
+		</if>
 	</select>
 
 	<select id="queryList" resultType="com.kmall.admin.entity.SupplierEntity">

+ 3 - 3
kmall-api/src/main/java/com/kmall/api/api/ApiCartController.java

@@ -538,7 +538,7 @@ public class ApiCartController extends ApiBaseAction {
      * 订单提交前的检验和填写相关订单信息
      */
     @GetMapping("checkout")
-    public Object checkout(@LoginUser UserVo loginUser, Long userCouponId) {
+    public Object checkout(@LoginUser UserVo loginUser, Long userCouponId,String merchSn) {
         Map<String, Object> resultObj = new HashMap();
         //选择的收货地址
         Map param = new HashMap();
@@ -560,7 +560,7 @@ public class ApiCartController extends ApiBaseAction {
         BigDecimal goodsTotalPrice = (BigDecimal) ((HashMap) cartData.get("cartTotal")).get("checkedGoodsAmount");
 
         //获取可用的优惠券信息 抵用券
-        List<UserCouponVo> enableCouponList = apiUserCouponService.matchUserCouponList(loginUser.getId(), goodsTotalPrice);
+        List<UserCouponVo> enableCouponList = apiUserCouponService.matchUserCouponList(loginUser.getId(),merchSn,goodsTotalPrice);
         UserCouponVo checkedCoupon = null;
         BigDecimal couponPrice = new BigDecimal(0.00);  //使用优惠券减免的金额
         if (null != enableCouponList && enableCouponList.size() > 0) {
@@ -666,7 +666,7 @@ public class ApiCartController extends ApiBaseAction {
             }
         }
         // 匹配优惠券
-        List<UserCouponVo> couponVos = apiUserCouponService.signUserCouponList(loginUser.getId(), checkedGoodsAmount);
+        List<UserCouponVo> couponVos = apiUserCouponService.signUserCouponList(loginUser.getId(),loginUser.getMerchSn(),checkedGoodsAmount);
         return toResponsSuccess(couponVos);
     }
 

+ 2 - 0
kmall-api/src/main/java/com/kmall/api/api/ApiCouponController.java

@@ -104,6 +104,7 @@ public class ApiCouponController extends ApiBaseAction {
         param.put("user_id", loginUser.getId());
         param.put("enabled", true);
         param.put("unUsed", true);
+        param.put("merchSn", loginUser.getMerchSn());
         List<UserCouponVo> couponVos = apiUserCouponService.queryList(param);
         return toResponsSuccess(couponVos);
     }
@@ -121,6 +122,7 @@ public class ApiCouponController extends ApiBaseAction {
         //
         Map param = new HashMap();
         param.put("coupon_number", coupon_number);
+        param.put("merchSn", loginUser.getMerchSn());
         List<UserCouponVo> couponVos = apiUserCouponService.queryList(param);
         UserCouponVo userCouponVo = null;
         if (null == couponVos || couponVos.size() == 0) {

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

@@ -56,6 +56,16 @@ public class UserCouponVo implements Serializable {
 
     private String isUsed;
 
+    private String merchSn;
+
+    public String getMerchSn() {
+        return merchSn;
+    }
+
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
     public String getIsUsed() {
         return isUsed;
     }

+ 4 - 2
kmall-api/src/main/java/com/kmall/api/service/ApiUserCouponService.java

@@ -59,13 +59,14 @@ public class ApiUserCouponService {
      * @param goodsTotalPrice
      * @return
      */
-    public List<UserCouponVo> signUserCouponList(Long userId, BigDecimal goodsTotalPrice) {
+    public List<UserCouponVo> signUserCouponList(Long userId,String merchSn, BigDecimal goodsTotalPrice) {
         Map param = new HashMap();
         param.put("user_id", userId);
         param.put("unUsed", true);
         param.put("enabled", true);
         Integer[] send_types = new Integer[]{1, 2, 3, 4, 5, 6}; // 去除订单满减0,运费7
         param.put("send_types", send_types);
+        param.put("merchSn", merchSn);
 
         List<UserCouponVo> couponVos = userCouponDao.queryList(param);
         if (null != couponVos && couponVos.size() > 0) {
@@ -86,7 +87,7 @@ public class ApiUserCouponService {
      * @param goodsTotalPrice
      * @return
      */
-    public List<UserCouponVo> matchUserCouponList(Long userId, BigDecimal goodsTotalPrice) {
+    public List<UserCouponVo> matchUserCouponList(Long userId, String merchSn, BigDecimal goodsTotalPrice) {
         List<UserCouponVo> result = new ArrayList();
         Map param = new HashMap();
         param.put("user_id", userId);
@@ -95,6 +96,7 @@ public class ApiUserCouponService {
         Integer[] send_types = new Integer[]{1, 2, 3, 4, 5, 6}; // 去除订单满减0,运费7
         param.put("send_types", send_types);
         param.put("isUsed", Dict.isUsed.item_0.getItem());
+        param.put("merchSn", merchSn);
 
         List<UserCouponVo> couponVos = userCouponDao.queryList(param);
         if (null != couponVos && couponVos.size() > 0) {

+ 4 - 0
kmall-api/src/main/resources/mybatis/mapper/ApiUserCouponMapper.xml

@@ -23,6 +23,7 @@
         <result property="isAll" column="is_all"/>
         <result property="couponUrl" column="coupon_url"/>
         <result property="isUsed" column="is_used"/>
+        <result property="merchSn" column="merch_sn"/>
 
     </resultMap>
 
@@ -46,6 +47,9 @@
         select a.*,c.is_all,c.coupon_url
         from mall_user_coupon a  inner join mall_coupon c on a.coupon_id = c.id
         where 1 = 1
+        <if test="merchSn != null">
+            and c.merch_sn = #{merchSn}
+        </if>
         <if test="coupon_number != null">
             and a.coupon_number = #{coupon_number}
         </if>