浏览代码

2022/4/18bug修复

zyh 3 年之前
父节点
当前提交
7cf189a039
共有 19 个文件被更改,包括 320 次插入29 次删除
  1. 47 0
      kmall-admin/src/main/java/com/kmall/admin/controller/mk/MkActivitiesPresentIntegralController.java
  2. 1 3
      kmall-admin/src/main/java/com/kmall/admin/controller/vip/Mall2PointsRulesController.java
  3. 1 1
      kmall-admin/src/main/java/com/kmall/admin/dao/vip/Mall2PointsRulesDetilDao.java
  4. 88 0
      kmall-admin/src/main/java/com/kmall/admin/dto/ActivitiesPresentIntegralDto.java
  5. 52 10
      kmall-admin/src/main/java/com/kmall/admin/service/impl/mk/MkActivitiesPresentIntegralServiceImpl.java
  6. 6 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/vip/Mall2PointsRulesDetilServiceImpl.java
  7. 24 2
      kmall-admin/src/main/java/com/kmall/admin/service/impl/vip/Mall2PointsRulesServiceImpl.java
  8. 3 0
      kmall-admin/src/main/java/com/kmall/admin/service/mk/MkActivitiesPresentIntegralService.java
  9. 3 0
      kmall-admin/src/main/java/com/kmall/admin/service/vip/Mall2PointsRulesDetilService.java
  10. 1 1
      kmall-admin/src/main/java/com/kmall/admin/service/vip/Mall2PointsRulesService.java
  11. 23 0
      kmall-admin/src/main/resources/XmlTemplate/ActivitiesPresentIntegralDtoList.xml
  12. 6 0
      kmall-admin/src/main/resources/mybatis/mapper/vip/Mall2PointsRulesDao.xml
  13. 6 2
      kmall-admin/src/main/resources/mybatis/mapper/vip/Mall2PointsRulesDetilDao.xml
  14. 17 4
      kmall-admin/src/main/webapp/WEB-INF/page/mk/mkactivitiespresentintegral.html
  15. 1 0
      kmall-admin/src/main/webapp/js/mk/mall2RulesDetil.js
  16. 37 4
      kmall-admin/src/main/webapp/js/mk/mkactivitiespresentintegral.js
  17. 2 2
      kmall-admin/src/main/webapp/js/vip/mall2pointsrules.js
  18. 二进制
      kmall-admin/src/main/webapp/statics/file/activities_present_integral.xlsx
  19. 2 0
      kmall-common/src/main/java/com/kmall/common/constant/JxlsXmlTemplateName.java

+ 47 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/mk/MkActivitiesPresentIntegralController.java

@@ -1,17 +1,28 @@
 package com.kmall.admin.controller.mk;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.kmall.admin.dto.ActivitiesPresentIntegralDto;
+import com.kmall.admin.dto.TemporaryPromotionalItemsDto;
 import com.kmall.admin.entity.mk.MkActivitiesPresentIntegralEntity;
+import com.kmall.admin.haikong.task.MemberSysAccessTokenRefreshTask;
 import com.kmall.admin.service.mk.MkActivitiesPresentIntegralService;
+import com.kmall.admin.utils.jackson.JacksonUtil;
+import com.kmall.common.constant.JxlsXmlTemplateName;
 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.apache.shiro.authz.annotation.RequiresPermissions;
+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.*;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 营销活动-赠送积分Controller
@@ -23,8 +34,11 @@ import org.springframework.web.bind.annotation.*;
 @Controller
 @RequestMapping("mkactivitiespresentintegral")
 public class MkActivitiesPresentIntegralController {
+    private static final Logger log = LoggerFactory.getLogger(MkActivitiesPresentIntegralController.class);
     @Autowired
     private MkActivitiesPresentIntegralService mkActivitiesPresentIntegralService;
+    @Autowired
+    private ExcelUtil excelUtil;
 
     /**
      * 查看列表
@@ -101,4 +115,37 @@ public class MkActivitiesPresentIntegralController {
 
         return R.ok().put("list", list);
     }
+
+    /**
+     * 导入excel
+     */
+    @PostMapping("/upload")
+    @ResponseBody
+    public R storeUpload(@RequestParam("file") MultipartFile file, String storeId, String mkaId) {
+        List<ActivitiesPresentIntegralDto> activitiesPresentIntegralDtoList = new ArrayList<>();//信息
+        try {
+
+            ActivitiesPresentIntegralDto activitiesPresentIntegralDto= new ActivitiesPresentIntegralDto();
+            Map<String, Object> beans = new HashMap<String, Object>();
+            beans.put("activitiesPresentIntegralDto", activitiesPresentIntegralDto);
+            beans.put("activitiesPresentIntegralDtoList", activitiesPresentIntegralDtoList);
+            if (file.isEmpty()) {
+                return R.error("文件不能为空!");
+            }
+            excelUtil.readExcel(JxlsXmlTemplateName.ACTIVITIES_PRESENT_INTEGRAL_LIST, beans, file.getInputStream());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败!请确认导入数据无误");
+        }
+        try {
+
+        } catch (RuntimeException e){
+            e.printStackTrace();
+            return R.error(e.getMessage());
+        }
+        log.debug("营销活动-赠送积分导入数据:{},storeId:{},mkaId:{}", JacksonUtil.toJson(activitiesPresentIntegralDtoList),storeId,mkaId);
+        R r = mkActivitiesPresentIntegralService.uploadExcel(activitiesPresentIntegralDtoList, storeId, mkaId);
+        //上传文件
+        return r;
+    }
 }

+ 1 - 3
kmall-admin/src/main/java/com/kmall/admin/controller/vip/Mall2PointsRulesController.java

@@ -75,9 +75,7 @@ public class Mall2PointsRulesController {
 //    @RequiresPermissions("mall2pointsrules:save")
     @ResponseBody
     public R save(@RequestBody Mall2PointsRulesEntity mall2PointsRules) {
-        mall2PointsRulesService.save(mall2PointsRules);
-
-        return R.ok();
+        return mall2PointsRulesService.save(mall2PointsRules);
     }
 
     /**

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

@@ -11,5 +11,5 @@ import com.kmall.manager.dao.BaseDao;
  * @date 2022-04-12 15:05:12
  */
 public interface Mall2PointsRulesDetilDao extends BaseDao<Mall2PointsRulesDetilEntity> {
-
+    Integer deleteByFatherId(Integer fatherId);
 }

+ 88 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/ActivitiesPresentIntegralDto.java

@@ -0,0 +1,88 @@
+package com.kmall.admin.dto;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @author zyh
+ * @version 1.0
+ * 2022-04-18 10:01
+ * 赠送积分模板
+ */
+public class ActivitiesPresentIntegralDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String storeId; // 门店编号
+    private String sku;//sku
+    private String productName;//产品中文名
+    private String activityGiveType;//赠送方式
+    private String activityGiveNum;//赠送数值
+    private String productBrand;//商品品牌
+    private String productSeries;//商品系列
+    private String rejectScore;//是否与积分抵扣互斥
+
+    public String getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
+    public String getSku() {
+        return sku;
+    }
+
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public String getActivityGiveType() {
+        return activityGiveType;
+    }
+
+    public void setActivityGiveType(String activityGiveType) {
+        this.activityGiveType = activityGiveType;
+    }
+
+    public String getActivityGiveNum() {
+        return activityGiveNum;
+    }
+
+    public void setActivityGiveNum(String activityGiveNum) {
+        this.activityGiveNum = activityGiveNum;
+    }
+
+    public String getProductBrand() {
+        return productBrand;
+    }
+
+    public void setProductBrand(String productBrand) {
+        this.productBrand = productBrand;
+    }
+
+    public String getProductSeries() {
+        return productSeries;
+    }
+
+    public void setProductSeries(String productSeries) {
+        this.productSeries = productSeries;
+    }
+
+    public String getRejectScore() {
+        return rejectScore;
+    }
+
+    public void setRejectScore(String rejectScore) {
+        this.rejectScore = rejectScore;
+    }
+}

+ 52 - 10
kmall-admin/src/main/java/com/kmall/admin/service/impl/mk/MkActivitiesPresentIntegralServiceImpl.java

@@ -1,6 +1,8 @@
 package com.kmall.admin.service.impl.mk;
 
+import com.google.common.collect.ImmutableBiMap;
 import com.kmall.admin.dao.mk.MkActivitiesPresentIntegralDao;
+import com.kmall.admin.dto.ActivitiesPresentIntegralDto;
 import com.kmall.admin.entity.mk.MkActivitiesPresentIntegralEntity;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.admin.haikong.task.MemberSysAccessTokenRefreshTask;
@@ -8,12 +10,14 @@ import com.kmall.admin.service.mk.MkActivitiesPresentIntegralService;
 import com.kmall.admin.service.vip.Mall2PointsRulesService;
 import com.kmall.admin.utils.ShiroUtils;
 import com.kmall.admin.utils.jackson.JacksonUtil;
-import com.kmall.common.utils.R;
+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 org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.*;
 
 /**
@@ -46,8 +50,24 @@ public class MkActivitiesPresentIntegralServiceImpl implements MkActivitiesPrese
         return mkActivitiesPresentIntegralDao.queryTotal(map);
     }
 
+    private R check(MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegral){
+        Map<String, Object> valideDate = MapBeanUtil.fromObject(mkActivitiesPresentIntegral);
+        ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
+        builder.put("activityGiveType", "赠送方式");
+        builder.put("activityGiveNum", "赠送数值");
+        builder.put("sku", "商品sku");
+        builder.put("rejectScore", "是否与积分抵扣互斥");
+//        builder.put("deadline", "截止日期");
+        R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
+        return r;
+    }
+
     @Override
     public R save(MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegral) {
+        R r = check(mkActivitiesPresentIntegral);
+        if (Integer.valueOf(r.get("code").toString()) != 0) {
+            return R.error(r.get("msg").toString());
+        }
         log.debug("添加营销活动-赠送积分数据:{}", JacksonUtil.toJson(mkActivitiesPresentIntegral));
         SysUserEntity userEntity = ShiroUtils.getUserEntity();
         log.debug("添加营销活动-赠送积分操作人信息:{}", JacksonUtil.toJson(userEntity));
@@ -82,18 +102,13 @@ public class MkActivitiesPresentIntegralServiceImpl implements MkActivitiesPrese
 
     @Override
     public R update(MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegral) {
+        R r = check(mkActivitiesPresentIntegral);
+        if (Integer.valueOf(r.get("code").toString()) != 0) {
+            return R.error(r.get("msg").toString());
+        }
         log.debug("修改营销活动-赠送积分数据:{}", JacksonUtil.toJson(mkActivitiesPresentIntegral));
         SysUserEntity userEntity = ShiroUtils.getUserEntity();
         log.debug("修改营销活动-赠送积分操作人信息:{}", JacksonUtil.toJson(userEntity));
-        // sku,条码,门店id查询如果有则说明添加过一次
-        MkActivitiesPresentIntegralEntity query = new MkActivitiesPresentIntegralEntity();
-        query.setSku(mkActivitiesPresentIntegral.getSku());
-        query.setMkaId(mkActivitiesPresentIntegral.getMkaId());
-//        query.setShopSn(Integer.toString(userEntity.getStoreId()));
-        List<MkActivitiesPresentIntegralEntity> list = mkActivitiesPresentIntegralDao.list(query);
-        if (!list.isEmpty()){
-            return R.error("该赠送积分活动sku:"+mkActivitiesPresentIntegral.getSku()+"已存在!");
-        }
         // 校验sku 条码的准确性
         Map<String, Object> map = new HashMap<>();
         map.put("sku",mkActivitiesPresentIntegral.getSku());
@@ -141,4 +156,31 @@ public class MkActivitiesPresentIntegralServiceImpl implements MkActivitiesPrese
     public Integer deleteByMkaId(int mkaId) {
         return mkActivitiesPresentIntegralDao.deleteByMkaId(mkaId);
     }
+
+    @Override
+    @Transactional
+    public R uploadExcel(List<ActivitiesPresentIntegralDto> activitiesPresentIntegralDtoList, String storeId, String mkaId) {
+        log.debug("营销活动-赠送积分导入数据:{},storeId:{},mkaId:{}", JacksonUtil.toJson(activitiesPresentIntegralDtoList),storeId,mkaId);
+        StringBuilder errSku = new StringBuilder();
+        activitiesPresentIntegralDtoList.forEach(activitiesPresentIntegralDto -> {
+            MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegralEntity = new MkActivitiesPresentIntegralEntity();
+            mkActivitiesPresentIntegralEntity.setSku(activitiesPresentIntegralDto.getSku());
+            mkActivitiesPresentIntegralEntity.setProductName(activitiesPresentIntegralDto.getProductName());
+            mkActivitiesPresentIntegralEntity.setActivityGiveType(activitiesPresentIntegralDto.getActivityGiveType());
+            mkActivitiesPresentIntegralEntity.setActivityGiveNum(BigDecimal.valueOf(Long.parseLong(activitiesPresentIntegralDto.getActivityGiveNum())));
+            mkActivitiesPresentIntegralEntity.setProductBrand(activitiesPresentIntegralDto.getProductBrand());
+            mkActivitiesPresentIntegralEntity.setRejectScore(activitiesPresentIntegralDto.getRejectScore());
+            mkActivitiesPresentIntegralEntity.setMkaId(Long.getLong(mkaId));
+            mkActivitiesPresentIntegralEntity.setShopSn(storeId);
+            log.debug("营销活动-赠送积分数据:{}",JacksonUtil.toJson(mkActivitiesPresentIntegralEntity));
+            R r = save(mkActivitiesPresentIntegralEntity);
+            if (Integer.valueOf(r.get("code").toString()) != 0) {
+                errSku.append("sku:"+activitiesPresentIntegralDto.getSku()+","+r.get("msg").toString());
+            }
+        });
+        if (errSku.length()>0){
+            throw new RRException(errSku.toString()+",请确认导入数据无误再进行导入!");
+        }
+        return R.ok("导入成功");
+    }
 }

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

@@ -49,6 +49,7 @@ public class Mall2PointsRulesDetilServiceImpl implements Mall2PointsRulesDetilSe
     public R save(Mall2RulesDto mall2RulesDto) {
         Integer rulesType = mall2PointsRulesService.getRulesDetilId(mall2RulesDto.getMkaId());
         mall2RulesDto.setRulesType(Integer.toString(rulesType));
+        mall2RulesDto.setStoreName(mall2RulesDto.getPointsRulesName());
         List<Mall2RulesDto> mall2RulesDtos = new ArrayList<>();
         mall2RulesDtos.add(mall2RulesDto);
         return mall2PointsRulesService.rulesUploadDetil(mall2RulesDtos, mall2RulesDto.getMkaId(),false);
@@ -72,4 +73,9 @@ public class Mall2PointsRulesDetilServiceImpl implements Mall2PointsRulesDetilSe
     public int deleteBatch(Integer[]ids) {
         return mall2PointsRulesDetilDao.deleteBatch(ids);
     }
+
+    @Override
+    public Integer deleteByFatherId(Integer fatherId) {
+        return mall2PointsRulesDetilDao.deleteByFatherId(fatherId);
+    }
 }

+ 24 - 2
kmall-admin/src/main/java/com/kmall/admin/service/impl/vip/Mall2PointsRulesServiceImpl.java

@@ -7,8 +7,11 @@ 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.entity.vip.Mall2PointsRulesDetilEntity;
 import com.kmall.admin.haikong.vo.PointsRulesAndDetailVO;
+import com.kmall.admin.service.vip.Mall2PointsRulesDetilService;
 import com.kmall.admin.utils.jackson.JacksonUtil;
+import com.kmall.common.constant.Dict;
 import com.kmall.common.utils.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -40,6 +43,8 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
     private ProductStoreRelaDao productStoreRelaDao;
     @Autowired
     private CategoryDao categoryDao;
+    @Autowired
+    private Mall2PointsRulesDetilService mall2PointsRulesDetilService;
 
 
     @Override
@@ -58,8 +63,18 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
     }
 
     @Override
-    public int save(Mall2PointsRulesEntity mall2PointsRules) {
-        return mall2PointsRulesDao.save(mall2PointsRules);
+    public R save(Mall2PointsRulesEntity mall2PointsRules) {
+        //校验 积分类型和是否启用 查询出不让增加
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("pointsType",mall2PointsRules.getPointsType());
+        map.put("isValid", Dict.isValid.item_0.getItem());
+        List<Mall2PointsRulesEntity> mall2PointsRulesEntities = mall2PointsRulesDao.queryList(map);
+        if ((!mall2PointsRulesEntities.isEmpty()) && Dict.isValid.item_0.getItem().equals(mall2PointsRules.getIsValid())){
+            return R.error("已存在该积分类型有效数据,请确认再进行操作");
+        }
+        mall2PointsRulesDao.save(mall2PointsRules);
+
+        return R.ok("添加成功");
     }
 
     @Override
@@ -69,6 +84,13 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
 
     @Override
     public int delete(Integer mprId) {
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("fatherId", mprId);
+        List<Mall2PointsRulesDetilEntity> mall2PointsRulesDetilEntities = mall2PointsRulesDetilService.queryList(map);
+        log.debug("需要删除积分规则明细数据:{}",JacksonUtil.toJson(mall2PointsRulesDetilEntities));
+        if (!mall2PointsRulesDetilEntities.isEmpty()){
+            mall2PointsRulesDetilService.deleteByFatherId(mprId);
+        }
         return mall2PointsRulesDao.delete(mprId);
     }
 

+ 3 - 0
kmall-admin/src/main/java/com/kmall/admin/service/mk/MkActivitiesPresentIntegralService.java

@@ -1,5 +1,6 @@
 package com.kmall.admin.service.mk;
 
+import com.kmall.admin.dto.ActivitiesPresentIntegralDto;
 import com.kmall.admin.entity.mk.MkActivitiesPresentIntegralEntity;
 import com.kmall.common.utils.R;
 import io.swagger.models.auth.In;
@@ -82,4 +83,6 @@ public interface MkActivitiesPresentIntegralService {
     List<MkActivitiesPresentIntegralEntity> querySkuByNow(String storeId, String currentTime, String mkaTopic);
 
     Integer deleteByMkaId(int mkaId);
+
+    R uploadExcel(List<ActivitiesPresentIntegralDto> activitiesPresentIntegralDtoList,String storeId, String mkaId);
 }

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

@@ -71,4 +71,7 @@ public interface Mall2PointsRulesDetilService {
      * @return 删除条数
      */
     int deleteBatch(Integer[]ids);
+
+    Integer deleteByFatherId(Integer fatherId);
+
 }

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

@@ -50,7 +50,7 @@ public interface Mall2PointsRulesService {
      * @param mall2PointsRules 实体
      * @return 保存条数
      */
-    int save(Mall2PointsRulesEntity mall2PointsRules);
+    R save(Mall2PointsRulesEntity mall2PointsRules);
 
     /**
      * 根据主键更新实体

+ 23 - 0
kmall-admin/src/main/resources/XmlTemplate/ActivitiesPresentIntegralDtoList.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workbook>
+    <worksheet name="Sheet1">
+        <section startRow="0" endRow="0"/>
+        <loop startRow="1" endRow="1" items="activitiesPresentIntegralDtoList" var="activitiesPresentIntegralDto"
+              varType="com.kmall.admin.dto.ActivitiesPresentIntegralDto">
+            <section startRow="1" endRow="1">
+                <mapping row="1" col="0">activitiesPresentIntegralDto.sku</mapping>
+                <mapping row="1" col="1">activitiesPresentIntegralDto.productName</mapping>
+                <mapping row="1" col="2">activitiesPresentIntegralDto.activityGiveType</mapping>
+                <mapping row="1" col="3">activitiesPresentIntegralDto.activityGiveNum</mapping>
+                <mapping row="1" col="4">activitiesPresentIntegralDto.productBrand</mapping>
+                <mapping row="1" col="5">activitiesPresentIntegralDto.productSeries</mapping>
+                <mapping row="1" col="6">activitiesPresentIntegralDto.rejectScore</mapping>
+            </section>
+            <loopbreakcondition>
+                <rowcheck offset="0">
+                    <cellcheck offset="0"></cellcheck>
+                </rowcheck>
+            </loopbreakcondition>
+        </loop>
+    </worksheet>
+</workbook>

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

@@ -52,6 +52,12 @@
 		<if test="name != null and name.trim() != ''">
 			AND points_type = #{name}
 		</if>
+		<if test="isValid != null and isValid != ''">
+			AND is_valid = #{isValid}
+		</if>
+		<if test="pointsType != null and pointsType != ''">
+			AND points_type = #{pointsType}
+		</if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}

+ 6 - 2
kmall-admin/src/main/resources/mybatis/mapper/vip/Mall2PointsRulesDetilDao.xml

@@ -43,8 +43,8 @@
     		`tstm`
 		from mall2_points_rules_detil
 		WHERE 1=1
-		<if test="name != null and name.trim() != ''">
-			AND name LIKE concat('%',#{name},'%')
+		<if test="fatherId != null and fatherId != ''">
+			AND father_id=#{fatherId}
 		</if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
@@ -106,6 +106,10 @@
 	<delete id="delete">
 		delete from mall2_points_rules_detil where id = #{value}
 	</delete>
+
+	<delete id="deleteByFatherId">
+		delete from mall2_points_rules_detil where father_id = #{fatherId}
+	</delete>
 	
 	<delete id="deleteBatch">
 		delete from mall2_points_rules_detil where id in 

+ 17 - 4
kmall-admin/src/main/webapp/WEB-INF/page/mk/mkactivitiespresentintegral.html

@@ -20,6 +20,16 @@
                 <i-button @click="query">查询</i-button>
                 <i-button @click="reloadSearch">重置</i-button>
             </div>
+            <div class="buttons-group" style="width: 100%;margin-top: 8px;">
+                <i-col style="display: inline-grid;">
+                    <Upload :show-upload-list="false" :on-success="uploadExcelSuccess" :on-error="uploadExcelError" :on-format-error="uploadExcelFormatError"
+                            :format="['xls','xlsx']"
+                            action="../mkactivitiespresentintegral/upload" :before-upload="beforeUpload"  :data="uploadData" >
+                        <i-button type="ghost" icon="ios-cloud-upload-outline">导入</i-button>
+                    </Upload>
+                </i-col>
+                <a href="../statics/file/activities_present_integral.xlsx">赠送积分模板下载</a>
+            </div>
             <div class="buttons-group">
                 <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                 <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
@@ -46,7 +56,10 @@
             <Form-item label="赠送数值" prop="activityGiveNum">
                 <i-input type="number" v-model="mkActivitiesPresentIntegral.activityGiveNum" placeholder="赠送数值"/>
             </Form-item>
-            <Form-item label="商品sku" prop="sku">
+            <Form-item v-if="isUpdate" label="商品sku" prop="sku">
+                <i-input v-model="mkActivitiesPresentIntegral.sku" placeholder="商品sku" disabled/>
+            </Form-item>
+            <Form-item v-if="!isUpdate" label="商品sku" prop="sku">
                 <i-input v-model="mkActivitiesPresentIntegral.sku" placeholder="商品sku"/>
             </Form-item>
 <!--            <Form-item label="条形码" prop="barcode">-->
@@ -63,9 +76,9 @@
                     <i-option v-for="rejectScore in rejectScores" :value="rejectScore.value" :key="rejectScore.value">{{rejectScore.name}}</i-option>
                 </i-select>
             </Form-item>
-            <Form-item label="截止日期" prop="deadline">
-                <i-input type="date" v-model="mkActivitiesPresentIntegral.deadline" placeholder="截止日期"/>
-            </Form-item>
+<!--            <Form-item label="截止日期" prop="deadline">-->
+<!--                <i-input type="date" v-model="mkActivitiesPresentIntegral.deadline" 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>

+ 1 - 0
kmall-admin/src/main/webapp/js/mk/mall2RulesDetil.js

@@ -237,6 +237,7 @@ let vm = new Vue({
 			});
 		},
         handleReset: function (name) {
+			vm.mall2PointsRulesDetil={}
             handleResetForm(this, name);
         },
         //返回积分规则设置页

+ 37 - 4
kmall-admin/src/main/webapp/js/mk/mkactivitiespresentintegral.js

@@ -48,7 +48,7 @@ $(function () {
 					}
 					return '-';
 				}},
-			{label: '截止日期', name: 'deadline', index: 'deadline', width: 80,align: 'center'},
+			// {label: '截止日期', name: 'deadline', index: 'deadline', width: 80,align: 'center'},
 			{label: '创建时间', name: 'createTime', index: 'deadline', width: 80,align: 'center'}],
 		viewrecords: true,
 		postData: {'mkaId': vm.mkaId},
@@ -97,7 +97,8 @@ let vm = new Vue({
 		storeId : '',
 		mkaId : '',
 		activityGiveTypes:{},
-		rejectScores:{}
+		rejectScores:{},
+		isUpdate:false
 	},
 	methods: {
 		query: function () {
@@ -106,6 +107,7 @@ let vm = new Vue({
 		add: function () {
 			vm.showList = false;
 			vm.title = "新增";
+			vm.isUpdate=false;
 			vm.mkActivitiesPresentIntegral = {};
 		},
 		update: function (event) {
@@ -115,13 +117,13 @@ let vm = new Vue({
 			}
 			vm.showList = false;
             vm.title = "修改";
-
+			vm.isUpdate=true
             vm.getInfo(mapId)
 		},
 		saveOrUpdate: function (event) {
             let url = vm.mkActivitiesPresentIntegral.mapId == null ? "../mkactivitiespresentintegral/save" : "../mkactivitiespresentintegral/update";
             vm.mkActivitiesPresentIntegral.mkaId=vm.mkaId;
-            vm.mkActivitiesPresentIntegral.shop_sn=vm.storeId;
+            vm.mkActivitiesPresentIntegral.shopSn=vm.storeId;
 
 			$.ajax({
 				type: "POST",
@@ -195,6 +197,37 @@ let vm = new Vue({
 		reloadMkactivities: function () {
 			window.location.href = "/mk/mkactivityform.html?mkCode="+vm.mkCode;
 		},
+		uploadExcelSuccess: function (data) {
+			// console.log(data);
+			if(data.code==0){
+				alert('导入成功', function (index) {
+					$("#jqGrid").trigger("reloadGrid");
+				});
+			}else{
+				alert(data.msg);
+			}
+		},
+		uploadExcelError: function () {
+			alert('上传出现异常,请重试!');
+		},
+		uploadExcelFormatError: function (file) {
+			this.$Notice.warning({
+				title: '文件格式不正确',
+				desc: '文件 ' + file.name + ' 格式不正确,请上传 xls 或 xlsx 格式的文件。'
+			});
+		},beforeUpload(){
+			vm.uploadData = {
+				storeId: vm.storeId,
+				mkaId : vm.mkaId
+			}
+			let promise = new Promise((resolve) => {
+				this.$nextTick(function () {
+					resolve(true);
+				});
+			});
+			return promise; //通过返回一个promis对象解决
+
+		},
 	},
 	mounted() {
 		$.get("../sys/macro/queryMacrosByValue?value=activityGiveType", function (r) {

+ 2 - 2
kmall-admin/src/main/webapp/js/vip/mall2pointsrules.js

@@ -23,12 +23,12 @@ $(function () {
 			{label: '对应积分生成比例', name: 'ratio', index: 'ratio', width: 80},
 			{
 				label: '规则适用开始时间', name: 'pointsBeginTime', index: 'points_begin_time',align:"center", width: 200, formatter: function (value) {
-					return transDate(value, 'yyyy-MM-dd');
+					return transDate(value, 'yyyy-MM-dd HH:mm:ss');
 				}
 			},
 			{
 				label: '规则适用结束时间', name: 'pointsEndTime', index: 'points_end_time',align:"center", width: 200, formatter: function (value) {
-					return transDate(value, 'yyyy-MM-dd');
+					return transDate(value, 'yyyy-MM-dd HH:mm:ss');
 				}
 			},
 			{

二进制
kmall-admin/src/main/webapp/statics/file/activities_present_integral.xlsx


+ 2 - 0
kmall-common/src/main/java/com/kmall/common/constant/JxlsXmlTemplateName.java

@@ -32,6 +32,8 @@ public class JxlsXmlTemplateName {
     public static final String DAILY_PRICE_GOODS_DTO_LIST = "/XmlTemplate/DailyPriceGoodsDtoList.xml";
     // 临时促销商品导入
     public static final String TEMPORARY_PROMOTIONAL_ITEMS_DTO_LIST = "/XmlTemplate/TemporaryPromotionalItemsDtoList.xml";
+    // 赠送积分商品导入
+    public static final String ACTIVITIES_PRESENT_INTEGRAL_LIST = "/XmlTemplate/ActivitiesPresentIntegralDtoList.xml";
     // 买一送一商品导入
     public static final String BUY_ONE_GET_ONE_FREE_DTO_LIST = "/XmlTemplate/BuyOneGetOneFreeDtoList.xml";
     // 满减商品导入