From 32185e7f8501b2cd1db3dede0bb555b4039c5ac2 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Thu, 19 Dec 2024 10:05:09 +0800
Subject: [PATCH] feat(mall): 添加跑腿会员系统设置功能

---
 src/main/java/cc/mrbird/febs/mall/controller/ViewRunVipController.java       |    6 
 src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java               |   97 ++++------
 src/main/java/cc/mrbird/febs/mall/quartz/BaiduJob.java                       |   77 ++++----
 src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java                       |  140 +++++++--------
 src/main/java/cc/mrbird/febs/mall/quartz/OrderSettlementJob.java             |   95 ++++-----
 src/main/java/cc/mrbird/febs/common/enumerates/RunVipDataDictionaryEnum.java |    8 
 src/main/resources/mapper/modules/DataDictionaryCustomMapper.xml             |    2 
 src/main/java/cc/mrbird/febs/mall/controller/AdminRunVipController.java      |    8 
 src/main/resources/templates/febs/views/modules/runVip/systemSetting.html    |   94 ++++++++++
 9 files changed, 298 insertions(+), 229 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/common/enumerates/RunVipDataDictionaryEnum.java b/src/main/java/cc/mrbird/febs/common/enumerates/RunVipDataDictionaryEnum.java
index 8304d00..0558141 100644
--- a/src/main/java/cc/mrbird/febs/common/enumerates/RunVipDataDictionaryEnum.java
+++ b/src/main/java/cc/mrbird/febs/common/enumerates/RunVipDataDictionaryEnum.java
@@ -6,12 +6,12 @@
 public enum RunVipDataDictionaryEnum {
 
     //释放碳积分的开始结束时间
-    RUN_START_TIME("RUN_START_TIME", "RUN_START_TIME"),
-    RUN_END_TIME("RUN_END_TIME", "RUN_END_TIME"),
+    RUN_START_TIME("CHARGE_TYPE", "RUN_START_TIME"),
+    RUN_END_TIME("CHARGE_TYPE", "RUN_END_TIME"),
 
     //充值类型
-    CHARGE_TYPE_TRC("CHARGE_TYPE", "CHARGE_TYPE_TRC"),
-    CHARGE_TYPE_BSC("CHARGE_TYPE", "CHARGE_TYPE_BSC"),
+    CHARGE_TYPE_TRC("CHARGE_TYPE_TRC", "CHARGE_TYPE_TRC"),
+    CHARGE_TYPE_BSC("CHARGE_TYPE_BSC", "CHARGE_TYPE_BSC"),
 
     //系统充值失效时间
     CHARGE_SYS_FAIL_TIME("CHARGE_TYPE", "CHARGE_SYS_FAIL_TIME"),
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminRunVipController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminRunVipController.java
index 1f6aa6b..52aefd3 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminRunVipController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminRunVipController.java
@@ -10,6 +10,7 @@
 import cc.mrbird.febs.mall.entity.RunVip;
 import cc.mrbird.febs.mall.mapper.MallMemberMapper;
 import cc.mrbird.febs.mall.service.IAdminRunVipService;
+import cc.mrbird.febs.mall.service.ISystemService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.annotation.Validated;
@@ -27,6 +28,13 @@
 
     private final IAdminRunVipService iAdminRunVipService;
     private final MallMemberMapper mallMemberMapper;
+    private final ISystemService systemService;
+
+    @PostMapping(value = "/bonusSystemSetting")
+    public FebsResponse bonusSystemSetting(@RequestBody Map<String, Object> map) {
+        systemService.bonusSystemSetting(map);
+        return new FebsResponse().success().message("设置成功");
+    }
 
     @GetMapping(value = "/allMoneyType")
     public FebsResponse allMoneyType() {
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ViewRunVipController.java b/src/main/java/cc/mrbird/febs/mall/controller/ViewRunVipController.java
index 995fdc1..4dc0c67 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ViewRunVipController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ViewRunVipController.java
@@ -46,4 +46,10 @@
         return FebsUtil.view("modules/runVip/vipEdit");
     }
 
+    @GetMapping("systemSetting")
+    @RequiresPermissions("systemSetting:view")
+    public String vipCenterSetting() {
+        return FebsUtil.view("modules/runVip/systemSetting");
+    }
+
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/quartz/BaiduJob.java b/src/main/java/cc/mrbird/febs/mall/quartz/BaiduJob.java
index d9c2125..2f9ada8 100644
--- a/src/main/java/cc/mrbird/febs/mall/quartz/BaiduJob.java
+++ b/src/main/java/cc/mrbird/febs/mall/quartz/BaiduJob.java
@@ -1,14 +1,9 @@
 package cc.mrbird.febs.mall.quartz;
 
 import cc.mrbird.febs.common.utils.RedisUtils;
-import cc.mrbird.febs.pay.util.WechatConfigure;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.extension.exceptions.ApiException;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.web.client.RestTemplate;
 
@@ -24,41 +19,41 @@
     @Resource
     RestTemplate restTemplate;
 
-    @Scheduled(cron = "0 0 1 * * ? ")
-    public void getAccessToken(){
-        // 官网获取的 API Key 更新为你注册的
-        String clientId = "MPHXcBxkGLIDOmoaahS9pIB7";
-        // 官网获取的 Secret Key 更新为你注册的
-        String clientSecret = "f5ueNY65fE9C6FzFTVKc6Imo8NdZSWMw";
-        String authHost = "https://aip.baidubce.com/oauth/2.0/token?";
-        String getAccessTokenUrl = authHost
-                // 1. grant_type为固定参数
-                + "grant_type=client_credentials"
-                // 2. 官网获取的 API Key
-                + "&client_id=" + clientId
-                // 3. 官网获取的 Secret Key
-                + "&client_secret=" + clientSecret;
-        String jsonStr = restTemplate.getForObject(getAccessTokenUrl, String.class);
-
-        /**
-         * 返回结果
-         * {"access_token":"ACCESS_TOKEN","expires_in":7200}
-         */
-        if (!jsonStr.contains("access_token")) {
-            System.out.println("获取access_token失败");
-        }
-        JSONObject jsonObject = JSONObject.parseObject(jsonStr);
-        String accessToken = jsonObject.getString("access_token");
-
-        String accessTokenKey = WechatConfigure.BAIDU_ACCESS_TOKEN_REDIS_KEY;
-        if (StrUtil.isEmpty(accessToken)) {
-            log.error("获取baidu access_token失败: {}" , jsonObject.getString("errmsg"));
-            throw new ApiException("获取access token失败");
-        } else {
-            log.info("baidu access_token : {}",accessToken);
-            System.out.println(accessToken);
-            redisUtils.set(accessTokenKey,accessToken);
-        }
-    }
+//    @Scheduled(cron = "0 0 1 * * ? ")
+//    public void getAccessToken(){
+//        // 官网获取的 API Key 更新为你注册的
+//        String clientId = "MPHXcBxkGLIDOmoaahS9pIB7";
+//        // 官网获取的 Secret Key 更新为你注册的
+//        String clientSecret = "f5ueNY65fE9C6FzFTVKc6Imo8NdZSWMw";
+//        String authHost = "https://aip.baidubce.com/oauth/2.0/token?";
+//        String getAccessTokenUrl = authHost
+//                // 1. grant_type为固定参数
+//                + "grant_type=client_credentials"
+//                // 2. 官网获取的 API Key
+//                + "&client_id=" + clientId
+//                // 3. 官网获取的 Secret Key
+//                + "&client_secret=" + clientSecret;
+//        String jsonStr = restTemplate.getForObject(getAccessTokenUrl, String.class);
+//
+//        /**
+//         * 返回结果
+//         * {"access_token":"ACCESS_TOKEN","expires_in":7200}
+//         */
+//        if (!jsonStr.contains("access_token")) {
+//            System.out.println("获取access_token失败");
+//        }
+//        JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+//        String accessToken = jsonObject.getString("access_token");
+//
+//        String accessTokenKey = WechatConfigure.BAIDU_ACCESS_TOKEN_REDIS_KEY;
+//        if (StrUtil.isEmpty(accessToken)) {
+//            log.error("获取baidu access_token失败: {}" , jsonObject.getString("errmsg"));
+//            throw new ApiException("获取access token失败");
+//        } else {
+//            log.info("baidu access_token : {}",accessToken);
+//            System.out.println(accessToken);
+//            redisUtils.set(accessTokenKey,accessToken);
+//        }
+//    }
 
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java b/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java
index e408b37..d9197bc 100644
--- a/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java
+++ b/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java
@@ -1,21 +1,10 @@
 package cc.mrbird.febs.mall.quartz;
 
-import cc.mrbird.febs.common.enumerates.OrderStatusEnum;
-import cc.mrbird.febs.common.exception.FebsException;
-import cc.mrbird.febs.mall.entity.*;
 import cc.mrbird.febs.mall.mapper.*;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateUnit;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.ObjectUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
-
-import java.util.Date;
-import java.util.List;
 
 /**
  * @author wzy
@@ -44,51 +33,51 @@
     @Autowired
     private MallMemberCouponMapper mallMemberCouponMapper;
 
-    @Scheduled(cron = "0 0/5 * * * ? ")
-    public void overtimeJob() {
-        log.info("订单超时任务执行");
-        List<MallOrderInfo> orderList = orderInfoMapper.selectOrderInfoUpTime(OrderStatusEnum.WAIT_PAY.getValue());
-        if (CollUtil.isNotEmpty(orderList)) {
-            for (MallOrderInfo orderInfo : orderList) {
-                //更新订单状态
-                orderInfo.setStatus(OrderStatusEnum.CANCEL.getValue());
-                orderInfo.setCancelType(MallOrderInfo.CANCEL_OVERTIME_NO_PAY);
-                orderInfoMapper.updateById(orderInfo);
-
-                List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(orderInfo.getId());
-                if(CollUtil.isNotEmpty(mallOrderItemList)){
-                    for(MallOrderItem mallOrderItem : mallOrderItemList){
-                        MallGoodsSku sku = mallGoodsSkuMapper.selectSkuInfoById(mallOrderItem.getSkuId());
-                        if (sku == null) {
-                            throw new FebsException("购买商品或sku不存在");
-                        }
-
-//                        if (sku.getStock() < mallOrderItem.getCnt()) {
+//    @Scheduled(cron = "0 0/5 * * * ? ")
+//    public void overtimeJob() {
+//        log.info("订单超时任务执行");
+//        List<MallOrderInfo> orderList = orderInfoMapper.selectOrderInfoUpTime(OrderStatusEnum.WAIT_PAY.getValue());
+//        if (CollUtil.isNotEmpty(orderList)) {
+//            for (MallOrderInfo orderInfo : orderList) {
+//                //更新订单状态
+//                orderInfo.setStatus(OrderStatusEnum.CANCEL.getValue());
+//                orderInfo.setCancelType(MallOrderInfo.CANCEL_OVERTIME_NO_PAY);
+//                orderInfoMapper.updateById(orderInfo);
+//
+//                List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(orderInfo.getId());
+//                if(CollUtil.isNotEmpty(mallOrderItemList)){
+//                    for(MallOrderItem mallOrderItem : mallOrderItemList){
+//                        MallGoodsSku sku = mallGoodsSkuMapper.selectSkuInfoById(mallOrderItem.getSkuId());
+//                        if (sku == null) {
+//                            throw new FebsException("购买商品或sku不存在");
+//                        }
+//
+////                        if (sku.getStock() < mallOrderItem.getCnt()) {
+////                            throw new FebsException(sku.getSkuName() + "库存不足");
+////                        }
+//
+//                        MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId());
+//                        Integer goodsResult = mallGoodsMapper.updateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt());
+//                        if(1 != goodsResult){
+//                            throw new FebsException(mallGoods.getGoodsName() + "库存不足");
+//                        }
+//
+//                        Integer skuResult = mallGoodsSkuMapper.updateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt());
+//                        if(1 != skuResult){
 //                            throw new FebsException(sku.getSkuName() + "库存不足");
 //                        }
-
-                        MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId());
-                        Integer goodsResult = mallGoodsMapper.updateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt());
-                        if(1 != goodsResult){
-                            throw new FebsException(mallGoods.getGoodsName() + "库存不足");
-                        }
-
-                        Integer skuResult = mallGoodsSkuMapper.updateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt());
-                        if(1 != skuResult){
-                            throw new FebsException(sku.getSkuName() + "库存不足");
-                        }
-                        Long memberCouponId = mallOrderItem.getMemberCouponId();
-                        MallMemberCoupon mallMemberCoupon = mallMemberCouponMapper.selectById(memberCouponId);
-                        if(ObjectUtil.isNotEmpty(mallMemberCoupon)){
-                            mallMemberCoupon.setState(1);
-                            mallMemberCouponMapper.updateById(mallMemberCoupon);
-                        }
-                    }
-                }
-            }
-        }
-
-    }
+//                        Long memberCouponId = mallOrderItem.getMemberCouponId();
+//                        MallMemberCoupon mallMemberCoupon = mallMemberCouponMapper.selectById(memberCouponId);
+//                        if(ObjectUtil.isNotEmpty(mallMemberCoupon)){
+//                            mallMemberCoupon.setState(1);
+//                            mallMemberCouponMapper.updateById(mallMemberCoupon);
+//                        }
+//                    }
+//                }
+//            }
+//        }
+//
+//    }
 
 //    @Scheduled(cron = "0/5 * * * * ? ")
 //    public void wakeup() {
diff --git a/src/main/java/cc/mrbird/febs/mall/quartz/OrderSettlementJob.java b/src/main/java/cc/mrbird/febs/mall/quartz/OrderSettlementJob.java
index 7a742cb..f0a94da 100644
--- a/src/main/java/cc/mrbird/febs/mall/quartz/OrderSettlementJob.java
+++ b/src/main/java/cc/mrbird/febs/mall/quartz/OrderSettlementJob.java
@@ -1,24 +1,15 @@
 package cc.mrbird.febs.mall.quartz;
 
-import cc.mrbird.febs.common.enumerates.DataDictionaryEnum;
-import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
-import cc.mrbird.febs.mall.entity.MallOrderInfo;
 import cc.mrbird.febs.mall.mapper.*;
 import cc.mrbird.febs.mall.service.IApiMallMemberWalletService;
 import cc.mrbird.febs.mall.service.IMallAchieveService;
 import cc.mrbird.febs.mall.service.IMallMoneyFlowService;
 import cc.mrbird.febs.mall.service.IMemberProfitService;
 import cc.mrbird.febs.rabbit.producter.AgentProducer;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
-
-import java.util.Date;
-import java.util.List;
 
 /**
  * @author wzy
@@ -100,49 +91,49 @@
     /**
      * 自动确认收货
      */
-    @Scheduled(cron = "0 0 0 * * ?")
-
-//    @Scheduled(cron = "1 * * * * ?")
-    public void orderAutoConfirmJob() {
-        log.info("自动确认收货");
-        DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OEDER_AUTO_CONFIRM.getType(), DataDictionaryEnum.OEDER_AUTO_CONFIRM.getCode());
-        Integer value = Integer.parseInt(dic.getValue());
-        List<MallOrderInfo> orderInfos = mallOrderInfoMapper.selectOrderByStatusAndPayTime(3,DateUtil.offsetDay(new Date(), -value));
-        if(CollUtil.isNotEmpty(orderInfos)){
-//            for(MallOrderInfo orderInfo : orderInfos){
-//                MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(orderInfo.getTakeUniqueCode());
-//                Integer profitSwitch = mallTeamLeader.getProfitSwitch()==null?2:mallTeamLeader.getProfitSwitch();
-//                if(1 == profitSwitch){
-//                    BigDecimal bonusPercent =new BigDecimal(mallTeamLeader.getBonusPercent()==null?"0":mallTeamLeader.getBonusPercent());
-////                DataDictionaryCustom dicBonusPercent = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_PERCENT.getType(), DataDictionaryEnum.BONUS_PERCENT.getCode());
-////                BigDecimal bonusPercent = new BigDecimal(dicBonusPercent.getValue()).setScale(2,BigDecimal.ROUND_DOWN);
-//                    //生成一条团长提成记录
-//                    Long id = orderInfo.getId();
-//                    List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(id);
-//                    if(CollUtil.isNotEmpty(mallOrderItemList)){
-//                        for(MallOrderItem mallOrderItem : mallOrderItemList){
-//                            Integer state = mallOrderItem.getState() == null ? 1 : mallOrderItem.getState();
-//                            if(1 == state){
-//                                MallLeaderAchieve mallLeaderAchieve = new MallLeaderAchieve();
-//                                mallLeaderAchieve.setMemberId(orderInfo.getMemberId());
-//                                mallLeaderAchieve.setOrderNo(orderInfo.getOrderNo());
-//                                mallLeaderAchieve.setOrderItemId(mallOrderItem.getId());
-//                                BigDecimal itemAmount = mallOrderItem.getAmount();
-//                                mallLeaderAchieve.setAmount(itemAmount);
-//                                BigDecimal bigDecimal = bonusPercent.multiply(itemAmount).setScale(2, BigDecimal.ROUND_DOWN);
-//                                mallLeaderAchieve.setProfitAmount(bigDecimal);
-//                                mallLeaderAchieve.setUniqueCode(orderInfo.getTakeUniqueCode());
-//                                mallLeaderAchieve.setState(MallLeaderAchieve.STATE_ONE);
-//                                mallLeaderAchieveMapper.insert(mallLeaderAchieve);
-//                            }
-//                        }
-//                    }
-//                }
-//            }
-            mallOrderInfoMapper.updateOrderConfirmStatus(DateUtil.date(),DateUtil.offsetDay(new Date(), -value));
-
-        }
-    }
+//    @Scheduled(cron = "0 0 0 * * ?")
+//
+////    @Scheduled(cron = "1 * * * * ?")
+//    public void orderAutoConfirmJob() {
+//        log.info("自动确认收货");
+//        DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OEDER_AUTO_CONFIRM.getType(), DataDictionaryEnum.OEDER_AUTO_CONFIRM.getCode());
+//        Integer value = Integer.parseInt(dic.getValue());
+//        List<MallOrderInfo> orderInfos = mallOrderInfoMapper.selectOrderByStatusAndPayTime(3,DateUtil.offsetDay(new Date(), -value));
+//        if(CollUtil.isNotEmpty(orderInfos)){
+////            for(MallOrderInfo orderInfo : orderInfos){
+////                MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(orderInfo.getTakeUniqueCode());
+////                Integer profitSwitch = mallTeamLeader.getProfitSwitch()==null?2:mallTeamLeader.getProfitSwitch();
+////                if(1 == profitSwitch){
+////                    BigDecimal bonusPercent =new BigDecimal(mallTeamLeader.getBonusPercent()==null?"0":mallTeamLeader.getBonusPercent());
+//////                DataDictionaryCustom dicBonusPercent = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_PERCENT.getType(), DataDictionaryEnum.BONUS_PERCENT.getCode());
+//////                BigDecimal bonusPercent = new BigDecimal(dicBonusPercent.getValue()).setScale(2,BigDecimal.ROUND_DOWN);
+////                    //生成一条团长提成记录
+////                    Long id = orderInfo.getId();
+////                    List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(id);
+////                    if(CollUtil.isNotEmpty(mallOrderItemList)){
+////                        for(MallOrderItem mallOrderItem : mallOrderItemList){
+////                            Integer state = mallOrderItem.getState() == null ? 1 : mallOrderItem.getState();
+////                            if(1 == state){
+////                                MallLeaderAchieve mallLeaderAchieve = new MallLeaderAchieve();
+////                                mallLeaderAchieve.setMemberId(orderInfo.getMemberId());
+////                                mallLeaderAchieve.setOrderNo(orderInfo.getOrderNo());
+////                                mallLeaderAchieve.setOrderItemId(mallOrderItem.getId());
+////                                BigDecimal itemAmount = mallOrderItem.getAmount();
+////                                mallLeaderAchieve.setAmount(itemAmount);
+////                                BigDecimal bigDecimal = bonusPercent.multiply(itemAmount).setScale(2, BigDecimal.ROUND_DOWN);
+////                                mallLeaderAchieve.setProfitAmount(bigDecimal);
+////                                mallLeaderAchieve.setUniqueCode(orderInfo.getTakeUniqueCode());
+////                                mallLeaderAchieve.setState(MallLeaderAchieve.STATE_ONE);
+////                                mallLeaderAchieveMapper.insert(mallLeaderAchieve);
+////                            }
+////                        }
+////                    }
+////                }
+////            }
+//            mallOrderInfoMapper.updateOrderConfirmStatus(DateUtil.date(),DateUtil.offsetDay(new Date(), -value));
+//
+//        }
+//    }
     /**
      * 团长第二天才会结算前一天的所有提成
      * 从团长业绩表中查询出前一天的所有已完成订单金额*提成系数,得到今日提成
diff --git a/src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java b/src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java
index 2609206..8d19095 100644
--- a/src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java
+++ b/src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java
@@ -1,94 +1,80 @@
 package cc.mrbird.febs.mall.quartz;
 
-import cc.mrbird.febs.common.properties.XcxProperties;
-import cc.mrbird.febs.common.utils.RedisUtils;
-import cc.mrbird.febs.common.utils.SpringContextHolder;
-import cc.mrbird.febs.mall.entity.MallMemberCoupon;
-import cc.mrbird.febs.mall.mapper.MallMemberCouponMapper;
-import cc.mrbird.febs.mall.service.MallInvoiceService;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
-import org.springframework.web.client.RestTemplate;
-
-import javax.annotation.Resource;
-import java.util.List;
 
 @Slf4j
 @Component
 @ConditionalOnProperty(prefix = "system", name = "job", havingValue = "true")
 public class WxxcxJob {
 
-    private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class);
-
-    @Autowired
-    private RedisUtils redisUtils;
-    @Autowired
-    private MallMemberCouponMapper mallMemberCouponMapper;
-    @Autowired
-    private MallInvoiceService mallInvoiceService;
-    @Resource
-    RestTemplate restTemplate;
+//    private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class);
+//
 //    @Autowired
-//    private SpringContextHolder springContextHolder;
-    /**
-     * 获取access_token
-     * 有效期两小时
-     */
-//    @Scheduled(cron = "0 0 0/1 * * ? ")
-//    public void getAccessToken() throws IOException {
-//        log.info("执行access_token刷新");
-//        String appId = xcxProperties.getXcxAppid();
-//        String appSecret = xcxProperties.getXcxSecret();
-//        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
-//        String jsonStr = restTemplate.getForObject(url, String.class);
-//
-//        /**
-//         * 返回结果
-//         * {"access_token":"ACCESS_TOKEN","expires_in":7200}
-//         */
-//        if (!jsonStr.contains("access_token")) {
-//            System.out.println("获取微信access_token失败");
-//        }
-//
-//        String accessTokenKey = WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY;
-//        JSONObject jsonObject = JSONObject.parseObject(jsonStr);
-//        String accessToken = jsonObject.getString(accessTokenKey);
-//        if (StrUtil.isEmpty(accessToken)) {
-//            log.error("获取access token失败: {}" , jsonObject.getString("errmsg"));
-//            throw new ApiException("获取access token失败");
-//        } else {
-//            log.info("wx access_token : {}",accessToken);
-//            redisUtils.set(accessTokenKey,accessToken);
-//        }
-//
-//    }
-
-    @Scheduled(cron = "0 0 0/1 * * ? ")
-    public void expireCoupon() {
-        List<MallMemberCoupon> mallMemberCoupons = mallMemberCouponMapper.selectListByExpireTime(DateUtil.date());
-        if(CollUtil.isEmpty(mallMemberCoupons)){
-            return;
-        }
-        for(MallMemberCoupon mallMemberCoupon : mallMemberCoupons){
-            mallMemberCoupon.setState(3);
-            mallMemberCouponMapper.updateById(mallMemberCoupon);
-        }
-
-    }
-
+//    private RedisUtils redisUtils;
+//    @Autowired
+//    private MallMemberCouponMapper mallMemberCouponMapper;
+//    @Autowired
+//    private MallInvoiceService mallInvoiceService;
+//    @Resource
+//    RestTemplate restTemplate;
+////    @Autowired
+////    private SpringContextHolder springContextHolder;
 //    /**
-//     * 更新发票记录表数据
-//     * 定时,每天凌晨一点
-//     * 已完成的订单,更新到发票记录中
+//     * 获取access_token
+//     * 有效期两小时
 //     */
-//    @Scheduled(cron = "0 0 1 * * ?")
-//    public void mallInvoiceJob() {
-//        mallInvoiceService.mallInvoiceJob();
+////    @Scheduled(cron = "0 0 0/1 * * ? ")
+////    public void getAccessToken() throws IOException {
+////        log.info("执行access_token刷新");
+////        String appId = xcxProperties.getXcxAppid();
+////        String appSecret = xcxProperties.getXcxSecret();
+////        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
+////        String jsonStr = restTemplate.getForObject(url, String.class);
+////
+////        /**
+////         * 返回结果
+////         * {"access_token":"ACCESS_TOKEN","expires_in":7200}
+////         */
+////        if (!jsonStr.contains("access_token")) {
+////            System.out.println("获取微信access_token失败");
+////        }
+////
+////        String accessTokenKey = WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY;
+////        JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+////        String accessToken = jsonObject.getString(accessTokenKey);
+////        if (StrUtil.isEmpty(accessToken)) {
+////            log.error("获取access token失败: {}" , jsonObject.getString("errmsg"));
+////            throw new ApiException("获取access token失败");
+////        } else {
+////            log.info("wx access_token : {}",accessToken);
+////            redisUtils.set(accessTokenKey,accessToken);
+////        }
+////
+////    }
+//
+//    @Scheduled(cron = "0 0 0/1 * * ? ")
+//    public void expireCoupon() {
+//        List<MallMemberCoupon> mallMemberCoupons = mallMemberCouponMapper.selectListByExpireTime(DateUtil.date());
+//        if(CollUtil.isEmpty(mallMemberCoupons)){
+//            return;
+//        }
+//        for(MallMemberCoupon mallMemberCoupon : mallMemberCoupons){
+//            mallMemberCoupon.setState(3);
+//            mallMemberCouponMapper.updateById(mallMemberCoupon);
+//        }
+//
 //    }
+//
+////    /**
+////     * 更新发票记录表数据
+////     * 定时,每天凌晨一点
+////     * 已完成的订单,更新到发票记录中
+////     */
+////    @Scheduled(cron = "0 0 1 * * ?")
+////    public void mallInvoiceJob() {
+////        mallInvoiceService.mallInvoiceJob();
+////    }
 
 }
diff --git a/src/main/resources/mapper/modules/DataDictionaryCustomMapper.xml b/src/main/resources/mapper/modules/DataDictionaryCustomMapper.xml
index 72da31a..7ca6ad1 100644
--- a/src/main/resources/mapper/modules/DataDictionaryCustomMapper.xml
+++ b/src/main/resources/mapper/modules/DataDictionaryCustomMapper.xml
@@ -3,7 +3,7 @@
 <mapper namespace="cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper">
 
     <select id="selectDicByType" resultType="cc.mrbird.febs.mall.entity.DataDictionaryCustom">
-        select * from data_dictionary_custom where type=#{type}
+        select * from data_dictionary_custom where type=#{type} ORDER by code asc
     </select>
 
     <select id="getPayMethodListInPage" resultType="cc.mrbird.febs.mall.vo.AdminPayMethodVo">
diff --git a/src/main/resources/templates/febs/views/modules/runVip/systemSetting.html b/src/main/resources/templates/febs/views/modules/runVip/systemSetting.html
new file mode 100644
index 0000000..45c58f7
--- /dev/null
+++ b/src/main/resources/templates/febs/views/modules/runVip/systemSetting.html
@@ -0,0 +1,94 @@
+<div class="layui-fluid layui-anim febs-anim" id="system-setting" lay-title="参数设置">
+    <div class="layui-row layui-col-space8 febs-container">
+        <form class="layui-form" action="" lay-filter="system-setting-form">
+            <div class="layui-card">
+                <div class="layui-card-body" id="setBody">
+
+                </div>
+
+                <div class="layui-card-footer">
+                    <button class="layui-btn layui-btn-normal save-btn" lay-submit="" lay-filter="system-setting-form-submit" id="submit">保存</button>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+<style>
+    .layui-form-label {
+        width: 120px;
+    }
+
+    .layui-form-item .layui-input-block {
+        margin-left: 150px;
+    }
+
+    .layui-table-form .layui-form-item {
+        margin-bottom: 20px !important;
+    }
+    .save-btn{
+        display: block;
+        margin: 0 auto;
+    }
+</style>
+<script type="text/html" id="systemSettingOperate">
+    {{#  layui.each(d, function(index, item){ }}
+    <div class="layui-form-item">
+        <div class="layui-col-lg6">
+            <label class="layui-form-label febs-form-item-require">参数{{item.id}}:</label>
+            <div class="layui-input-block">
+                <input type="text" name="{{item.code}}" value="{{item.value}}" lay-verify="required" autocomplete="off" class="layui-input" >
+                <div class="layui-form-mid layui-word-aux">{{item.description}}。</div>
+            </div>
+        </div>
+    </div>
+    {{# }) }}
+</script>
+<script data-th-inline="javascript" type="text/javascript">
+    layui.use(['dropdown', 'jquery', 'validate', 'febs', 'form', 'eleTree', 'laytpl', 'upload'], function () {
+        var $ = layui.jquery,
+            febs = layui.febs,
+            form = layui.form,
+            validate = layui.validate
+            , templateHtml = systemSettingOperate.innerHTML
+            , $setBody = $("#setBody")
+            , laytpl = layui.laytpl
+            , upload = layui.upload
+            , $view = $('#system-setting');
+
+        form.verify(validate);
+        form.render();
+
+        dicDataReq("CHARGE_TYPE");
+        function dicDataReq(type) {
+            $setBody.empty();
+            $.get(ctx + 'admin/common/findDicByType/' + type, function (r) {
+                if (r.code === 200) {
+                    var data = r.data;
+                    laytpl(templateHtml).render(data, function(html) {
+                        $setBody.append(html);
+                    })
+                }
+            });
+        }
+
+        form.on('submit(system-setting-form-submit)', function (data) {
+            $.ajax({
+                'url':ctx + 'admin/runVip/bonusSystemSetting',
+                'type':'post',
+                'dataType':'json',
+                'headers' : {'Content-Type' : 'application/json;charset=utf-8'},
+                'traditional': true,
+                'data':JSON.stringify(data.field),
+                'success':function (data) {
+                    if (data.code == 200) {
+                        febs.alert.success(data.message);
+                    }
+                },
+                'error':function () {
+                    febs.alert.warn('服务器繁忙');
+                }
+            })
+            return false;
+        });
+    });
+</script>
\ No newline at end of file

--
Gitblit v1.9.1