From 382c853bb36bc2521818058c788b6fdf48d7f684 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 07 Apr 2021 10:29:02 +0800
Subject: [PATCH] Merge branch 'score_shop' of http://120.27.238.55:7000/r/beauty-erp into score_shop

---
 zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java                       |    4 
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java                    |   31 ++
 zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProductComment.java                   |   11 
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java                   |    4 
 zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java               |  141 +++++++++---
 zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityPayTimeOutQuartz.java       |    4 
 zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java                     |   83 +++++-
 zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityGroupJoinTimeOutQuartz.java |    5 
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html              |   33 ++
 zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityTimeOutQuartz.java          |    2 
 zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanApplyDao.java                  |    2 
 zq-erp/src/main/java/com/matrix/system/score/scheduledJob/ScoreScheduledJob.java              |   64 +++++
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductCommentAction.java         |   22 +
 zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopCouponQuartz.java                   |    4 
 zq-erp/src/main/java/com/matrix/config/TaskScheduleConfig.java                                |   10 
 zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopAutomaticReceiveQuartz.java         |    4 
 zq-erp/src/main/java/com/matrix/system/hive/statistics/StatisticsBusinessDataJob.java         |    8 
 zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml                               |    4 
 zq-erp/src/main/java/com/matrix/system/app/vo/ParameterSettingVo.java                         |   39 +++
 zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java                        |   24 ++
 zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java                       |   10 
 zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java                              |   10 
 zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java                  |    4 
 zq-erp/src/test/java/com/matrix/ParameterSettingsTool.java                                    |   92 ++++++++
 zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html       |    2 
 zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html           |    2 
 zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java                     |    8 
 zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml                          |    9 
 28 files changed, 527 insertions(+), 109 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/config/TaskScheduleConfig.java b/zq-erp/src/main/java/com/matrix/config/TaskScheduleConfig.java
new file mode 100644
index 0000000..100f3f6
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/config/TaskScheduleConfig.java
@@ -0,0 +1,10 @@
+package com.matrix.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@Configuration
+@EnableScheduling
+public class TaskScheduleConfig {
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
index 1ea1ccc..6a882aa 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
@@ -2,6 +2,7 @@
 
 import com.alibaba.fastjson.JSONObject;
 import com.matrix.component.redis.RedisClient;
+import com.matrix.core.constance.MatrixConstance;
 import com.matrix.core.pojo.AjaxResult;
 import com.matrix.core.tools.*;
 import com.matrix.system.app.authority.AppAuthorityManager;
@@ -11,10 +12,11 @@
 import com.matrix.system.app.dto.UploadPhotoDto;
 import com.matrix.system.app.utils.Sms106Send;
 import com.matrix.system.app.vo.UserInfoVo;
-import com.matrix.system.common.authority.DefaultAuthorityManager;
 import com.matrix.system.common.authority.strategy.AccountPasswordLogin;
 import com.matrix.system.common.authority.strategy.LoginStrategy;
 import com.matrix.system.common.bean.SysUsers;
+import com.matrix.system.common.constance.AppConstance;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
 import com.matrix.system.common.service.SysUsersService;
 import com.matrix.system.common.tools.PasswordUtil;
 import com.matrix.system.common.tools.UploadUtil;
@@ -62,6 +64,9 @@
 
     @Autowired
     private AppAuthorityManager authorityManager;
+
+    @Autowired
+    private BusParameterSettingsDao busParameterSettingsDao;
 
     @Autowired
     private RedisClient redisClient;
@@ -220,4 +225,21 @@
     public AjaxResult findAppVersion() {
         return AjaxResult.buildSuccessInstance(sysUsersService.findAppVersion());
     }
+
+
+
+    @ApiOperation(value = "获取app配置", notes = "获取app配置")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "ok", response = AppVersion.class)
+    })
+    @GetMapping(value = "/findAppSettings")
+    public AjaxResult findAppSettings() {
+        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+        AjaxResult result = AjaxResult.buildSuccessInstance("查询成功");
+        result.putInMap(AppConstance.APP_BANNER_GL, busParameterSettingsDao.selectCompanyParamByCode(AppConstance.APP_BANNER_GL,user.getCompanyId()));
+        return result;
+    }
+
+
+
 }
diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java
index d9285cb..01db2dd 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java
@@ -150,9 +150,7 @@
             throw new GlobleException("请选择服务");
         }
         SysVipInfo vipInfo = sysVipInfoService.findById(serviceOrderDto.getVipId());
-//        if (StringUtils.isBlank(vipInfo.getPassWord())) {
-//            return AjaxResult.buildFailInstance("未设置资金密码");
-//        }
+
 
         if (StringUtils.isNotBlank(vipInfo.getPassWord())) {
             if (!vipInfo.getPassWord().equals(serviceOrderDto.getPassword())) {
diff --git a/zq-erp/src/main/java/com/matrix/system/app/vo/ParameterSettingVo.java b/zq-erp/src/main/java/com/matrix/system/app/vo/ParameterSettingVo.java
new file mode 100644
index 0000000..b7f82c7
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/app/vo/ParameterSettingVo.java
@@ -0,0 +1,39 @@
+package com.matrix.system.app.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * jyy
+ */
+@Data
+@ApiModel(value = "ParameterSettingVo", description = "配置返回参数类")
+public class ParameterSettingVo  {
+
+    @ApiModelProperty(value = "参数编码ID")
+    private Long paramId;
+
+
+    @ApiModelProperty(value = "参数编码")
+    private String paramCode;
+
+
+
+    @ApiModelProperty(value = "参数值")
+    private String paramValue;
+
+
+    @ApiModelProperty(value = "值1")
+    private String paramValue1;
+
+
+    @ApiModelProperty(value = "值2")
+    private String paramValue2;
+
+
+    @ApiModelProperty(value = "值3")
+    private String paramValue3;
+
+
+}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java b/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java
index 957ed99..2d78a95 100644
--- a/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java
+++ b/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java
@@ -553,6 +553,14 @@
      */
     public static final String WECHARPAY_CERTLOCAL_PATH = "certLocalPath";
 
+    /**
+     * APP管理模块Banner
+     */
+    public static final String APP_BANNER_GL = "APP_BANNER_GL";
+
+
+
+
 
 
 
diff --git a/zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanApplyDao.java b/zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanApplyDao.java
index b8f81ed..52b6c4f 100644
--- a/zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanApplyDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanApplyDao.java
@@ -24,7 +24,7 @@
  */
 public interface ShopSalesmanApplyDao extends BaseMapper<ShopSalesmanApply> {
 
-    IPage<SalesmanVo> selectInvitationuserInPage(Page<SalesmanVo> page, @Param("id") Long userId, @Param("isSales")String isSales);
+    IPage<SalesmanVo> selectInvitationuserInPage(Page<SalesmanVo> page, @Param("userId") Long userId, @Param("isSales")String isSales);
 
     IPage<SalesmanVo> selectInvitationuserInPage(Page<SalesmanVo> page, @Param("userId") Long userId);
 
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java
index dcfc9cf..2c08183 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java
@@ -79,6 +79,8 @@
 	 * 购买业绩
 	 */
 	private Double  goodsCash;
+
+	private Double cardCash;
 	
 	/**
 	 * 赠送消耗
@@ -247,6 +249,14 @@
 
 	private String cateName;
 
+	public Double getCardCash() {
+		return cardCash;
+	}
+
+	public void setCardCash(Double cardCash) {
+		this.cardCash = cardCash;
+	}
+
 	public String getCateName() {
 		return cateName;
 	}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/statistics/StatisticsBusinessDataJob.java b/zq-erp/src/main/java/com/matrix/system/hive/statistics/StatisticsBusinessDataJob.java
index 4e80ff7..257600e 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/statistics/StatisticsBusinessDataJob.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/statistics/StatisticsBusinessDataJob.java
@@ -18,11 +18,9 @@
 import static com.matrix.system.hive.statistics.BusinessDataTypeEnum.*;
 
 /**
- * 定时任务测试类
+ * 业绩统计报表定时任务
  *
- * @author zhangheng
- * @email 512061637@qq.com
- * @date 2019年1月15日
+ * @author jyy
  */
 @Component
 public class StatisticsBusinessDataJob {
@@ -72,7 +70,7 @@
     }
 
 
-    @Scheduled(cron = "0 0 0 1/1 * ?")
+    @Scheduled(cron = "1 0 0 1/1 * ?")
     public boolean executeExt() {
 
         LogUtil.info("业绩统计定时任务开始运行*******************");
diff --git a/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java b/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java
index 95e8d33..26be27d 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/dao/ScoreVipDetailDao.java
@@ -27,4 +27,8 @@
      * @return
      */
     List<ScoreVipDetail> selectEffectiveScore(@Param("vipId")Long vipId);
+
+    List<ScoreVipDetail> selectInvalidaVipScore();
+
+    int invalidVipScore();
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java b/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java
index 947e243..b32fe45 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java
@@ -33,9 +33,19 @@
 	 */
 	public static final int SCORE_VIP_TYPE_REFERRER=3;
 	/**
+	 * 获取类型(4参加活动)
+	 */
+	public static final int SCORE_VIP_TYPE_JOIN_ACTIVE=4;
+
+
+	/**
 	 * 获取类型(4人工调整)
 	 */
 	public static final int SCORE_VIP_TYPE_USERCHANGE=4;
+	/**
+	 * 获取类型(5积分失效)
+	 */
+	public static final int SCORE_OVER_TIME=5;
 
 	/** 有效*/
 	public static final int SCORE_STATUS_YX=1;
diff --git a/zq-erp/src/main/java/com/matrix/system/score/scheduledJob/ScoreScheduledJob.java b/zq-erp/src/main/java/com/matrix/system/score/scheduledJob/ScoreScheduledJob.java
new file mode 100644
index 0000000..edef129
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/score/scheduledJob/ScoreScheduledJob.java
@@ -0,0 +1,64 @@
+package com.matrix.system.score.scheduledJob;
+
+
+import cn.hutool.core.date.DateTime;
+import com.matrix.core.tools.LogUtil;
+import com.matrix.system.common.constance.AppConstance;
+import com.matrix.system.score.dao.ScoreUseRecordDao;
+import com.matrix.system.score.dao.ScoreVipDetailDao;
+import com.matrix.system.score.entity.ScoreUseRecord;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 用户积分相关定时任务
+ *
+ * @author jyy
+ */
+@Component
+public class ScoreScheduledJob {
+
+
+    @Autowired
+    ScoreVipDetailDao scoreVipDetailDao;
+
+    @Autowired
+    ScoreUseRecordDao scoreUseRecordDao;
+
+    @Scheduled(cron = "1 0 0 1/1 * ?")
+    public boolean invalidVipScore() {
+
+        LogUtil.info("计算无效积分定时任务开始运行****************");
+
+        //获取所有失效的积分,生成失效记录
+        List<ScoreVipDetail>  invalidavipScoreList = scoreVipDetailDao.selectInvalidaVipScore();
+
+        for (ScoreVipDetail scoreVipDetail : invalidavipScoreList) {
+            ScoreUseRecord scoreUseRecord=new ScoreUseRecord();
+            scoreUseRecord.setCreateBy(AppConstance.SYSTEM_USER);
+            scoreUseRecord.setUpdateBy(AppConstance.SYSTEM_USER);
+            scoreUseRecord.setCreateTime(DateTime.now());
+            scoreUseRecord.setUpdateTime(DateTime.now());
+            scoreUseRecord.setNowScore(0);
+            scoreUseRecord.setCompanyId(scoreVipDetail.getCompanyId());
+            scoreUseRecord.setScoreVipDetailId(scoreVipDetail.getId());
+            scoreUseRecord.setBusinessId(0L);
+            scoreUseRecord.setRecNum(-scoreVipDetail.getRemainScore());
+            scoreUseRecord.setType(ScoreVipDetail.SCORE_OVER_TIME);
+            scoreUseRecord.setVipId(scoreVipDetail.getVipId());
+            scoreUseRecord.setPreScore(scoreVipDetail.getRemainScore());
+            scoreUseRecord.setRemarks("积分失效");
+            scoreUseRecordDao.insert(scoreUseRecord);
+        }
+        //更新失效积分记录状态
+        scoreVipDetailDao.invalidVipScore();
+        LogUtil.info("计算无效积分定时任务结束*******************");
+        return true;
+    }
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java b/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
index 1c36562..7c27a80 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
@@ -6,9 +6,11 @@
 import com.matrix.core.constance.MatrixConstance;
 import com.matrix.core.exception.GlobleException;
 import com.matrix.core.tools.DateUtil;
+import com.matrix.core.tools.StringUtils;
 import com.matrix.system.common.bean.BusParameterSettings;
 import com.matrix.system.common.dao.BusParameterSettingsDao;
 import com.matrix.system.common.dao.SysUsersDao;
+import com.matrix.system.hive.bean.SysVipInfo;
 import com.matrix.system.hive.dao.SysVipInfoDao;
 import com.matrix.system.score.constant.ScoreSettingConstant;
 import com.matrix.system.score.dao.ScoreUseRecordDao;
@@ -53,12 +55,12 @@
      * 扣除用户积分
      */
     @Transactional(rollbackFor = Exception.class)
-    public void deductionScore(Long vipId,Long oprationUserId,Long shopId, Integer score, Long businessId, int type,String remark) {
-        Long companyId= vipInfoDao.selectById(vipId).getCompanyId();
+    public void deductionScore(Long vipId, Long oprationUserId, Long shopId, Integer score, Long businessId, int type, String remark) {
+        Long companyId = vipInfoDao.selectById(vipId).getCompanyId();
 
-        String createBy=MatrixConstance.SYSTEM_USER;
-        if(oprationUserId!=null){
-            createBy=sysUsersDao.selectById(oprationUserId).getSuName();
+        String createBy = MatrixConstance.SYSTEM_USER;
+        if (oprationUserId != null) {
+            createBy = sysUsersDao.selectById(oprationUserId).getSuName();
         }
 
         List<ScoreVipDetail> effectiveScoreList = scoreVipDetailDao.selectEffectiveScore(vipId);
@@ -74,20 +76,18 @@
                 //余额充足
                 currentDedution = score;
                 scoreVipDetail.setRemainScore(surplus);
-                if(surplus==0){
+                if (surplus == 0) {
                     scoreVipDetail.setState(ScoreVipDetail.SCORE_STATUS_WX);
                 }
                 scoreVipDetailDao.updateById(scoreVipDetail);
-                score=0;
+                score = 0;
             } else {
                 currentDedution = scoreVipDetail.getRemainScore();
                 scoreVipDetail.setState(ScoreVipDetail.SCORE_STATUS_WX);
                 scoreVipDetail.setRemainScore(0);
                 scoreVipDetailDao.updateById(scoreVipDetail);
-                score=Math.abs(surplus);
+                score = Math.abs(surplus);
             }
-
-
 
 
             //新增扣除记录
@@ -107,11 +107,11 @@
             scoreUseRecord.setOprationUserId(oprationUserId);
             scoreUseRecordDao.insert(scoreUseRecord);
 
-            if(surplus > 0 || surplus == 0){
+            if (surplus > 0 || surplus == 0) {
                 break;
             }
         }
-        if(score>0){
+        if (score > 0) {
             throw new GlobleException("积分不足");
         }
     }
@@ -120,26 +120,26 @@
      * 新增用户积分
      */
     @Transactional(rollbackFor = Exception.class)
-    public void addScore(Long vipId, Long oprationUserId,Long shopId, Integer score, Long businessId, int type,String remark) {
-        Long companyId= vipInfoDao.selectById(vipId).getCompanyId();
+    public void addScore(Long vipId, Long oprationUserId, Long shopId, Integer score, Long businessId, int type, String remark) {
+        Long companyId = vipInfoDao.selectById(vipId).getCompanyId();
 
-        if(score<0){
+        if (score < 0) {
             throw new IllegalArgumentException("score必须有为大于零的数");
         }
 
-        String createBy=MatrixConstance.SYSTEM_USER;
-        if(oprationUserId!=null){
-            createBy=sysUsersDao.selectById(oprationUserId).getSuName();
+        String createBy = MatrixConstance.SYSTEM_USER;
+        if (oprationUserId != null) {
+            createBy = sysUsersDao.selectById(oprationUserId).getSuName();
         }
 
         //计算过期时间
         BusParameterSettings yxqSetting = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.VALID_PERIOD_POINTS, companyId);
-        Calendar cal=Calendar.getInstance();
+        Calendar cal = Calendar.getInstance();
         int year = cal.get(Calendar.YEAR);
-        int sxYear=year+(Integer.parseInt(yxqSetting.getParamValue())-1);
-        Date sxys=DateUtil.stringToDate(sxYear+"-12-31 23:59",DateUtil.DATE_FORMAT_MM );
+        int sxYear = year + (Integer.parseInt(yxqSetting.getParamValue()) - 1);
+        Date sxys = DateUtil.stringToDate(sxYear + "-12-31 23:59", DateUtil.DATE_FORMAT_MM);
 
-        ScoreVipDetail scoreVipDetail=new ScoreVipDetail();
+        ScoreVipDetail scoreVipDetail = new ScoreVipDetail();
 
         scoreVipDetail.setCreateBy(createBy);
         scoreVipDetail.setUpdateBy(createBy);
@@ -158,7 +158,7 @@
         scoreVipDetailDao.insert(scoreVipDetail);
 
         //新增添加记录
-        ScoreUseRecord   scoreUseRecord = new ScoreUseRecord();
+        ScoreUseRecord scoreUseRecord = new ScoreUseRecord();
         scoreUseRecord.setPreScore(score);
         scoreUseRecord.setCreateBy(createBy);
         scoreUseRecord.setUpdateBy(createBy);
@@ -180,28 +180,89 @@
     }
 
     /**
+     * 根据固定等级规则新增用户积分
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void addScoreByParamSetting(Long vipId, Long oprationUserId, Long shopId, Long businessId, int type, String remark, BusParameterSettings parameterSetting) {
+
+        if (parameterSetting != null) {
+            SysVipInfo vipInfo = sysVipInfoDao.selectById(vipId);
+            //添加自己的积分
+            if (StringUtils.isNotBlank(parameterSetting.getParamValue())) {
+                Integer firstScore = new Integer(parameterSetting.getParamValue());
+                if (firstScore > 0) {
+                    addScore(
+                            vipInfo.getId(),
+                            oprationUserId,
+                            shopId,
+                            firstScore,
+                            businessId,
+                            type,
+                            remark
+                    );
+                }
+            }
+
+            if (StringUtils.isNotBlank(parameterSetting.getParamValue1())
+                    && vipInfo.getRecommendId() != null) {
+                //推荐注册老带新积分奖励
+                SysVipInfo referrerVip = sysVipInfoDao.selectById(vipInfo.getRecommendId());
+                Integer secondScore = new Integer(parameterSetting.getParamValue1());
+                if (secondScore > 0) {
+                    addScore(
+                            referrerVip.getId(),
+                            oprationUserId,
+                            shopId,
+                            secondScore,
+                            businessId,
+                            type,
+                            remark
+                    );
+                }
+                //推荐注册二级带新积分奖励
+                if (StringUtils.isNotBlank(parameterSetting.getParamValue2())
+                        && referrerVip.getRecommendId() != null) {
+                    Integer threeScore = new Integer(parameterSetting.getParamValue2());
+                    if (threeScore > 0) {
+                        addScore(
+                                referrerVip.getRecommendId(),
+                                oprationUserId,
+                                shopId,
+                                threeScore,
+                                businessId,
+                                type,
+                                remark
+                        );
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
      * 退积分
      */
-    public void refundScore(Long vipId, Integer score, Long oldBusinessId, int type){
+    public void refundScore(Long vipId, Integer score, Long oldBusinessId, int type) {
 
-        Long companyId= vipInfoDao.selectById(vipId).getCompanyId();
+        Long companyId = vipInfoDao.selectById(vipId).getCompanyId();
 
-        if(score<0){
+        if (score < 0) {
             throw new IllegalArgumentException("score必须有为大于零的数");
         }
         //查询原始使用记录
-        QueryWrapper queryWrapper=new QueryWrapper();
-        queryWrapper.eq("business_id",oldBusinessId);
-        queryWrapper.eq("company_id",companyId);
-        queryWrapper.eq("type",type);
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.eq("business_id", oldBusinessId);
+        queryWrapper.eq("company_id", companyId);
+        queryWrapper.eq("type", type);
         List<ScoreUseRecord> scoreUseRecordList = scoreUseRecordDao.selectList(queryWrapper);
         scoreUseRecordList.forEach(scoreUseRecord -> {
             ScoreVipDetail scoreVipDetail = scoreVipDetailDao.selectById(scoreUseRecord.getScoreVipDetailId());
-            if(scoreVipDetail!=null){
-                if(DateTime.now().isAfter(scoreVipDetail.getValiditeTime())){
+            if (scoreVipDetail != null) {
+                if (DateTime.now().isAfter(scoreVipDetail.getValiditeTime())) {
                     //积分还有效
-                    scoreVipDetail.setRemainScore( scoreVipDetail.getRemainScore()+score);
-                    scoreVipDetail.setUsedScore(scoreVipDetail.getUsedScore()-score);
+                    scoreVipDetail.setRemainScore(scoreVipDetail.getRemainScore() + score);
+                    scoreVipDetail.setUsedScore(scoreVipDetail.getUsedScore() - score);
                     scoreVipDetail.setState(ScoreVipDetail.SCORE_STATUS_YX);
                     scoreVipDetailDao.updateById(scoreVipDetail);
                     scoreUseRecordDao.deleteById(scoreUseRecord.getId());
@@ -211,15 +272,15 @@
         });
     }
 
-    public void removeByBusinessId( Long vipId,  Long oldBusinessId){
-        Long companyId= vipInfoDao.selectById(vipId).getCompanyId();
+    public void removeByBusinessId(Long vipId, Long oldBusinessId) {
+        Long companyId = vipInfoDao.selectById(vipId).getCompanyId();
 
-        if(oldBusinessId==null){
+        if (oldBusinessId == null) {
             throw new IllegalArgumentException("oldBusinessId必须有");
         }
-        QueryWrapper queryWrapper=new QueryWrapper();
-        queryWrapper.eq("business_id",oldBusinessId);
-        queryWrapper.eq("company_id",companyId);
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.eq("business_id", oldBusinessId);
+        queryWrapper.eq("company_id", companyId);
         scoreVipDetailDao.delete(queryWrapper);
         scoreUseRecordDao.delete(queryWrapper);
     }
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductCommentAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductCommentAction.java
index b34cdd5..456b0e2 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductCommentAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductCommentAction.java
@@ -1,10 +1,14 @@
 package com.matrix.system.shopXcx.api.action;
 
-import com.matrix.core.pojo.AjaxResult;
-import com.matrix.system.hive.bean.SysVipInfo;
 import com.matrix.component.redis.RedisUserLoginUtils;
+import com.matrix.core.pojo.AjaxResult;
+import com.matrix.system.common.bean.BusParameterSettings;
 import com.matrix.system.common.constance.AppConstance;
-
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.score.constant.ScoreSettingConstant;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import com.matrix.system.score.service.ScoreVipDetailService;
 import com.matrix.system.shopXcx.bean.ShopOrder;
 import com.matrix.system.shopXcx.bean.ShopProductComment;
 import com.matrix.system.shopXcx.dao.ShopOrderDao;
@@ -34,6 +38,11 @@
     @Autowired
     private ShopOrderDao shopOrderDao;
 
+    @Autowired
+    ScoreVipDetailService scoreVipDetailService;
+
+    @Autowired
+    private BusParameterSettingsDao busParameterSettingsDao;
     /**
      * 根据ID逻辑删除产品评价
      * @param
@@ -81,6 +90,13 @@
         modifyMap.put("id", orderId);
         modifyMap.put("orderStatus", ShopOrder.ORDER_STATUS_ALREADY_REMARK);
         shopOrderDao.updateByMap(modifyMap);
+
+        //添加用户积分
+        BusParameterSettings parameterSetting = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.EVALUATUIN_ORDER_SHOP_NAME, loginUser.getCompanyId());
+        scoreVipDetailService.addScoreByParamSetting(loginUser.getId(), null,null, commentList.get(0).getComId(),
+                ScoreVipDetail.SCORE_VIP_TYPE_JOIN_ACTIVE,"评价送积分", parameterSetting);
+
+
         return new AjaxResult(AjaxResult.STATUS_SUCCESS, "保存成功");
     }
 
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
index 82aea50..9cac99e 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
@@ -108,10 +108,10 @@
                     sysVipInfo.setSessionKey(sessionKey);
                     sysVipInfo.setCompanyId(HostInterceptor.getCompanyId());
                     sysVipInfo.setArrivalWay("微商城");
+                    sysVipInfo.setVipName("微信用户");
                     sysVipInfo.setVipState(Dictionary.VIP_STATE_HY);
                     sysVipInfo.setVipType(Dictionary.VIP_TYPE_NOCARD);
                     sysVipInfo.setIsDeal(SysVipInfo.UNDEAL_VIP);
-
                     sysVipInfo.setVipNo(openId);
                     sysVipInfoService.add(sysVipInfo);
 
@@ -177,7 +177,7 @@
 
         BeanUtil.copyProperties(xcxUserSaveUserInfoDto,sysVipInfo);
         sysVipInfo.setPhone(xcxUserSaveUserInfoDto.getPhoneNumber());
-        if(StringUtils.isBlank(loginUser.getVipName())){
+        if(StringUtils.isBlank(loginUser.getVipName())||loginUser.getVipName().equals("微信用户")){
             sysVipInfo.setVipName(xcxUserSaveUserInfoDto.getNickName());
         }
         if(StringUtils.isBlank(loginUser.getSex())){
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java
index ec10347..9aefc8a 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java
@@ -1,7 +1,5 @@
 package com.matrix.system.shopXcx.api.action;
 
-import com.matrix.system.hive.bean.SysVipInfo;
-import com.matrix.system.hive.dao.SysVipInfoDao;
 import com.matrix.component.rabbitmq.RabiitMqTemplate;
 import com.matrix.component.redis.RedisUserLoginUtils;
 import com.matrix.core.exception.GlobleException;
@@ -10,8 +8,12 @@
 import com.matrix.core.tools.DateUtil;
 import com.matrix.core.tools.StringUtils;
 import com.matrix.system.app.mapper.SysProjUseMapper;
-import com.matrix.system.app.vo.*;
+import com.matrix.system.app.vo.ServiceProductListVo;
+import com.matrix.system.app.vo.ServiceProjVo;
+import com.matrix.system.app.vo.ServiceTcVo;
+import com.matrix.system.common.bean.BusParameterSettings;
 import com.matrix.system.common.bean.SysUsers;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
 import com.matrix.system.common.dao.SysUsersDao;
 import com.matrix.system.common.interceptor.HostInterceptor;
 import com.matrix.system.common.tools.LocationUtil;
@@ -20,6 +22,9 @@
 import com.matrix.system.hive.dao.*;
 import com.matrix.system.hive.plugin.util.CollectionUtils;
 import com.matrix.system.hive.service.*;
+import com.matrix.system.score.constant.ScoreSettingConstant;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import com.matrix.system.score.service.ScoreVipDetailService;
 import com.matrix.system.shopXcx.api.dto.ErpServiceCommentDto;
 import com.matrix.system.shopXcx.api.dto.ErpServiceOrderListDto;
 import com.matrix.system.shopXcx.api.vo.ErpServiceOrderListVo;
@@ -27,7 +32,9 @@
 import com.matrix.system.shopXcx.dao.ShopSkuDao;
 import com.matrix.system.shopXcx.dto.YYDayOfWeek;
 import com.matrix.system.shopXcx.dto.YYmonth;
-import io.swagger.annotations.*;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
@@ -36,7 +43,9 @@
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 
 /**
  * @author jiangyouyao
@@ -91,6 +100,11 @@
 
     @Autowired
     ShoppingGoodsDao shoppingGoodsDao;
+    @Autowired
+    ScoreVipDetailService scoreVipDetailService;
+
+    @Autowired
+    private BusParameterSettingsDao busParameterSettingsDao;
 
     @Value("${evn}")
     private String evn;
@@ -303,6 +317,13 @@
         sysProjServices.setState(Dictionary.SERVICE_STATU_DQR);
         SysProjServices newSysProjServices = projServicesService.addSysProjServices(sysProjServices);
         if (newSysProjServices != null) {
+
+            //添加用户积分
+            BusParameterSettings parameterSetting = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.RESERVATION_SERVICE_SHOP, sysVipInfo.getCompanyId());
+            scoreVipDetailService.addScoreByParamSetting(sysVipInfo.getId(), null,null, newSysProjServices.getId(),
+                    ScoreVipDetail.SCORE_VIP_TYPE_JOIN_ACTIVE,"预约送积分", parameterSetting);
+
+
             return AjaxResult.buildSuccessInstance("下单成功");
         } else {
             return new AjaxResult(AjaxResult.STATUS_FAIL, "下单失败!");
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProductComment.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProductComment.java
index 9c9557d..77e678d 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProductComment.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProductComment.java
@@ -20,7 +20,7 @@
 	/**
 	 * 主键
 	 */
-	private Integer  comId;
+	private Long  comId;
 			
 	
 	/**
@@ -182,14 +182,13 @@
 		auditStatus = auditStatus;
 	}
 
-	public Integer getComId() {
+	public Long getComId() {
 		return comId;
 	}
-   	
-   	public void setComId(Integer comId) {
-		this.comId=comId;
+
+	public void setComId(Long comId) {
+		this.comId = comId;
 	}
-   	
 
 	public String getUserId() {
 		return userId;
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
index 3b7c40e..0ad9e03 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
@@ -1,11 +1,13 @@
 package com.matrix.system.shopXcx.mqTask;
 
 
-import com.matrix.system.hive.service.SysVipInfoService;
 import com.matrix.core.tools.LogUtil;
 import com.matrix.core.tools.StringUtils;
 import com.matrix.system.common.bean.BusParameterSettings;
 import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.hive.dao.SysVipInfoDao;
+import com.matrix.system.hive.service.SysVipInfoService;
 import com.matrix.system.score.constant.ScoreSettingConstant;
 import com.matrix.system.score.entity.ScoreVipDetail;
 import com.matrix.system.score.service.ScoreVipDetailService;
@@ -38,14 +40,14 @@
     SysVipInfoService sysVipInfoService;
 
 
-
     @Autowired
     ScoreVipDetailService scoreVipDetailService;
 
     @Autowired
     BusParameterSettingsDao busParameterSettingsDao;
 
-
+    @Autowired
+    SysVipInfoDao sysVipInfoDao;
 
     @Override
     public void handle(String consumerTag, Delivery message) throws IOException {
@@ -58,37 +60,78 @@
         List<ShopOrderDetails> orderDetails = shopOrderDetailsDao.selectByOrderId(Integer.valueOf(orderId));
         order.setDetails(orderDetails);
         //扣除积分
-        if(order.getScorePay()!=null&&order.getScorePay()>0){
-            scoreVipDetailService.deductionScore(order.getUserId(),null,
-                    Long.parseLong(order.getStoreId()+""),order.getScorePay(),
-                    Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH,"商城积分抵扣");
-        }else{
+        if (order.getScorePay() != null && order.getScorePay() > 0) {
+            scoreVipDetailService.deductionScore(order.getUserId(), null,
+                    Long.parseLong(order.getStoreId() + ""), order.getScorePay(),
+                    Long.parseLong(order.getId() + ""), ScoreVipDetail.SCORE_VIP_TYPE_CASH, "商城积分抵扣");
+        } else {
 
             //消费获得积分
-            int addScore=0;
+            int addScore = 0;
             BusParameterSettings cashConsumptionShop = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.CASH_CONSUMPTION_SHOP, order.getCompanyId());
-            for(ShopOrderDetails shopOrderDetail : orderDetails) {
-                if(shopOrderDetail.getPayType()==ShopOrderDetails.PAYTYPE_MICRO){
-                    Integer xfkdScore=  shopOrderDetail.getShopSku().getScore();
-                    if(xfkdScore!=null && xfkdScore>0){
-                        addScore+=xfkdScore;
-                    }else{
-                        if(StringUtils.isNotBlank(cashConsumptionShop.getParamValue())){
-                            addScore+= shopOrderDetail.getTotalPrice().divide(new BigDecimal(cashConsumptionShop.getParamValue())).intValue();
+            for (ShopOrderDetails shopOrderDetail : orderDetails) {
+                if (shopOrderDetail.getPayType() == ShopOrderDetails.PAYTYPE_MICRO) {
+                    Integer xfkdScore = shopOrderDetail.getShopSku().getScore();
+                    if (xfkdScore != null && xfkdScore > 0) {
+                        addScore += xfkdScore;
+                    } else {
+                        if (StringUtils.isNotBlank(cashConsumptionShop.getParamValue())) {
+                            addScore += shopOrderDetail.getTotalPrice().divide(new BigDecimal(cashConsumptionShop.getParamValue())).intValue();
                         }
                     }
                 }
             }
-            if(addScore>0){
+            if (addScore > 0) {
                 //插入新的积分
                 scoreVipDetailService.addScore(
                         order.getUserId(),
                         null,
-                        Long.parseLong(order.getStoreId()+""),
+                        Long.parseLong(order.getStoreId() + ""),
                         addScore,
-                        Long.parseLong(orderId+""),
+                        Long.parseLong(orderId + ""),
                         ScoreVipDetail.SCORE_VIP_TYPE_CASH,
                         "微商城消费");
+
+                //插入上级积分
+                SysVipInfo vipInfo = sysVipInfoService.findById(order.getUserId());
+
+
+                if (vipInfo.getRecommendId() != null) {
+                    //推荐注册老带新积分奖励
+                    SysVipInfo referrerVip = sysVipInfoDao.selectById(vipInfo.getRecommendId());
+                    if (StringUtils.isNotBlank(cashConsumptionShop.getParamValue1())) {
+
+                        int parentScore = order.getOrderMoney().divide(new BigDecimal(cashConsumptionShop.getParamValue1())).intValue();
+                        if (parentScore > 0) {
+                            scoreVipDetailService.addScore(
+                                    referrerVip.getId(),
+                                    null,
+                                    Long.parseLong(order.getStoreId() + ""),
+                                    parentScore,
+                                    Long.parseLong(order.getId() + ""),
+                                    ScoreVipDetail.SCORE_VIP_TYPE_CASH,
+                                    "推荐消费奖励"
+                            );
+                        }
+                    }
+
+                    //推荐注册二级带新积分奖励
+                    if (referrerVip.getRecommendId() != null && StringUtils.isNotBlank(cashConsumptionShop.getParamValue2())) {
+                        SysVipInfo topVipInfo = sysVipInfoDao.selectById(referrerVip.getRecommendId());
+                        int topParentScore = order.getOrderMoney().divide(new BigDecimal(cashConsumptionShop.getParamValue2())).intValue();
+                        if (topParentScore > 0) {
+                            scoreVipDetailService.addScore(
+                                    topVipInfo.getId(),
+                                    null,
+                                    Long.parseLong(order.getStoreId() + ""),
+                                    topParentScore,
+                                    Long.parseLong(order.getId() + ""),
+                                    ScoreVipDetail.SCORE_VIP_TYPE_CASH,
+                                    "推荐消费奖励"
+                            );
+                        }
+                    }
+                }
             }
         }
 
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityGroupJoinTimeOutQuartz.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityGroupJoinTimeOutQuartz.java
index 07927b5..4c1efc7 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityGroupJoinTimeOutQuartz.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityGroupJoinTimeOutQuartz.java
@@ -1,19 +1,15 @@
 package com.matrix.system.shopXcx.quartz;
 
 import com.matrix.core.tools.LogUtil;
-import com.matrix.core.tools.WebUtil;
-
 import com.matrix.system.hive.plugin.util.CollectionUtils;
 import com.matrix.system.shopXcx.bean.ShopActivities;
 import com.matrix.system.shopXcx.bean.ShopActivitiesGroupInfo;
 import com.matrix.system.shopXcx.bean.ShopActivitiesGroupJoin;
 import com.matrix.system.shopXcx.dao.ShopActivitiesDao;
 import com.matrix.system.shopXcx.dao.ShopActivitiesGroupJoinDao;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
 import java.util.List;
@@ -24,7 +20,6 @@
  * @author wzy
  */
 @Configuration
-@EnableScheduling
 public class ShopActivityGroupJoinTimeOutQuartz {
 
     @Autowired
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityPayTimeOutQuartz.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityPayTimeOutQuartz.java
index 143a2d2..8a2d9b3 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityPayTimeOutQuartz.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityPayTimeOutQuartz.java
@@ -1,7 +1,6 @@
 package com.matrix.system.shopXcx.quartz;
 
 import com.matrix.core.tools.LogUtil;
-import com.matrix.core.tools.WebUtil;
 import com.matrix.system.hive.plugin.util.CollectionUtils;
 import com.matrix.system.shopXcx.bean.ShopActivitiesGroupJoin;
 import com.matrix.system.shopXcx.bean.ShopActivitiesGroupJoinUser;
@@ -9,11 +8,9 @@
 import com.matrix.system.shopXcx.dao.ShopActivitiesGroupJoinDao;
 import com.matrix.system.shopXcx.dao.ShopActivitiesGroupJoinUserDao;
 import com.matrix.system.shopXcx.dao.ShopOrderDao;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
 import java.util.List;
@@ -24,7 +21,6 @@
  * @author wzy
  */
 @Configuration
-@EnableScheduling
 public class ShopActivityPayTimeOutQuartz {
 
     @Autowired
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityTimeOutQuartz.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityTimeOutQuartz.java
index 8f1d146..10e754d 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityTimeOutQuartz.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopActivityTimeOutQuartz.java
@@ -11,7 +11,6 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
 import java.util.ArrayList;
@@ -24,7 +23,6 @@
  * @author wzy
  */
 @Configuration
-@EnableScheduling
 public class ShopActivityTimeOutQuartz {
 
     @Autowired
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopAutomaticReceiveQuartz.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopAutomaticReceiveQuartz.java
index bcf6a1a..10df6db 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopAutomaticReceiveQuartz.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopAutomaticReceiveQuartz.java
@@ -1,18 +1,15 @@
 package com.matrix.system.shopXcx.quartz;
 
 import com.matrix.core.tools.LogUtil;
-import com.matrix.core.tools.WebUtil;
 import com.matrix.system.shopXcx.api.tools.WxShopOrderUtil;
 import com.matrix.system.shopXcx.bean.ShopDeliveryInfo;
 import com.matrix.system.shopXcx.bean.ShopOrder;
 import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao;
 import com.matrix.system.shopXcx.dao.ShopOrderDao;
 import org.apache.commons.collections.CollectionUtils;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
 import java.util.HashMap;
@@ -24,7 +21,6 @@
  * 15天自动确认收货定时任务
  */
 @Configuration
-@EnableScheduling
 public class ShopAutomaticReceiveQuartz {
 
     @Value("${scheduling.enabled}")
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopCouponQuartz.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopCouponQuartz.java
index 25e4314..4a1ddf1 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopCouponQuartz.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/quartz/ShopCouponQuartz.java
@@ -1,13 +1,10 @@
 package com.matrix.system.shopXcx.quartz;
 
 import com.matrix.core.tools.LogUtil;
-import com.matrix.core.tools.WebUtil;
 import com.matrix.system.shopXcx.dao.ShopCouponDao;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
 /**
@@ -15,7 +12,6 @@
  * 优惠券定时任务
  */
 @Configuration
-@EnableScheduling
 public class ShopCouponQuartz   {
 
 
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
index 408bb1b..f0f1086 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -18,6 +18,7 @@
 		<result property="freeConsume" column="free_consume" />
 		<result property="hisConsume" column="his_consume" />
 		<result property="goodsCash" column="goods_cash" />
+		<result property="cardCash" column="card_cash" />
 		<result property="projNum" column="proj_num" />
 		<result property="numberOfPeople" column="number_of_people" />
 		<result property="shopName" column="shop_name" />
@@ -66,7 +67,6 @@
 		c.vip_name,
 		e.name as pro_name,
 		b.ZK_TOTAL as zk_total,
-		a.goods_cash,
 		a.his_consume,
 		a.free_consume,
 		f.su_name meiliao,
@@ -79,6 +79,8 @@
 		h.shop_short_name shop_name,
 		a.order_type,
 		a.achieveType,
+		case when a.pay_method = '现金' then goods_cash end goods_cash,
+		case when a.pay_method = '划扣' then goods_cash end card_cash,
 		j.pay_method
 		from
 		achieve_new a
diff --git a/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml b/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml
index 47664d6..5481b2b 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml
@@ -19,4 +19,13 @@
 
     </select>
 
+
+    <select id="selectInvalidaVipScore" resultType="com.matrix.system.score.entity.ScoreVipDetail">
+        select * from score_vip_detail where  state=1 and remain_score>0 and validite_time <![CDATA[ < now()]]>
+    </select>
+
+    <update id="invalidVipScore">
+        update score_vip_detail set state = 2 , remain_score=0  where state=1 and validite_time <![CDATA[ < now()]]>
+    </update>
+
 </mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html
index 0137137..f19c967 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html
@@ -113,6 +113,8 @@
 			<el-table-column prop="proName" label="产品" width="200"></el-table-column>
 			<el-table-column prop="cateName" label="产品分类"></el-table-column>
 			<el-table-column prop="zkTotal" label="订单金额"></el-table-column>
+			<el-table-column prop="goodsCash" label="现金"></el-table-column>
+			<el-table-column prop="cardCash" label="划扣"></el-table-column>
 <!--			<el-table-column prop="goodsCash" label="订单业绩"></el-table-column>-->
 			<el-table-column prop="meiliao" label="员工"></el-table-column>
 			<el-table-column v-for="(item, index) in customColumns" width="120" :key="index" :label="item.value">
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
index 474b61e..0bee811 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
@@ -237,6 +237,18 @@
                         </template>
                     </el-table-column>
                 </el-table>
+
+                <el-row style="text-align: center; margin-top: 10px;">
+                    <el-pagination
+                            @size-change="handleSizeChange"
+                            @current-change="handleCurrentChange"
+                            :current-page="page.currentPage"
+                            :page-sizes="[10, 20, 30, 50]"
+                            :page-size="page.pageSize"
+                            layout="total, prev, pager, next, jumper"
+                            :total="page.total">
+                    </el-pagination>
+                </el-row>
                 <el-row class="btn-box">
                     <el-button size="mini" type="danger" @click="closeXm()">关闭</el-button>
                     <el-button size="mini" type="primary" @click="chouseGoods()">确认</el-button>
@@ -659,6 +671,11 @@
             searchTableData: [],
             //表格加载效果
             loading: false,
+            page : {
+                currentPage : 1,
+                pageSize : 10,
+                total : 0
+            },
             /******搜索表格数据END********/
 
             dialogSettleVisible : false,
@@ -1174,6 +1191,9 @@
              */
             searchGoods() {
                 let _this = this;
+                var currentPage = this.page.currentPage;
+                var pageSize = this.page.pageSize;
+                var offset = (currentPage - 1) * pageSize;
                 if (this.queryKey && this.queryKey.trim().length > 0) {
                     this.showSearchTable = true;
                     this.loading = true;
@@ -1181,10 +1201,11 @@
                         app: _this,
                         contentType: 'application/x-www-form-urlencoded',
                         //TODO 优化下拉加载
-                        data: {name: _this.queryKey, limit: 10000},
+                        data: {name: _this.queryKey, limit: pageSize, offset : offset},
                         url: basePath + "/admin/shoppinggoods/showList",
                         callback: function (data) {
                             _this.searchTableData = data.rows;
+                            _this.page.total = data.total;
                             _this.loading = false;
                         }
                     });
@@ -1192,8 +1213,14 @@
                     this.showSearchTable = false;
                 }
             },
-
-
+            handleSizeChange(val) {
+                this.page.pageSize = val;
+                this.searchGoods();
+            },
+            handleCurrentChange(val) {
+                this.page.currentPage = val;
+                this.searchGoods();
+            },
             remoteMethod(query) {
                 if (query !== '') {
                     this.vipLoading = true;
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html
index 0137137..f19c967 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html
@@ -113,6 +113,8 @@
 			<el-table-column prop="proName" label="产品" width="200"></el-table-column>
 			<el-table-column prop="cateName" label="产品分类"></el-table-column>
 			<el-table-column prop="zkTotal" label="订单金额"></el-table-column>
+			<el-table-column prop="goodsCash" label="现金"></el-table-column>
+			<el-table-column prop="cardCash" label="划扣"></el-table-column>
 <!--			<el-table-column prop="goodsCash" label="订单业绩"></el-table-column>-->
 			<el-table-column prop="meiliao" label="员工"></el-table-column>
 			<el-table-column v-for="(item, index) in customColumns" width="120" :key="index" :label="item.value">
diff --git a/zq-erp/src/test/java/com/matrix/ParameterSettingsTool.java b/zq-erp/src/test/java/com/matrix/ParameterSettingsTool.java
new file mode 100644
index 0000000..e12109a
--- /dev/null
+++ b/zq-erp/src/test/java/com/matrix/ParameterSettingsTool.java
@@ -0,0 +1,92 @@
+package com.matrix;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.matrix.system.common.bean.BusParameterSettings;
+import com.matrix.system.common.bean.SysCompany;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.common.dao.SysCompanyDao;
+import com.matrix.system.hive.bean.ParameterSettings;
+import com.matrix.system.hive.dao.ParameterSettingsDao;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 配置工具
+ * 
+ * @author jiangyouyao
+ * @email 512061637@qq.com
+ * @date 2019年2月25日
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {ZqErpApplication.class},webEnvironment =SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class ParameterSettingsTool {
+
+
+	@Autowired
+	private ParameterSettingsDao parameterSettingsDao;
+
+	@Autowired
+	private BusParameterSettingsDao busParameterSettingsDao;
+
+	@Autowired
+	private SysCompanyDao sysCompanyDao;
+
+	/*
+	给所有公司加上多个配置,如果已经存在则跳过
+	 */
+	@Test
+	public void addSettings(){
+
+		List<ParameterSettings> newSettings=new ArrayList<>();
+
+
+		ParameterSettings newSetting1=new ParameterSettings();
+		newSetting1.setCode("APP_BANNER_GL");
+		newSetting1.setName("APP管理模块Banner");
+		newSetting1.setType(1);
+		newSetting1.setCategory("APP设置");
+		newSettings.add(newSetting1);
+
+		for (ParameterSettings newSetting : newSettings) {
+			List<ParameterSettings> parameterSettings = parameterSettingsDao.selectByModel(newSetting);
+			if(CollectionUtil.isEmpty(parameterSettings)){
+				parameterSettingsDao.insert(newSetting);
+				System.out.println("新增配置"+newSetting.getName());
+			}else {
+				System.out.println("配置"+newSetting.getName()+"已经存在");
+			}
+			addSettingsTOAllCompany(newSetting);
+		}
+	}
+
+	private void addSettingsTOAllCompany(ParameterSettings newSetting) {
+
+		List<SysCompany> allCompany = sysCompanyDao.selectByModel(null);
+
+		for (SysCompany sysCompany : allCompany) {
+			BusParameterSettings checkExist = busParameterSettingsDao.selectCompanyParamByCode(newSetting.getCode(), sysCompany.getComId());
+			if(checkExist==null){
+				BusParameterSettings busParameterSettings=new BusParameterSettings();
+				busParameterSettings.setCompanyId(sysCompany.getComId());
+				busParameterSettings.setParamCode(newSetting.getCode());
+				busParameterSettings.setParamValue("");
+				busParameterSettingsDao.insert(busParameterSettings);
+				System.out.println(sysCompany.getComName()+"新增成功");
+			}else{
+				System.out.println("公司"+sysCompany.getComName()+"已经存在配置"+newSetting.getName());
+			}
+
+		}
+
+
+
+	}
+
+
+}

--
Gitblit v1.9.1