浏览代码

Merge branch 'master' of http://git.ds-bay.com/project/kmall-haikong

Scott 3 年之前
父节点
当前提交
e043b35e64
共有 73 个文件被更改,包括 3417 次插入279 次删除
  1. 14 1
      kmall-admin/src/main/java/com/kmall/admin/controller/SysOssController.java
  2. 151 0
      kmall-admin/src/main/java/com/kmall/admin/controller/mk/MkActivitiesPresentIntegralController.java
  3. 1 3
      kmall-admin/src/main/java/com/kmall/admin/controller/mk/MkActivityFormController.java
  4. 13 3
      kmall-admin/src/main/java/com/kmall/admin/controller/order/OrderController.java
  5. 18 8
      kmall-admin/src/main/java/com/kmall/admin/controller/vip/Mall2PointsRulesController.java
  6. 103 0
      kmall-admin/src/main/java/com/kmall/admin/controller/vip/Mall2PointsRulesDetilController.java
  7. 2 0
      kmall-admin/src/main/java/com/kmall/admin/dao/ProductStoreRelaDao.java
  8. 28 0
      kmall-admin/src/main/java/com/kmall/admin/dao/mk/MkActivitiesPresentIntegralDao.java
  9. 1 0
      kmall-admin/src/main/java/com/kmall/admin/dao/mk/MkActivityFormDao.java
  10. 11 4
      kmall-admin/src/main/java/com/kmall/admin/dao/vip/Mall2PointsRulesDao.java
  11. 15 0
      kmall-admin/src/main/java/com/kmall/admin/dao/vip/Mall2PointsRulesDetilDao.java
  12. 88 0
      kmall-admin/src/main/java/com/kmall/admin/dto/ActivitiesPresentIntegralDto.java
  13. 14 0
      kmall-admin/src/main/java/com/kmall/admin/dto/GoodsDetailsDto.java
  14. 46 0
      kmall-admin/src/main/java/com/kmall/admin/dto/Mall2PointsRulesDto.java
  15. 23 0
      kmall-admin/src/main/java/com/kmall/admin/entity/OrderEntity.java
  16. 12 0
      kmall-admin/src/main/java/com/kmall/admin/entity/OrderGoodsEntity.java
  17. 15 1
      kmall-admin/src/main/java/com/kmall/admin/entity/haikong/HaiKongMemberScoreChangeDetailRecordEntity.java
  18. 12 0
      kmall-admin/src/main/java/com/kmall/admin/entity/haikong/HaiKongMemberScoreChangeRecordEntity.java
  19. 5 0
      kmall-admin/src/main/java/com/kmall/admin/entity/haikong/IntegralGoBackEntity.java
  20. 12 0
      kmall-admin/src/main/java/com/kmall/admin/entity/mk/MkActivitiesEntity.java
  21. 298 0
      kmall-admin/src/main/java/com/kmall/admin/entity/mk/MkActivitiesPresentIntegralEntity.java
  22. 14 0
      kmall-admin/src/main/java/com/kmall/admin/entity/vip/Mall2MemberConsumptionRecordsEntity.java
  23. 171 0
      kmall-admin/src/main/java/com/kmall/admin/entity/vip/Mall2PointsRulesDetilEntity.java
  24. 7 0
      kmall-admin/src/main/java/com/kmall/admin/entity/vip/Mall2PointsRulesEntity.java
  25. 3 6
      kmall-admin/src/main/java/com/kmall/admin/haikong/client/HaiKongMemberTemplate.java
  26. 42 0
      kmall-admin/src/main/java/com/kmall/admin/haikong/constant/ActivityGiveTypeEnum.java
  27. 4 0
      kmall-admin/src/main/java/com/kmall/admin/haikong/constant/Constants.java
  28. 17 1
      kmall-admin/src/main/java/com/kmall/admin/haikong/dto/MemberScoreChangeDTO.java
  29. 15 1
      kmall-admin/src/main/java/com/kmall/admin/haikong/vo/OrderGiftScoreRulesVo.java
  30. 115 24
      kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java
  31. 186 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/mk/MkActivitiesPresentIntegralServiceImpl.java
  32. 14 1
      kmall-admin/src/main/java/com/kmall/admin/service/impl/mk/MkActivitiesServiceImpl.java
  33. 59 5
      kmall-admin/src/main/java/com/kmall/admin/service/impl/mk/MkActivityFormServiceImpl.java
  34. 85 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/vip/Mall2PointsRulesDetilServiceImpl.java
  35. 231 21
      kmall-admin/src/main/java/com/kmall/admin/service/impl/vip/Mall2PointsRulesServiceImpl.java
  36. 88 0
      kmall-admin/src/main/java/com/kmall/admin/service/mk/MkActivitiesPresentIntegralService.java
  37. 2 1
      kmall-admin/src/main/java/com/kmall/admin/service/mk/MkActivityFormService.java
  38. 77 0
      kmall-admin/src/main/java/com/kmall/admin/service/vip/Mall2PointsRulesDetilService.java
  39. 19 6
      kmall-admin/src/main/java/com/kmall/admin/service/vip/Mall2PointsRulesService.java
  40. 23 0
      kmall-admin/src/main/resources/XmlTemplate/ActivitiesPresentIntegralDtoList.xml
  41. 5 2
      kmall-admin/src/main/resources/mybatis/mapper/OrderDao.xml
  42. 21 1
      kmall-admin/src/main/resources/mybatis/mapper/ProductStoreRelaDao.xml
  43. 6 0
      kmall-admin/src/main/resources/mybatis/mapper/haikong/HaiKongMemberScoreChangeDetailRecordDao.xml
  44. 7 0
      kmall-admin/src/main/resources/mybatis/mapper/haikong/HaiKongMemberScoreChangeRecordDao.xml
  45. 6 0
      kmall-admin/src/main/resources/mybatis/mapper/mk/MkActivitiesAssociationDao.xml
  46. 6 2
      kmall-admin/src/main/resources/mybatis/mapper/mk/MkActivitiesDao.xml
  47. 221 0
      kmall-admin/src/main/resources/mybatis/mapper/mk/MkActivitiesPresentIntegralDao.xml
  48. 19 2
      kmall-admin/src/main/resources/mybatis/mapper/mk/MkActivityFormDao.xml
  49. 14 5
      kmall-admin/src/main/resources/mybatis/mapper/vip/Mall2MemberConsumptionRecordsDao.xml
  50. 86 3
      kmall-admin/src/main/resources/mybatis/mapper/vip/Mall2PointsRulesDao.xml
  51. 121 0
      kmall-admin/src/main/resources/mybatis/mapper/vip/Mall2PointsRulesDetilDao.xml
  52. 66 42
      kmall-admin/src/main/webapp/WEB-INF/page/mk/mall2RulesDetil.html
  53. 93 0
      kmall-admin/src/main/webapp/WEB-INF/page/mk/mkactivitiespresentintegral.html
  54. 6 6
      kmall-admin/src/main/webapp/WEB-INF/page/mk/mkactivitiesscore.html
  55. 16 3
      kmall-admin/src/main/webapp/WEB-INF/page/mk/mkactivityform.html
  56. 77 30
      kmall-admin/src/main/webapp/WEB-INF/page/sale/sale.html
  57. 5 2
      kmall-admin/src/main/webapp/WEB-INF/page/shop/offilineOrderList.html
  58. 2 3
      kmall-admin/src/main/webapp/WEB-INF/page/vip/mall2pointsrules.html
  59. 1 0
      kmall-admin/src/main/webapp/js/haikong/haikongmemberscorechangedetailrecord.js
  60. 124 71
      kmall-admin/src/main/webapp/js/mk/mall2RulesDetil.js
  61. 240 0
      kmall-admin/src/main/webapp/js/mk/mkactivitiespresentintegral.js
  62. 20 3
      kmall-admin/src/main/webapp/js/mk/mkactivityform.js
  63. 22 2
      kmall-admin/src/main/webapp/js/sale/sale.js
  64. 4 1
      kmall-admin/src/main/webapp/js/shop/offilineOrderList.js
  65. 2 0
      kmall-admin/src/main/webapp/js/shop/store.js
  66. 14 8
      kmall-admin/src/main/webapp/js/vip/mall2pointsrules.js
  67. 二进制
      kmall-admin/src/main/webapp/statics/file/activities_present_integral.xlsx
  68. 56 4
      kmall-admin/src/main/webapp/userLogin.html
  69. 13 0
      kmall-api/src/main/java/com/kmall/api/entity/OrderVo.java
  70. 67 0
      kmall-common/src/main/java/com/kmall/common/constant/Dict.java
  71. 2 0
      kmall-common/src/main/java/com/kmall/common/constant/JxlsXmlTemplateName.java
  72. 13 1
      kmall-common/src/main/java/com/kmall/common/utils/print/ticket/item/CashInfo.java
  73. 8 2
      kmall-manager/src/main/java/com/kmall/manager/manager/redis/JedisUtil.java

+ 14 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/SysOssController.java

@@ -2,6 +2,8 @@ package com.kmall.admin.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.kmall.admin.entity.SysOssEntity;
+import com.kmall.admin.haikong.task.MemberSysAccessTokenRefreshTask;
+import com.kmall.admin.utils.jackson.JacksonUtil;
 import com.kmall.common.fileserver.util.FileManager;
 import com.kmall.common.oss.CloudStorageConfig;
 import com.kmall.admin.fromcomm.service.SysConfigService;
@@ -12,6 +14,8 @@ import com.kmall.common.validator.group.AliyunGroup;
 import com.kmall.common.validator.group.QcloudGroup;
 import com.kmall.common.validator.group.QiniuGroup;
 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.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -37,6 +41,7 @@ import java.util.Map;
 @RestController
 @RequestMapping("sys/oss")
 public class SysOssController {
+    private static final Logger log = LoggerFactory.getLogger(SysOssController.class);
     @Autowired
     private SysOssService sysOssService;
     @Autowired
@@ -118,12 +123,20 @@ public class SysOssController {
             throw new RRException("上传图片,不能超过 300k");
         }
         //上传文件
-        String url = FileManager.upload(file);
+        String url="";
+        try {
+            url= FileManager.upload(file);
+        }catch (Exception e){
+            log.debug("上传文件:{}",e);
+            R.error("上传失败");
+        }
+
 
         //保存文件信息
         SysOssEntity ossEntity = new SysOssEntity();
         ossEntity.setUrl(url);
         ossEntity.setCreateDate(new Date());
+        log.debug("上传文件数据:{}", JacksonUtil.toJson(ossEntity));
         sysOssService.save(ossEntity);
 
         R r = new R();

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

@@ -0,0 +1,151 @@
+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
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-14 10:20:48
+ */
+@Controller
+@RequestMapping("mkactivitiespresentintegral")
+public class MkActivitiesPresentIntegralController {
+    private static final Logger log = LoggerFactory.getLogger(MkActivitiesPresentIntegralController.class);
+    @Autowired
+    private MkActivitiesPresentIntegralService mkActivitiesPresentIntegralService;
+    @Autowired
+    private ExcelUtil excelUtil;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+//    @RequiresPermissions("mkactivitiespresentintegral:list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<MkActivitiesPresentIntegralEntity> mkActivitiesPresentIntegralList = mkActivitiesPresentIntegralService.queryList(query);
+        int total = mkActivitiesPresentIntegralService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(mkActivitiesPresentIntegralList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{mapId}")
+//    @RequiresPermissions("mkactivitiespresentintegral:info")
+    @ResponseBody
+    public R info(@PathVariable("mapId") Long mapId) {
+        MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegral = mkActivitiesPresentIntegralService.queryObject(mapId);
+
+        return R.ok().put("mkActivitiesPresentIntegral", mkActivitiesPresentIntegral);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+//    @RequiresPermissions("mkactivitiespresentintegral:save")
+    @ResponseBody
+    public R save(@RequestBody MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegral) {
+        return mkActivitiesPresentIntegralService.save(mkActivitiesPresentIntegral);
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+//    @RequiresPermissions("mkactivitiespresentintegral:update")
+    @ResponseBody
+    public R update(@RequestBody MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegral) {
+
+
+        return mkActivitiesPresentIntegralService.update(mkActivitiesPresentIntegral);
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+//    @RequiresPermissions("mkactivitiespresentintegral:delete")
+    @ResponseBody
+    public R delete(@RequestBody Long[]mapIds) {
+        mkActivitiesPresentIntegralService.deleteBatch(mapIds);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<MkActivitiesPresentIntegralEntity> list = mkActivitiesPresentIntegralService.queryList(params);
+
+        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/mk/MkActivityFormController.java

@@ -108,9 +108,7 @@ public class MkActivityFormController {
     @RequiresPermissions("mkactivityform:delete")
     @ResponseBody
     public R delete(@RequestBody Long[]mmIds) {
-        mkActivityFormService.deleteBatch(mmIds);
-
-        return R.ok();
+        return mkActivityFormService.deleteBatch(mmIds);
     }
 
     /**

+ 13 - 3
kmall-admin/src/main/java/com/kmall/admin/controller/order/OrderController.java

@@ -610,18 +610,22 @@ public class OrderController {
             Map map = new HashMap();
             map.put("orderId", orderEntity.getId());
             List<OrderGoodsEntity> goodsList = orderGoodsService.queryList(map);
+            // 计算订单全部优惠 ,区分积分总抵扣金额 和其他优惠金额
 
+            BigDecimal allDiscountedPrice = new BigDecimal(0);
             for (OrderGoodsEntity orderGoodsEntity : goodsList) {
                 GoodsEntity goodsEntity = goodsService.queryObject(orderGoodsEntity.getGoodsId());
                 BigDecimal goodsTax = CalculateTax.calculateFinalTax(goodsEntity,orderGoodsEntity.getMarketPrice(),goodsService).setScale(3,RoundingMode.HALF_UP);
                 goodsTax = goodsTax.multiply(new BigDecimal(orderGoodsEntity.getNumber())).setScale(2,RoundingMode.HALF_UP);
                 orderGoodsEntity.setTax(goodsTax);
                 tax = tax.add(goodsTax).setScale(2,RoundingMode.HALF_UP);
-
 //                BigDecimal goodsTax = orderGoodsEntity.getMarketPrice().divide(new BigDecimal(1).add(orderGoodsEntity.getGoodsRate()),2,RoundingMode.HALF_DOWN).multiply(orderGoodsEntity.getGoodsRate())
 //                        .multiply(new BigDecimal(orderGoodsEntity.getNumber())).setScale(2,RoundingMode.HALF_DOWN);
 //                tax = tax.add(goodsTax).setScale(2,RoundingMode.HALF_UP);
+                allDiscountedPrice = allDiscountedPrice.add(orderGoodsEntity.getDiscountedPrice());
             }
+            BigDecimal otherDiscountPrice = allDiscountedPrice.subtract(orderEntity.getIntegralMoney());
+            orderEntity.setOtherDiscountedPrice(otherDiscountPrice);
             orderEntity.setTax(tax);
         }
 
@@ -664,23 +668,29 @@ public class OrderController {
         List<OrderWXPayRecordEntity> payRecords = orderWXPayRecordService.getRecordsByOutTradeNo(order.getOrderSn());
         BigDecimal tax = new BigDecimal(0);
         List<OrderGoodsEntity> goodsList = order.getOrderGoodsEntityList();
-
+        BigDecimal allDiscountedPrice = new BigDecimal(0);
         for (OrderGoodsEntity orderGoodsEntity : goodsList) {
             GoodsEntity goodsEntity = goodsService.queryObject(orderGoodsEntity.getGoodsId());
             BigDecimal goodsTax = CalculateTax.calculateFinalTax(goodsEntity,orderGoodsEntity.getMarketPrice(),goodsService).setScale(3,RoundingMode.HALF_UP);
             goodsTax = goodsTax.multiply(new BigDecimal(orderGoodsEntity.getNumber())).setScale(2,RoundingMode.HALF_UP);
             orderGoodsEntity.setTax(goodsTax);
             tax = tax.add(goodsTax).setScale(2,RoundingMode.HALF_UP);
+            // 计算其他优惠 = 总优惠减去积分抵扣优惠
+            BigDecimal otherPrice = orderGoodsEntity.getDiscountedPrice().subtract(orderGoodsEntity.getDeductionPrice());
+            orderGoodsEntity.setOtherDiscountedPrice(otherPrice);
 
 //            BigDecimal goodsTax = orderGoodsEntity.getMarketPrice().divide(new BigDecimal(1).add(orderGoodsEntity.getGoodsRate()),2,RoundingMode.HALF_DOWN).multiply(orderGoodsEntity.getGoodsRate())
 //                    .multiply(new BigDecimal(orderGoodsEntity.getNumber())).setScale(2,RoundingMode.HALF_DOWN);
 //            orderGoodsEntity.setTax(goodsTax);
 //
 //            tax = tax.add(goodsTax).setScale(2,RoundingMode.HALF_UP);
-
+            allDiscountedPrice = allDiscountedPrice.add(orderGoodsEntity.getDiscountedPrice());
         }
+        BigDecimal otherDiscountPrice = allDiscountedPrice.subtract(order.getIntegralMoney());
         order.setTax(tax);
         order.setPayRecordList(payRecords);
+        // 放入订单其他优惠
+        order.setOtherDiscountedPrice(otherDiscountPrice);
         return R.ok().put("order", order);
     }
 

+ 18 - 8
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);
     /**
      * 查看列表
      */
@@ -71,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);
     }
 
     /**
@@ -83,9 +85,7 @@ public class Mall2PointsRulesController {
 //    @RequiresPermissions("mall2pointsrules:update")
     @ResponseBody
     public R update(@RequestBody Mall2PointsRulesEntity mall2PointsRules) {
-        mall2PointsRulesService.update(mall2PointsRules);
-
-        return R.ok();
+        return mall2PointsRulesService.update(mall2PointsRules);
     }
 
     /**
@@ -118,8 +118,18 @@ public class Mall2PointsRulesController {
             e.printStackTrace();
             return R.error("导入失败!");
         }
-        mall2PointsRulesService.rulesUploadDetil(mall2RulesDtoList,mkaId);
-        return R.ok();
+
+        return mall2PointsRulesService.rulesUploadDetil(mall2RulesDtoList,mkaId,false);
+    }
+
+    /**
+     * 积分赠送规则查询积分类型
+     */
+    @RequestMapping("/getRulesDetilId")
+    @ResponseBody
+    public R getRulesDetilId(Long mkaId) {
+        Integer rulesDetilId = mall2PointsRulesService.getRulesDetilId(mkaId);
+        return R.ok(rulesDetilId.toString());
     }
 
     /**

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

@@ -0,0 +1,103 @@
+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) {
+        return mall2PointsRulesDetilService.save(mall2RulesDto);
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+//    @RequiresPermissions("mall2pointsrulesdetil:update")
+    @ResponseBody
+    public R update(@RequestBody Mall2RulesDto mall2RulesDto) {
+        return mall2PointsRulesDetilService.update(mall2RulesDto);
+    }
+
+    /**
+     * 删除
+     */
+    @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);
+    }
+}

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/ProductStoreRelaDao.java

@@ -118,6 +118,8 @@ public interface ProductStoreRelaDao extends BaseDao<ProductStoreRelaEntity> {
 
     String queryproductStoreByName(@Param("sku")String sku,@Param("storeId")Long storeId);
 
+    String queryProdBarcode(Map<String,Object> map);
+
     ProductStoreRelaEntity queryByGoodsIdAndStoreIdHkMall(@Param("storeId") Long storeId, @Param("goodsId") Long goodsId);
 
     void updateStockNumberByOutbound(List<StockChangeRecordEntity> outboundList);

+ 28 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/mk/MkActivitiesPresentIntegralDao.java

@@ -0,0 +1,28 @@
+package com.kmall.admin.dao.mk;
+
+import com.kmall.admin.entity.mk.MkActivitiesPresentIntegralEntity;
+import com.kmall.manager.dao.BaseDao;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 营销活动-赠送积分Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-14 10:20:48
+ */
+public interface MkActivitiesPresentIntegralDao extends BaseDao<MkActivitiesPresentIntegralEntity> {
+    List<MkActivitiesPresentIntegralEntity> list(MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegralEntity);
+    /**
+     * 根据门店id和当前时间和活动类型查询有那些sku参加了积分抵扣活动
+     * @param storeId
+     * @param currentTime
+     * @param mkaTopic
+     * @return
+     */
+    List<MkActivitiesPresentIntegralEntity> querySkuByNow(@Param("storeId") String storeId, @Param("currentTime")String currentTime, @Param("mkaTopic")String mkaTopic);
+
+    Integer deleteByMkaId(int mkaId);
+}

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/mk/MkActivityFormDao.java

@@ -29,4 +29,5 @@ public interface MkActivityFormDao extends BaseDao<MkActivityFormEntity> {
      */
     MkActivityFormEntity queryObjectByMkCode(@Param("mkCode") String mkCode);
 
+    List<MkActivityFormEntity> listBymmIds(Long[] mmIds);
 }

+ 11 - 4
kmall-admin/src/main/java/com/kmall/admin/dao/vip/Mall2PointsRulesDao.java

@@ -1,8 +1,8 @@
 package com.kmall.admin.dao.vip;
 
 import com.kmall.admin.dto.Mall2RulesDto;
-import com.kmall.admin.entity.vip.Mall2DetilEntity;
 import com.kmall.admin.entity.vip.Mall2PointsRulesEntity;
+import com.kmall.admin.dto.Mall2PointsRulesDto;
 import com.kmall.admin.haikong.vo.PointsRulesAndDetailVO;
 import com.kmall.common.utils.Query;
 import com.kmall.manager.dao.BaseDao;
@@ -10,7 +10,6 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 积分规则表Dao
@@ -30,13 +29,21 @@ public interface Mall2PointsRulesDao extends BaseDao<Mall2PointsRulesEntity> {
      * @param nowTime 当前时间
      * @return 积分生成规则
      */
-    List<PointsRulesAndDetailVO> queryListByTime(Date nowTime);
+    List<PointsRulesAndDetailVO> queryListByTime(@Param("nowTime") Date nowTime, @Param("pointsStoreId") String pointsStoreId);
 
-    void saveMall2PointsRulesDetil(List<Mall2RulesDto> pointsRulesList);
+    Integer saveMall2PointsRulesDetil(List<Mall2RulesDto> pointsRulesList);
+
+    Integer updateMall2PointsRulesDetil(List<Mall2RulesDto> pointsRulesList);
 
     List<Mall2RulesDto> querymall2PointsRulesDetil(Query query);
 
     int querymall2PointsRulesDetilTotal(Long id);
 
     void deleteRulesDetil(Integer[] mprIds);
+    /**
+     * 根据查询条件积分规则及其明细
+     * @param mall2PointsRulesDto
+     * @return
+     */
+    List<PointsRulesAndDetailVO> queryListBy(Mall2PointsRulesDto mall2PointsRulesDto);
 }

+ 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> {
+    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;
+    }
+}

+ 14 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/GoodsDetailsDto.java

@@ -95,6 +95,12 @@ public class GoodsDetailsDto {
     private BigDecimal deductionPrice;
 
     /**
+     * 其他优惠金额
+     */
+    private BigDecimal otherDiscountedPrice = new BigDecimal(0);
+
+
+    /**
      * 仓库编码
      */
     private String warehouseSn;
@@ -114,6 +120,14 @@ public class GoodsDetailsDto {
      */
     private String inventoryType;
 
+    public BigDecimal getOtherDiscountedPrice() {
+        return otherDiscountedPrice;
+    }
+
+    public void setOtherDiscountedPrice(BigDecimal otherDiscountedPrice) {
+        this.otherDiscountedPrice = otherDiscountedPrice;
+    }
+
     public BigDecimal getRmarketPrice() {
         return rmarketPrice;
     }

+ 46 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/Mall2PointsRulesDto.java

@@ -0,0 +1,46 @@
+package com.kmall.admin.dto;
+
+import com.kmall.admin.entity.vip.Mall2PointsRulesEntity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-12 10:44:07
+ */
+public class Mall2PointsRulesDto extends Mall2PointsRulesEntity implements Serializable {
+
+    private String mkaId;
+
+    private Date nowTime;
+
+    private String pointsStoreId;
+
+    public Date getNowTime() {
+        return nowTime;
+    }
+
+    public void setNowTime(Date nowTime) {
+        this.nowTime = nowTime;
+    }
+
+    public String getPointsStoreId() {
+        return pointsStoreId;
+    }
+
+    public void setPointsStoreId(String pointsStoreId) {
+        this.pointsStoreId = pointsStoreId;
+    }
+
+    public String getMkaId() {
+        return mkaId;
+    }
+
+    public void setMkaId(String mkaId) {
+        this.mkaId = mkaId;
+    }
+}

+ 23 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/OrderEntity.java

@@ -73,6 +73,8 @@ public class OrderEntity implements Serializable {
     private Integer integral;
     // 积分抵扣金额
     private BigDecimal integralMoney;
+    // 其他优惠金额
+    private BigDecimal otherDiscountedPrice;
     //订单总价
     private BigDecimal orderPrice;
     //商品总价
@@ -214,6 +216,27 @@ public class OrderEntity implements Serializable {
     //小票码状态
     private String pickUpCodeStatus;
 
+    /**
+     * 海控会员系统会员码(会员手机号)
+     */
+    private String memberCode;
+
+    public BigDecimal getOtherDiscountedPrice() {
+        return otherDiscountedPrice;
+    }
+
+    public void setOtherDiscountedPrice(BigDecimal otherDiscountedPrice) {
+        this.otherDiscountedPrice = otherDiscountedPrice;
+    }
+
+    public String getMemberCode() {
+        return memberCode;
+    }
+
+    public void setMemberCode(String memberCode) {
+        this.memberCode = memberCode;
+    }
+
     public BigDecimal getTopicPrice() {
         return topicPrice;
     }

+ 12 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/OrderGoodsEntity.java

@@ -87,6 +87,18 @@ public class OrderGoodsEntity implements Serializable {
 	 */
 	private BigDecimal deductionPrice;
 
+	/**
+	 * 其他优惠金额
+	 */
+	private BigDecimal otherDiscountedPrice = new BigDecimal(0);
+
+	public BigDecimal getOtherDiscountedPrice() {
+		return otherDiscountedPrice;
+	}
+
+	public void setOtherDiscountedPrice(BigDecimal otherDiscountedPrice) {
+		this.otherDiscountedPrice = otherDiscountedPrice;
+	}
 
 	public BigDecimal getDeductionPrice() {
 		return deductionPrice;

+ 15 - 1
kmall-admin/src/main/java/com/kmall/admin/entity/haikong/HaiKongMemberScoreChangeDetailRecordEntity.java

@@ -25,8 +25,14 @@ public class HaiKongMemberScoreChangeDetailRecordEntity {
     private Integer sellVolume;
 
     private Integer deductionScore;
-
+    /**
+     * 订单赠送积分
+     */
     private Integer giftScore;
+    /**
+     * 活动赠送积分
+     */
+    private Integer activityGiftScore;
 
     /**
      * 生成积分规则
@@ -43,6 +49,14 @@ public class HaiKongMemberScoreChangeDetailRecordEntity {
 
     private Date modifyTime;
 
+    public Integer getActivityGiftScore() {
+        return activityGiftScore;
+    }
+
+    public void setActivityGiftScore(Integer activityGiftScore) {
+        this.activityGiftScore = activityGiftScore;
+    }
+
     public Integer getId() {
         return id;
     }

+ 12 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/haikong/HaiKongMemberScoreChangeRecordEntity.java

@@ -20,6 +20,10 @@ public class HaiKongMemberScoreChangeRecordEntity {
      * 变动的积分数量
      */
     private Integer score;
+    /**
+     * 活动赠送积分变动值
+     */
+    private Integer activityScore;
 
     /**
      * 外部订单号(kmall订单号)
@@ -47,6 +51,14 @@ public class HaiKongMemberScoreChangeRecordEntity {
      */
     private String statementId;
 
+    public Integer getActivityScore() {
+        return activityScore;
+    }
+
+    public void setActivityScore(Integer activityScore) {
+        this.activityScore = activityScore;
+    }
+
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
     private Date createTime;
 

+ 5 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/haikong/IntegralGoBackEntity.java

@@ -24,6 +24,11 @@ public class IntegralGoBackEntity implements Serializable {
      */
     private Integer rollback_score;
     /**
+     * 回退活动积分数量
+     */
+    private Integer rollback_activity_score;
+
+    /**
      * 渠道自定义积分变动唯一标识,用于平台幂等性保证
      */
     private String change_id;

+ 12 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/mk/MkActivitiesEntity.java

@@ -103,6 +103,18 @@ public class MkActivitiesEntity implements Serializable, Comparable<MkActivities
      */
     private Integer priority;
 
+    /**
+     * 营销活动名称
+     */
+    private String mkaName;
+
+    public String getMkaName() {
+        return mkaName;
+    }
+
+    public void setMkaName(String mkaName) {
+        this.mkaName = mkaName;
+    }
 
     /**
      * 设置:编号

+ 298 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/mk/MkActivitiesPresentIntegralEntity.java

@@ -0,0 +1,298 @@
+package com.kmall.admin.entity.mk;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 营销活动-赠送积分实体
+ * 表名 mk_activities_present_integral
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-14 10:20:48
+ */
+public class MkActivitiesPresentIntegralEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Long mapId;
+    /**
+     * 产品中文名
+     */
+    private String productName;
+    /**
+     * 赠送方式- 1 :固定值 2:倍率
+     */
+    private String activityGiveType;
+    /**
+     * 赠送数值
+     */
+    private BigDecimal activityGiveNum;
+    /**
+     * 门店编号
+     */
+    private String shopSn;
+    /**
+     * 商品sku
+     */
+    private String sku;
+    /**
+     * 条形码
+     */
+    private String barcode;
+    /**
+     * 商品品牌
+     */
+    private String productBrand;
+    /**
+     * 商品系列
+     */
+    private String productSeries;
+    /**
+     * 营销活动编号
+     */
+    private Long mkaId;
+    /**
+     * 是否与积分抵扣互斥,0:不互斥 1:互斥
+     */
+    private String rejectScore;
+    /**
+     * 截止日期
+     */
+    private String deadline;
+    /**
+     * 创建时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+    /**
+     * 创建人编号
+     */
+    private String createrSn;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+    /**
+     * 修改时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /**
+     * 设置:编号
+     */
+    public void setMapId(Long mapId) {
+        this.mapId = mapId;
+    }
+
+    /**
+     * 获取:编号
+     */
+    public Long getMapId() {
+        return mapId;
+    }
+    /**
+     * 设置:产品中文名
+     */
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    /**
+     * 获取:产品中文名
+     */
+    public String getProductName() {
+        return productName;
+    }
+    /**
+     * 设置:赠送方式- 1 :固定值 2:倍率
+     */
+    public void setActivityGiveType(String activityGiveType) {
+        this.activityGiveType = activityGiveType;
+    }
+
+    /**
+     * 获取:赠送方式- 1 :固定值 2:倍率
+     */
+    public String getActivityGiveType() {
+        return activityGiveType;
+    }
+    /**
+     * 设置:赠送数值
+     */
+    public void setActivityGiveNum(BigDecimal activityGiveNum) {
+        this.activityGiveNum = activityGiveNum;
+    }
+
+    /**
+     * 获取:赠送数值
+     */
+    public BigDecimal getActivityGiveNum() {
+        return activityGiveNum;
+    }
+    /**
+     * 设置:门店编号
+     */
+    public void setShopSn(String shopSn) {
+        this.shopSn = shopSn;
+    }
+
+    /**
+     * 获取:门店编号
+     */
+    public String getShopSn() {
+        return shopSn;
+    }
+    /**
+     * 设置:商品sku
+     */
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    /**
+     * 获取:商品sku
+     */
+    public String getSku() {
+        return sku;
+    }
+    /**
+     * 设置:条形码
+     */
+    public void setBarcode(String barcode) {
+        this.barcode = barcode;
+    }
+
+    /**
+     * 获取:条形码
+     */
+    public String getBarcode() {
+        return barcode;
+    }
+    /**
+     * 设置:商品品牌
+     */
+    public void setProductBrand(String productBrand) {
+        this.productBrand = productBrand;
+    }
+
+    /**
+     * 获取:商品品牌
+     */
+    public String getProductBrand() {
+        return productBrand;
+    }
+    /**
+     * 设置:商品系列
+     */
+    public void setProductSeries(String productSeries) {
+        this.productSeries = productSeries;
+    }
+
+    /**
+     * 获取:商品系列
+     */
+    public String getProductSeries() {
+        return productSeries;
+    }
+    /**
+     * 设置:营销活动编号
+     */
+    public void setMkaId(Long mkaId) {
+        this.mkaId = mkaId;
+    }
+
+    /**
+     * 获取:营销活动编号
+     */
+    public Long getMkaId() {
+        return mkaId;
+    }
+    /**
+     * 设置:是否与积分抵扣互斥,0:不互斥 1:互斥
+     */
+    public void setRejectScore(String rejectScore) {
+        this.rejectScore = rejectScore;
+    }
+
+    /**
+     * 获取:是否与积分抵扣互斥,0:不互斥 1:互斥
+     */
+    public String getRejectScore() {
+        return rejectScore;
+    }
+    /**
+     * 设置:截止日期
+     */
+    public void setDeadline(String deadline) {
+        this.deadline = deadline;
+    }
+
+    /**
+     * 获取:截止日期
+     */
+    public String getDeadline() {
+        return deadline;
+    }
+    /**
+     * 设置:创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:创建人编号
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:创建人编号
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+    /**
+     * 设置:修改时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    /**
+     * 获取:修改时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+}

+ 14 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/vip/Mall2MemberConsumptionRecordsEntity.java

@@ -124,6 +124,20 @@ public class Mall2MemberConsumptionRecordsEntity implements Serializable {
     private Integer orderGiftScore;
 
     /**
+     * 活动赠送积分
+     */
+    private Integer activityGiftScore;
+
+
+    public Integer getActivityGiftScore() {
+        return activityGiftScore;
+    }
+
+    public void setActivityGiftScore(Integer activityGiftScore) {
+        this.activityGiftScore = activityGiftScore;
+    }
+
+    /**
      * 设置:主键
      */
     public void setMmcrId(Integer mmcrId) {

+ 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;
+    }
+}

+ 7 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/vip/Mall2PointsRulesEntity.java

@@ -1,5 +1,8 @@
 package com.kmall.admin.entity.vip;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
@@ -30,10 +33,14 @@ public class Mall2PointsRulesEntity implements Serializable, Comparable<Mall2Poi
     /**
      * 积分规则适用开始时间
      */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date pointsBeginTime;
     /**
      * 积分规则适用结束时间
      */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date pointsEndTime;
     /**
      * 积分规则是否有效

+ 3 - 6
kmall-admin/src/main/java/com/kmall/admin/haikong/client/HaiKongMemberTemplate.java

@@ -3,14 +3,11 @@ package com.kmall.admin.haikong.client;
 import cn.hutool.core.map.MapUtil;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.kmall.admin.haikong.config.HaiKongProperties;
-import com.kmall.admin.haikong.constant.Constants;
-import com.kmall.admin.haikong.dto.AccessTokenDTO;
+import com.kmall.admin.haikong.constant.HaiKongMemberSystemUrlEnum;
 import com.kmall.admin.haikong.dto.MemberInfoDTO;
 import com.kmall.admin.haikong.task.MemberSysAccessTokenRefreshTask;
 import com.kmall.admin.haikong.utils.*;
-import com.kmall.admin.haikong.constant.HaiKongMemberSystemUrlEnum;
 import com.kmall.admin.utils.jackson.JacksonUtil;
-import com.kmall.manager.manager.redis.JedisUtil;
 import okhttp3.MediaType;
 import okhttp3.Request;
 import okhttp3.RequestBody;
@@ -23,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.util.StringUtils;
 
-import java.math.BigDecimal;
 import java.util.Map;
 
 
@@ -104,9 +100,9 @@ public class HaiKongMemberTemplate {
         String url = haiKongProperties.getMemberUrl() + HaiKongMemberSystemUrlEnum.QUERY_ACCESS_TOKEN.getUrl() + "?app_id=" + haiKongProperties.getMemberAppId() + "&timestamp=" + System.currentTimeMillis();
         url = getSignUrl(url, "");
         Request request = new Request.Builder()
+                            .post(requestBody(""))
                             .url(url)
                             .build();
-
         String response = OkHttpUtils.retry(request, haiKongProperties.getRetry());
         log.info("请求获取accessToken接口成功......" + response);
         return response;
@@ -122,6 +118,7 @@ public class HaiKongMemberTemplate {
         String url = haiKongProperties.getMemberUrl() + HaiKongMemberSystemUrlEnum.REFRESH_ACCESS_TOKEN.getUrl() + "?refresh_token=" + refreshToken + "&timestamp=" + System.currentTimeMillis();
         url = getSignUrl(url, "");
         Request request = new Request.Builder()
+                            .post(requestBody(""))
                             .url(url)
                             .build();
         String response = OkHttpUtils.retry(request, haiKongProperties.getRetry());

+ 42 - 0
kmall-admin/src/main/java/com/kmall/admin/haikong/constant/ActivityGiveTypeEnum.java

@@ -0,0 +1,42 @@
+package com.kmall.admin.haikong.constant;
+
+/**
+ * 积分赠送方式
+ */
+public enum ActivityGiveTypeEnum {
+
+    /**
+     * 固定值
+     */
+    FIXED_VALUE("1", "固定值"),
+    /**
+     * 倍率
+     */
+    MULTIPLYING_POWER("2", "倍率"),
+    ;
+
+
+    /**
+     * code
+     */
+    private String code;
+    /**
+     * 名称
+     */
+    private String name;
+
+    ActivityGiveTypeEnum(String code, String name) {
+        this.code = code;
+        this.name = name;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+
+}

+ 4 - 0
kmall-admin/src/main/java/com/kmall/admin/haikong/constant/Constants.java

@@ -79,6 +79,10 @@ public class Constants {
          * 积分抵扣
          */
         JFDK("jfdk", "积分抵扣", 99),
+        /**
+         * 赠送积分
+         */
+        ZSJF("zsjf", "赠送积分", 80),
         ;
 
         private final String topicCode;

+ 17 - 1
kmall-admin/src/main/java/com/kmall/admin/haikong/dto/MemberScoreChangeDTO.java

@@ -15,8 +15,15 @@ public class MemberScoreChangeDTO implements Serializable {
 
     @JsonProperty("open_id")
     private String openId;
-
+    /**
+     * 积分变动
+     */
     private Integer score;
+    /**
+     * 活动积分变动
+     */
+    @JsonProperty("activity_score")
+    private Integer activityScore;
 
     /**
      * 外部订单号
@@ -40,6 +47,15 @@ public class MemberScoreChangeDTO implements Serializable {
     @JsonProperty("change_id")
     private String changeId;
 
+
+    public Integer getActivityScore() {
+        return activityScore;
+    }
+
+    public void setActivityScore(Integer activityScore) {
+        this.activityScore = activityScore;
+    }
+
     public String getOpenId() {
         return openId;
     }

+ 15 - 1
kmall-admin/src/main/java/com/kmall/admin/haikong/vo/OrderGiftScoreRulesVo.java

@@ -10,11 +10,25 @@ import java.math.BigDecimal;
 public class OrderGiftScoreRulesVo {
 
     private Integer generateType;
-
+    /**
+     * 下单赠送积分
+     */
     private Integer giftScore;
+    /**
+     * 活动赠送积分
+     */
+    private Integer activityGiftScore;
 
     private BigDecimal generateRatio;
 
+    public Integer getActivityGiftScore() {
+        return activityGiftScore;
+    }
+
+    public void setActivityGiftScore(Integer activityGiftScore) {
+        this.activityGiftScore = activityGiftScore;
+    }
+
     public Integer getGenerateType() {
         return generateType;
     }

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

@@ -2,10 +2,7 @@ package com.kmall.admin.service.impl;
 
 import cn.hutool.core.lang.Snowflake;
 import cn.hutool.core.lang.UUID;
-import cn.hutool.core.lang.generator.SnowflakeGenerator;
 import cn.hutool.core.util.IdUtil;
-import cn.hutool.core.util.XmlUtil;
-import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.type.TypeReference;
@@ -15,8 +12,6 @@ import com.google.gson.Gson;
 import com.google.gson.internal.LinkedTreeMap;
 import com.kmall.admin.cuspay.biz.ali.AliCusDeclareBiz;
 import com.kmall.admin.cuspay.biz.wx.WxCusDeclareBiz;
-import com.kmall.admin.cuspay.manager.snow.SnowflakeIdWorker;
-import com.kmall.admin.cuspay.manager.snow.SnowflakeUtil;
 import com.kmall.admin.dao.*;
 import com.kmall.admin.dao.alarm.Mall2LowPriceWarningDao;
 import com.kmall.admin.dao.mk.Mk2GoodsTopicPriceDao;
@@ -31,12 +26,12 @@ import com.kmall.admin.dto.*;
 import com.kmall.admin.entity.*;
 import com.kmall.admin.entity.haikong.*;
 import com.kmall.admin.entity.mk.MkActivitiesEntity;
+import com.kmall.admin.entity.mk.MkActivitiesPresentIntegralEntity;
 import com.kmall.admin.entity.mk.MkActivitiesScoreEntity;
 import com.kmall.admin.entity.mk.store.MkStorePromOrderRealEntity;
 import com.kmall.admin.entity.record.NewRetailOrderRestoreStockRecordEntity;
 import com.kmall.admin.entity.vip.Mall2MemberConsumptionRecordsEntity;
 import com.kmall.admin.entity.vip.Mall2MemberPointsEntity;
-import com.kmall.admin.entity.vip.Mall2PointsRulesEntity;
 import com.kmall.admin.fromcomm.dao.SysConfigDao;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.admin.haikong.constant.*;
@@ -52,6 +47,7 @@ import com.kmall.admin.haikong.config.HaiKongProperties;
 import com.kmall.admin.haikong.utils.Response;
 import com.kmall.admin.service.*;
 import com.kmall.admin.service.haikong.*;
+import com.kmall.admin.service.mk.MkActivitiesPresentIntegralService;
 import com.kmall.admin.service.mk.MkActivitiesScoreService;
 import com.kmall.admin.service.mk.MkActivitiesService;
 import com.kmall.admin.service.mk.store.MkStoreCampMinusService;
@@ -240,6 +236,8 @@ public class OrderServiceImpl implements OrderService {
     @Autowired
     private MkActivitiesService mkActivitiesService;
 
+    @Autowired
+    private MkActivitiesPresentIntegralService mkActivitiesPresentIntegralService;
     /**
      * 满赠
      */
@@ -594,6 +592,8 @@ public class OrderServiceImpl implements OrderService {
                 new BigDecimal(orderEntity.getFreightPrice()).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
         cashInfo.setDeductionScore(memberConsumptionRecordsEntity.getDeductionScore());
         cashInfo.setScoreDeductionPrice(memberConsumptionRecordsEntity.getScoreDeductionPrice().toString());
+        // 其他优惠金额=优惠合计-积分抵扣金额
+        cashInfo.setOtherDiscountedPrice(discountedPrice.subtract(memberConsumptionRecordsEntity.getScoreDeductionPrice()));
         if ("alipay".equals(orderEntity.getPayFlag())) {
             cashInfo.setPaymentMode("支付宝支付");
         } else {
@@ -2525,6 +2525,8 @@ public class OrderServiceImpl implements OrderService {
             order.setMerchOrderSn(merchOrderSn);
             order.setCoupon_name(couponSn); // 借用这个字段来记录是否使用优惠券
             order.setIdCard(userEntity.getIdNo());
+            order.setMemberCode((String)userInfo.get("consigneePhone"));
+            LOGGER.debug("插入订单信息数据:{}",JacksonUtil.toJson(order));
             //插入订单信息和订单商品
             orderDao.saveOrderVo(order);
 
@@ -2629,21 +2631,41 @@ public class OrderServiceImpl implements OrderService {
 
             // 查询当前时间积分规则以及明细,根据积分生成规则进行增加会员积分
             Integer userEntityId = userEntity.getId();
-            // 总的积分:基础积分
+            // 总的积分:基础积分  AtomicReference 用来保证此integer的操作线程安全
             AtomicReference<Integer> memberScore = new AtomicReference<>(0);
+            // 订单总赠送积分
+            AtomicReference<Integer> activityGiftScore = new AtomicReference<>(0);
             // 无会员码,不参与积分赠送
             Map<String, OrderGiftScoreRulesVo> giftGoodsScoreDetailMap = new HashMap<>();
+            // memberCode为不为空 判断 下单时有没有传入会员码
             if (!org.springframework.util.StringUtils.isEmpty(memberCode)) {
-                List<PointsRulesAndDetailVO> pointsRulesAndDetailVOList = mall2PointsRulesService.queryListByTime(new Date());
+                /**
+                 * 修复A门店、B门店的积分规则进行赠送,而是都使用了同一个门店或商品赠送规则
+                 * 修改为各用各的
+                 * 根据门店id 和时间查询积分赠送规则
+                 */
+                List<PointsRulesAndDetailVO> pointsRulesAndDetailVOList= mall2PointsRulesService.queryListByTime(new Date(), store.getId().toString());
+
                 // 商品map,key===>sku value===>金额
                 Map<String, BigDecimal> goodsMap = goodsEntities.stream().collect(Collectors.toMap(GoodsEntity::getSku, GoodsEntity::getActualPaymentAmount, (k1, k2) -> k2));
                 // 商品数据map,key===>sku value===>商品实体
                 Map<String, GoodsEntity> goodsDataMap = goodsEntities.stream().collect(Collectors.toMap(GoodsEntity::getSku, goodsEntity -> goodsEntity, (k1, k2) -> k2));
+                // 根据门店、时间和活动类型 查询参加积分赠送活动的sku,转换为map
+                //  ,sku为key,对象为值,判断sku是否在此之中,在则计算赠送积分算完
+                List<MkActivitiesPresentIntegralEntity> mkActivitiesEntityList = mkActivitiesPresentIntegralService.querySkuByNow(store.getId().toString(), DateUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"), Constants.ActivityTopicEnum.ZSJF.getTopicCode());
+                Map<String, MkActivitiesPresentIntegralEntity> mkActivitiesEntityMap = new HashMap<>();
+                if(!CollectionUtils.isEmpty(mkActivitiesEntityList) && mkActivitiesEntityList.size() > 0){
+                    // 不为空 则处理
+                    mkActivitiesEntityMap = mkActivitiesEntityList.stream()
+                            .collect(Collectors.toMap(MkActivitiesPresentIntegralEntity::getSku
+                                    , mkActivitiesPresentIntegralEntity -> mkActivitiesPresentIntegralEntity, (k1, k2) -> k2));
+                }
+
                 // 订单全部的sku
                 Set<String> goodsSkuList = goodsMap.keySet();
                 // 订单全部商品的分类列表,只有二级分类才能设置生成规则
                 Set<Integer> categorySet = goodsEntities.stream().map(GoodsEntity::getCategoryId).collect(Collectors.toSet());
-                pointsRulesAndDetailVOList.forEach(pointsRulesAndDetailVO -> {
+                for(PointsRulesAndDetailVO pointsRulesAndDetailVO : pointsRulesAndDetailVOList){
                     Integer pointsType = pointsRulesAndDetailVO.getPointsType();
                     // 可以是sku、门店id、分类id
                     String pointsDetailNameId = pointsRulesAndDetailVO.getPointsDetailNameId();
@@ -2657,9 +2679,10 @@ public class OrderServiceImpl implements OrderService {
                             BigDecimal money = goodsMap.get(pointsDetailNameId);
                             OrderGiftScoreRulesVo orderGiftScoreRulesVo = new OrderGiftScoreRulesVo();
                             orderGiftScoreRulesVo.setGenerateType(Constants.MemberScoreRulesEnum.TWO.getCode());
+                            BigDecimal bigDecimal = new BigDecimal(0);
                             if (ratio.compareTo(BigDecimal.ZERO) > 0) {
                                 // 算出所积的分
-                                BigDecimal bigDecimal = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR);
+                                bigDecimal = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR);
                                 int giftScore = bigDecimal.add(new BigDecimal(memberScore.get())).intValue();
                                 memberScore.set(giftScore);
                                 orderGiftScoreRulesVo.setGiftScore(bigDecimal.intValue());
@@ -2670,6 +2693,9 @@ public class OrderServiceImpl implements OrderService {
                                 orderGiftScoreRulesVo.setGiftScore(0);
                                 orderGiftScoreRulesVo.setGenerateRatio(BigDecimal.ZERO);
                             }
+                            // 在这里计算赠送积分,并放入
+                            // 判断此sku是否参加活动 并计算活动积分
+                            getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, pointsDetailNameId, orderGiftScoreRulesVo);
                             giftGoodsScoreDetailMap.put(pointsDetailNameId, orderGiftScoreRulesVo);
                             goodsDataMap.remove(pointsDetailNameId);
                         }
@@ -2678,7 +2704,7 @@ public class OrderServiceImpl implements OrderService {
                     if (pointsType.equals(Constants.MemberScoreRulesEnum.ONE.getCode())) {
                         Collection<GoodsEntity> values = goodsDataMap.values();
                         Collection<GoodsEntity> entityCollection = DeepCopyUtils.depCopyHashSet(new HashSet<>(values));
-                        entityCollection.forEach(goodsEntity -> {
+                        for(GoodsEntity goodsEntity : entityCollection){
                             // 商品类别
                             Integer categoryId = goodsEntity.getCategoryId();
                             String sku = goodsEntity.getSku();
@@ -2688,9 +2714,10 @@ public class OrderServiceImpl implements OrderService {
                                 if (categoryId.equals(Integer.parseInt(pointsDetailNameId))) {
                                     // 订单中该sku的总金额
                                     BigDecimal money = goodsMap.get(sku);
+                                    BigDecimal bigDecimal = new BigDecimal(0);
                                     if (ratio.compareTo(BigDecimal.ZERO) > 0) {
                                         // 算出所积的分
-                                        BigDecimal bigDecimal = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR);
+                                        bigDecimal = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR);
                                         int giftScore = bigDecimal.add(new BigDecimal(memberScore.get())).intValue();
                                         memberScore.set(giftScore);
                                         orderGiftScoreRulesVo.setGiftScore(bigDecimal.intValue());
@@ -2701,26 +2728,30 @@ public class OrderServiceImpl implements OrderService {
                                         orderGiftScoreRulesVo.setGiftScore(0);
                                         orderGiftScoreRulesVo.setGenerateRatio(BigDecimal.ZERO);
                                     }
+                                    // 判断此sku是否参加活动 并计算活动积分
+                                    getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, sku, orderGiftScoreRulesVo);
                                     giftGoodsScoreDetailMap.put(sku, orderGiftScoreRulesVo);
                                     goodsDataMap.remove(sku);
                                 }
                             }
-                        });
+                        }
+
                     }
                     if (pointsType.equals(Constants.MemberScoreRulesEnum.ZERO.getCode())) {
                         // 门店
                         Collection<GoodsEntity> goodsEntityCollection = goodsDataMap.values();
-                        goodsEntityCollection.forEach(goodsEntity -> {
+                        for(GoodsEntity goodsEntity : goodsEntityCollection){
                             Integer storeId1 = goodsEntity.getStoreId();
                             String sku = goodsEntity.getSku();
                             OrderGiftScoreRulesVo orderGiftScoreRulesVo = new OrderGiftScoreRulesVo();
                             orderGiftScoreRulesVo.setGenerateType(Constants.MemberScoreRulesEnum.ZERO.getCode());
+                            BigDecimal bigDecimal = new BigDecimal(0);
                             if (storeId.equals(storeId1)) {
                                 // 订单中该sku的总金额
                                 BigDecimal money = goodsMap.get(sku);
                                 if (ratio.compareTo(BigDecimal.ZERO) != 0) {
                                     // 算出所积的分
-                                    BigDecimal bigDecimal = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR);
+                                    bigDecimal = money.multiply(ratio).setScale(0, BigDecimal.ROUND_FLOOR);
                                     int giftScore = bigDecimal.add(new BigDecimal(memberScore.get())).intValue();
                                     memberScore.set(giftScore);
                                     orderGiftScoreRulesVo.setGiftScore(bigDecimal.intValue());
@@ -2732,10 +2763,15 @@ public class OrderServiceImpl implements OrderService {
                                     orderGiftScoreRulesVo.setGenerateRatio(BigDecimal.ZERO);
                                 }
                             }
+
+                            // 判断此sku是否参加活动 并计算活动积分
+                            getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, sku, orderGiftScoreRulesVo);
                             giftGoodsScoreDetailMap.put(sku, orderGiftScoreRulesVo);
-                        });
+                        }
+
                     }
-                });
+                }
+
                 goodsSkuList.forEach(s -> {
                     if (!giftGoodsScoreDetailMap.containsKey(s)) {
                         OrderGiftScoreRulesVo orderGiftScoreRulesVo = new OrderGiftScoreRulesVo();
@@ -2789,6 +2825,7 @@ public class OrderServiceImpl implements OrderService {
             consumptionRecords.setMemberCode(memberCode);
             consumptionRecords.setMemberPhone(memberPhone);
             consumptionRecords.setOrderGiftScore(memberScore.get());
+            consumptionRecords.setActivityGiftScore(activityGiftScore.get());
             consumptionRecords.setDeductionScore(deductionScore);
             consumptionRecords.setCreaterSn(userId + "");
             consumptionRecords.setCreateTime(new Date());
@@ -2799,11 +2836,11 @@ public class OrderServiceImpl implements OrderService {
                 syncMemberConsumeRecord(memberPhone, order, deductionScore);
                 if (deductionScore > 0) {
                     // 积分变动接口,下单扣减
-                    syncMemberScoreChangeRecord(openId, order, deductionScore, "下单扣减", queryGoodsVOList, giftGoodsScoreDetailMap, HaiKongMemberScoreChangeEventEnum.SUBTRACT.getEvent());
+                    syncMemberScoreChangeRecord(openId, order, deductionScore,null, "下单扣减", queryGoodsVOList, giftGoodsScoreDetailMap, HaiKongMemberScoreChangeEventEnum.SUBTRACT.getEvent());
                 }
                 Integer score = memberScore.get();
                 if (score > 0) {
-                    syncMemberScoreChangeRecord(openId, order, score, "下单赠送", queryGoodsVOList, giftGoodsScoreDetailMap, HaiKongMemberScoreChangeEventEnum.ADD.getEvent());
+                    syncMemberScoreChangeRecord(openId, order, score,activityGiftScore, "下单赠送", queryGoodsVOList, giftGoodsScoreDetailMap, HaiKongMemberScoreChangeEventEnum.ADD.getEvent());
                 }
             }
 
@@ -2848,6 +2885,37 @@ public class OrderServiceImpl implements OrderService {
     }
 
     /**
+     * 计算sku实际赠送积分 和 订单总赠送积分
+     * @param activityGiftScore
+     * @param baseScore
+     * @param mkActivitiesEntityMap
+     * @param sku
+     */
+    private void getGiftScore(AtomicReference<Integer> activityGiftScore, BigDecimal baseScore
+            , Map<String, MkActivitiesPresentIntegralEntity> mkActivitiesEntityMap, String sku, OrderGiftScoreRulesVo orderGiftScoreRulesVo) {
+        if(mkActivitiesEntityMap.containsKey(sku)){
+            // 存在表示它参加赠送积分活动
+            MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegralEntity = mkActivitiesEntityMap.get(sku);
+            // 计算活动积分
+            if(ActivityGiveTypeEnum.FIXED_VALUE.getCode().equals(mkActivitiesPresentIntegralEntity.getActivityGiveType())){
+                // 固定值  那赠送积分就是固定值
+                BigDecimal giftScoreTmp = mkActivitiesPresentIntegralEntity.getActivityGiveNum();
+                // 此sku赠送的积分加上之前赠送的积分 算出来订单赠送总分
+                int giftScore = giftScoreTmp.add(new BigDecimal(activityGiftScore.get())).intValue();
+                activityGiftScore.set(giftScore);
+                orderGiftScoreRulesVo.setActivityGiftScore(giftScoreTmp.intValue());
+            } else if(ActivityGiveTypeEnum.MULTIPLYING_POWER.getCode().equals(mkActivitiesPresentIntegralEntity.getActivityGiveType())){
+                // 计算积分  sku实际积分 * 赠送倍率 = 赠送积分
+                BigDecimal giftScoreTmp = baseScore.multiply(mkActivitiesPresentIntegralEntity.getActivityGiveNum()).setScale(0, BigDecimal.ROUND_FLOOR);
+                // 赠送积分加上 之前的积分 算出订单总赠送积分
+                int giftScore = giftScoreTmp.add(new BigDecimal(activityGiftScore.get())).intValue();
+                activityGiftScore.set(giftScore);
+                orderGiftScoreRulesVo.setActivityGiftScore(giftScoreTmp.intValue());
+            }
+        }
+    }
+
+    /**
      * 免税mall创建订单
      * @param order             订单信息:包含订单信息,支付信息,跨境信息
      * @param orderGoodsVoList  订单详情数据
@@ -3400,15 +3468,17 @@ public class OrderServiceImpl implements OrderService {
      * 同步会员积分变动记录
      * @param openId    会员openid
      * @param order     订单信息
-     * @param changeEvent 变动事件
+     * @param score     变动积分
+     * @param activityScore
      * @param changeReason 变动原因
      * @param goodsList 商品详情
      * @param giftGoodsScoreDetailMap 赠送积分详情
-     * @param score     变动积分
+     * @param changeEvent 变动事件
      */
     private void syncMemberScoreChangeRecord(String openId,
                                              OrderVo order,
                                              Integer score,
+                                             AtomicReference<Integer> activityScore,
                                              String changeReason,
                                              List<QueryGoodsVO> goodsList,
                                              Map<String, OrderGiftScoreRulesVo> giftGoodsScoreDetailMap,
@@ -3422,6 +3492,9 @@ public class OrderServiceImpl implements OrderService {
         memberScoreChangeDTO.setOpenId(openId);
         memberScoreChangeDTO.setOutBizNo(order.getOrder_sn());
         memberScoreChangeDTO.setScore(score);
+        if(!Objects.isNull(activityScore)){
+            memberScoreChangeDTO.setActivityScore(activityScore.get());
+        }
         BeanUtils.copyProperties(memberScoreChangeDTO, haiKongMemberScoreChangeRecordEntity);
         Date date = new Date();
         haiKongMemberScoreChangeRecordEntity.setCreateTime(date);
@@ -3459,6 +3532,7 @@ public class OrderServiceImpl implements OrderService {
                     entity.setGenerateRatio(orderGiftScoreRulesVo.getGenerateRatio());
                     entity.setGenerateRules(orderGiftScoreRulesVo.getGenerateType());
                     entity.setGiftScore(orderGiftScoreRulesVo.getGiftScore());
+                    entity.setActivityGiftScore(orderGiftScoreRulesVo.getActivityGiftScore());
                 }
                 entity.setOrderSn(order.getOrder_sn());
                 entity.setRetailPrice(goodsEntity.getRetailPrice());
@@ -4069,7 +4143,7 @@ public class OrderServiceImpl implements OrderService {
                 // 计算综合税率
                 BigDecimal taxRate = tax.divide(pretaxPrice, 4, RoundingMode.HALF_UP);
                 // 消费税率
-                BigDecimal saleTaxRate = new BigDecimal(taxDetailDto.getSaleTaxRate()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
+                BigDecimal saleTaxRate = new BigDecimal(Objects.isNull(taxDetailDto.getSaleTaxRate()) ? "0" : taxDetailDto.getSaleTaxRate() ).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
                 // 综合税率
                 BigDecimal vatRate = new BigDecimal(taxDetailDto.getVatRate()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
 //              消费税 = (明细商品总价 / (1-消费税税率)) * 消费税税率
@@ -4469,7 +4543,8 @@ public class OrderServiceImpl implements OrderService {
         List<String> promotionSkuList = new ArrayList<>();
         // 判断活动类型并排序,再确定购物栏中商品是否满足活动条件
         mkActivitiesEntityList.stream().filter(mkActivitiesEntity -> {
-            if (!Constants.ActivityTopicEnum.JFDK.getTopicCode().equals(mkActivitiesEntity.getMkaTopic())) {
+            if (!Constants.ActivityTopicEnum.JFDK.getTopicCode().equals(mkActivitiesEntity.getMkaTopic())
+                    && !Constants.ActivityTopicEnum.ZSJF.getTopicCode().equals(mkActivitiesEntity.getMkaTopic())) {
                 return true;
             }
             if (Objects.isNull(mkActivitiesEntity.getPriority())) {
@@ -4516,6 +4591,8 @@ public class OrderServiceImpl implements OrderService {
                             goodsDetailsDto.setActivity(Constants.ActivityTopicEnum.LSCX.getTopicName());
                             // 优惠价格 应该用优惠后的特价价格 乘以 数量
                             goodsDetailsDto.setDiscountedPrice((retailPrice.subtract(activityPrice)).multiply(new BigDecimal(goodsDetailsDto.getSellVolume())));
+                            // 不涉及到积分时  其他优惠就是优惠金额
+                            goodsDetailsDto.setOtherDiscountedPrice(goodsDetailsDto.getDiscountedPrice());
                             goodsDetailsDto.setDeductionPrice(null);
                             activityFlag.set(false);
                             promotionActivityFlag.set(true);
@@ -4558,6 +4635,8 @@ public class OrderServiceImpl implements OrderService {
                                     goodsDetailsDto.setActivity(Constants.ActivityTopicEnum.MZ.getTopicName());
                                     goodsDetailsDto.setGiftNumber(mkActivitiesFullGiftEntity.getGiftNumber());
                                     goodsDetailsDto.setDiscountedPrice(goodsEntity.getRetailPrice());
+                                    // 不涉及到积分时  其他优惠就是优惠金额
+                                    goodsDetailsDto.setOtherDiscountedPrice(goodsDetailsDto.getDiscountedPrice());
                                     goodsDetailsDto.setDeductionPrice(null);
                                     // 添加进商品详情列表
                                     goodsDetailsDtos.add(goodsDetailsDto);
@@ -4591,6 +4670,8 @@ public class OrderServiceImpl implements OrderService {
                                     goodsDetailsDto.setActivity(Constants.ActivityTopicEnum.MZ.getTopicName());
                                     goodsDetailsDto.setGiftNumber(mkActivitiesFullGiftEntity.getGiftNumber());
                                     goodsDetailsDto.setDiscountedPrice(goodsEntity.getRetailPrice());
+                                    // 不涉及到积分时  其他优惠就是优惠金额
+                                    goodsDetailsDto.setOtherDiscountedPrice(goodsDetailsDto.getDiscountedPrice());
                                     goodsDetailsDto.setDeductionPrice(null);
                                     // 添加进商品详情列表
                                     goodsDetailsDtos.add(goodsDetailsDto);
@@ -4648,6 +4729,8 @@ public class OrderServiceImpl implements OrderService {
                                     goodsDetailsDto.setGoodstaxes(String.valueOf(tax.multiply(new BigDecimal(goodsDetailsDto.getSellVolume()))));
                                     goodsDetailsDto.setActivity(Constants.ActivityTopicEnum.YHQ.getTopicName());
                                     goodsDetailsDto.setDiscountedPrice(retailPrice.subtract(discountAfterPrice));
+                                    // 不涉及到积分时  其他优惠就是优惠金额
+                                    goodsDetailsDto.setOtherDiscountedPrice(goodsDetailsDto.getDiscountedPrice());
                                     goodsDetailsDto.setDeductionPrice(null);
                                     goodsDetailsDtos.add(goodsDetailsDto);
                                     activityFlag.set(false);
@@ -4677,6 +4760,8 @@ public class OrderServiceImpl implements OrderService {
                                     goodsDetailsDto.setGoodstaxes(String.valueOf(tax.multiply(new BigDecimal(goodsDetailsDto.getSellVolume()))));
                                     goodsDetailsDto.setActivity(Constants.ActivityTopicEnum.YHQ.getTopicName());
                                     goodsDetailsDto.setDiscountedPrice(retailPrice.subtract(discountAfterPrice));
+                                    // 不涉及到积分时  其他优惠就是优惠金额
+                                    goodsDetailsDto.setOtherDiscountedPrice(goodsDetailsDto.getDiscountedPrice());
                                     goodsDetailsDto.setDeductionPrice(null);
                                     goodsDetailsDtos.add(goodsDetailsDto);
                                     activityFlag.set(false);
@@ -4707,6 +4792,8 @@ public class OrderServiceImpl implements OrderService {
                                         goodsDetailsDto.setGoodstaxes(String.valueOf(tax.multiply(new BigDecimal(goodsDetailsDto.getSellVolume()))));
                                         goodsDetailsDto.setActivity(Constants.ActivityTopicEnum.YHQ.getTopicName());
                                         goodsDetailsDto.setDiscountedPrice(retailPrice.subtract(discountAfterPrice));
+                                        // 不涉及到积分时  其他优惠就是优惠金额
+                                        goodsDetailsDto.setOtherDiscountedPrice(goodsDetailsDto.getDiscountedPrice());
                                         goodsDetailsDto.setDeductionPrice(null);
                                         goodsDetailsDtos.add(goodsDetailsDto);
                                         activityFlag.set(false);
@@ -4734,7 +4821,8 @@ public class OrderServiceImpl implements OrderService {
             queryGoodsVo.setTotalPrice(good.getActualPaymentAmount().multiply(BigDecimal.valueOf(good.getSellVolume())));
             orderTotalPrice = orderTotalPrice.add(good.getRetailPrice().multiply(BigDecimal.valueOf(good.getSellVolume())));// 订单总金额 改为用零售价*数量
             // 订单总价 总价减去 优惠活动的优惠价格 后续积分优惠 也从总金额中减去(打补丁操作
-            // 这块设计有问题 :后续积分优惠金额  由总金额减去积分抵扣金额 但没有处理其他活动的优惠金额  补丁内容:如果这里有参加其他活动的商品 优惠金额要在这里减去)
+            // 这块设计有问题 :后续积分优惠金额  由总金额减去积分抵扣金额 但没有处理其他活动的优惠金额
+            // 补丁内容:如果这里有参加其他活动的商品 优惠金额要在这里减去)
             orderTotalPrice = orderTotalPrice.subtract(good.getDiscountedPrice());
             goodsVos.add(queryGoodsVo);
         }
@@ -5027,6 +5115,9 @@ public class OrderServiceImpl implements OrderService {
                     }
                     // 设置总优惠金额
                     goodsDetailsDto.setDiscountedPrice(discountedPrice);
+                    // 设置其他优惠金额
+                    BigDecimal otherPrice = discountedPrice.subtract(goodsDetailsDto.getDeductionPrice());
+                    goodsDetailsDto.setOtherDiscountedPrice(otherPrice);
                     LOGGER.info("--------------------------------------------------------");
                     LOGGER.info("【计算优惠价】sku:【{}】,条码:【{}】积分抵扣{}元,抵扣积分{}分", sku, prodBarcode, goodsDetailsDto.getDiscountedPrice(), shareScore.intValue());
                     LOGGER.info("--------------------------------------------------------");

+ 186 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/mk/MkActivitiesPresentIntegralServiceImpl.java

@@ -0,0 +1,186 @@
+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;
+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.*;
+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.*;
+
+/**
+ * 营销活动-赠送积分Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-14 10:20:48
+ */
+@Service("mkActivitiesPresentIntegralService")
+public class MkActivitiesPresentIntegralServiceImpl implements MkActivitiesPresentIntegralService {
+    private static final Logger log = LoggerFactory.getLogger(MkActivitiesPresentIntegralServiceImpl.class);
+    @Autowired
+    private MkActivitiesPresentIntegralDao mkActivitiesPresentIntegralDao;
+    @Autowired
+    private Mall2PointsRulesService mall2PointsRulesService;
+
+    @Override
+    public MkActivitiesPresentIntegralEntity queryObject(Long mapId) {
+        return mkActivitiesPresentIntegralDao.queryObject(mapId);
+    }
+
+    @Override
+    public List<MkActivitiesPresentIntegralEntity> queryList(Map<String, Object> map) {
+        return mkActivitiesPresentIntegralDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        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));
+        // 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());
+        map.put("mkaId",mkActivitiesPresentIntegral.getMkaId());
+        String prodBarcode = mall2PointsRulesService.queryProdBarcode(map);
+        if (Objects.isNull(prodBarcode)){
+            return R.error("该门店没有sku:"+mkActivitiesPresentIntegral.getSku());
+        }
+        mkActivitiesPresentIntegral.setBarcode(prodBarcode);
+//        mkActivitiesPresentIntegral.setShopSn(Integer.toString(userEntity.getStoreId()));
+        mkActivitiesPresentIntegral.setCreateTime(new Date());
+        mkActivitiesPresentIntegral.setUpdateTime(new Date());
+        log.debug("添加营销活动-赠送积分数据:{}",JacksonUtil.toJson(mkActivitiesPresentIntegral));
+        int save = mkActivitiesPresentIntegralDao.save(mkActivitiesPresentIntegral);
+        if (save <=0){
+            return R.error("添加错误");
+        }
+        return R.ok();
+    }
+
+    @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 条码的准确性
+        Map<String, Object> map = new HashMap<>();
+        map.put("sku",mkActivitiesPresentIntegral.getSku());
+        map.put("mkaId",mkActivitiesPresentIntegral.getMkaId());
+        String prodBarcode = mall2PointsRulesService.queryProdBarcode(map);
+        if (Objects.isNull(prodBarcode)){
+            return R.error("该门店没有sku:"+mkActivitiesPresentIntegral.getSku());
+        }
+        mkActivitiesPresentIntegral.setBarcode(prodBarcode);
+//        mkActivitiesPresentIntegral.setShopSn(Integer.toString(userEntity.getStoreId()));
+        mkActivitiesPresentIntegral.setCreateTime(new Date());
+        mkActivitiesPresentIntegral.setUpdateTime(new Date());
+        log.debug("修改营销活动-赠送积分数据:{}",JacksonUtil.toJson(mkActivitiesPresentIntegral));
+        int update = mkActivitiesPresentIntegralDao.update(mkActivitiesPresentIntegral);
+        if (update <=0){
+            return R.error("更新错误");
+        }
+        return R.ok();
+    }
+
+    @Override
+    public int delete(Long mapId) {
+        return mkActivitiesPresentIntegralDao.delete(mapId);
+    }
+
+    @Override
+    public int deleteBatch(Long[]mapIds) {
+        return mkActivitiesPresentIntegralDao.deleteBatch(mapIds);
+    }
+
+    /**
+     * 根据门店id和当前时间和活动类型查询有那些sku参加了积分抵扣活动
+     *
+     * @param storeId
+     * @param currentTime
+     * @param mkaTopic
+     * @return
+     */
+    @Override
+    public List<MkActivitiesPresentIntegralEntity> querySkuByNow(String storeId, String currentTime, String mkaTopic) {
+        return mkActivitiesPresentIntegralDao.querySkuByNow(storeId,currentTime,mkaTopic);
+    }
+
+    @Override
+    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("导入成功");
+    }
+}

+ 14 - 1
kmall-admin/src/main/java/com/kmall/admin/service/impl/mk/MkActivitiesServiceImpl.java

@@ -7,11 +7,15 @@ import com.kmall.admin.entity.mk.MkActivitiesEntity;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.admin.haikong.constant.Constants;
 import com.kmall.admin.service.MkActivitiesPromotionService;
+import com.kmall.admin.service.mk.MkActivitiesPresentIntegralService;
 import com.kmall.admin.service.mk.MkActivitiesScoreService;
 import com.kmall.admin.service.mk.MkActivitiesService;
 import com.kmall.admin.utils.ShiroUtils;
+import com.kmall.admin.utils.jackson.JacksonUtil;
 import com.kmall.common.utils.BeanUtils;
 import com.kmall.common.utils.RRException;
+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;
@@ -30,6 +34,7 @@ import java.util.stream.Collectors;
  */
 @Service("mkActivitiesService")
 public class MkActivitiesServiceImpl implements MkActivitiesService {
+    private static final Logger logger = LoggerFactory.getLogger(MkActivitiesServiceImpl.class);
     @Autowired
     private MkActivitiesDao mkActivitiesDao;
     @Autowired
@@ -41,6 +46,9 @@ public class MkActivitiesServiceImpl implements MkActivitiesService {
     @Autowired
     private MkActivitiesPromotionService mkActivitiesPromotionService;
 
+    @Autowired
+    private MkActivitiesPresentIntegralService mkActivitiesPresentIntegralService;
+
     @Override
     public MkActivitiesEntity queryObject(Long mkaId) {
         return mkActivitiesDao.queryObject(mkaId);
@@ -119,18 +127,23 @@ public class MkActivitiesServiceImpl implements MkActivitiesService {
             mkActivitiesScoreService.deleteBatchByMkaId(mkaId);
         } else if (Constants.ActivityTopicEnum.LSCX.getTopicCode().equals(mkActivitiesEntity.getMkaTopic())) {
             mkActivitiesPromotionService.deleteBatchByMkaId(mkaId);
+        } else if (Constants.ActivityTopicEnum.ZSJF.getTopicCode().equals(mkActivitiesEntity.getMkaTopic())){
+            mkActivitiesPresentIntegralService.deleteByMkaId(mkaId);
         }
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int deleteBatch(Long[]mkaIds) {
-        mkActivitiesDao.deleteBatch(mkaIds);
+        logger.debug("删除参数:{}", JacksonUtil.toJson(mkaIds));
         List<Integer> integerList = Arrays.stream(mkaIds).map(Long::intValue).collect(Collectors.toList());
         List<MkActivitiesEntity> mkActivitiesEntities = queryListByMkaIdList(integerList);
+        logger.debug("营销活动删除数据集合:{}",JacksonUtil.toJson(mkActivitiesEntities));
         for (MkActivitiesEntity mkActivitiesEntity : mkActivitiesEntities) {
+            logger.debug("营销活动删除数据:{}",JacksonUtil.toJson(mkActivitiesEntity));
             deleteByTopic(mkActivitiesEntity);
         }
+        mkActivitiesDao.deleteBatch(mkaIds);
         mkActivitiesAssociationDao.deleteBatch(mkaIds);
         return 1;
     }

+ 59 - 5
kmall-admin/src/main/java/com/kmall/admin/service/impl/mk/MkActivityFormServiceImpl.java

@@ -1,18 +1,27 @@
 package com.kmall.admin.service.impl.mk;
 
+import com.kmall.admin.cuspay.aop.AspectWebLog;
 import com.kmall.admin.dao.mk.MkActivityFormDao;
+import com.kmall.admin.entity.mk.MkActivitiesAssociationEntity;
 import com.kmall.admin.entity.mk.MkActivitiesEntity;
 import com.kmall.admin.entity.mk.MkActivityFormEntity;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
+import com.kmall.admin.service.mk.MkActivitiesAssociationService;
+import com.kmall.admin.service.mk.MkActivitiesService;
 import com.kmall.admin.service.mk.MkActivityFormService;
 import com.kmall.admin.utils.ShiroUtils;
+import com.kmall.admin.utils.jackson.JacksonUtil;
+import com.kmall.common.constant.Dict;
+import com.kmall.common.utils.R;
 import com.kmall.common.utils.RRException;
+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.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 活动形式表Service实现类
@@ -23,8 +32,13 @@ import java.util.Map;
  */
 @Service("mkActivityFormService")
 public class MkActivityFormServiceImpl implements MkActivityFormService {
+    private static final Logger logger = LoggerFactory.getLogger(MkActivityFormServiceImpl.class);
     @Autowired
     private MkActivityFormDao mkActivityFormDao;
+    @Autowired
+    private MkActivitiesAssociationService mkActivitiesAssociationService;
+    @Autowired
+    private MkActivitiesService mkActivitiesService;
 
     @Override
     public MkActivityFormEntity queryObject(Long mmId) {
@@ -71,8 +85,48 @@ public class MkActivityFormServiceImpl implements MkActivityFormService {
     }
 
     @Override
-    public int deleteBatch(Long[]mmIds) {
-        return mkActivityFormDao.deleteBatch(mmIds);
+    @Transactional(rollbackFor = Exception.class)
+    public R deleteBatch(Long[]mmIds) {
+        List<MkActivityFormEntity> mkActivityFormEntities = mkActivityFormDao.listBymmIds(mmIds);
+        logger.debug("活动形式删除数据:{}", JacksonUtil.toJson(mkActivityFormEntities));
+        if (!mkActivityFormEntities.isEmpty()){
+            //不为空说明下一级菜单有
+            for (Long mmid : mmIds) {
+                MkActivityFormEntity mkActivitiesEntity=null;
+                for (MkActivityFormEntity activitiesEntity:
+                        mkActivityFormEntities) {
+                    if (mmid.equals(activitiesEntity.getMmId())){
+                        mkActivitiesEntity=activitiesEntity;
+                    }
+                }
+                // mkActivitiesEntity对象为空跳出循环 应该是不会为空
+                if (Objects.isNull(mkActivitiesEntity)){
+                    continue;
+                }
+                logger.debug("当前删除的活动形式数据:{}",JacksonUtil.toJson(mkActivitiesEntity));
+                String mkCode = mkActivitiesEntity.getMkCode();
+                //第二层 营销活动-活动关联表
+                HashMap<String, Object> map = new HashMap<>();
+                map.put("mkCode",mkCode);
+                List<MkActivitiesAssociationEntity> mkActivitiesAssociationEntities = mkActivitiesAssociationService.queryList(map);
+                logger.debug("营销活动-活动关联表数据:{}",JacksonUtil.toJson(mkActivitiesAssociationEntities));
+                if (mkActivitiesAssociationEntities.isEmpty()){
+                    //查询出来的活动关联为空
+                    continue;
+                }
+                List<Long> mkaIds = mkActivitiesAssociationEntities.stream().map(bean -> bean.getMkaId()).collect(Collectors.toList());
+                Long[] longs = mkaIds.toArray(new Long[]{});
+//            mkActivitiesAssociationEntities.stream().map(Long::get).collect(Collectors.toList());
+                //第三层 营销活动表
+                //第四层 营销活动对应具体活动
+                logger.debug("营销活动-活动关联删除数据:{}",JacksonUtil.toJson(longs));
+                mkActivitiesService.deleteBatch(longs);
+            }
+        }
+
+        //第一层删除  活动形式表
+        mkActivityFormDao.deleteBatch(mmIds);
+        return R.ok("删除成功");
     }
 
     @Override

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

@@ -0,0 +1,85 @@
+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 com.kmall.common.constant.Dict;
+import com.kmall.common.utils.R;
+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 R save(Mall2RulesDto mall2RulesDto) {
+        Integer rulesType = mall2PointsRulesService.getRulesDetilId(mall2RulesDto.getMkaId());
+        mall2RulesDto.setRulesType(Integer.toString(rulesType));
+        if (Dict.pointsType.item_0.getItem().equals(rulesType.toString())){
+            //门店再设置
+            mall2RulesDto.setStoreName(mall2RulesDto.getPointsRulesName());
+        }
+        List<Mall2RulesDto> mall2RulesDtos = new ArrayList<>();
+        mall2RulesDtos.add(mall2RulesDto);
+        return mall2PointsRulesService.rulesUploadDetil(mall2RulesDtos, mall2RulesDto.getMkaId(),false);
+    }
+
+    @Override
+    public R update(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(),true);
+    }
+
+    @Override
+    public int delete(Integer id) {
+        return mall2PointsRulesDetilDao.delete(id);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]ids) {
+        return mall2PointsRulesDetilDao.deleteBatch(ids);
+    }
+
+    @Override
+    public Integer deleteByFatherId(Integer fatherId) {
+        return mall2PointsRulesDetilDao.deleteByFatherId(fatherId);
+    }
+}

+ 231 - 21
kmall-admin/src/main/java/com/kmall/admin/service/impl/vip/Mall2PointsRulesServiceImpl.java

@@ -1,22 +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.GoodsDto;
 import com.kmall.admin.dto.Mall2RulesDto;
-import com.kmall.admin.entity.GoodsEntity;
-import com.kmall.admin.entity.vip.Mall2DetilEntity;
+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;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import com.kmall.admin.dao.vip.Mall2PointsRulesDao;
 import com.kmall.admin.entity.vip.Mall2PointsRulesEntity;
@@ -31,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
@@ -39,6 +43,8 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
     private ProductStoreRelaDao productStoreRelaDao;
     @Autowired
     private CategoryDao categoryDao;
+    @Autowired
+    private Mall2PointsRulesDetilService mall2PointsRulesDetilService;
 
 
     @Override
@@ -57,66 +63,260 @@ 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("已存在该积分类型有效数据,请确认再进行操作");
+        }
+        //积分规则适用开始时间
+        Date pointsBeginTime = mall2PointsRules.getPointsBeginTime();
+        //积分规则适用结束时间
+        Date pointsEndTime = mall2PointsRules.getPointsEndTime();
+        // 开始时间>结束时间 时间设置有问题
+        if (pointsBeginTime.getTime() > pointsEndTime.getTime()){
+            return R.error("设置的开始时间和结束时间冲突");
+        }
+
+        log.debug("积分规则添加数据:{}",JacksonUtil.toJson(mall2PointsRules));
+        mall2PointsRulesDao.save(mall2PointsRules);
+
+        return R.ok("添加成功");
     }
 
     @Override
-    public int update(Mall2PointsRulesEntity mall2PointsRules) {
-        return mall2PointsRulesDao.update(mall2PointsRules);
+    public R update(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("已存在该积分类型有效数据,请确认再进行操作");
+        }
+        //积分规则适用开始时间
+        Date pointsBeginTime = mall2PointsRules.getPointsBeginTime();
+        //积分规则适用结束时间
+        Date pointsEndTime = mall2PointsRules.getPointsEndTime();
+        // 开始时间>结束时间 时间设置有问题
+        if (pointsBeginTime.getTime() > pointsEndTime.getTime()){
+            return R.error("设置的开始时间和结束时间冲突");
+        }
+        log.debug("积分规则修改数据:{}",JacksonUtil.toJson(mall2PointsRules));
+        mall2PointsRulesDao.update(mall2PointsRules);
+        return R.ok("修改成功");
     }
 
     @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);
     }
 
     @Override
     public int deleteBatch(Integer[]mprIds) {
+        log.debug("积分规则删除参数:{}",JacksonUtil.toJson(mprIds));
+        for (int i = 0; i < mprIds.length; i++) {
+            Integer mprId=mprIds[i];
+            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.deleteBatch(mprIds);
     }
 
 
     /**
      * 积分规则明细导入
+     * 使用原来逻辑和修改整合在一起
+     * isUpdate是否是修改
      * @param pointsRulesList
      * @param mkaId
      */
     @Override
-    public void rulesUploadDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId) {
+    public R rulesUploadDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId,Boolean isUpdate) {
+        /**
+         * 导入会出现重复数据并且数据库里没有
+         *  数据长度大于1的时候说明是导入进行校验
+         *  为1时 是导入或者界面添加
+         */
+        if (pointsRulesList.size() >1){
+            for (int i = 0; i < pointsRulesList.size(); i++) {
+                String pointsRulesName = Objects.isNull(pointsRulesList.get(i).getPointsRulesName()) ? "":pointsRulesList.get(i).getPointsRulesName();
+                String storeName = Objects.isNull(pointsRulesList.get(i).getStoreName()) ? "" : pointsRulesList.get(i).getStoreName();
+                if (Objects.isNull(pointsRulesName) || Objects.isNull(storeName)){
+                    continue;
+                }
+                for (int j = i+1; j < pointsRulesList.size(); j++) {
+                    String pointsRulesName1 = Objects.isNull(pointsRulesList.get(j).getPointsRulesName()) ? "": pointsRulesList.get(j).getPointsRulesName();
+                    String storeName1 = Objects.isNull(pointsRulesList.get(j).getStoreName()) ? "" : pointsRulesList.get(j).getStoreName();
+                    log.debug("前一个数据 pointsRulesName:{},storeName:{}",pointsRulesName,storeName);
+                    log.debug("后一个数据 pointsRulesName:{},storeName:{}",pointsRulesName1,storeName1);
+                    if (pointsRulesName.equals(pointsRulesName1) && storeName.equals(storeName1)){
+                        //都相等
+                        return R.error("导入存在重复数据");
+                    }
+                }
+
+            }
+        }
+        StringBuilder stringBuilder = new StringBuilder();
         Integer pointsType = mall2PointsRulesDao.queryRulesDetilId(mkaId);
         if(pointsRulesList.size()>0){
             for(Mall2RulesDto mall2RulesDto : pointsRulesList) {
+                log.debug("积分规则明细导入数据:{}",JacksonUtil.toJson(mall2RulesDto));
                 //校验参数
                 checkMsg(pointsType,mall2RulesDto);
+                //获取门店ID
+                Long id = storeDao.queryObjectRulesByName(Objects.isNull(mall2RulesDto.getStoreName()) ? "": mall2RulesDto.getStoreName().trim());
+                if (Objects.isNull(id)){
+                    return R.error("门店名称不存在请确认再进行添加");
+                }
+                mall2RulesDto.setStoreId(id);
                 switch (pointsType) {
                     //门店
                     case 0:
-                        mall2RulesDto.setRulesId(storeDao.queryObjectRulesByName(mall2RulesDto.getPointsRulesName().trim()) + "");
+                        Long store = storeDao.queryObjectRulesByName(mall2RulesDto.getPointsRulesName().trim());
+                        if (Objects.isNull(store)){
+                            stringBuilder.append(mall2RulesDto.getPointsRulesName()+"的门店名称不存在请确认再添加,");
+                            continue;
+//                            return R.error("门店名称不存在请确认再添加");
+                        }
+                        mall2RulesDto.setRulesId(store+"");
                         break;
                     //商品类别
                     case 1:
-                        mall2RulesDto.setRulesId(categoryDao.queryObjectCategoryByName(mall2RulesDto.getPointsRulesName().trim()) + "");
+                        Long category = categoryDao.queryObjectCategoryByName(mall2RulesDto.getPointsRulesName().trim());
+                        if (Objects.isNull(category)){
+                            stringBuilder.append(mall2RulesDto.getPointsRulesName()+"的类别名称不存在请确认再添加,");
+                            continue;
+//                            return R.error("类别名称不存在请确认再添加");
+                        }
+                        mall2RulesDto.setRulesId( category+ "");
                         break;
                     //商品
                     case 2:
-                        //获取门店ID
-                        Long id = storeDao.queryObjectRulesByName(mall2RulesDto.getStoreName().trim());
-                        mall2RulesDto.setStoreId(id);
-                        mall2RulesDto.setRulesId(productStoreRelaDao.queryproductStoreByName(mall2RulesDto.getPointsRulesName().trim(), id));
+                        String s = productStoreRelaDao.queryproductStoreByName(mall2RulesDto.getPointsRulesName().trim(), id);
+                        if (Objects.isNull(s)){
+                            stringBuilder.append(mall2RulesDto.getPointsRulesName()+"的商品条码不存在请确认再添加,");
+                            continue;
+//                            return R.error("商品条码不存在请确认再添加");
+                        }
+                        mall2RulesDto.setRulesId(mall2RulesDto.getPointsRulesName().trim());
+                        mall2RulesDto.setPointsRulesName(s);
                         break;
                     default:
                         break;
                 }
                 mall2RulesDto.setMkaId(mkaId);
                 mall2RulesDto.setPointsRulesType(pointsType);
+                mall2RulesDto.setPointsRulesName(mall2RulesDto.getPointsRulesName().trim());
+                HashMap<String, Object> map = new HashMap<>();
+                map.put("pointsDetilNameId",mall2RulesDto.getRulesId());
+                map.put("storeName",mall2RulesDto.getStoreName());
+                map.put("mkaId",mkaId);
+                Query query = new Query(map);
 
+                List<Mall2RulesDto> mall2RulesDtos = mall2PointsRulesDao.querymall2PointsRulesDetil(query);
+                if (!mall2RulesDtos.isEmpty()){
+                    stringBuilder.append(mall2RulesDto.getPointsRulesName()+"已存在,无法添加");
+                }
             }
-            if(pointsRulesList.size()>0){
+            if (stringBuilder.length()>0){
+                return R.error(stringBuilder.toString());
+            }
+
+            if(pointsRulesList.size()>0 && isUpdate == false){
+                log.debug("积分规则明细导入数据:{}", JacksonUtil.toJson(pointsRulesList));
                 mall2PointsRulesDao.saveMall2PointsRulesDetil(pointsRulesList);
             }
+            if(pointsRulesList.size()>0 && isUpdate){
+                log.debug("积分规则明细修改数据:{}", JacksonUtil.toJson(pointsRulesList));
+                mall2PointsRulesDao.updateMall2PointsRulesDetil(pointsRulesList);
+            }
+
+
         }
+        return R.ok();
+    }
 
+    @Override
+    public R updateRulesDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId) {
+        StringBuilder stringBuilder = new StringBuilder();
+        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:
+                        Long store = storeDao.queryObjectRulesByName(mall2RulesDto.getPointsRulesName().trim());
+                        if (Objects.isNull(store)){
+                            stringBuilder.append(mall2RulesDto.getPointsRulesName()+"的门店名称不存在请确认再修改,");
+//                            return R.error("门店名称不存在请确认再添加");
+                        }
+                        mall2RulesDto.setRulesId(store+"");
+                        break;
+                    //商品类别
+                    case 1:
+                        Long category = categoryDao.queryObjectCategoryByName(mall2RulesDto.getPointsRulesName().trim());
+                        if (Objects.isNull(category)){
+                            stringBuilder.append(mall2RulesDto.getPointsRulesName()+"的类别名称不存在请确认再修改,");
+//                            return R.error("类别名称不存在请确认再添加");
+                        }
+                        mall2RulesDto.setRulesId( category+ "");
+                        break;
+                    //商品
+                    case 2:
+                        String s = productStoreRelaDao.queryproductStoreByName(mall2RulesDto.getPointsRulesName().trim(), id);
+                        if (Objects.isNull(s)){
+                            stringBuilder.append(mall2RulesDto.getPointsRulesName()+"的商品条码不存在请确认再修改,");
+//                            return R.error("商品条码不存在请确认再添加");
+                        }
+                        mall2RulesDto.setRulesId(mall2RulesDto.getPointsRulesName().trim());
+                        mall2RulesDto.setPointsRulesName(s);
+                        break;
+                    default:
+                        break;
+                }
+                mall2RulesDto.setMkaId(mkaId);
+                mall2RulesDto.setPointsRulesType(pointsType);
+                mall2RulesDto.setPointsRulesName(mall2RulesDto.getPointsRulesName().trim());
+
+            }
+            if (stringBuilder.length()>0){
+                return R.error(stringBuilder.toString());
+            }
+            if(pointsRulesList.size()>0){
+                log.debug("积分规则明细修改数据:{}", JacksonUtil.toJson(pointsRulesList));
+                mall2PointsRulesDao.updateMall2PointsRulesDetil(pointsRulesList);
+            }
+        }
+        return R.ok();
+    }
+
+    @Override
+    public Integer getRulesDetilId(Long mkaId) {
+        return mall2PointsRulesDao.queryRulesDetilId(mkaId);
     }
 
     /**
@@ -149,8 +349,8 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
      * @return 积分生成规则
      */
     @Override
-    public List<PointsRulesAndDetailVO> queryListByTime(Date nowTime) {
-        return mall2PointsRulesDao.queryListByTime(nowTime);
+    public List<PointsRulesAndDetailVO> queryListByTime(Date nowTime, String storeId) {
+        return mall2PointsRulesDao.queryListByTime(nowTime, storeId);
     }
 
     @Override
@@ -159,6 +359,16 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
         return mall2PointsRulesDao.querymall2PointsRulesDetilTotal(id);
     }
 
+    @Override
+    public List<PointsRulesAndDetailVO> queryList(Mall2PointsRulesDto mall2PointsRulesDto) {
+        return mall2PointsRulesDao.queryListBy(mall2PointsRulesDto);
+    }
+
+    @Override
+    public String queryProdBarcode(Map<String, Object> map) {
+        return productStoreRelaDao.queryProdBarcode(map);
+    }
+
     /**
      * 导入参数校验
      * @param mall2RulesDto

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

@@ -0,0 +1,88 @@
+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;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 营销活动-赠送积分Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2022-04-14 10:20:48
+ */
+public interface MkActivitiesPresentIntegralService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param mapId 主键
+     * @return 实体
+     */
+    MkActivitiesPresentIntegralEntity queryObject(Long mapId);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<MkActivitiesPresentIntegralEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param mkActivitiesPresentIntegral 实体
+     * @return 保存条数
+     */
+    R save(MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegral);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param mkActivitiesPresentIntegral 实体
+     * @return 更新条数
+     */
+    R update(MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegral);
+
+    /**
+     * 根据主键删除
+     *
+     * @param mapId
+     * @return 删除条数
+     */
+    int delete(Long mapId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param mapIds
+     * @return 删除条数
+     */
+    int deleteBatch(Long[]mapIds);
+
+    /**
+     * 根据门店id和当前时间和活动类型查询有那些sku参加了积分抵扣活动
+     * @param storeId
+     * @param currentTime
+     * @param mkaTopic
+     * @return
+     */
+    List<MkActivitiesPresentIntegralEntity> querySkuByNow(String storeId, String currentTime, String mkaTopic);
+
+    Integer deleteByMkaId(int mkaId);
+
+    R uploadExcel(List<ActivitiesPresentIntegralDto> activitiesPresentIntegralDtoList,String storeId, String mkaId);
+}

+ 2 - 1
kmall-admin/src/main/java/com/kmall/admin/service/mk/MkActivityFormService.java

@@ -2,6 +2,7 @@ package com.kmall.admin.service.mk;
 
 import com.kmall.admin.entity.mk.MkActivitiesEntity;
 import com.kmall.admin.entity.mk.MkActivityFormEntity;
+import com.kmall.common.utils.R;
 
 import java.util.List;
 import java.util.Map;
@@ -69,7 +70,7 @@ public interface MkActivityFormService {
      * @param mmIds
      * @return 删除条数
      */
-    int deleteBatch(Long[] mmIds);
+    R deleteBatch(Long[] mmIds);
 
     /**
      * 查询营方式分页总数

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

@@ -0,0 +1,77 @@
+package com.kmall.admin.service.vip;
+
+import com.kmall.admin.dto.Mall2RulesDto;
+import com.kmall.admin.entity.vip.Mall2PointsRulesDetilEntity;
+import com.kmall.common.utils.R;
+
+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 保存条数
+     */
+    R save(Mall2RulesDto Mall2RulesDto);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param mall2RulesDto 实体
+     * @return 更新条数
+     */
+    R update(Mall2RulesDto mall2RulesDto);
+
+    /**
+     * 根据主键删除
+     *
+     * @param id
+     * @return 删除条数
+     */
+    int delete(Integer id);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param ids
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[]ids);
+
+    Integer deleteByFatherId(Integer fatherId);
+
+}

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

@@ -1,12 +1,11 @@
 package com.kmall.admin.service.vip;
 
 import com.kmall.admin.dto.Mall2RulesDto;
-import com.kmall.admin.entity.vip.Mall2DetilEntity;
 import com.kmall.admin.entity.vip.Mall2PointsRulesEntity;
+import com.kmall.admin.dto.Mall2PointsRulesDto;
 import com.kmall.admin.haikong.vo.PointsRulesAndDetailVO;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
-import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
 import java.util.List;
@@ -51,7 +50,7 @@ public interface Mall2PointsRulesService {
      * @param mall2PointsRules 实体
      * @return 保存条数
      */
-    int save(Mall2PointsRulesEntity mall2PointsRules);
+    R save(Mall2PointsRulesEntity mall2PointsRules);
 
     /**
      * 根据主键更新实体
@@ -59,7 +58,7 @@ public interface Mall2PointsRulesService {
      * @param mall2PointsRules 实体
      * @return 更新条数
      */
-    int update(Mall2PointsRulesEntity mall2PointsRules);
+    R update(Mall2PointsRulesEntity mall2PointsRules);
 
     /**
      * 根据主键删除
@@ -77,8 +76,11 @@ public interface Mall2PointsRulesService {
      */
     int deleteBatch(Integer[] mprIds);
 
-    void rulesUploadDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId);
+    R rulesUploadDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId,Boolean isUpdate);
 
+    R updateRulesDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId);
+
+    Integer getRulesDetilId(Long mkaId);
     /**
      * 查询积分明细数据
      * @param query
@@ -92,9 +94,20 @@ public interface Mall2PointsRulesService {
     /**
      * 查询当前时间的积分规则及其明细
      * @param nowTime 当前时间
+     * @param storeId 门店id
      * @return        积分生成规则
      */
-    List<PointsRulesAndDetailVO> queryListByTime(Date nowTime);
+    List<PointsRulesAndDetailVO> queryListByTime(Date nowTime, String storeId);
 
     int querymall2PointsRulesDetilTotal(Query query);
+
+    /**
+     * 根据查询条件积分规则及其明细
+     * @param mall2PointsRulesDto
+     * @return
+     */
+    List<PointsRulesAndDetailVO> queryList(Mall2PointsRulesDto mall2PointsRulesDto);
+
+    String queryProdBarcode(Map<String,Object> map);
+
 }

+ 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>

+ 5 - 2
kmall-admin/src/main/resources/mybatis/mapper/OrderDao.xml

@@ -76,6 +76,7 @@
         <result property="pickUpCodeSn" column="pick_up_code_sn"/>
         <result property="pickUpCodeStatus" column="pick_up_code_status"/>
         <result property="pickUpCodeSn" column="pick_up_code_sn"/>
+        <result property="memberCode" column="member_code"/>
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.OrderEntity">
@@ -409,10 +410,12 @@
         o.pay_status,
         o.coupon_name,
         o.coupon_price,
+        o.integral_money,
         o.actual_price,
         o.order_price,
         o.pay_time,
         o.pay_flag,
+        o.member_code,
         c.pick_up_code_sn
         from mall_order o
         LEFT JOIN mall_store s on o.store_id = s.id
@@ -696,6 +699,7 @@
         `predict_time`,
         `coupon_name`,
         `comment_count`,
+        `member_code`,
 
         <if test="merchSn != null" >
             merch_sn,
@@ -787,6 +791,7 @@
         #{predict_time},
         #{coupon_name},
         #{comment_count},
+        #{memberCode},
         <if test="merchSn != null" >
             #{merchSn},
         </if>
@@ -2102,7 +2107,6 @@
         left join mall_brand b on b.id=sr.brand_id
         left join mall_supplier sup on gs.supplier_id = sup.id
         WHERE 1=1
-        AND g.number>0
         <if test="orderSn != null and orderSn.trim() != ''">
             AND o.order_sn LIKE concat('%',#{orderSn},'%')
         </if>
@@ -2177,7 +2181,6 @@
         left join mall_supplier sup on gs.supplier_id = sup.id
         left join mall_order_refund mor on mor.out_refund_no = o.order_sn
         WHERE 1=1
-        AND g.number>0
         <if test="orderSn != null and orderSn.trim() != ''">
             AND o.order_sn LIKE concat('%',#{orderSn},'%')
         </if>

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

@@ -952,11 +952,31 @@
 
     <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>
 
+    <select id="queryProdBarcode" resultType="java.lang.String" parameterType="java.util.Map">
+        select g.prod_barcode
+        from mall_product_store_rela r
+        left join mall_goods g on r.sku = g.sku
+        left join mk_activities a on a.mka_store_id = r.store_id
+        <where>
+            <if test="sku != null">
+                and r.sku=#{sku}
+            </if>
+            <if test="storeId != null">
+                and r.store_id=#{storeId}
+            </if>
+            <if test="mkaId != null">
+                and a.mka_id=#{mkaId}
+            </if>
+        </where>
+
+    </select>
+
     <!--批量修改-->
     <update id="updateProductStoreRela" parameterType="list">
         update mall_product_store_rela

+ 6 - 0
kmall-admin/src/main/resources/mybatis/mapper/haikong/HaiKongMemberScoreChangeDetailRecordDao.xml

@@ -11,6 +11,7 @@
         <result column="sell_volume" property="sellVolume" />
         <result column="deduction_score" property="deductionScore" />
         <result column="gift_score" property="giftScore" />
+        <result column="activity_gift_score" property="activityGiftScore" />
         <result column="generate_rules" property="generateRules" />
         <result column="generate_ratio" property="generateRatio" />
         <result column="modify_time" property="modifyTime" />
@@ -34,6 +35,7 @@
             `sell_volume`,
             `deduction_score`,
             `gift_score`,
+            `activity_gift_score`,
             `generate_rules`,
             `generate_ratio`,
             `modify_time`,
@@ -49,6 +51,7 @@
             #{sellVolume},
             #{deductionScore},
             #{giftScore},
+            #{activityGiftScore},
             #{generateRules},
             #{generateRatio},
             #{modifyTime},
@@ -67,6 +70,7 @@
             `sell_volume`,
             `deduction_score`,
             `gift_score`,
+            `activity_gift_score`,
             `generate_rules`,
             `generate_ratio`,
             `modify_time`,
@@ -83,6 +87,7 @@
                 #{item.sellVolume},
                 #{item.deductionScore},
                 #{item.giftScore},
+                #{item.activityGiftScore},
                 #{item.generateRules},
                 #{item.generateRatio},
                 #{item.modifyTime},
@@ -106,6 +111,7 @@
         `sell_volume`,
         `deduction_score`,
         `gift_score`,
+        `activity_gift_score`,
         `generate_rules`,
         `generate_ratio`,
         `create_time`,

+ 7 - 0
kmall-admin/src/main/resources/mybatis/mapper/haikong/HaiKongMemberScoreChangeRecordDao.xml

@@ -5,6 +5,7 @@
         <id column="id" property="id" />
         <result column="open_id" property="openId" />
         <result column="score" property="score" />
+        <result column="activity_score" property="activityScore" />
         <result column="out_biz_no" property="outBizNo" />
         <result column="change_reason" property="changeReason" />
         <result column="change_event" property="changeEvent" />
@@ -18,6 +19,7 @@
     <resultMap id="IntegralGoBack" type="com.kmall.admin.entity.haikong.IntegralGoBackEntity">
         <result column="open_id" property="open_id" />
         <result column="score" property="rollback_score" />
+        <result column="activity_score" property="rollback_activity_score" />
         <result column="statement_id" property="statement_id" />
         <result column="change_id" property="change_id" />
     </resultMap>
@@ -55,6 +57,7 @@
         (
             `open_id`,
             `score`,
+            `activity_score`,
             `out_biz_no`,
             `change_reason`,
             `change_event`,
@@ -68,6 +71,7 @@
         (
             #{openId},
             #{score},
+            #{activityScore},
             #{outBizNo},
             #{changeReason},
             #{changeEvent},
@@ -84,6 +88,7 @@
         <set>
             <if test="openId != null">`open_id` = #{openId}, </if>
             <if test="score != null">`score` = #{score}, </if>
+            <if test="activityScore != null">`activity_score` = #{activityScore}, </if>
             <if test="outBizNo != null">`out_biz_no` = #{outBizNo}, </if>
             <if test="changeReason != null">`change_reason` = #{changeReason}, </if>
             <if test="changeId != null">`change_id` = #{changeId}, </if>
@@ -129,6 +134,7 @@
         SELECT
             open_id,
             score,
+            activity_score,
             statement_id,
             change_id
         FROM
@@ -141,6 +147,7 @@
         `id`,
         `open_id`,
         `score`,
+        `activity_score`,
         `out_biz_no`,
         `change_reason`,
         `change_event`,

+ 6 - 0
kmall-admin/src/main/resources/mybatis/mapper/mk/MkActivitiesAssociationDao.xml

@@ -48,6 +48,12 @@
 		<if test="name != null and name.trim() != ''">
 			AND name LIKE concat('%',#{name},'%')
 		</if>
+		<if test="mkCode != null and mkCode != ''">
+			AND mk_code=#{mkCode}
+		</if>
+		<if test="mkaStatus != null and mkaStatus != ''">
+			AND mka_status=#{mkaStatus}
+		</if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}

+ 6 - 2
kmall-admin/src/main/resources/mybatis/mapper/mk/MkActivitiesDao.xml

@@ -37,7 +37,8 @@
 			`creater_sn`,
 			`update_time`,
 			`moder_sn`,
-			`priority`
+			`priority`,
+			`mka_name`
 		from mk_activities
 		where mka_id = #{id}
 	</select>
@@ -98,6 +99,7 @@
 			`creater_sn`,
 			`update_time`,
 			`moder_sn`,
+			`mka_name`,
 			`priority`)
 		values(
 			#{mkaTopic},
@@ -113,6 +115,7 @@
 			#{createrSn},
 			#{updateTime},
 			#{moderSn},
+			#{mkaName},
 			#{priority})
 	</insert>
 
@@ -132,7 +135,8 @@
 			<if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
 			<if test="updateTime != null">`update_time` = #{updateTime}, </if>
 			<if test="moderSn != null">`moder_sn` = #{moderSn},</if>
-			<if test="priority != null">`priority` = #{priority}</if>
+			<if test="priority != null">`priority` = #{priority},</if>
+			<if test="mkaName != null">`mka_name` = #{mkaName}</if>
 		</set>
 		where mka_id = #{mkaId}
 	</update>

+ 221 - 0
kmall-admin/src/main/resources/mybatis/mapper/mk/MkActivitiesPresentIntegralDao.xml

@@ -0,0 +1,221 @@
+<?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.mk.MkActivitiesPresentIntegralDao">
+
+    <resultMap type="com.kmall.admin.entity.mk.MkActivitiesPresentIntegralEntity" id="mkActivitiesPresentIntegralMap">
+        <result property="mapId" column="map_id"/>
+        <result property="productName" column="product_name"/>
+        <result property="activityGiveType" column="activity_give_type"/>
+        <result property="activityGiveNum" column="activity_give_num"/>
+        <result property="shopSn" column="shop_sn"/>
+        <result property="sku" column="sku"/>
+        <result property="barcode" column="barcode"/>
+        <result property="productBrand" column="product_brand"/>
+        <result property="productSeries" column="product_series"/>
+        <result property="mkaId" column="mka_id"/>
+        <result property="rejectScore" column="reject_score"/>
+        <result property="deadline" column="deadline"/>
+        <result property="createTime" column="create_time"/>
+        <result property="createrSn" column="creater_sn"/>
+        <result property="moderSn" column="moder_sn"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+	<select id="queryObject" resultType="com.kmall.admin.entity.mk.MkActivitiesPresentIntegralEntity">
+		select
+			`map_id`,
+			`product_name`,
+			`activity_give_type`,
+			`activity_give_num`,
+			`shop_sn`,
+			`sku`,
+			`barcode`,
+			`product_brand`,
+			`product_series`,
+			`mka_id`,
+			`reject_score`,
+			`deadline`,
+			`create_time`,
+			`creater_sn`,
+			`moder_sn`,
+			`update_time`
+		from mk_activities_present_integral
+		where map_id = #{id}
+	</select>
+
+	<select id="queryList" resultType="com.kmall.admin.entity.mk.MkActivitiesPresentIntegralEntity">
+		select
+    		`map_id`,
+    		`product_name`,
+    		`activity_give_type`,
+    		`activity_give_num`,
+    		`shop_sn`,
+    		`sku`,
+    		`barcode`,
+    		`product_brand`,
+    		`product_series`,
+    		`mka_id`,
+    		`reject_score`,
+    		`deadline`,
+    		`create_time`,
+    		`creater_sn`,
+    		`moder_sn`,
+    		`update_time`
+		from mk_activities_present_integral
+		WHERE 1=1
+		<if test="name != null and name.trim() != ''">
+			AND name LIKE concat('%',#{name},'%')
+		</if>
+		<if test="sku != null and sku != ''">
+			AND sku =#{sku}
+		</if>
+		<if test="mkaId != null and mkaId != ''">
+			AND mka_id =#{mkaId}
+		</if>
+		<if test="activityGiveType != null and activityGiveType != ''">
+			AND activity_give_type =#{activityGiveType}
+		</if>
+        <choose>
+            <when test="sidx != null and sidx.trim() != ''">
+                order by ${sidx} ${order}
+            </when>
+			<otherwise>
+                order by map_id desc
+			</otherwise>
+        </choose>
+		<if test="offset != null and limit != null">
+			limit #{offset}, #{limit}
+		</if>
+	</select>
+	
+ 	<select id="queryTotal" resultType="int">
+		select count(*) from mk_activities_present_integral
+		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.mk.MkActivitiesPresentIntegralEntity" useGeneratedKeys="true" keyProperty="mapId">
+		insert into mk_activities_present_integral(
+			`product_name`,
+			`activity_give_type`,
+			`activity_give_num`,
+			`shop_sn`,
+			`sku`,
+			`barcode`,
+			`product_brand`,
+			`product_series`,
+			`mka_id`,
+			`reject_score`,
+			`deadline`,
+			`create_time`,
+			`creater_sn`,
+			`moder_sn`,
+			`update_time`)
+		values(
+			#{productName},
+			#{activityGiveType},
+			#{activityGiveNum},
+			#{shopSn},
+			#{sku},
+			#{barcode},
+			#{productBrand},
+			#{productSeries},
+			#{mkaId},
+			#{rejectScore},
+			#{deadline},
+			#{createTime},
+			#{createrSn},
+			#{moderSn},
+			#{updateTime})
+	</insert>
+	 
+	<update id="update" parameterType="com.kmall.admin.entity.mk.MkActivitiesPresentIntegralEntity">
+		update mk_activities_present_integral 
+		<set>
+			<if test="productName != null">`product_name` = #{productName}, </if>
+			<if test="activityGiveType != null">`activity_give_type` = #{activityGiveType}, </if>
+			<if test="activityGiveNum != null">`activity_give_num` = #{activityGiveNum}, </if>
+			<if test="shopSn != null">`shop_sn` = #{shopSn}, </if>
+			<if test="sku != null">`sku` = #{sku}, </if>
+			<if test="barcode != null">`barcode` = #{barcode}, </if>
+			<if test="productBrand != null">`product_brand` = #{productBrand}, </if>
+			<if test="productSeries != null">`product_series` = #{productSeries}, </if>
+			<if test="mkaId != null">`mka_id` = #{mkaId}, </if>
+			<if test="rejectScore != null">`reject_score` = #{rejectScore}, </if>
+			<if test="deadline != null">`deadline` = #{deadline}, </if>
+			<if test="createTime != null">`create_time` = #{createTime}, </if>
+			<if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
+			<if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
+			<if test="updateTime != null">`update_time` = #{updateTime}</if>
+		</set>
+		where map_id = #{mapId}
+	</update>
+	
+	<delete id="delete">
+		delete from mk_activities_present_integral where map_id = #{value}
+	</delete>
+	
+	<delete id="deleteBatch">
+		delete from mk_activities_present_integral where map_id in 
+		<foreach item="mapId" collection="array" open="(" separator="," close=")">
+			#{mapId}
+		</foreach>
+	</delete>
+	<select id="querySkuByNow" resultMap="mkActivitiesPresentIntegralMap">
+		select
+			mapi.*
+		from mk_activities_present_integral mapi
+		left join mk_activities ma on ma.mka_id = mapi.mka_id
+		where
+			ma.mka_store_id = #{storeId}
+			and ma.mka_start_time &lt; #{currentTime}
+			and ma.mkd_end_time &gt; #{currentTime}
+			and ma.mka_status = 1
+			and ma.mka_topic = #{mkaTopic}
+	</select>
+	<delete id="deleteByMkaId" parameterType="java.lang.Integer">
+		delete
+		from mk_activities_present_integral
+		where mka_id=#{mkaId}
+	</delete>
+
+
+	<select id="list" parameterType="com.kmall.admin.entity.mk.MkActivitiesPresentIntegralEntity" resultMap="mkActivitiesPresentIntegralMap">
+		select
+			`map_id`,
+			`product_name`,
+			`activity_give_type`,
+			`activity_give_num`,
+			`shop_sn`,
+			`sku`,
+			`barcode`,
+			`product_brand`,
+			`product_series`,
+			`mka_id`,
+			`reject_score`,
+			`deadline`,
+			`create_time`,
+			`creater_sn`,
+			`moder_sn`,
+			`update_time`
+		from mk_activities_present_integral
+		<where>
+			<if test="mapId != null">
+				and map_id=#{mapId}
+			</if>
+			<if test="shopSn != null">
+				and shop_sn=#{shopSn}
+			</if>
+			<if test="sku != null">
+				and sku=#{sku}
+			</if>
+			<if test="mkaId != null">
+				and mka_id=#{mkaId}
+			</if>
+		</where>
+	</select>
+
+</mapper>

+ 19 - 2
kmall-admin/src/main/resources/mybatis/mapper/mk/MkActivityFormDao.xml

@@ -50,6 +50,22 @@
 		</if>
 	</select>
 
+	<select id="listBymmIds" parameterType="java.util.List" resultType="com.kmall.admin.entity.mk.MkActivityFormEntity">
+		select
+    		a.mm_id,
+    		a.mk_name,
+    		a.mk_code,
+    		a.create_time,
+    		a.creater_sn,
+			u.username createrName
+		from mk_activity_form a
+		left join sys_user u on a.creater_sn = u.user_id
+		WHERE mm_id in
+		<foreach item="mmid" collection="array" open="(" separator="," close=")">
+			#{mmid}
+		</foreach>
+	</select>
+
  	<select id="queryTotal" resultType="int">
 		select count(*) from mk_activity_form
 		WHERE 1=1
@@ -125,7 +141,8 @@
 		u1.username moderName,
 		m.merch_name merchName,
 		mb.third_party_merch_name thirdMerchName,
-		s.store_name storeName
+		s.store_name storeName,
+		a.mka_name mkaName
 		from mk_activities_association a2
 		left join mk_activities a on a.mka_id = a2.mka_id
 		left join sys_user u on u.user_id = a.creater_sn
@@ -135,7 +152,7 @@
 		left join mall_store s on s.merch_sn = a2.merch_sn and s.third_party_merch_code = a2.third_merch_sn and s.id = a2.mka_store_id
 		WHERE 1=1
 		<if test="mkCode != null and mkCode.trim() != ''">
-			AND a2.mk_code LIKE concat('%',#{mkCode},'%')
+			AND a2.mk_code =#{mkCode}
 		</if>
         <if test="topic != null and topic.trim() != ''">
             AND a.mka_topic LIKE concat('%',#{topic},'%')

+ 14 - 5
kmall-admin/src/main/resources/mybatis/mapper/vip/Mall2MemberConsumptionRecordsDao.xml

@@ -24,6 +24,8 @@
         <result property="beforeScore" column="before_score"/>
         <result property="afterScore" column="after_score"/>
         <result property="orderGiftScore" column="order_gift_score"/>
+		<result property="activityGiftScore" column="activity_gift_score"/>
+
     </resultMap>
 
 	<select id="queryObject" resultType="com.kmall.admin.entity.vip.Mall2MemberConsumptionRecordsEntity">
@@ -47,7 +49,8 @@
 			`score_limit`,
 			`before_score`,
 			`after_score`,
-			`order_gift_score`
+			`order_gift_score`,
+			`activity_gift_score`
 		from mall2_member_consumption_records
 		where mmcr_id = #{id}
 	</select>
@@ -75,7 +78,8 @@
 			records.`score_limit`,
 			records.`before_score`,
 			records.`after_score`,
-			records.`order_gift_score`
+			records.`order_gift_score`,
+			records.`activity_gift_score`
 		from mall2_member_consumption_records records
 		left join mall_user mu on mu.id = records.user_id
 		left join mall_store store on store.id = records.shop_sn
@@ -132,7 +136,8 @@
 			`score_limit`,
 			`before_score`,
 			`after_score`,
-			`order_gift_score`
+			`order_gift_score`,
+			`activity_gift_score`
 		from mall2_member_consumption_records
 		where `order_sn` = #{orderSn}
 	</select>
@@ -158,7 +163,8 @@
 			`score_limit`,
 			`before_score`,
 			`after_score`,
-			`order_gift_score`)
+			`order_gift_score`,
+			`activity_gift_score`)
 		values(
 			#{mmcrId},
 			#{userId},
@@ -179,7 +185,8 @@
 			#{scoreLimit},
 			#{beforeScore},
 			#{afterScore},
-			#{orderGiftScore})
+			#{orderGiftScore},
+			#{activityGiftScore})
 	</insert>
 
 	<update id="update" parameterType="com.kmall.admin.entity.vip.Mall2MemberConsumptionRecordsEntity">
@@ -204,6 +211,8 @@
 			<if test="beforeScore != null">`before_score` = #{beforeScore},</if>
 			<if test="afterScore != null">`after_score` = #{afterScore},</if>
 			<if test="orderGiftScore != null">`order_gift_score` = #{orderGiftScore}</if>
+			<if test="activityGiftScore != null">`activity_gift_score` = #{activityGiftScore}</if>
+
 		</set>
 		where mmcr_id = #{mmcrId}
 	</update>

+ 86 - 3
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}
@@ -156,10 +162,51 @@
     	from mall2_points_rules mpr
     	left join mall2_points_rules_detil mprs on mpr.mpr_id = mprs.father_id
     	where mprs.id is not null and mpr.is_valid = 0 and mpr.points_begin_time &lt;= #{nowTime} and mpr.points_end_time &gt;= #{nowTime}
+    	and mprs.points_store_id = #{pointsStoreId}
+    	order by mpr.points_type desc
+	</select>
+
+	<select id="queryListBy" resultType="com.kmall.admin.haikong.vo.PointsRulesAndDetailVO" parameterType="com.kmall.admin.dto.Mall2PointsRulesDto">
+		select
+    		mpr.`mpr_id` as mprId,
+    		mpr.`points_type` as pointsType,
+    		mpr.`points_begin_time` as pointsBeginTime,
+    		mpr.`points_end_time` as pointsEndTime,
+    		mpr.`is_valid` as isValid,
+    		mpr.`ratio` as ratio,
+    		mpr.`creater_sn` as createrSn,
+    		mpr.`create_time` as createTime,
+    		mpr.`moder_sn` as moderSn,
+    		mpr.`mod_time` as modTime,
+    		mpr.`tstm` as tstm,
+			mprs.`id` as id,
+			mprs.`father_id` as fatherId,
+			mprs.`points_rules_type` as pointRulesType,
+			mprs.`points_detil_name` as pointsDetailName,
+			mprs.`points_detil_name_id` as pointsDetailNameId,
+			mprs.`points_store_name` as pointsStoreName,
+			mprs.`points_store_id` as pointsStoreId,
+			mprs.`remark` as remark
+    	from mall2_points_rules mpr
+    	left join mall2_points_rules_detil mprs on mpr.mpr_id = mprs.father_id
+		<where>
+			<if test="pointsType!=null">
+				and mpr.points_type=#{pointsType}
+			</if>
+			<if test="isValid!=null">
+				and mpr.is_valid=#{isValid}
+			</if>
+			<if test="nowTime!=null">
+				and mpr.points_begin_time &lt;= #{nowTime} and mpr.points_end_time &gt;= #{nowTime}
+			</if>
+			<if test="pointsStoreId!=null">
+				and mprs.points_store_id =#{pointsStoreId}
+			</if>
+		</where>
     	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,
@@ -178,19 +225,55 @@
 			#{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.pointsRulesName},
+				</if>
+				<if test="item.pointsRulesName != null and item.pointsRulesName !=''">
+					points_detil_name_id=#{item.rulesId},
+				</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="pointsDetilNameId !=null and pointsDetilNameId !=''">
+			and points_detil_name_id=#{pointsDetilNameId}
+		</if>
+		<if test="pointsDetilName !=null and pointsDetilName.trim() !=''">
+			and points_detil_name like concat('%',#{pointsDetilName},'%')
+		</if>
+		<if test="storeName !=null and storeName !=''">
+			and points_store_name=#{storeName}
+		</if>
 		<if test="offset != null and limit != null">
 			limit #{offset}, #{limit}
 		</if>

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

@@ -0,0 +1,121 @@
+<?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="fatherId != null and fatherId != ''">
+			AND father_id=#{fatherId}
+		</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="deleteByFatherId" parameterType="java.lang.Integer">
+		delete from mall2_points_rules_detil where father_id = #{fatherId}
+	</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>

+ 66 - 42
kmall-admin/src/main/webapp/WEB-INF/page/mk/mall2RulesDetil.html

@@ -9,26 +9,33 @@
 	<Card v-show="showList">
         <p slot="title">积分规则详情</p>
         <Row :gutter="16">
-<!--            <div class="search-group">-->
-<!--                <i-col span="4">-->
-<!--                    <i-input v-model="q.name" @on-enter="query" placeholder="条形码"/>-->
-<!--                </i-col>-->
-<!--                <i-button @click="query">查询</i-button>-->
-<!--                <i-button @click="reloadSearch">重置</i-button>-->
-<!--            </div>-->
-            <div class="buttons-group" style="width: 100%;margin-top: 8px;">
+            <div class="search-group">
+                <i-col span="4">
+                    <i-input v-model="q.pointsDetilName" @on-enter="query" placeholder="商品/门店/分类名称"/>
+                </i-col>
+                <i-col span="4">
+                    <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>
+            </div>
+            <div class="buttons-group" style="width: 100%;margin-top: 8px;" disabled="true">
                 <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="../mall2pointsrules/rulesUpload" :before-upload="beforeUpload"  :data="uploadData" >
-                        <i-button type="ghost" icon="ios-cloud-upload-outline">导入</i-button>
+                        <i-button id="isDisplay" type="ghost" icon="ios-cloud-upload-outline">导入</i-button>
                     </Upload>
                 </i-col>
                 <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>
 
@@ -38,40 +45,57 @@
 	    <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>-->
+            <div v-show="pointsType==0">
+                <Form-item label="门店名称" prop="pointsRulesName">
+                    <i-select v-model="mall2PointsRulesDetil.pointsRulesName" filterable placeholder="门店名称" label-in-value>
+                        <i-option v-for="store in storeSelects" :value="store.storeName" :key="store.storeName">{{store.storeName}}</i-option>
+                    </i-select>
+<!--                    <i-input v-model="mall2PointsRulesDetil.pointsRulesName" placeholder="门店名称"/>-->
+                </Form-item>
+            </div>
+            <div v-show="pointsType==1">
+                <Form-item label="类别名称" prop="pointsRulesName">
+                    <i-input v-model="mall2PointsRulesDetil.pointsRulesName" placeholder="类别名称"/>
+                </Form-item>
+<!--                <Form-item label="对应的商品门店" prop="storeName">-->
+<!--                    <i-input v-model="mall2PointsRulesDetil.storeName" placeholder="门店名称"/>-->
+<!--                </Form-item>-->
+                <Form-item label="对应的商品门店" prop="storeName">
+                    <i-select v-model="mall2PointsRulesDetil.storeName" filterable placeholder="对应的商品门店" label-in-value>
+                        <i-option v-for="store in storeSelects" :value="store.storeName" :key="store.storeName">{{store.storeName}}</i-option>
+                    </i-select>
+                </Form-item>
+            </div>
+            <div v-show="pointsType==2">
+                <Form-item label="商品条码" prop="pointsRulesName">
+                    <i-input v-model="mall2PointsRulesDetil.pointsRulesName" placeholder="商品条码"/>
+                </Form-item>
+<!--                <Form-item label="对应的商品门店" prop="storeName">-->
+<!--                    <i-input v-model="mall2PointsRulesDetil.storeName" placeholder="门店名称"/>-->
+<!--                </Form-item>-->
+                <Form-item label="对应的商品门店" prop="storeName">
+                    <i-select v-model="mall2PointsRulesDetil.storeName" filterable placeholder="对应的商品门店" label-in-value>
+                        <i-option v-for="store in storeSelects" :value="store.storeName" :key="store.storeName">{{store.storeName}}</i-option>
+                    </i-select>
+                </Form-item>
+            </div>
+            <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>

+ 93 - 0
kmall-admin/src/main/webapp/WEB-INF/page/mk/mkactivitiespresentintegral.html

@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>营销活动-赠送积分</title>
+    #parse("sys/header.html")
+</head>
+<body>
+<div id="rrapp" v-cloak>
+	<div v-show="showList">
+        <Row :gutter="16">
+            <div class="search-group">
+                <i-col span="4">
+                    <i-input v-model="q.sku" @on-enter="query" placeholder="sku"/>
+                </i-col>
+                <i-col span="4">
+                    <i-select v-model="q.activityGiveType" @on-enter="query"  placeholder="赠送方式">
+                        <i-option v-for="activityGiveType in activityGiveTypes" :value="activityGiveType.value" :key="activityGiveType.value">{{activityGiveType.name}}</i-option>
+                    </i-select>
+                </i-col>
+                <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>
+                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
+                <i-button type="warning" @click="reloadMkactivities" v-show="!isMkactivitiesShow">返回营销方式页</i-button>
+            </div>
+        </Row>
+	    <table id="jqGrid"></table>
+	    <div id="jqGridPager"></div>
+    </div>
+
+    <Card v-show="!showList">
+        <p slot="title">{{title}}</p>
+		<i-form ref="formValidate" :model="mkActivitiesPresentIntegral" :rules="ruleValidate" :label-width="80">
+            <Form-item label="产品中文名" prop="productName">
+                <i-input v-model="mkActivitiesPresentIntegral.productName" placeholder="产品中文名"/>
+            </Form-item>
+            <Form-item label="赠送方式" prop="activityGiveType" >
+                <i-select v-model="mkActivitiesPresentIntegral.activityGiveType" filterable placeholder="赠送方式" label-in-value>
+                    <i-option v-for="activityGiveType in activityGiveTypes" :value="activityGiveType.value" :key="activityGiveType.value">{{activityGiveType.name}}</i-option>
+                </i-select>
+            </Form-item>
+
+            <Form-item label="赠送数值" prop="activityGiveNum">
+                <i-input type="number" v-model="mkActivitiesPresentIntegral.activityGiveNum" placeholder="赠送数值"/>
+            </Form-item>
+            <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">-->
+<!--                <i-input v-model="mkActivitiesPresentIntegral.barcode" placeholder="条形码"/>-->
+<!--            </Form-item>-->
+            <Form-item label="商品品牌" prop="productBrand">
+                <i-input v-model="mkActivitiesPresentIntegral.productBrand" placeholder="商品品牌"/>
+            </Form-item>
+            <Form-item label="商品系列" prop="productSeries">
+                <i-input v-model="mkActivitiesPresentIntegral.productSeries" placeholder="商品系列"/>
+            </Form-item>
+            <Form-item label="是否与积分抵扣互斥" prop="rejectScore">
+                <i-select v-model="mkActivitiesPresentIntegral.rejectScore" filterable placeholder="是否与积分抵扣互斥" label-in-value>
+                    <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>
+                <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/mkactivitiespresentintegral.js?_${date.systemTime}"></script>
+</body>
+</html>

+ 6 - 6
kmall-admin/src/main/webapp/WEB-INF/page/mk/mkactivitiesscore.html

@@ -48,9 +48,9 @@
             <Form-item label="sku" prop="sku">
                 <i-input v-model="mkActivitiesScore.sku" placeholder="sku"/>
             </Form-item>
-            <Form-item label="门店id" prop="storeId">
-                <i-input v-model="mkActivitiesScore.storeId" placeholder="门店id"/>
-            </Form-item>
+<!--            <Form-item label="门店id" prop="storeId">-->
+<!--                <i-input v-model="mkActivitiesScore.storeId" placeholder="门店id"/>-->
+<!--            </Form-item>-->
             <Form-item label="是否参与积分抵扣" prop="reject">
                 <p>只能有一种情况,如果积分抵扣商品中都为0,则默认这些商品为参与,其余商品不参与,如果积分抵扣商品都为1,其余商品都参与</p>
                 <i-select v-model="mkActivitiesScore.reject" placeholder="0:参与,1:不参与" style="width: 268px;">
@@ -61,9 +61,9 @@
             <!--<Form-item label="抵扣比例" prop="scoreLimit">
                 <i-input v-model="mkActivitiesScore.scoreLimit" placeholder="抵扣比例"/>
             </Form-item>-->
-            <Form-item label="营销活动编号" prop="mkaId">
-                <i-input v-model="mkActivitiesScore.mkaId" placeholder="营销活动编号"/>
-            </Form-item>
+<!--            <Form-item label="营销活动编号" prop="mkaId">-->
+<!--                <i-input v-model="mkActivitiesScore.mkaId" placeholder="营销活动编号"/>-->
+<!--            </Form-item>-->
 <!--            <Form-item label="截止日期" prop="deadline">-->
 <!--                <Date-picker type="datetime" format="yyyy-MM-dd HH:mm:ss" v-model="mkActivitiesScore.deadline" @on-change="getDeadLine" placeholder="截止日期" style="width: 240px"></Date-picker>-->
 <!--            </Form-item>-->

+ 16 - 3
kmall-admin/src/main/webapp/WEB-INF/page/mk/mkactivityform.html

@@ -34,7 +34,10 @@
     <Card v-show="!showList">
         <p slot="title">{{title}}</p>
 		<i-form ref="formValidate" :model="mkActivityForm" :rules="ruleValidate" :label-width="80">
-            <Form-item label="活动形式代码" prop="mkCode">
+            <Form-item v-if="isMkactivityformUpdate" label="活动形式代码" prop="mkCode">
+                <i-input v-model="mkActivityForm.mkCode" disabled placeholder="活动形式代码"/>
+            </Form-item>
+            <Form-item v-else label="活动形式代码" prop="mkCode">
                 <i-input v-model="mkActivityForm.mkCode" placeholder="活动形式代码"/>
             </Form-item>
             <Form-item label="活动形式名称" prop="mkName">
@@ -80,6 +83,9 @@
                     </i-option>
                 </i-select>
             </Form-item>
+            <Form-item label="营销活动名称" prop="mkaName">
+                <i-input type="text" v-model="mkActivities.mkaName" placeholder="营销活动名称"/>
+            </Form-item>
             <Form-item label="商户" prop="merchSn">
                 <i-select v-model="mkActivities.merchSn" filterable placeholder="商户" @on-change="changeMerch" label-in-value>
                     <i-option v-for="merch in merchList" :value="merch.merchSn" :key="merch.merchSn">{{merch.merchName}}</i-option>
@@ -91,11 +97,18 @@
                               :key="thirdMerchant.thirdPartyMerchCode">{{thirdMerchant.thirdPartyMerchName}}</i-option>
                 </i-select>
             </Form-item>
-            <Form-item label="活动门店" prop="mkaStoreId">
-                <i-select v-model="mkActivities.mkaStoreId" filterable placeholder="活动门店" label-in-value>
+
+
+            <Form-item label="活动门店" prop="mkaStoreId" >
+                <i-select v-if="isAdd" v-model="mkActivities.mkaStoreId" filterable placeholder="活动门店" label-in-value>
+                    <i-option v-for="store in storeList" :value="store.id" :key="store.id">{{store.storeName}}</i-option>
+                </i-select>
+
+                <i-select v-else v-model="mkActivities.mkaStoreId" disabled filterable placeholder="活动门店" label-in-value>
                     <i-option v-for="store in storeList" :value="store.id" :key="store.id">{{store.storeName}}</i-option>
                 </i-select>
             </Form-item>
+
             <Form-item label="活动优先级" prop="priority">
                 <i-input v-model="mkActivities.priority" placeholder="活动优先级,数字越小优先级越高,最低为0"/>
             </Form-item>

+ 77 - 30
kmall-admin/src/main/webapp/WEB-INF/page/sale/sale.html

@@ -4,7 +4,43 @@
     <title>收付款管理</title>
     #parse("sys/header.html")
 
-    <style type="text/css">
+    <style type="text/css" lang="scss">
+
+
+        @media screen and (max-width: 1396px) {
+            #rrapp {
+                font-size: 0.1rem;
+            }
+            #goodsImg{
+                width: 50%;
+            }
+        }
+        @media screen and (min-width: 1396px) and (max-width: 1536px) {
+            #rrapp {
+                font-size: 0.2rem;
+            }
+            #goodsImg{
+                width: 50%;
+            }
+        }
+        @media screen and (min-width: 1536px) and (max-width: 1920px) {
+            #rrapp {
+                font-size: 0.5rem;
+            /*//我这里是按1920的屏幕宽度设置的,所以1rem相当于100px*/
+            }
+            #goodsImg{
+                width: 75%;
+            }
+        }
+        @media screen and (min-width: 1920px) {
+            #rrapp {
+                font-size: 0.1rem;
+            }
+            #goodsImg{
+                width: 100%;
+            }
+        }
+
         #saomiao{
             padding-right: 30px;
         }
@@ -105,11 +141,11 @@
     <header class="main-header">
         <div class="container-fluid">
             <div class="row" style="border:0;margin-bottom:10px">
-                <div class="col-md-3 logodiv">
+                <div class="col-md-3 col-sm-6 logodiv">
                     <!--center-block-->
                     <img src="${rc.contextPath}/statics/img/logotest2.jpg" class="img-rounded img-responsive" style="height: 70px;">
                 </div>
-                <div class="col-md-9" style="background-color: #f0f0f0;margin:0px;padding: 0px" >
+                <div class="col-md-9 col-sm-6" style="background-color: #f0f0f0;margin:0px;padding: 0px" >
                     <div v-show="showList">
 
                         <Row :gutter="16">
@@ -132,12 +168,13 @@
                     </div>
                 </div>
             </div>
+
         </div>
     </header>
 
     <div class="container-fluid" style="margin-top: 15px">
         <div id="content" class="row-fluid">
-            <div class="col-md-3">
+            <div class="col-md-3 col-sm-3">
                 <div>
                     <i-input class="search" placeholder="输入或扫码商品条形码" ref="saomiao" id="saomiao" v-model.trim='prodBarcode' @on-enter="searchQuery(prodBarcode)"/>
                 </div>
@@ -154,8 +191,8 @@
                     </li>-->
                     <li style="margin-top: 50px;" >
                         <div v-show="goodsDetail" style="font-size: 1.2em">
-                            <img style="height: 400px;width: 400px;" :src="goods.primaryPicUrl" class="img-rounded"/>
-                            <h1 style="margin: 8px;"><strong>{{goods.name}}</strong></h1>
+                            <img id="goodsImg" :src="goods.primaryPicUrl" class="img-rounded"/>
+                            <h1 style="margin: 8px;font-size: 20px;"><strong>{{goods.name}}</strong></h1>
                             <p style="margin: 8px;">单价: <strong>{{goods.retailPrice}}</strong> /元</p>
                             <p style="margin: 8px;">优惠前税费: <strong>{{goods.goodstaxes}}</strong> /元</p>
                             <p style="margin: 8px;">规格: {{goods.specification}}</p>
@@ -171,24 +208,26 @@
                     </li>
                 </ul>
             </div>
-            <div class="col-md-6" style="padding: 0px;padding-bottom: 10%;background-color: #f0f0f0">
+            <div class="col-md-6 col-sm-8" style="padding: 0px;background-color: #f0f0f0">
                 <ul class="list-unstyled; ">
-                    <li ref="overflowLi" style="height: 600px;overflow:auto">
+                    <li ref="overflowLi" style="height: 310px;overflow:auto">
                         <table id="cbec" class="table .table-striped">
                             <tr style="border: white;background-color: #F5DCB3;font-size: 1.3em" >
-                                <th style="width: 300px;padding: 7px">跨境商品名称</th>
-                                <th style="padding: 7px">单价</th>
-                                <th style="padding: 7px">优惠金额</th>
-                                <th style="padding: 7px">预估税费</th>
-                                <th style="padding: 7px">实际支付价</th>
-                                <th style="padding: 7px">数量</th>
-                                <th style="padding: 7px">参与活动</th>
-                                <th>操作</th>
+                                <th style="width: 26%;">跨境商品名称</th>
+                                <th style="width: 9%;">单价</th>
+                                <th style="width: 11%;">积分优惠</th>
+                                <th style="width: 11%;">其他优惠</th>
+                                <th style="width: 10%;">预估税费</th>
+                                <th style="width: 12%;">实际支付价</th>
+                                <th style="width: 10%;">数量</th>
+                                <th style="width: 13%;">参与活动</th>
+                                <th>&nbsp;</th>
                             </tr>
-                            <tr v-for="(item,i) in goodsList" v-if="item.name" style="font-size: 1.3em">
-                                <td><h3>{{item.name}}</h3></td>
+                            <tr v-for="(item,i) in goodsList" v-if="item.name" style="font-size: 1em">
+                                <td> {{item.name}}</td>
                                 <td> {{item.retailPrice}}</td>
-                                <td> {{item.discountedPrice}}</td>
+                                <td> {{item.deductionPrice}}</td>
+                                <td> {{item.otherDiscountedPrice}}</td>
                                 <td> {{item.goodstaxes}}</td>
                                 <td> {{item.actualPaymentAmount}}</td>
                                 <td>
@@ -207,28 +246,36 @@
                     </li>
                     <li>
                         <div style="margin-bottom: 10PX">
-                            <h3 style="border: white;padding: 8px">会员手机号:{{userInfo.customPhone}}</h3>
+                            <ul style="display: inline-block">
+<!--                                2022/04/11海控一期需求  17和19问题  将其意思修改-->
+<!--                                原userInfo.customPhone属性是会员手机号-->
+<!--                                现其定义为收货人手机号(支付人手机号)-->
+<!--                                海控需要将其分开-->
+                                <li><p style="border: white;padding: 8px;font-weight:600;">会员手机号:{{userInfo.consigneePhone}}</p></li>
+                                <li><p style="border: white;padding: 8px;font-weight:600;">收货人手机号:{{userInfo.customPhone}}</p></li>
+                            </ul>
                         </div>
                         <ul style="display: inline-block">
-                            <li><h3 style="border: white;padding: 8px;">会员当前积分:{{memberCurrentAvailableScore}}</h3></li>
-                            <li><h3 style="border: white;padding: 8px;">抵扣积分:{{deductionScore}}</h3></li>
-                            <li><h3 style="border: white;padding: 8px;">会员等级:{{levelName}}</h3></li>
+                            <li><p style="border: white;padding: 8px;font-weight:600;">会员当前积分:{{memberCurrentAvailableScore}}</p></li>
+                            <li><p style="border: white;padding: 8px;font-weight:600;">抵扣积分:{{deductionScore}}</p></li>
+                            <li><p style="border: white;padding: 8px;font-weight:600;">会员等级:{{levelName}}</p></li>
                         </ul>
                         <div style="width: 30px; display: inline-block"></div>
                         <ul style="display: inline-block">
-                            <li><h3 style="border: white;padding: 8px;">总件数:{{totalCount}}</h3></li>
-                            <li><h3 style="border: white;padding: 8px;">总价:{{totalPrice}}</h3></li>
+                            <li><p style="border: white;padding: 8px;font-weight:600;">总件数:{{totalCount}}</p></li>
+                            <li><p style="border: white;padding: 8px;font-weight:600;">总价:{{totalPrice}}</p></li>
 <!--                            <li><h3 style="border: white;padding: 8px">优惠价:{{discountedPrice}}</h3></li>-->
-                            <li><h3 style="border: white;padding: 8px">实际支付价:{{actualPrice}}</h3></li>
-                            <li v-if="showReduceMoney != 0"><h3 style="border: white;padding: 8px">满减:{{showReduceMoney}}</h3></li>
+                            <li><p style="border: white;padding: 8px;font-weight:600;">实际支付价:{{actualPrice}}</p></li>
+                            <li v-if="showReduceMoney != 0"><h3 style="border: white;padding: 8px;font-weight:600;">满减:{{showReduceMoney}}</h3></li>
                         </ul>
                     </li>
-                    <li  style="height: 100px;">
+                    <li style="padding-bottom: 10px;">
                         <i-button type="error" @click="clearGoodsList" class="goods-button"><i class="fa fa-pencil-square-o"></i>&nbsp;清空</i-button>
                         <i-button data-toggle="modal" @click="pendingOrder" class="goods-button" ><i class="fa fa-pencil-square-o"></i>&nbsp;订单挂起</i-button>
                         <i-button data-toggle="modal" @click="toResumePending" class="goods-button" ><i class="fa fa-pencil-square-o"></i>&nbsp;恢复挂起</i-button>
                         <i-button data-toggle="modal" @click="calculateOrderPrice" type="primary" class="goods-button" ><i class="fa fa-pencil-square-o"></i>&nbsp;计算优惠后价格</i-button>
                         <i-button data-toggle="modal" @click="toOrderSubmit" type="primary" class="goods-button" ><i class="fa fa-pencil-square-o"></i>&nbsp;提交订单</i-button>
+<!--                        <button type="button" style="margin:0 30px 0 20px;font-size: 25px;" class="btn btn-primary" @click="demo" id="demo" data-dismiss="modal">测试打印小票</button>-->
 
 <!--                        45636914-->
                         <div class="modal fade" id="pendignOrderModal"  role="dialog" aria-labelledby="pendignOrderLabel" aria-hidden="true">
@@ -408,9 +455,9 @@
 
 
             </div>
-            <div class="col-md-3">
+            <div class="col-md-3 col-sm-1">
                 <h2 class="text-center" style="border: white;background-color: #F5DCB3;padding: 8px" >小票码 <span v-show="delayResponse"> 海关卡回执导致单量堆积</span></h2><br/>
-                <div class="row" style="border: white;background-color: #f0f0f0;overflow:auto;height: 700px;">
+                <div class="row" style="border: white;background-color: #f0f0f0;overflow:auto;min-height: 420px;">
                     <div class="col-xs-4 col-sm-4" v-for="(item,i) in pickUpCodeList" style="margin-bottom: 8px;">
                         <i-button data-toggle="modal" data-target="#orderDetail" style="width: 110px;font-family: 微软雅黑" @click="queryOrderDetail(item.orderSn,item.pickUpCodeSn)" v-if="item.pickUpCodeStatus == 0"  >&nbsp;{{item.pickUpCodeSn}}</i-button>
                         <i-button data-toggle="modal" data-target="#orderDetail" style="background-color:#83e7b4;width: 110px;font-family: 微软雅黑" @click="queryOrderDetail(item.orderSn,item.pickUpCodeSn)" v-if="item.pickUpCodeStatus == 1" >{{item.pickUpCodeSn}}</i-button>

+ 5 - 2
kmall-admin/src/main/webapp/WEB-INF/page/shop/offilineOrderList.html

@@ -199,7 +199,8 @@
                     <tr>
                         <td style="text-align: left; width: 600px; font-weight: bold;" colspan="2">商品</td>
                         <td style="text-align: center; width: 240px; font-weight: bold;">小计</td>
-                        <td style="text-align: center; width: 240px; font-weight: bold;">优惠抵扣金额(元)</td>
+                        <td style="text-align: center; width: 240px; font-weight: bold;">积分抵扣金额(元)</td>
+                        <td style="text-align: center; width: 240px; font-weight: bold;">其他优惠金额(元)</td>
                         <td style="text-align: center; width: 240px; font-weight: bold;">应收金额(元)</td>
                         <td style="text-align: center; width: 240px; font-weight: bold;">实收金额(元)</td>
                         <td style="text-align: center; width: 240px; font-weight: bold;">预估税额(元)</td>
@@ -215,7 +216,8 @@
                             <p style="line-height: 30px;">SKU:{{item.sku}}</p>
                         </td>
                         <td align="center">¥{{item.number * item.marketPrice}}</td>
-                        <td align="center">¥{{item.discountedPrice}}</td>
+                        <td align="center">¥{{item.deductionPrice}}</td>
+                        <td align="center">¥{{item.otherDiscountedPrice}}</td>
                         <td align="center">¥{{item.actualPaymentAmount}}</td>
                         <td align="center">¥{{item.actualPaymentAmount}}</td>
                         <td align="center">¥{{item.tax}}</td>
@@ -233,6 +235,7 @@
                         <td align="left" colspan="2" style="font-weight: bold;">总计</td>
                         <td align="center">¥{{order.orderPrice}}</td>
                         <td align="center">¥{{order.fullCutPrice}}</td>
+                        <td align="center">¥{{order.otherDiscountedPrice}}</td>
                         <td align="center">¥{{order.actualPrice}}</td>
 
                         <td align="center" v-show="order.payStatus == 0">未付款</td>

+ 2 - 3
kmall-admin/src/main/webapp/WEB-INF/page/vip/mall2pointsrules.html

@@ -34,7 +34,6 @@
 	    <table id="jqGrid"></table>
 	    <div id="jqGridPager"></div>
     </div>
-
     <Card v-show="!showList">
         <p slot="title">{{title}}</p>
 		<i-form ref="formValidate" :model="mall2PointsRules" :rules="ruleValidate" :label-width="80">
@@ -52,10 +51,10 @@
 <!--                <i-input v-model="mall2PointsRules.pointsRulesNum" placeholder="对应积分数"/>-->
 <!--            </Form-item>-->
             <Form-item label="适用开始时间" prop="pointsBeginTime">
-                <i-input type="date"  v-model="mall2PointsRules.pointsBeginTime" placeholder="积分规则适用开始时间"/>
+                <i-input type="datetime-local"  v-model="mall2PointsRules.pointsBeginTime" placeholder="积分规则适用开始时间"/>
             </Form-item>
             <Form-item label="适用结束时间" prop="pointsEndTime">
-                <i-input type="date"  v-model="mall2PointsRules.pointsEndTime" placeholder="积分规则适用结束时间"/>
+                <i-input type="datetime-local"  v-model="mall2PointsRules.pointsEndTime" placeholder="积分规则适用结束时间"/>
             </Form-item>
             <Form-item label="积分比例(小数)" prop="ratio">
                 <i-input v-model="mall2PointsRules.ratio" placeholder="积分比例小数,保留两位" />

+ 1 - 0
kmall-admin/src/main/webapp/js/haikong/haikongmemberscorechangedetailrecord.js

@@ -12,6 +12,7 @@ $(function () {
 			{label: '销售数', name: 'sellVolume', index: 'sell_volume', align: 'center', width: 100},
 			{label: '分摊抵扣积分', name: 'deductionScore', index: 'deduction_score', align: 'center', width: 100},
 			{label: '赠送积分', name: 'giftScore', index: 'gift_score', align: 'center', width: 100},
+			{label: '活动赠送积分', name: 'activityGiftScore', index: 'activity_gift_score', align: 'center', width: 100},
 			{label: '生成规则', name: 'generateRules', index: 'generate_rules', align: 'center', width: 100,
 				formatter: function (value) {
 					if (value == '0') {

+ 124 - 71
kmall-admin/src/main/webapp/js/mk/mall2RulesDetil.js

@@ -4,54 +4,89 @@ $(function () {
 	if(mkaId){
 		vm.mkaId = mkaId;
 	}
+	// var interval;
+	$("#isDisplay").on("click",function () {
+		$("#isDisplay").attr("disabled","true")
+		// interval = setInterval(function () {
+		// 	$("#isDisplay").removeAttr("disabled")
+		// 	window.clearInterval(interval)
+		// }, 10000);
+	});
 
-    $("#jqGrid").jqGrid({
-        url: '../mall2pointsrules/detilList',
-        datatype: "json",
-        colModel: [
-			{label: 'ID', name: 'id', index: 'id', width: 30, align: 'center'},
-			{
-				label: '积分类型', name: 'rulesType', index: 'points_rules_type', width: 80, formatter: function (value) {
-					if (value === '0' || value === 0) {
-						return '门店';
-					}
-					if (value == '1' || value === 1) {
-						return '商品类别';
-					}
-					if (value == '2' || value === 2) {
-						return '门店商品';
+	$.ajax({
+		type: "POST",
+		url: "../mall2pointsrules/getRulesDetilId/?mkaId="+vm.mkaId,
+		contentType: "application/json",
+		success: function (r) {
+			if (r.code == 0) {
+				var pointsType = r.msg;
+				vm.pointsType=r.msg;
+				var rulesId,pointsRulesName;
+				if (pointsType == 0){
+					rulesId="门店";
+					pointsRulesName="门店ID";
+				}else if(pointsType == 1){
+					rulesId="分类名称";
+					pointsRulesName="商品分类ID";
+				}else if (pointsType == 2){
+					rulesId="商品";
+					pointsRulesName="商品sku";
+				}
+
+				$("#jqGrid").jqGrid({
+					url: '../mall2pointsrules/detilList',
+					datatype: "json",
+					colModel: [
+						{label: 'ID', name: 'id', index: 'id', width: 30, align: 'center'},
+						{
+							label: '积分类型', name: 'rulesType', index: 'points_rules_type', width: 80,align: 'center', formatter: function (value) {
+								if (value === '0' || value === 0) {
+									return '门店';
+								}
+								if (value == '1' || value === 1) {
+									return '商品类别';
+								}
+								if (value == '2' || value === 2) {
+									return '门店商品';
+								}
+
+							}
+						},
+						{label: rulesId, name: 'pointsRulesName', index: 'points_detil_name', width: 80, align: 'center'},
+						{label: pointsRulesName, 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,
+					postData: {'mkaId': vm.mkaId},
+					height: 550,
+					rowNum: 10,
+					rowList: [10, 30, 50],
+					rownumbers: true,
+					rownumWidth: 25,
+					autowidth: true,
+					multiselect: true,
+					pager: "#jqGridPager",
+					jsonReader: {
+						root: "page.list",
+						page: "page.currPage",
+						total: "page.totalPage",
+						records: "page.totalCount"
+					},
+					prmNames: {
+						page: "page",
+						rows: "limit",
+						order: "order"
+					},
+					gridComplete: function () {
+						$("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
 					}
+				});
 
-				}
-			},
-			{label: '商品条码/门店/类别名称', name: 'pointsRulesName', index: 'points_detil_name', 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,
-		postData: {'mkaId': vm.mkaId},
-        height: 550,
-        rowNum: 10,
-        rowList: [10, 30, 50],
-        rownumbers: true,
-        rownumWidth: 25,
-        autowidth: true,
-        multiselect: true,
-        pager: "#jqGridPager",
-        jsonReader: {
-            root: "page.list",
-            page: "page.currPage",
-            total: "page.totalPage",
-            records: "page.totalCount"
-        },
-        prmNames: {
-            page: "page",
-            rows: "limit",
-            order: "order"
-        },
-        gridComplete: function () {
-            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
-        }
-    });
+			} else {
+				alert(r.msg);
+			}
+		}
+	});
 
 
 });
@@ -71,13 +106,17 @@ let vm = new Vue({
 			]
 		},
 		q: {
-		    name: ''
+			pointsDetilNameId:"",
+			pointsDetilName:""
 		},
         isMkactivitiesShow: true,
         mkCode: '',
 		uploadData:[],
 		storeId : '',
-		mkaId : ''
+		mkaId : '',
+		mall2PointsRulesDetil:{},
+		pointsType:"",
+		storeSelects:{}
 	},
 	methods: {
 		query: function () {
@@ -86,37 +125,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 +191,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: {'name': vm.q.name},
+                postData: {'pointsDetilNameId': vm.q.pointsDetilNameId,'pointsDetilName':vm.q.pointsDetilName,'mkaId': vm.mkaId},
                 page: page
             }).trigger("reloadGrid");
             vm.handleReset('formValidate');
@@ -196,6 +238,7 @@ let vm = new Vue({
 			});
 		},
         handleReset: function (name) {
+			vm.mall2PointsRulesDetil={}
             handleResetForm(this, name);
         },
         //返回积分规则设置页
@@ -211,10 +254,17 @@ let vm = new Vue({
 			}else{
 				alert(data.msg);
 			}
+			$("#isDisplay").removeAttr("disabled")
 		},
 		uploadExcelError: function () {
 			alert('上传出现异常,请重试!');
 		},
+		storeSelect:function (){
+			$.get("../store/list", function (r) {
+				vm.storeSelects = r.page.list;
+			});
+
+		},
 		uploadExcelFormatError: function (file) {
 			this.$Notice.warning({
 				title: '文件格式不正确',
@@ -230,7 +280,10 @@ let vm = new Vue({
 				});
 			});
 			return promise; //通过返回一个promis对象解决
-
 		},
+	},
+	mounted:function (){
+		this.storeSelect();
 	}
+
 });

+ 240 - 0
kmall-admin/src/main/webapp/js/mk/mkactivitiespresentintegral.js

@@ -0,0 +1,240 @@
+$(function () {
+	let flag = getQueryString("flag");
+	if(flag != null && flag == "false"){
+		vm.isMkactivitiesShow = false;
+	}
+	let mkCode = getQueryString("mkCode");
+	if(mkCode){
+		vm.mkCode = mkCode;
+	}
+
+	let storeId = getQueryString("storeId");
+	if(storeId){
+		vm.storeId = storeId;
+	}
+	let mkaId = getQueryString("mkaId");
+	if(mkaId){
+		vm.mkaId = mkaId;
+	}
+
+
+    $("#jqGrid").jqGrid({
+        url: '../mkactivitiespresentintegral/list',
+        datatype: "json",
+        colModel: [
+			{label: 'mapId', name: 'mapId', index: 'map_id', key: true, hidden: true},
+			{label: '产品中文名', name: 'productName', index: 'product_name', width: 80,align: 'center'},
+			{label: '赠送方式', name: 'activityGiveType', index: 'activity_give_type', width: 80,align: 'center',
+				formatter: function (value) {
+					if (value == '1') {
+						return '固定值';
+					} else if (value == '2') {
+						return '倍率';
+					}
+					return '-';
+				}},
+			{label: '赠送数值', name: 'activityGiveNum', index: 'activity_give_num', width: 80,align: 'center'},
+			{label: '商品sku', name: 'sku', index: 'sku', width: 80,align: 'center'},
+			{label: '条形码', name: 'barcode', index: 'barcode', width: 80,align: 'center'},
+			{label: '商品品牌', name: 'productBrand', index: 'product_brand', width: 80,align: 'center'},
+			{label: '商品系列', name: 'productSeries', index: 'product_series', width: 80,align: 'center'},
+			// {label: '营销活动编号', name: 'mkaId', index: 'mka_id', width: 80},
+			{label: '是否与积分抵扣互斥', name: 'rejectScore', index: 'reject_score', width: 80,align: 'center',
+				formatter: function (value) {
+					if (value == '0') {
+						return '不互斥';
+					} else if (value == '1') {
+						return '互斥';
+					}
+					return '-';
+				}},
+			// {label: '截止日期', name: 'deadline', index: 'deadline', width: 80,align: 'center'},
+			{label: '创建时间', name: 'createTime', index: 'deadline', width: 80,align: 'center'}],
+		viewrecords: true,
+		postData: {'mkaId': vm.mkaId},
+        height: 550,
+        rowNum: 10,
+        rowList: [10, 30, 50],
+        rownumbers: true,
+        rownumWidth: 25,
+        autowidth: true,
+        multiselect: true,
+        pager: "#jqGridPager",
+        jsonReader: {
+            root: "page.list",
+            page: "page.currPage",
+            total: "page.totalPage",
+            records: "page.totalCount"
+        },
+        prmNames: {
+            page: "page",
+            rows: "limit",
+            order: "order"
+        },
+        gridComplete: function () {
+            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
+        }
+    });
+});
+
+let vm = new Vue({
+	el: '#rrapp',
+	data: {
+        showList: true,
+        title: null,
+		mkActivitiesPresentIntegral: {},
+		ruleValidate: {
+			name: [
+				{required: true, message: '名称不能为空', trigger: 'blur'}
+			]
+		},
+		q: {
+		    sku: ''
+		},
+		isMkactivitiesShow: true,
+		mkCode: '',
+		uploadData:[],
+		storeId : '',
+		mkaId : '',
+		activityGiveTypes:{},
+		rejectScores:{},
+		isUpdate:false
+	},
+	methods: {
+		query: function () {
+			vm.reload();
+		},
+		add: function () {
+			vm.showList = false;
+			vm.title = "新增";
+			vm.isUpdate=false;
+			vm.mkActivitiesPresentIntegral = {};
+		},
+		update: function (event) {
+            let mapId = getSelectedRow();
+			if (mapId == null) {
+				return;
+			}
+			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.shopSn=vm.storeId;
+
+			$.ajax({
+				type: "POST",
+			    url: url,
+			    contentType: "application/json",
+			    data: JSON.stringify(vm.mkActivitiesPresentIntegral),
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('操作成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+			});
+		},
+		del: function (event) {
+            let mapIds = getSelectedRows();
+			if (mapIds == null){
+				return;
+			}
+
+			confirm('确定要删除选中的记录?', function () {
+				$.ajax({
+					type: "POST",
+				    url: "../mkactivitiespresentintegral/delete",
+				    contentType: "application/json",
+				    data: JSON.stringify(mapIds),
+				    success: function (r) {
+						if (r.code == 0) {
+							alert('操作成功', function (index) {
+								$("#jqGrid").trigger("reloadGrid");
+							});
+						} else {
+							alert(r.msg);
+						}
+					}
+				});
+			});
+		},
+		getInfo: function(mapId){
+			$.get("../mkactivitiespresentintegral/info/"+mapId, function (r) {
+                vm.mkActivitiesPresentIntegral = r.mkActivitiesPresentIntegral;
+            });
+		},
+        reloadSearch: function() {
+            vm.q = {
+                name: ''
+            }
+            vm.reload();
+		},
+		reload: function (event) {
+			vm.showList = true;
+            let page = $("#jqGrid").jqGrid('getGridParam', 'page');
+			$("#jqGrid").jqGrid('setGridParam', {
+                postData: {'sku': vm.q.sku,'activityGiveType':vm.q.activityGiveType},
+                page: page
+            }).trigger("reloadGrid");
+            vm.handleReset('formValidate');
+		},
+        handleSubmit: function (name) {
+            handleSubmitValidate(this, name, function () {
+                vm.saveOrUpdate()
+            });
+        },
+        handleReset: function (name) {
+            handleResetForm(this, name);
+        },
+		//返回营销方式页
+		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) {
+			vm.activityGiveTypes = r.list;
+		});
+		$.get("../sys/macro/queryMacrosByValue?value=rejectScore", function (r) {
+			vm.rejectScores = r.list;
+		});
+	}
+});

+ 20 - 3
kmall-admin/src/main/webapp/js/mk/mkactivityform.js

@@ -52,7 +52,7 @@ $(function () {
     $("#jqGrid").jqGrid("setFrozenColumns");
 
     var marketing =
-        {'lscx': '临时促销','jfdk': '积分抵扣'/*'yhq': '优惠券','rchd': '日常活动','mysy': '买N送一',/*'mj': '满减', 'mz': '满赠','dz': '打折','zhjsp': '组合价商品','drjbj':'第二件半价'*/};
+        {'lscx': '临时促销','jfdk': '积分抵扣','zsjf':'赠送积分'/*'yhq': '优惠券','rchd': '日常活动','mysy': '买N送一',/*'mj': '满减', 'mz': '满赠','dz': '打折','zhjsp': '组合价商品','drjbj':'第二件半价'*/};
 
 
     let mkCode = getQueryString("mkCode");
@@ -95,8 +95,11 @@ $(function () {
                         mkaTopicName = marketing.drjbj;
                     else if(value === 'jfdk')
                         mkaTopicName = marketing.jfdk;
+                    else if(value === 'zsjf')
+                        mkaTopicName = marketing.zsjf;
                     return mkaTopicName == null? value : mkaTopicName;
                 }},
+            {label: '营销活动名称', name: 'mkaName', width: 200, align: 'center'},
             {label: '商户名称', name: 'merchName', width: 200, align: 'center'},
             {label: '第三方商户', name: 'thirdMerchName', width: 200, align: 'center'},
             {label: '门店编号', name: 'mkaStoreId', width: 200, align: 'center',hidden: true},
@@ -201,6 +204,9 @@ let vm = new Vue({
             }, {
                 id: 'jfdk',
                 name: '积分抵扣'
+            },{
+                id: 'zsjf',
+                name: '赠送积分'
             }
             /*, {
                 id: 'yhq',
@@ -228,6 +234,10 @@ let vm = new Vue({
                 name: '第二件半价'
             }*/
         ],
+        // 区分增加还是修改
+        isAdd:false,
+        // 区分活动形式表增加/修改
+        isMkactivityformUpdate:false
 	},
 	methods: {
 		query: function () {
@@ -238,6 +248,7 @@ let vm = new Vue({
             vm.showMkactivitiesViewList = true;
             vm.showList = false;
             vm.title = "新增";
+            vm.isMkactivityformUpdate=false
 			vm.mkActivityForm = {};
 		},
 		update: function (event) {
@@ -249,6 +260,7 @@ let vm = new Vue({
             vm.showMkactivitiesViewList = true;
             vm.showList = false;
             vm.title = "修改";
+            vm.isMkactivityformUpdate=true
 
             vm.getInfo(mmId)
 		},
@@ -272,6 +284,8 @@ let vm = new Vue({
 		},
 		del: function (event) {
             let mmIds = getSelectedRows();
+            console.log("mmIds")
+            console.log(mmIds)
 			if (mmIds == null){
 				return;
 			}
@@ -367,8 +381,7 @@ let vm = new Vue({
             };
             vm.isMkdEndEarlyTimeShow = false;
 
-
-
+            vm.isAdd=true;
             vm.getMerchList();
         },
         getMerchList: function() {
@@ -401,6 +414,8 @@ let vm = new Vue({
             vm.showMkactivitiesList = false;
             vm.title = "修改";
 
+            vm.isAdd=false;
+
             vm.getMerchList();
             vm.getMkactivitiesInfo(mkaId);
         },
@@ -540,6 +555,8 @@ let vm = new Vue({
                 url = "/mk/mkactivitiescombinationprice.html";
             else if(mkaTopic === 'drjbj')
                 url = "/mk/mkactivitieshalfprice.html"
+            else if(mkaTopic === 'zsjf')
+                url = "/mk/mkactivitiespresentintegral.html"
             window.location.href =  url+"?flag=false&mkCode="+vm.mkCode+"&mkaId="+mkaId+"&storeId="+storeId;
         }
 	}

+ 22 - 2
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -1548,6 +1548,15 @@ let vm = new Vue({
         },
 
 
+    },
+    mounted:function (){
+        // 页面开始加载时修改font-size
+        var html = document.getElementsByTagName("html")[0];
+        var oWidth =
+            document.body.clientWidth || document.documentElement.clientWidth;
+        // 这里的1920是指设计图的大小,自己根据实际情况改变
+        html.style.fontSize = (oWidth / 1920) * 100 + "px";
+        console.log("rem:", html.style.fontSize);
     }
 });
 
@@ -1781,7 +1790,7 @@ function getPrintContentOrder(ticket, callback) {
     content += "<tr>";
     content += "<td style=\"width: 30%;text-align: left;font-size: 10px;font-weight: bold;\">商品名称</td>";
     content += "<td style=\"width: 12%;text-align: right;font-size: 10px;font-weight: bold;\">单价</td>";
-    content += "<td style=\"width: 12%;text-align: right;font-size: 10px;font-weight: bold;\">优惠</td>";
+    // content += "<td style=\"width: 12%;text-align: right;font-size: 10px;font-weight: bold;\">优惠</td>";
     // content += "<td style=\"width: 22%;text-align: right;font-size: 10px;font-weight: bold;\">优惠后单价</td>";
     // content += "<td style=\"width: 16%;text-align: right;font-size: 10px;font-weight: bold;\">税费</td>";
     content += "<td style=\"width: 12%;text-align: right;font-size: 10px;font-weight: bold;\">数量</td>";
@@ -1801,7 +1810,7 @@ function getPrintContentOrder(ticket, callback) {
         content += "</table>";
         content += "</td>";
         content += "<td style=\"width: 12%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].uprice + "</td>";
-        content += "<td style=\"width: 12%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].discountPrice + "</td>";
+        // content += "<td style=\"width: 12%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].discountPrice + "</td>";
         // content += "<td style=\"width: 22%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].afterDiscountPrice + "</td>";
         // content += "<td style=\"width: 17%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].taxation + "</td>";
         content += "<td style=\"width: 12%;text-align: center;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].num + "</td>";
@@ -1830,6 +1839,16 @@ function getPrintContentOrder(ticket, callback) {
     content += "<span style=\"float: left;width: 50%;text-align: left;\">积分抵扣金额:</span>";
     content += "<span style=\"float: right;width: 50%;text-align: right;\">" + ticket.cashInfo.scoreDeductionPrice + "元</span>";
     content += "</div>";
+    /**
+     * 海控需求  将优惠合计拆分为 积分抵扣金额 + 其他优惠
+     * 其他优惠=优惠合计-积分抵扣金额
+     * 看后续海控要不要将其他优惠拆分
+     * @type {string}
+     */
+    content += "<div style=\"width: 100%;\">";
+    content += "<span style=\"float: left;width: 50%;text-align: left;\">其他优惠:</span>";
+    content += "<span style=\"float: right;width: 50%;text-align: right;\">" + ticket.cashInfo.otherDiscountedPrice + "元</span>";
+    content += "</div>";
     content += "<div style=\"width: 100%;\">";
     content += "<span style=\"float: left;width: 50%;text-align: left;\">优惠合计:</span>";
     content += "<span style=\"float: right;width: 50%;text-align: right;\">" + ticket.cashInfo.oddChange + "元</span>";
@@ -2343,6 +2362,7 @@ calculateOrderPrice = function() {
                 vm.userInfo.customPhone = r.data.memberPhone;
                 vm.$refs.customPhone.value = r.data.memberPhone;
                 vm.calActivityFlag = true;
+                vm.userInfo.consigneePhone= vm.$refs.couponBarCode.value;
 
                 vm.clickFlag = false;
                 // console.log("memberPhone===>" + r.data.memberPhone);

+ 4 - 1
kmall-admin/src/main/webapp/js/shop/offilineOrderList.js

@@ -44,7 +44,8 @@ $(function () {
             // {label: '操作店员', name: 'userName', index: 'user_name', align: 'center',width: 80},
             // {label: '取货码', name: 'pickUpCodeSn', index: 'pick_up_code_sn', align: 'center',width: 80},
             {label: '购买人姓名', name: 'payName', index: 'payName', align: 'center',width: 150},
-            {label: '购买人电话', name: 'mobile', index: 'mobile', align: 'center',width: 200},
+            {label: '收货人手机号', name: 'mobile', index: 'mobile', align: 'center',width: 200},
+            {label: '会员手机号', name: 'memberCode', index: 'mobile', align: 'center',width: 200},
             {
                 label: '购买类型', name: 'isOnfflineOrder', index: 'is_onffline_order', align: 'center',width: 80,
                 formatter: function (value) {
@@ -134,6 +135,8 @@ $(function () {
                     }
                     return value;
                 }},
+            {label: '积分抵扣金额', name: 'integralMoney', index: 'integral_money', align: 'center',width: 80},
+            {label: '其他优惠金额', name: 'otherDiscountedPrice', index: 'other_discounted_price', align: 'center',width: 80},
             {label: '实际支付', name: 'actualPrice', index: 'actual_price', align: 'center',width: 80},
             {label: '预计税额', name: 'tax', index: 'tax', align: 'center',width: 80},
             {label: '订单总价', name: 'orderPrice', index: 'order_price',align: 'center', width: 80},

+ 2 - 0
kmall-admin/src/main/webapp/js/shop/store.js

@@ -175,7 +175,9 @@ let vm = new Vue({
                     title: res.msg,
                     desc: "无上传文件的权限,请联系管理员授权"
                 });
+                return
             }
+            alert("上传成功")
             vm.store.storeImgUrl = file.response.url;
         },
         del: function (event) {

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

@@ -22,14 +22,10 @@ $(function () {
 			// {label: '对应积分数', name: 'pointsRulesNum', index: 'points_rules_num', width: 80},
 			{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');
-				}
+				label: '规则适用开始时间', name: 'pointsBeginTime', index: 'points_begin_time',align:"center", width: 200
 			},
 			{
-				label: '规则适用结束时间', name: 'pointsEndTime', index: 'points_end_time',align:"center", width: 200, formatter: function (value) {
-					return transDate(value, 'yyyy-MM-dd');
-				}
+				label: '规则适用结束时间', name: 'pointsEndTime', index: 'points_end_time',align:"center", width: 200
 			},
 			{
 				label: '是否有效', name: 'isValid', index: 'is_valid', width: 80, formatter: function (value) {
@@ -138,6 +134,10 @@ let vm = new Vue({
 		},
 		saveOrUpdate: function (event) {
             let url = vm.mall2PointsRules.mprId == null ? "../mall2pointsrules/save" : "../mall2pointsrules/update";
+            var pointsBeginTime=vm.mall2PointsRules.pointsBeginTime;
+            var pointsEndTime=vm.mall2PointsRules.pointsEndTime;
+			vm.mall2PointsRules.pointsBeginTime=vm.mall2PointsRules.pointsBeginTime.replaceAll("T"," ")+":00";
+			vm.mall2PointsRules.pointsEndTime=vm.mall2PointsRules.pointsEndTime.replaceAll("T"," ")+":00";
 			$.ajax({
 				type: "POST",
 			    url: url,
@@ -153,6 +153,12 @@ let vm = new Vue({
                     }
                 }
 			});
+			//修改会出现问题
+			if (vm.mall2PointsRules.mprId != null){
+				vm.mall2PointsRules.pointsBeginTime=pointsBeginTime.replaceAll(" ","T");
+				vm.mall2PointsRules.pointsEndTime=pointsEndTime.replaceAll(" ","T");
+			}
+
 		},
         // 管理商品
 		showMkactivitiesGoods: function(mkaId){
@@ -186,8 +192,8 @@ let vm = new Vue({
 		getInfo: function(mprId){
 			$.get("../mall2pointsrules/info/"+mprId, function (r) {
                 vm.mall2PointsRules = r.mall2PointsRules;
-				vm.mall2PointsRules.pointsBeginTime = transDate(r.mall2PointsRules.pointsBeginTime, 'yyyy-MM-dd')
-				vm.mall2PointsRules.pointsEndTime = transDate(r.mall2PointsRules.pointsEndTime, 'yyyy-MM-dd')
+				vm.mall2PointsRules.pointsBeginTime=r.mall2PointsRules.pointsBeginTime.replaceAll(" ","T");
+				vm.mall2PointsRules.pointsEndTime=r.mall2PointsRules.pointsEndTime.replaceAll(" ","T");
             });
 		},
         reloadSearch: function() {

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


+ 56 - 4
kmall-admin/src/main/webapp/userLogin.html

@@ -39,10 +39,10 @@
         <div class="col-md-5">
             <div class="m-t text-center" style="border: 0px solid #dddee1;">
                 <div class="form-group has-feedback">
-                    <i-input class="userinput" v-model="username" @on-enter="login" placeholder="账号" style="width: 250px;" autofocus/>
+                    <i-input class="userinput" v-model="username" @on-enter="beforeLogin" placeholder="账号" style="width: 250px;" autofocus/>
                 </div>
                 <div class="form-group has-feedback">
-                    <i-input class="userinput"  type="password" v-model="password" @on-enter="login" style="width: 250px;"
+                    <i-input class="userinput"  type="password" v-model="password" @on-enter="beforeLogin" style="width: 250px;"
                              placeholder="密码"/>
                 </div>
                 <!--<div class="form-group has-feedback" id="authcode">
@@ -56,7 +56,7 @@
                     </div>
                 </div>-->
                 <div>
-                    <i-button @click="login" style="width: 125px;height: 45px">登录</i-button>
+                    <i-button @click="beforeLogin" style="width: 125px;height: 45px">登录</i-button>
                     <i-button @click="change" style="width: 125px;height: 45px">切换管理端</i-button>
                 </div>
             </div>
@@ -127,13 +127,49 @@
             refreshCode: function () {
                 this.src = "captcha.jpg?t=" + $.now();
             },
+            beforeLogin:function (){
+                //登录前 用户在点击登录时再请求机器码
+                // vm.machineCode = sessionStorage.getItem("machineCode");
+                console.log("登录")
+                console.log(!vm.machineCode)
+                if (!vm.machineCode){
+                    alert("第一次登录比较慢,稍等片刻");
+                    $.ajax({
+                        url:"http://127.0.0.1:21600/api/reg/gen",
+                        success:function(r){
+                            if(r.code == "0"){
+                                vm.machineCode = r.rows[0].data.code;
+                                console.log(vm.machineCode);
+                                vm.machineCode = vm.machineCode.replace("+","%2B");
+                                sessionStorage.setItem("machineCode",vm.machineCode);
+                                vm.login();
+                            }
+                        },
+                        error:function(XMLHttpRequest, textStatus, errorThrown){
+                            alert("获取机器码失败,请联系管理员");
+                        }
+                    })
+                    return
+                }
+                this.login();
+            },
             login: function (event) {
+                if (vm.username =='' || vm.password==''){
+                    alert("账号或密码为空,请重新输入");
+                    return;
+                }
                 var data = "username=" + vm.username + "&password=" + vm.password + "&captcha=" + vm.captcha + "&machineCode=" + vm.machineCode+"&loginType=2"; //TODO  新增加一个机器码;
                 // var data = "username=" + vm.username + "&password=" + vm.password + "&captcha=" + vm.captcha + "&machineCode=0z4kBPFEve0=&loginType=2"; //TODO  新增加一个机器码;
                 sessionStorage.removeItem("permsSet");
-                var code = sessionStorage.getItem("machineCode");
+                // var code = sessionStorage.getItem("machineCode");
                 // if(!code){
                 //     alert("正在获取机器码,请稍后登录,大约5s");
+                //     /**
+                //      * 场景:第一次登录会出现问题该机器未录入报错
+                //      * 原因:用户登录过快  请求机器码还没响应
+                //      * 在这响应请求
+                //      */
+                //     this.gen();
                 //     return;
                 // }
                 $.ajax({
@@ -158,6 +194,22 @@
                     }
                 });
             },
+            gen:function (){
+                $.ajax({
+                    url:"http://127.0.0.1:21600/api/reg/gen",
+                    success:function(r){
+                        if(r.code == "0"){
+                            vm.machineCode = r.rows[0].data.code;
+                            console.log(vm.machineCode);
+                            vm.machineCode = vm.machineCode.replace("+","%2B");
+                            sessionStorage.setItem("machineCode",vm.machineCode);
+                        }
+                    },
+                    error:function(XMLHttpRequest, textStatus, errorThrown){
+                        alert("获取机器码失败,请联系管理员");
+                    }
+                })
+            },
             change:function(){
                 parent.location.href = 'login.html';
             },

+ 13 - 0
kmall-api/src/main/java/com/kmall/api/entity/OrderVo.java

@@ -241,6 +241,19 @@ public class OrderVo implements Serializable {
      */
     private BigDecimal weight;
 
+    /**
+     * 海控会员系统会员码(会员手机号)
+     */
+    private String memberCode;
+
+    public String getMemberCode() {
+        return memberCode;
+    }
+
+    public void setMemberCode(String memberCode) {
+        this.memberCode = memberCode;
+    }
+
     public String getDiscountApplyType() {
         return discountApplyType;
     }

+ 67 - 0
kmall-common/src/main/java/com/kmall/common/constant/Dict.java

@@ -2079,4 +2079,71 @@ public class Dict {
         }
     }
 
+    /**
+     * 积分类型 :0.门店 ,1.商品类别,2.门店商品
+     */
+    public enum pointsType{
+        item_0("0", "门店"),
+        item_1("1", "商品类别"),
+        item_2("2", "门店商品");
+
+        pointsType(String item, String itemName) {
+            this.item = item;
+            this.itemName = itemName;
+        }
+
+        private String item;
+        private String itemName;
+
+        public String getItemName() {
+            return itemName;
+        }
+
+        public void setItemName(String itemName) {
+            this.itemName = itemName;
+        }
+
+        public String getItem() {
+            return item;
+        }
+
+        public void setItem(String item) {
+            this.item = item;
+        }
+    }
+
+    /**
+     * 是否启用,1:启用,0:不启用
+     */
+    public enum mkaStatus{
+        item_1("1", "启用"),
+        item_2("2", "不启用");
+
+        mkaStatus(String item, String itemName) {
+            this.item = item;
+            this.itemName = itemName;
+        }
+
+        private String item;
+        private String itemName;
+
+        public String getItemName() {
+            return itemName;
+        }
+
+        public void setItemName(String itemName) {
+            this.itemName = itemName;
+        }
+
+        public String getItem() {
+            return item;
+        }
+
+        public void setItem(String item) {
+            this.item = item;
+        }
+
+
+    }
+
 }

+ 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";
     // 满减商品导入

+ 13 - 1
kmall-common/src/main/java/com/kmall/common/utils/print/ticket/item/CashInfo.java

@@ -1,6 +1,7 @@
 package com.kmall.common.utils.print.ticket.item;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 
 /**
  * 收银信息
@@ -22,7 +23,7 @@ public class CashInfo implements Serializable {
 
     // 实收款
     private String receipts;
-    // 找零
+    // 找零   优惠合计
     private String oddChange;
     // 优惠券
     private String coupon;
@@ -45,7 +46,18 @@ public class CashInfo implements Serializable {
      * 积分抵扣金额
      */
     private String scoreDeductionPrice;
+    /**
+     * 其他优惠金额
+     */
+    private BigDecimal otherDiscountedPrice;
 
+    public BigDecimal getOtherDiscountedPrice() {
+        return otherDiscountedPrice;
+    }
+
+    public void setOtherDiscountedPrice(BigDecimal otherDiscountedPrice) {
+        this.otherDiscountedPrice = otherDiscountedPrice;
+    }
 
     public String getTotal() {
         return total;

+ 8 - 2
kmall-manager/src/main/java/com/kmall/manager/manager/redis/JedisUtil.java

@@ -31,8 +31,14 @@ public class JedisUtil implements Serializable {
 
         try {
             if (null == JedisPropertiesBuilder.instance()) {
-                logger.error("jedis init is error.");
-                throw new Exception("jedis init is error.");
+                logger.info("redis没有获取到配置信息休眠3s");
+                Thread.sleep(3000);
+                logger.info("redis没有获取到配置信息休眠3s结束");
+                if (null == JedisPropertiesBuilder.instance()){
+                    logger.error("jedis init is error.");
+                    throw new Exception("jedis init is error.");
+                }
+
             }
 
             JedisProperties jp = JedisPropertiesBuilder.instance();