Browse Source

Merge branch 'master' of zyh/kmall-haikong into master

张永豪 3 years ago
parent
commit
108bbade12

+ 4 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/vip/Mall2PointsRulesController.java

@@ -12,6 +12,8 @@ import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
 import com.kmall.common.utils.excel.ExcelUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
@@ -34,6 +36,8 @@ public class Mall2PointsRulesController {
     private Mall2PointsRulesService mall2PointsRulesService;
     @Autowired
     private ExcelUtil excelUtil;
+
+    private static final Logger log = LoggerFactory.getLogger(Mall2PointsRulesController.class);
     /**
      * 查看列表
      */

+ 107 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/vip/Mall2PointsRulesDetilController.java

@@ -0,0 +1,107 @@
+package com.kmall.admin.controller.vip;
+
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.dto.Mall2RulesDto;
+import com.kmall.admin.entity.vip.Mall2PointsRulesDetilEntity;
+import com.kmall.admin.service.vip.Mall2PointsRulesDetilService;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 积分规则明细表Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-12 15:05:12
+ */
+@Controller
+@RequestMapping("mall2pointsrulesdetil")
+public class Mall2PointsRulesDetilController {
+    @Autowired
+    private Mall2PointsRulesDetilService mall2PointsRulesDetilService;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @RequiresPermissions("mall2pointsrulesdetil:list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<Mall2PointsRulesDetilEntity> mall2PointsRulesDetilList = mall2PointsRulesDetilService.queryList(query);
+        int total = mall2PointsRulesDetilService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(mall2PointsRulesDetilList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{id}")
+//    @RequiresPermissions("mall2pointsrulesdetil:info")
+    @ResponseBody
+    public R info(@PathVariable("id") Integer id) {
+        Mall2PointsRulesDetilEntity mall2PointsRulesDetil = mall2PointsRulesDetilService.queryObject(id);
+
+        return R.ok().put("mall2PointsRulesDetil", mall2PointsRulesDetil);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+//    @RequiresPermissions("mall2pointsrulesdetil:save")
+    @ResponseBody
+    public R save(@RequestBody Mall2RulesDto mall2RulesDto) {
+        mall2PointsRulesDetilService.save(mall2RulesDto);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+//    @RequiresPermissions("mall2pointsrulesdetil:update")
+    @ResponseBody
+    public R update(@RequestBody Mall2RulesDto mall2RulesDto) {
+        mall2PointsRulesDetilService.update(mall2RulesDto);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @RequiresPermissions("mall2pointsrulesdetil:delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]ids) {
+        mall2PointsRulesDetilService.deleteBatch(ids);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<Mall2PointsRulesDetilEntity> list = mall2PointsRulesDetilService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+}

+ 3 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/vip/Mall2PointsRulesDao.java

@@ -30,7 +30,9 @@ public interface Mall2PointsRulesDao extends BaseDao<Mall2PointsRulesEntity> {
      */
     List<PointsRulesAndDetailVO> queryListByTime(Date nowTime);
 
-    void saveMall2PointsRulesDetil(List<Mall2RulesDto> pointsRulesList);
+    Integer saveMall2PointsRulesDetil(List<Mall2RulesDto> pointsRulesList);
+
+    Integer updateMall2PointsRulesDetil(List<Mall2RulesDto> pointsRulesList);
 
     List<Mall2RulesDto> querymall2PointsRulesDetil(Query query);
 

+ 15 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/vip/Mall2PointsRulesDetilDao.java

@@ -0,0 +1,15 @@
+package com.kmall.admin.dao.vip;
+
+import com.kmall.admin.entity.vip.Mall2PointsRulesDetilEntity;
+import com.kmall.manager.dao.BaseDao;
+
+/**
+ * 积分规则明细表Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-12 15:05:12
+ */
+public interface Mall2PointsRulesDetilDao extends BaseDao<Mall2PointsRulesDetilEntity> {
+
+}

+ 19 - 14
kmall-admin/src/main/java/com/kmall/admin/dto/Mall2PointsRulesDto.java

@@ -7,22 +7,27 @@ import java.math.BigDecimal;
 import java.util.Date;
 
 /**
- * 积分规则表实体查询
- * 表名 mall2_points_rules
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-12 10:44:07
  */
 public class Mall2PointsRulesDto extends Mall2PointsRulesEntity implements Serializable {
-    private static final long serialVersionUID = 1L;
-    /**
-     * 当前日期用于查询
-     */
+
+    private String mkaId;
+
     private Date nowTime;
 
-    /**
-     * 当导入商品时,对应的商品门店ID
-     * @return
-     */
     private String pointsStoreId;
 
+    public Date getNowTime() {
+        return nowTime;
+    }
+
+    public void setNowTime(Date nowTime) {
+        this.nowTime = nowTime;
+    }
+
     public String getPointsStoreId() {
         return pointsStoreId;
     }
@@ -31,11 +36,11 @@ public class Mall2PointsRulesDto extends Mall2PointsRulesEntity implements Seria
         this.pointsStoreId = pointsStoreId;
     }
 
-    public Date getNowTime() {
-        return nowTime;
+    public String getMkaId() {
+        return mkaId;
     }
 
-    public void setNowTime(Date nowTime) {
-        this.nowTime = nowTime;
+    public void setMkaId(String mkaId) {
+        this.mkaId = mkaId;
     }
 }

+ 171 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/vip/Mall2PointsRulesDetilEntity.java

@@ -0,0 +1,171 @@
+package com.kmall.admin.entity.vip;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 积分规则明细表实体
+ * 表名 mall2_points_rules_detil
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-12 15:05:12
+ */
+public class Mall2PointsRulesDetilEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    private Integer id;
+    /**
+     * 积分生成主表ID
+     */
+    private Integer fatherId;
+    /**
+     * 积分生成规则类型ID
+     */
+    private Integer pointsRulesType;
+    /**
+     * 商品/门店/分类名称
+     */
+    private String pointsDetilName;
+    /**
+     * 门店ID/商品sku/商品分类ID
+     */
+    private String pointsDetilNameId;
+    /**
+     * 当导入商品时,对应的商品门店名称
+     */
+    private String pointsStoreName;
+    /**
+     * 当导入商品时,对应的商品门店ID
+     */
+    private String pointsStoreId;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 时间戳
+     */
+    private Date tstm;
+
+    /**
+     * 设置:主键id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取:主键id
+     */
+    public Integer getId() {
+        return id;
+    }
+    /**
+     * 设置:积分生成主表ID
+     */
+    public void setFatherId(Integer fatherId) {
+        this.fatherId = fatherId;
+    }
+
+    /**
+     * 获取:积分生成主表ID
+     */
+    public Integer getFatherId() {
+        return fatherId;
+    }
+    /**
+     * 设置:积分生成规则类型ID
+     */
+    public void setPointsRulesType(Integer pointsRulesType) {
+        this.pointsRulesType = pointsRulesType;
+    }
+
+    /**
+     * 获取:积分生成规则类型ID
+     */
+    public Integer getPointsRulesType() {
+        return pointsRulesType;
+    }
+    /**
+     * 设置:商品/门店/分类名称
+     */
+    public void setPointsDetilName(String pointsDetilName) {
+        this.pointsDetilName = pointsDetilName;
+    }
+
+    /**
+     * 获取:商品/门店/分类名称
+     */
+    public String getPointsDetilName() {
+        return pointsDetilName;
+    }
+    /**
+     * 设置:门店ID/商品sku/商品分类ID
+     */
+    public void setPointsDetilNameId(String pointsDetilNameId) {
+        this.pointsDetilNameId = pointsDetilNameId;
+    }
+
+    /**
+     * 获取:门店ID/商品sku/商品分类ID
+     */
+    public String getPointsDetilNameId() {
+        return pointsDetilNameId;
+    }
+    /**
+     * 设置:当导入商品时,对应的商品门店名称
+     */
+    public void setPointsStoreName(String pointsStoreName) {
+        this.pointsStoreName = pointsStoreName;
+    }
+
+    /**
+     * 获取:当导入商品时,对应的商品门店名称
+     */
+    public String getPointsStoreName() {
+        return pointsStoreName;
+    }
+    /**
+     * 设置:当导入商品时,对应的商品门店ID
+     */
+    public void setPointsStoreId(String pointsStoreId) {
+        this.pointsStoreId = pointsStoreId;
+    }
+
+    /**
+     * 获取:当导入商品时,对应的商品门店ID
+     */
+    public String getPointsStoreId() {
+        return pointsStoreId;
+    }
+    /**
+     * 设置:备注
+     */
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    /**
+     * 获取:备注
+     */
+    public String getRemark() {
+        return remark;
+    }
+    /**
+     * 设置:时间戳
+     */
+    public void setTstm(Date tstm) {
+        this.tstm = tstm;
+    }
+
+    /**
+     * 获取:时间戳
+     */
+    public Date getTstm() {
+        return tstm;
+    }
+}

+ 2 - 2
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -2570,7 +2570,7 @@ public class OrderServiceImpl implements OrderService {
                 if (parCode.startsWith("28")) {
                     // 支付宝支付
                     try {
-                        AliPay(user, parCode, order, processRecordEntity, orderWXPayRecordCurrent, store);
+//                        AliPay(user, parCode, order, processRecordEntity, orderWXPayRecordCurrent, store);
                     } catch (Exception e) {
                         LOGGER.error("支付宝支付出现异常!订单号:【{}】", order.getOrder_sn(), e);
                         throw e;
@@ -2578,7 +2578,7 @@ public class OrderServiceImpl implements OrderService {
                 } else {
                     // 微信支付
                     try {
-                        wxPay(user, parCode, resultObj, order, processRecordEntity, orderWXPayRecordCurrent, store);
+//                        wxPay(user, parCode, resultObj, order, processRecordEntity, orderWXPayRecordCurrent, store);
                     } catch (Exception e) {
                         e.printStackTrace();
                         throw e;

+ 74 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/vip/Mall2PointsRulesDetilServiceImpl.java

@@ -0,0 +1,74 @@
+package com.kmall.admin.service.impl.vip;
+
+import com.kmall.admin.dao.vip.Mall2PointsRulesDetilDao;
+import com.kmall.admin.dto.Mall2RulesDto;
+import com.kmall.admin.entity.vip.Mall2PointsRulesDetilEntity;
+import com.kmall.admin.service.vip.Mall2PointsRulesDetilService;
+import com.kmall.admin.service.vip.Mall2PointsRulesService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+
+
+/**
+ * 积分规则明细表Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-12 15:05:12
+ */
+@Service("mall2PointsRulesDetilService")
+public class Mall2PointsRulesDetilServiceImpl implements Mall2PointsRulesDetilService {
+    @Autowired
+    private Mall2PointsRulesDetilDao mall2PointsRulesDetilDao;
+
+    @Autowired
+    private Mall2PointsRulesService mall2PointsRulesService;
+
+    @Override
+    public Mall2PointsRulesDetilEntity queryObject(Integer id) {
+        return mall2PointsRulesDetilDao.queryObject(id);
+    }
+
+    @Override
+    public List<Mall2PointsRulesDetilEntity> queryList(Map<String, Object> map) {
+        return mall2PointsRulesDetilDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return mall2PointsRulesDetilDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(Mall2RulesDto mall2RulesDto) {
+        Integer rulesType = mall2PointsRulesService.getRulesDetilId(mall2RulesDto.getMkaId());
+        mall2RulesDto.setRulesType(Integer.toString(rulesType));
+        List<Mall2RulesDto> mall2RulesDtos = new ArrayList<>();
+        mall2RulesDtos.add(mall2RulesDto);
+        return mall2PointsRulesService.rulesUploadDetil(mall2RulesDtos,mall2RulesDto.getMkaId());
+    }
+
+    @Override
+    public int update(Mall2RulesDto mall2RulesDto) {
+        Integer rulesType = mall2PointsRulesService.getRulesDetilId(mall2RulesDto.getMkaId());
+        mall2RulesDto.setRulesType(Integer.toString(rulesType));
+        List<Mall2RulesDto> mall2RulesDtos = new ArrayList<>();
+        mall2RulesDtos.add(mall2RulesDto);
+        return mall2PointsRulesService.updateRulesDetil(mall2RulesDtos,mall2RulesDto.getMkaId());
+    }
+
+    @Override
+    public int delete(Integer id) {
+        return mall2PointsRulesDetilDao.delete(id);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]ids) {
+        return mall2PointsRulesDetilDao.deleteBatch(ids);
+    }
+}

+ 61 - 5
kmall-admin/src/main/java/com/kmall/admin/service/impl/vip/Mall2PointsRulesServiceImpl.java

@@ -1,19 +1,24 @@
 package com.kmall.admin.service.impl.vip;
 
 import com.google.common.collect.ImmutableBiMap;
+import com.kmall.admin.controller.vip.Mall2PointsRulesController;
 import com.kmall.admin.dao.CategoryDao;
 import com.kmall.admin.dao.ProductStoreRelaDao;
 import com.kmall.admin.dao.StoreDao;
 import com.kmall.admin.dto.Mall2RulesDto;
 import com.kmall.admin.dto.Mall2PointsRulesDto;
 import com.kmall.admin.haikong.vo.PointsRulesAndDetailVO;
+import com.kmall.admin.utils.jackson.JacksonUtil;
 import com.kmall.common.utils.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 import com.kmall.admin.dao.vip.Mall2PointsRulesDao;
 import com.kmall.admin.entity.vip.Mall2PointsRulesEntity;
@@ -28,6 +33,8 @@ import com.kmall.admin.service.vip.Mall2PointsRulesService;
  */
 @Service("mall2PointsRulesService")
 public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
+    private static final Logger log = LoggerFactory.getLogger(Mall2PointsRulesServiceImpl.class);
+
     @Autowired
     private Mall2PointsRulesDao mall2PointsRulesDao;
     @Autowired
@@ -80,12 +87,15 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
      * @param mkaId
      */
     @Override
-    public void rulesUploadDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId) {
+    public Integer rulesUploadDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId) {
         Integer pointsType = mall2PointsRulesDao.queryRulesDetilId(mkaId);
         if(pointsRulesList.size()>0){
             for(Mall2RulesDto mall2RulesDto : pointsRulesList) {
                 //校验参数
                 checkMsg(pointsType,mall2RulesDto);
+                //获取门店ID
+                Long id = storeDao.queryObjectRulesByName(Objects.isNull(mall2RulesDto.getStoreName()) ? "": mall2RulesDto.getStoreName().trim());
+                mall2RulesDto.setStoreId(id);
                 switch (pointsType) {
                     //门店
                     case 0:
@@ -97,25 +107,71 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
                         break;
                     //商品
                     case 2:
-                        //获取门店ID
-                        Long id = storeDao.queryObjectRulesByName(mall2RulesDto.getStoreName().trim());
-                        mall2RulesDto.setStoreId(id);
                         mall2RulesDto.setRulesId(productStoreRelaDao.queryproductStoreByName(mall2RulesDto.getPointsRulesName().trim(), id));
                         break;
                     default:
                         break;
                 }
+
                 mall2RulesDto.setMkaId(mkaId);
                 mall2RulesDto.setPointsRulesType(pointsType);
+                mall2RulesDto.setPointsRulesName(mall2RulesDto.getPointsRulesName().trim());
 
             }
             if(pointsRulesList.size()>0){
-                mall2PointsRulesDao.saveMall2PointsRulesDetil(pointsRulesList);
+                log.debug("积分规则明细导入数据:{}", JacksonUtil.toJson(pointsRulesList));
+                return mall2PointsRulesDao.saveMall2PointsRulesDetil(pointsRulesList);
             }
         }
+        return 0;
 
     }
 
+    @Override
+    public Integer updateRulesDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId) {
+        Integer pointsType = mall2PointsRulesDao.queryRulesDetilId(mkaId);
+        if(pointsRulesList.size()>0){
+            for(Mall2RulesDto mall2RulesDto : pointsRulesList) {
+                //校验参数
+                checkMsg(pointsType,mall2RulesDto);
+                //获取门店ID
+                Long id = storeDao.queryObjectRulesByName(mall2RulesDto.getStoreName().trim());
+                mall2RulesDto.setStoreId(id);
+                switch (pointsType) {
+                    //门店
+                    case 0:
+                        mall2RulesDto.setRulesId(storeDao.queryObjectRulesByName(mall2RulesDto.getPointsRulesName().trim()) + "");
+                        break;
+                    //商品类别
+                    case 1:
+                        mall2RulesDto.setRulesId(categoryDao.queryObjectCategoryByName(mall2RulesDto.getPointsRulesName().trim()) + "");
+                        break;
+                    //商品
+                    case 2:
+                        mall2RulesDto.setRulesId(productStoreRelaDao.queryproductStoreByName(mall2RulesDto.getPointsRulesName().trim(), id));
+                        break;
+                    default:
+                        break;
+                }
+
+                mall2RulesDto.setMkaId(mkaId);
+                mall2RulesDto.setPointsRulesType(pointsType);
+                mall2RulesDto.setPointsRulesName(mall2RulesDto.getPointsRulesName().trim());
+
+            }
+            if(pointsRulesList.size()>0){
+                log.debug("积分规则明细修改数据:{}", JacksonUtil.toJson(pointsRulesList));
+                return mall2PointsRulesDao.updateMall2PointsRulesDetil(pointsRulesList);
+            }
+        }
+        return 0;
+    }
+
+    @Override
+    public Integer getRulesDetilId(Long mkaId) {
+        return mall2PointsRulesDao.queryRulesDetilId(mkaId);
+    }
+
     /**
      * 查询积分明细数据
      * @param query

+ 73 - 0
kmall-admin/src/main/java/com/kmall/admin/service/vip/Mall2PointsRulesDetilService.java

@@ -0,0 +1,73 @@
+package com.kmall.admin.service.vip;
+
+import com.kmall.admin.dto.Mall2RulesDto;
+import com.kmall.admin.entity.vip.Mall2PointsRulesDetilEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 积分规则明细表Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-12 15:05:12
+ */
+public interface Mall2PointsRulesDetilService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param id 主键
+     * @return 实体
+     */
+    Mall2PointsRulesDetilEntity queryObject(Integer id);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<Mall2PointsRulesDetilEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param Mall2RulesDto 实体
+     * @return 保存条数
+     */
+    int save(Mall2RulesDto Mall2RulesDto);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param mall2RulesDto 实体
+     * @return 更新条数
+     */
+    int update(Mall2RulesDto mall2RulesDto);
+
+    /**
+     * 根据主键删除
+     *
+     * @param id
+     * @return 删除条数
+     */
+    int delete(Integer id);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param ids
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[]ids);
+}

+ 4 - 1
kmall-admin/src/main/java/com/kmall/admin/service/vip/Mall2PointsRulesService.java

@@ -75,8 +75,11 @@ public interface Mall2PointsRulesService {
      */
     int deleteBatch(Integer[] mprIds);
 
-    void rulesUploadDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId);
+    Integer rulesUploadDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId);
 
+    Integer updateRulesDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId);
+
+    Integer getRulesDetilId(Long mkaId);
     /**
      * 查询积分明细数据
      * @param query

+ 2 - 1
kmall-admin/src/main/resources/mybatis/mapper/ProductStoreRelaDao.xml

@@ -952,8 +952,9 @@
 
     <select id="queryproductStoreByName" resultType="java.lang.String">
         select
-            a.sku
+            g.name
         from mall_product_store_rela a
+        left join mall_goods g on g.sku=a.sku
         where a.sku = #{sku} and a.store_id= #{storeId}
     </select>
 

+ 36 - 6
kmall-admin/src/main/resources/mybatis/mapper/vip/Mall2PointsRulesDao.xml

@@ -199,7 +199,7 @@
     	order by mpr.points_type desc
 	</select>
 
-	<insert id="saveMall2PointsRulesDetil" parameterType="com.kmall.admin.dto.Mall2RulesDto">
+	<insert id="saveMall2PointsRulesDetil"  parameterType="com.kmall.admin.dto.Mall2RulesDto">
 		insert into mall2_points_rules_detil(
 			 father_id,
 			 points_rules_type,
@@ -212,27 +212,57 @@
 			(
 			#{item.mkaId},
 			#{item.pointsRulesType},
-			#{item.pointsRulesName},
 			#{item.rulesId},
+			#{item.pointsRulesName},
 			#{item.storeName},
 			#{item.storeId}
 			)
 		</foreach>
-
 	</insert>
 
+	<update id="updateMall2PointsRulesDetil"  parameterType="com.kmall.admin.dto.Mall2RulesDto">
+		<foreach collection="list" item="item" separator=";">
+			update mall2_points_rules_detil
+			<set>
+				<if test="item.mkaId != null and item.mkaId !=''">
+					father_id=#{item.mkaId},
+				</if>
+				<if test="item.pointsRulesType != null and item.pointsRulesType !=''">
+					points_rules_type=#{item.pointsRulesType},
+				</if>
+				<if test="item.rulesId != null and item.rulesId !=''">
+					points_detil_name=#{item.rulesId},
+				</if>
+				<if test="item.pointsRulesName != null and item.pointsRulesName !=''">
+					points_detil_name_id=#{item.pointsRulesName},
+				</if>
+				<if test="item.storeName != null and item.storeName !=''">
+					points_store_name=#{item.storeName},
+				</if>
+				<if test="item.storeId != null and item.storeId !=''">
+					points_store_id=#{item.storeId}
+				</if>
+			</set>
+			where id=#{item.id}
+		</foreach>
+	</update>
+
 	<select id="querymall2PointsRulesDetil" resultType="com.kmall.admin.dto.Mall2RulesDto">
 		select
 		     id,
              father_id as mkaId,
 			 points_rules_type as rulesType,
 			 points_detil_name as pointsRulesName,
-			 points_store_name as storeName
+			 points_store_name as storeName,
+			 points_detil_name_id as rulesId
 		from mall2_points_rules_detil
 		WHERE
 		father_id = #{mkaId}
-		<if test="sku !=null and sku !=''">
-			and points_detil_name_id=#{sku}
+		<if test="pointsDetilNameId !=null and pointsDetilNameId !=''">
+			and points_detil_name_id=#{pointsDetilNameId}
+		</if>
+		<if test="pointsDetilName !=null and pointsDetilName !=''">
+			and points_detil_name=#{pointsDetilName}
 		</if>
 		<if test="offset != null and limit != null">
 			limit #{offset}, #{limit}

+ 117 - 0
kmall-admin/src/main/resources/mybatis/mapper/vip/Mall2PointsRulesDetilDao.xml

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.kmall.admin.dao.vip.Mall2PointsRulesDetilDao">
+
+    <resultMap type="com.kmall.admin.entity.vip.Mall2PointsRulesDetilEntity" id="mall2PointsRulesDetilMap">
+        <result property="id" column="id"/>
+        <result property="fatherId" column="father_id"/>
+        <result property="pointsRulesType" column="points_rules_type"/>
+        <result property="pointsDetilName" column="points_detil_name"/>
+        <result property="pointsDetilNameId" column="points_detil_name_id"/>
+        <result property="pointsStoreName" column="points_store_name"/>
+        <result property="pointsStoreId" column="points_store_id"/>
+        <result property="remark" column="remark"/>
+        <result property="tstm" column="tstm"/>
+    </resultMap>
+
+	<select id="queryObject" resultType="com.kmall.admin.entity.vip.Mall2PointsRulesDetilEntity">
+		select
+			`id`,
+			`father_id`,
+			`points_rules_type`,
+			`points_detil_name`,
+			`points_detil_name_id`,
+			`points_store_name`,
+			`points_store_id`,
+			`remark`,
+			`tstm`
+		from mall2_points_rules_detil
+		where id = #{id}
+	</select>
+
+	<select id="queryList" resultType="com.kmall.admin.entity.vip.Mall2PointsRulesDetilEntity">
+		select
+    		`id`,
+    		`father_id`,
+    		`points_rules_type`,
+    		`points_detil_name`,
+    		`points_detil_name_id`,
+    		`points_store_name`,
+    		`points_store_id`,
+    		`remark`,
+    		`tstm`
+		from mall2_points_rules_detil
+		WHERE 1=1
+		<if test="name != null and name.trim() != ''">
+			AND name LIKE concat('%',#{name},'%')
+		</if>
+        <choose>
+            <when test="sidx != null and sidx.trim() != ''">
+                order by ${sidx} ${order}
+            </when>
+			<otherwise>
+                order by id desc
+			</otherwise>
+        </choose>
+		<if test="offset != null and limit != null">
+			limit #{offset}, #{limit}
+		</if>
+	</select>
+	
+ 	<select id="queryTotal" resultType="int">
+		select count(*) from mall2_points_rules_detil
+		WHERE 1=1
+        <if test="name != null and name.trim() != ''">
+            AND name LIKE concat('%',#{name},'%')
+        </if>
+	</select>
+	 
+	<insert id="save" parameterType="com.kmall.admin.entity.vip.Mall2PointsRulesDetilEntity" useGeneratedKeys="true" keyProperty="id">
+		insert into mall2_points_rules_detil(
+			`father_id`,
+			`points_rules_type`,
+			`points_detil_name`,
+			`points_detil_name_id`,
+			`points_store_name`,
+			`points_store_id`,
+			`remark`,
+			`tstm`)
+		values(
+			#{fatherId},
+			#{pointsRulesType},
+			#{pointsDetilName},
+			#{pointsDetilNameId},
+			#{pointsStoreName},
+			#{pointsStoreId},
+			#{remark},
+			#{tstm})
+	</insert>
+	 
+	<update id="update" parameterType="com.kmall.admin.entity.vip.Mall2PointsRulesDetilEntity">
+		update mall2_points_rules_detil 
+		<set>
+			<if test="fatherId != null">`father_id` = #{fatherId}, </if>
+			<if test="pointsRulesType != null">`points_rules_type` = #{pointsRulesType}, </if>
+			<if test="pointsDetilName != null">`points_detil_name` = #{pointsDetilName}, </if>
+			<if test="pointsDetilNameId != null">`points_detil_name_id` = #{pointsDetilNameId}, </if>
+			<if test="pointsStoreName != null">`points_store_name` = #{pointsStoreName}, </if>
+			<if test="pointsStoreId != null">`points_store_id` = #{pointsStoreId}, </if>
+			<if test="remark != null">`remark` = #{remark}, </if>
+			<if test="tstm != null">`tstm` = #{tstm}</if>
+		</set>
+		where id = #{id}
+	</update>
+	
+	<delete id="delete">
+		delete from mall2_points_rules_detil where id = #{value}
+	</delete>
+	
+	<delete id="deleteBatch">
+		delete from mall2_points_rules_detil where id in 
+		<foreach item="id" collection="array" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</delete>
+
+</mapper>

+ 31 - 35
kmall-admin/src/main/webapp/WEB-INF/page/mk/mall2RulesDetil.html

@@ -11,10 +11,10 @@
         <Row :gutter="16">
             <div class="search-group">
                 <i-col span="4">
-                    <i-input v-model="q.sku" @on-enter="query" placeholder="sku"/>
+                    <i-input v-model="q.pointsDetilName" @on-enter="query" placeholder="商品/门店/分类名称"/>
                 </i-col>
                 <i-col span="4">
-                    <i-input v-model="q.goodsName" @on-enter="query" placeholder="商品名称"/>
+                    <i-input v-model="q.pointsDetilNameId" @on-enter="query" placeholder="门店ID/商品sku/商品分类ID"/>
                 </i-col>
                 <i-button @click="query">查询</i-button>
                 <i-button @click="reloadSearch">重置</i-button>
@@ -30,8 +30,12 @@
                 <a href="../statics/file/mall2RulesDetil_1.0.xlsx">模板下载</a>
             </div>
             <div class="buttons-group">
-<!--                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>-->
+<!--                #if($shiro.hasPermission("mall2pointsrulesdetil:save"))-->
+                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
+<!--                #end-->
+<!--                #if($shiro.hasPermission("mall2pointsrulesdetil:update"))-->
 <!--                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>-->
+<!--                #end-->
                 <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                 <i-button type="warning" @click="reloadMkactivities">返回积分规则设置页</i-button>
 
@@ -41,40 +45,32 @@
 	    <div id="jqGridPager"></div>
     </Card>
 
-<!--    <Card v-show="!showList">-->
-<!--        <p slot="title">{{title}}</p>-->
-<!--		<i-form ref="formValidate" :model="mkActivitiesHalfPrice" :rules="ruleValidate" :label-width="80">-->
-<!--&lt;!&ndash;            <Form-item label="积分规则类型" prop="productName">&ndash;&gt;-->
-<!--&lt;!&ndash;                <i-input v-model="mkActivitiesHalfPrice.productName" placeholder="产品中文名"/>&ndash;&gt;-->
-<!--&lt;!&ndash;            </Form-item>&ndash;&gt;-->
-<!--            <Form-item label="商品条码" prop="goodsSn">-->
-<!--                <i-select v-model="mall2PointsRules.pointsType" placeholder="商品条码" label-in-value>-->
-<!--                    <i-option v-for="category in categories" :value="category.value"-->
-<!--                              :key="category.value">{{category.name}}-->
-<!--                    </i-option>-->
+    <Card v-show="!showList">
+        <p slot="title">{{title}}</p>
+		<i-form ref="formValidate" :model="mkActivitiesHalfPrice" :rules="ruleValidate" :label-width="80">
+<!--            <Form-item label="积分规则类型" prop="productName">-->
+<!--                <i-select v-model="mall2PointsRulesDetil.rulesType" placeholder="积分规则类型" label-in-value>-->
+<!--                    <i-option :value="0" :key="0">门店</i-option>-->
+<!--                    <i-option :value="1" :key="1">商品类型</i-option>-->
+<!--                    <i-option :value="2" :key="2">门店商品</i-option>-->
 <!--                </i-select>-->
 <!--            </Form-item>-->
-<!--            <Form-item label="门店名称" prop="goodsSn">-->
-<!--                <i-select v-model="mall2PointsRules.pointsType" placeholder="门店名称" label-in-value>-->
-<!--                    <i-option v-for="category in categories2" :value="category.value"-->
-<!--                              :key="category.value">{{category.name}}-->
-<!--                    </i-option>-->
-<!--                </i-select>-->
-<!--            </Form-item>-->
-<!--            <Form-item label="商品类别" prop="goodsSn">-->
-<!--                <i-select v-model="mall2PointsRules.pointsType" placeholder="商品类别" label-in-value>-->
-<!--                    <i-option v-for="category in categories3" :value="category.value"-->
-<!--                              :key="category.value">{{category.name}}-->
-<!--                    </i-option>-->
-<!--                </i-select>-->
-<!--            </Form-item>-->
-<!--            <Form-item>-->
-<!--                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>-->
-<!--                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>-->
-<!--                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>-->
-<!--            </Form-item>-->
-<!--        </i-form>-->
-<!--	</Card>-->
+
+            <Form-item label="对应的商品条码/门店/类别名称" prop="goodsSn">
+                <i-input v-model="mall2PointsRulesDetil.pointsRulesName" placeholder="对应的商品条码/门店/类别名称"/>
+            </Form-item>
+
+            <Form-item label="对应的商品门店" prop="goodsSn">
+                <i-input v-model="mall2PointsRulesDetil.storeName" placeholder="对应的商品门店"/>
+            </Form-item>
+
+            <Form-item>
+                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
+                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
+                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
+            </Form-item>
+        </i-form>
+	</Card>
 </div>
 
 <script src="${rc.contextPath}/js/mk/mall2RulesDetil.js?_${date.systemTime}"></script>

+ 33 - 27
kmall-admin/src/main/webapp/js/mk/mall2RulesDetil.js

@@ -11,7 +11,7 @@ $(function () {
         colModel: [
 			{label: 'ID', name: 'id', index: 'id', width: 30, align: 'center'},
 			{
-				label: '积分类型', name: 'rulesType', index: 'points_rules_type', width: 80, formatter: function (value) {
+				label: '积分类型', name: 'rulesType', index: 'points_rules_type', width: 80,align: 'center', formatter: function (value) {
 					if (value === '0' || value === 0) {
 						return '门店';
 					}
@@ -24,7 +24,8 @@ $(function () {
 
 				}
 			},
-			{label: '商品条码/门店/类别名称', name: 'pointsRulesName', index: 'points_detil_name', width: 80, align: 'center'},
+			{label: '商品/门店/分类名称', name: 'pointsRulesName', index: 'points_detil_name', width: 80, align: 'center'},
+			{label: '门店ID/商品sku/商品分类ID', name: 'rulesId', index: 'points_detil_name_id', width: 80, align: 'center'},
 			{label: '对应的商品门店名称', name: 'storeName', index: 'points_store_name', width: 80, align: 'center'},
 			{label: '备注', name: 'remark', index: 'remark', width: 80, align: 'center'},],
 		viewrecords: true,
@@ -71,13 +72,15 @@ let vm = new Vue({
 			]
 		},
 		q: {
-		    name: ''
+			pointsDetilNameId:"",
+			pointsDetilName:""
 		},
         isMkactivitiesShow: true,
         mkCode: '',
 		uploadData:[],
 		storeId : '',
-		mkaId : ''
+		mkaId : '',
+		mall2PointsRulesDetil:{}
 	},
 	methods: {
 		query: function () {
@@ -86,37 +89,37 @@ let vm = new Vue({
 		add: function () {
 			vm.showList = false;
 			vm.title = "新增";
-			vm.getCategories();
-			vm.getCategories2();
-			vm.getCategories3();
-			vm.mkActivitiesHalfPrice = {};
+			// vm.getCategories();
+			// vm.getCategories2();
+			// vm.getCategories3();
+			vm.mall2PointsRulesDetil = {};
 		},
 		update: function (event) {
-            let mafrId = getSelectedRow();
-			if (mafrId == null) {
+            let id = getSelectedRow();
+			if (id == null) {
 				return;
 			}
-			vm.getCategories();
-			vm.getCategories2();
-			vm.getCategories3();
+			console.log("id")
+			console.log(id)
+			// vm.getCategories();
+			// vm.getCategories2();
+			// vm.getCategories3();
 			vm.showList = false;
             vm.title = "修改";
 
-            vm.getInfo(mafrId)
+            vm.getInfo(id)
 		},
 		saveOrUpdate: function (event) {
-            let url = vm.mkActivitiesHalfPrice.mafrId == null ? "../mkactivitieshalfprice/save" : "../mkactivitieshalfprice/update";
+			console.log(vm.mall2PointsRulesDetil.id)
+            let url = vm.mall2PointsRulesDetil.id == null ? "../mall2pointsrulesdetil/save" : "../mall2pointsrulesdetil/update";
 
-			//添加上层的门店编号与营销方式编号
-
-			vm.mkActivitiesHalfPrice.shopSn = vm.storeId;
-			vm.mkActivitiesHalfPrice.mkaId = vm.mkaId;
+			vm.mall2PointsRulesDetil.mkaId = vm.mkaId;
 
             $.ajax({
 				type: "POST",
 			    url: url,
 			    contentType: "application/json",
-			    data: JSON.stringify(vm.mkActivitiesHalfPrice),
+			    data: JSON.stringify(vm.mall2PointsRulesDetil),
                 success: function (r) {
                     if (r.code === 0) {
                         alert('操作成功', function (index) {
@@ -152,22 +155,25 @@ let vm = new Vue({
 				});
 			});
 		},
-		getInfo: function(mafrId){
-			$.get("../mkactivitieshalfprice/info/"+mafrId, function (r) {
-                vm.mkActivitiesHalfPrice = r.mkActivitiesHalfPrice;
+		getInfo: function(id){
+			$.get("../mall2pointsrulesdetil/info/"+id, function (r) {
+                vm.mall2PointsRulesDetil = r.mall2PointsRulesDetil;
+				vm.mall2PointsRulesDetil.pointsRulesName=r.mall2PointsRulesDetil.pointsDetilNameId;
+				vm.mall2PointsRulesDetil.storeName=r.mall2PointsRulesDetil.pointsStoreName;
             });
 		},
         reloadSearch: function() {
-            vm.q = {
-                name: ''
-            }
+            vm.q={
+				pointsDetilNameId:null,
+				pointsDetilName:null
+			},
             vm.reload();
 		},
 		reload: function (event) {
 			vm.showList = true;
             let page = $("#jqGrid").jqGrid('getGridParam', 'page');
 			$("#jqGrid").jqGrid('setGridParam', {
-                postData: {'sku': vm.q.sku,'goodsName':vm.q.goodsName,'mkaId': vm.mkaId},
+                postData: {'pointsDetilNameId': vm.q.pointsDetilNameId,'pointsDetilName':vm.q.pointsDetilName,'mkaId': vm.mkaId},
                 page: page
             }).trigger("reloadGrid");
             vm.handleReset('formValidate');