From 289b0503bc197d196997142f60b3a8ef8b70f0cc Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 11 Jun 2021 22:00:44 +0800
Subject: [PATCH] conflect fix
---
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml | 7
zq-erp/src/main/resources/static/images/luckyDraw/oAward.png | 0
zq-erp/src/main/java/com/matrix/system/activity/dto/LuckyDrawForUpdateDto.java | 17
zq-erp/pom.xml | 4
zq-erp/src/main/resources/templates/views/admin/activity/activity-luckyDraw-update.html | 1116 +++++++++
zq-erp/src/main/java/com/matrix/system/hive/dto/AchieveNewStatisticsDto.java | 41
zq-erp/src/main/java/com/matrix/system/activity/vo/LuckyDrawBasicJsonVo.java | 51
zq-erp/src/main/resources/static/images/luckyDraw/line.png | 0
zq-xcx/project.config.json | 4
zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java | 61
zq-erp/src/main/resources/config/test/application.properties | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java | 7
zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderItemDao.java | 2
zq-erp/src/test/java/com/matrix/JyyTests2.java | 241 ++
zq-erp/src/main/java/com/matrix/system/activity/vo/SignReceiveListVo.java | 4
zq-erp/src/main/java/com/matrix/system/activity/vo/AddLuckyDrawSetVo.java | 34
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveRuleDao.xml | 7
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html | 2
zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveRule.java | 33
zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html | 34
zq-erp/src/main/java/com/matrix/system/hiveErp/pojo/AchieveRuleItem.java | 56
zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/achieveNewStatiostics.html | 366 +++
zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawInfoVo.java | 44
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java | 5
zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignAwardSetDao.java | 6
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml | 101
zq-erp/src/main/java/com/matrix/system/activity/dto/AddLuckyDrawSetDto.java | 28
zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawSuccessVo.java | 150 +
zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java | 8
zq-erp/src/main/resources/static/images/luckyDraw/zhuanpanchoujian.png | 0
zq-erp/src/main/java/filecopy.java | 80
zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopActivities.java | 6
zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignReceiveRecordDao.xml | 2
zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java | 32
zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml | 38
zq-erp/src/main/resources/templates/views/admin/shop/shopOrder-form.html | 4
zq-erp/src/main/resources/mybatis/mapper/hive/OnlinebookingDao.xml | 24
zq-erp/src/main/java/com/matrix/system/hive/vo/AchieveNewStatisticsVo.java | 42
zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java | 5
zq-erp/src/main/resources/mybatis/mapper/common/SysUsersDao.xml | 2
zq-erp/src/main/resources/templates/views/admin/activity/activity-luckyDraw.html | 1027 ++++++++
zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java | 80
zq-erp/src/test/java/com/matrix/四月份家居产品业绩恢复.java | 61
zq-erp/src/main/resources/static/images/luckyDraw/xiexiecanyu.png | 0
zq-erp/src/main/java/com/matrix/config/MvcCoreConfig.java | 15
zq-erp/src/main/resources/templates/views/admin/activity/activity-market.html | 36
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java | 13
zq-erp/src/main/resources/config/application.properties | 1
zq-erp/src/main/resources/static/images/luckyDraw/zhuanpan.png | 0
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderDingDingNoticeTask.java | 24
zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignRecordDao.java | 3
zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawBasicInfoJsonVo.java | 60
zq-erp/src/main/resources/static/images/luckyDraw/start.png | 0
zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml | 10
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java | 22
zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-zb-list.html | 11
zq-erp/src/test/java/com/matrix/FenxiaoSoreInitTest.java | 649 ++++
zq-erp/src/main/resources/templates/views/admin/activity/activity-luckdraw-receive.html | 279 ++
zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveRuleDao.java | 11
zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignRecordDao.xml | 11
zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java | 26
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxRefundRecordAction.java | 13
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java | 6
zq-erp/src/main/resources/static/images/luckyDraw/sAward.png | 0
zq-erp/src/main/java/com/matrix/system/activity/dto/LuckyDrawBasicJsonDto.java | 53
zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java | 7
zq-erp/src/main/java/com/matrix/system/activity/action/ActivitySignAwardSetAction.java | 356 +++
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesLuckydrawAction.java | 542 ++++
zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipInfoDao.java | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java | 9
zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateLuckyDrawSetDto.java | 34
zq-erp/src/main/java/com/matrix/system/hive/service/AchieveRuleService.java | 33
zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java | 6
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 45
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderItemDao.xml | 7
zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-md-list.html | 11
zq-erp/src/main/resources/static/images/luckyDraw/tAward.png | 0
zq-erp/src/test/java/com/matrix/JyyTests.java | 41
zq-erp/src/main/resources/templates/views/admin/activity/activity-list.html | 42
zq-erp/src/main/java/com/matrix/system/activity/vo/LuckyDrawAwardCodeListVo.java | 57
zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html | 402 +++
zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html | 21
zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateSignAwardSetDto.java | 12
zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignAwardSetDao.xml | 24
zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html | 21
zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java | 2
zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java | 129 +
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java | 21
90 files changed, 6,678 insertions(+), 227 deletions(-)
diff --git a/zq-erp/pom.xml b/zq-erp/pom.xml
index ed1dc1f..111a11a 100644
--- a/zq-erp/pom.xml
+++ b/zq-erp/pom.xml
@@ -401,12 +401,12 @@
<exclude>config/xcx/*</exclude>
<exclude>config/xcshop/*</exclude>
- <!---->
+ <!--
<exclude>config/config.json</exclude>
<exclude>config/application.properties</exclude>
<exclude>config/system.properties</exclude>
-
+-->
<exclude>**/*.woff</exclude>
<exclude>**/*.woff2</exclude>
diff --git a/zq-erp/src/main/java/com/matrix/config/MvcCoreConfig.java b/zq-erp/src/main/java/com/matrix/config/MvcCoreConfig.java
index 5884118..03cb319 100644
--- a/zq-erp/src/main/java/com/matrix/config/MvcCoreConfig.java
+++ b/zq-erp/src/main/java/com/matrix/config/MvcCoreConfig.java
@@ -64,14 +64,15 @@
.excludePathPatterns("/plugin/**")
.excludePathPatterns("/swagger**/**")
.excludePathPatterns("/webjars/**");
+
// 用户认证拦截
- registry.addInterceptor(userLoginInterceptor)
- .addPathPatterns("/**")
- .excludePathPatterns("/common/**")
- .excludePathPatterns("/resource/**")
- .excludePathPatterns("/swagger**/**")
- .excludePathPatterns("/webjars/**")
- .excludePathPatterns("/api/**");
+// registry.addInterceptor(userLoginInterceptor)
+// .addPathPatterns("/**")
+// .excludePathPatterns("/common/**")
+// .excludePathPatterns("/resource/**")
+// .excludePathPatterns("/swagger**/**")
+// .excludePathPatterns("/webjars/**")
+// .excludePathPatterns("/api/**");
// url权限拦截
registry.addInterceptor(suAuthorityInterceptor).addPathPatterns("/**/su/**");
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/action/ActivitySignAwardSetAction.java b/zq-erp/src/main/java/com/matrix/system/activity/action/ActivitySignAwardSetAction.java
index c22744d..6caec1a 100644
--- a/zq-erp/src/main/java/com/matrix/system/activity/action/ActivitySignAwardSetAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/activity/action/ActivitySignAwardSetAction.java
@@ -1,18 +1,19 @@
package com.matrix.system.activity.action;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.StringUtils;
import com.matrix.core.tools.WebUtil;
+import com.matrix.system.activity.dao.ActivitySignAwardSetDao;
import com.matrix.system.activity.dto.*;
+import com.matrix.system.activity.entity.ActivitySignAwardSet;
import com.matrix.system.activity.service.ActivitySignAwardSetService;
-import com.matrix.system.activity.vo.ActivitiesListVo;
-import com.matrix.system.activity.vo.CouponVo;
-import com.matrix.system.activity.vo.GoodsVo;
-import com.matrix.system.activity.vo.SignReceiveListVo;
+import com.matrix.system.activity.vo.*;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.shopXcx.bean.ShopActivities;
@@ -23,7 +24,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
-import java.util.List;
+import java.util.*;
/**
* @description 奖品设置表
@@ -38,6 +39,351 @@
private ActivitySignAwardSetService activitySignAwardSetService;
@Autowired
private ShopActivitiesDao shopActivitiesDao;
+ @Autowired
+ private ActivitySignAwardSetDao activitySignAwardSetDao;
+
+ /**
+ * 马上创建转盘抽奖
+ */
+ @PostMapping(value = "/createLuckyDrawSet")
+ public @ResponseBody
+ AjaxResult createLuckyDrawSet() {
+ //获取当前登录人员信息
+ SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ Long companyId = user.getCompanyId();
+ //签到活动的唯一性
+ List<ShopActivities> shopActivitiesDone = shopActivitiesDao.selectOneByCompanyIdAndActType(companyId,ShopActivities.ACTIVITIES_TYPE_LUCKYDRAW);
+ if(CollUtil.isNotEmpty(shopActivitiesDone)){
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "转盘抽奖已经创建,请去活动管理菜单查看");
+ }
+ return new AjaxResult(AjaxResult.STATUS_SUCCESS, "");
+ }
+
+ /**
+ * 新增转盘抽奖
+ */
+ @PostMapping(value = "/addLuckyDrawSet")
+ public @ResponseBody
+ AjaxResult addLuckyDrawSet(@RequestBody AddLuckyDrawSetDto addLuckyDrawSetDto) {
+ //获取当前登录人员信息
+ SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ Long companyId = user.getCompanyId();
+ //转盘抽奖活动的唯一性
+ List<ShopActivities> shopActivitiesDone = shopActivitiesDao.selectOneByCompanyIdAndActType(companyId,ShopActivities.ACTIVITIES_TYPE_LUCKYDRAW);
+ if(CollUtil.isNotEmpty(shopActivitiesDone)){
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "转盘抽奖只能创建一次");
+ }
+
+ //新增活动主表信息
+ ShopActivities shopActivities = new ShopActivities();
+ shopActivities.setActName(addLuckyDrawSetDto.getActName());
+ shopActivities.setActCode(addLuckyDrawSetDto.getActCode());
+ shopActivities.setIsStart(ShopActivities.ACTIVITIES_STATUS_CLOSE);
+ shopActivities.setActType(ShopActivities.ACTIVITIES_TYPE_LUCKYDRAW);
+ shopActivities.setActStatus(ShopActivities.ACTSTATUS_STATUS_RELEASE);
+ shopActivities.setActBeginTime(addLuckyDrawSetDto.getBeginTime());
+ shopActivities.setActEndTime(addLuckyDrawSetDto.getEndTime());
+ shopActivities.setCompanyId(companyId);
+ shopActivities.setCreateBy(user.getSuName());
+ shopActivities.setUpdateBy(user.getSuName());
+ //将基本信息转换成JSON字符串存储到活动主表的act_content字段
+ LuckyDrawBasicJsonDto luckyDrawBasicJsonDto = addLuckyDrawSetDto.getLuckyDrawBasicJsonDto();
+ String json= JSON.toJSONString(luckyDrawBasicJsonDto);
+ shopActivities.setActContent(json);
+ int insert = shopActivitiesDao.insert(shopActivities);
+ if(insert > 0){
+ //新增活动奖品信息
+ List<ActivitySignAwardSet> activitySignAwardSets = addLuckyDrawSetDto.getLuckyDrawAwardSets();
+ if(CollUtil.isNotEmpty(activitySignAwardSets)) {
+ for(ActivitySignAwardSet activitySignAwardSet : activitySignAwardSets) {
+ activitySignAwardSet.setCreateBy(user.getSuName());
+ activitySignAwardSet.setCreateTime(new Date());
+ activitySignAwardSet.setUpdateTime(new Date());
+ activitySignAwardSet.setUpdateBy(user.getSuName());
+ activitySignAwardSet.setCompanyId(companyId);
+ activitySignAwardSet.setActivityId(shopActivities.getId());
+ activitySignAwardSet.setAwardState(ActivitySignAwardSet.AWARDSTATE_WORK);
+ activitySignAwardSetDao.insert(activitySignAwardSet);
+ }
+ //生成中奖顺序
+
+ Long actId = shopActivities.getId();
+ List<ActivitySignAwardSet> activitySignAwardSetList = activitySignAwardSetDao
+ .selectActivitySignAwardSetByActIDAndCompanyIdAndAwardType(actId, companyId, ActivitySignAwardSet.AWARDSTATE_WORK,ActivitySignAwardSet.AWARDRULE_CUMULATIVEDAY);
+ if(CollUtil.isNotEmpty(activitySignAwardSetList)){
+ String awrdList = getAwrdList(activitySignAwardSets).toString();
+ ShopActivities shopActivitiesAward = shopActivitiesDao.selectById(actId);
+ String actContent = shopActivitiesAward.getActContent();
+ LuckyDrawAwardCodeListVo luckyDrawAwardCodeListVo = JSON.parseObject(actContent, LuckyDrawAwardCodeListVo.class);
+ luckyDrawAwardCodeListVo.setAwardLine(awrdList);
+ luckyDrawAwardCodeListVo.setAwrdLineIndex(0);
+ String awardJson= JSON.toJSONString(luckyDrawAwardCodeListVo);
+ shopActivitiesAward.setActContent(awardJson);
+ shopActivitiesDao.updateByModel(shopActivitiesAward);
+ }
+ }
+ }else{
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "保存失败");
+ }
+ return new AjaxResult(AjaxResult.STATUS_SUCCESS, "保存成功");
+ }
+
+ //所有奖品ID后的集合
+ public List getAwrdList(List<ActivitySignAwardSet> activitySignAwardSets){
+ //插入所有奖品ID后的集合
+ LinkedList awardIdFinalList = new LinkedList<>();
+ if(CollUtil.isNotEmpty(activitySignAwardSets)){
+ //总数
+ int maxCount = 0;
+ HashMap<Long, ActivitySignAwardSet> integerStringHashMap = new HashMap<>();
+ for(ActivitySignAwardSet activitySignAwardSet : activitySignAwardSets){
+ //总共派发数量
+ int awardInventoryCnt = activitySignAwardSet.getAwardInventoryCnt();
+ integerStringHashMap.put(activitySignAwardSet.getId(),activitySignAwardSet);
+ maxCount = maxCount + awardInventoryCnt;
+ }
+ HashMap<Long, ActivitySignAwardSet> sortHashMap = sortHashMap(integerStringHashMap,2);
+ HashMap<Long, ActivitySignAwardSet> sortHashMapAec = sortHashMap(integerStringHashMap,1);
+ //获取奖品最多的ID
+ Long maxAwardIds = sortHashMap.keySet().stream().findFirst().get();
+ Long minAwardIds = sortHashMapAec.keySet().stream().findFirst().get();
+ //获取最大长度的奖品集合
+ List awardIdList = new LinkedList<Long>();
+ for(int i = 0; i< maxCount ; i++){
+ awardIdList.add(maxAwardIds);
+ }
+
+ Iterator<Map.Entry<Long, ActivitySignAwardSet>> entries = sortHashMap.entrySet().iterator();
+ //插入奖品
+ while (entries.hasNext()) {
+ Map.Entry<Long, ActivitySignAwardSet> entry = entries.next();
+ ActivitySignAwardSet activitySignAwardSetDone = entry.getValue();
+ int awardInventoryCnt = activitySignAwardSetDone.getAwardInventoryCnt();
+ Long awardIdNew = entry.getKey();
+ if(awardIdNew != maxAwardIds){
+ //分段之后的List
+ List splitLists = getSplitList(awardInventoryCnt, awardIdList);
+ for(int j = 0; j<awardInventoryCnt; j++){
+ List splitList = (List) splitLists.get(j);
+ //中间插入对应的奖品ID,如果和maxAwardIds相同,则索引+1
+ List<Long> listInsert = getListInsert(maxAwardIds, awardIdNew, splitList);
+ if(minAwardIds == awardIdNew){
+ awardIdFinalList.addAll(listInsert);
+ }
+ }
+ }
+ }
+ }
+ return awardIdFinalList;
+ }
+
+ //中间插入对应的奖品ID,如果和maxAwardIds相同,则索引+1
+ public static List<Long> getListInsert(Long awardOld,Long awardNew,List splitList){
+ //中间位置索引
+ LinkedList<Integer> indexs = new LinkedList<>();
+ int groupFlag = splitList.size() % 2 == 0 ? (splitList.size() / 2) : (splitList.size() / 2 + 1);
+ for(int j = groupFlag-1; j < splitList.size();j++){
+ if(splitList.get(j) == awardOld){
+ indexs.add(j);
+ }
+ }
+ if(CollUtil.isNotEmpty(indexs)){
+ splitList.set(indexs.get(0),awardNew);
+ }else{
+ splitList.add(groupFlag,awardNew);
+ }
+ return splitList;
+ }
+
+ //等份平分数组,最后剩余的添加到倒数第二个集合中
+ public static List<List<Long>> getSplitList(int splitNum, List<Long> list) {
+ LinkedList<List<Long>> splitList = new LinkedList<>();
+ // groupFlag >= 1
+ int groupFlag = list.size() % splitNum == 0 ? (list.size() / splitNum) : (list.size() / splitNum);
+ if(groupFlag * splitNum < list.size()){
+ for (int j = 1; j <= splitNum +1; j++) {
+ if ((j * groupFlag) <= list.size() ) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, j * groupFlag));
+ } else if ((j * groupFlag) > list.size()) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, list.size()));
+ }
+ }
+ }else if(groupFlag * splitNum > list.size()){
+ for (int j = 1; j < splitNum; j++) {
+ if ((j * groupFlag) <= list.size() ) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, j * groupFlag));
+ } else if ((j * groupFlag) > list.size()) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, list.size()));
+ }
+ }
+ }else{
+ for (int j = 1; j <= splitNum; j++) {
+ if ((j * groupFlag) <= list.size() ) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, j * groupFlag));
+ } else if ((j * groupFlag) > list.size()) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, list.size()));
+ }
+ }
+ }
+ return splitList;
+ }
+
+
+ //对于奖品排序 1:升序进行排,2是倒序就是o2-o1
+ public static HashMap<Long, ActivitySignAwardSet> sortHashMap(HashMap<Long, ActivitySignAwardSet> map,int type) {
+ // 首先拿到 map 的键值对集合
+ Set<Map.Entry<Long, ActivitySignAwardSet>> entrySet = map.entrySet();
+ // 将 set 集合转为 List 集合,为什么,为了使用工具类的排序方法
+ List<Map.Entry<Long, ActivitySignAwardSet>> list = new ArrayList<Map.Entry<Long, ActivitySignAwardSet>>(entrySet);
+ // 使用 Collections 集合工具类对 list 进行排序,排序规则使用匿名内部类来实现
+ Collections.sort(list, new Comparator<Map.Entry<Long, ActivitySignAwardSet>>() {
+ @Override
+ public int compare(Map.Entry<Long, ActivitySignAwardSet> o1, Map.Entry<Long, ActivitySignAwardSet> o2) {
+ if(type == 2){
+ //按照要求根据 升序进行排,如果是倒序就是o2-o1
+ return o2.getValue().getAwardInventoryCnt() - o1.getValue().getAwardInventoryCnt();
+ }
+ return o1.getValue().getAwardInventoryCnt() - o2.getValue().getAwardInventoryCnt();
+ }
+ });
+ //创建一个新的有序的 HashMap 子类的集合
+ LinkedHashMap<Long, ActivitySignAwardSet> linkedHashMap = new LinkedHashMap<Long, ActivitySignAwardSet>();
+ //将 List 中的数据存储在 LinkedHashMap 中
+ for (Map.Entry<Long, ActivitySignAwardSet> entry : list) {
+ linkedHashMap.put(entry.getKey(), entry.getValue());
+ }
+ //返回结果
+ return linkedHashMap;
+ }
+
+ /**
+ *进入修改
+ */
+ @ApiOperation(value = "进入修改")
+ @PostMapping(value = "/findLuckyDrawForUpdate")
+ public @ResponseBody
+ AjaxResult findLuckyDrawForUpdate(@RequestBody LuckyDrawForUpdateDto luckyDrawForUpdateDto) {
+ //设置用户公司ID
+ QueryUtil.setQueryLimitCom(luckyDrawForUpdateDto);
+ Long actId = luckyDrawForUpdateDto.getActId();
+ AjaxResult result= AjaxResult.buildSuccessInstance("查询成功");
+ //获取对应的活动主表信息和对应的奖品设置信息
+ AddLuckyDrawSetVo addLuckyDrawSetVo = new AddLuckyDrawSetVo();
+ ShopActivities shopActivity = shopActivitiesDao.selectById(actId);
+ if(ObjectUtil.isNotEmpty(shopActivity)) {
+ addLuckyDrawSetVo.setId(actId);
+ addLuckyDrawSetVo.setActName(shopActivity.getActName());
+ addLuckyDrawSetVo.setActCode(shopActivity.getActCode());
+ addLuckyDrawSetVo.setBeginTime(shopActivity.getActBeginTime());
+ addLuckyDrawSetVo.setEndTime(shopActivity.getActEndTime());
+
+ String actContent = shopActivity.getActContent();
+ LuckyDrawBasicJsonVo luckyDrawBasicJsonVo = JSON.parseObject(actContent, LuckyDrawBasicJsonVo.class);
+ addLuckyDrawSetVo.setLuckyDrawBasicJsonVo(luckyDrawBasicJsonVo);
+
+ Map<String, Object> columnMap = new HashMap<String, Object>();
+ columnMap.put("activity_id", actId);
+ columnMap.put("company_id", luckyDrawForUpdateDto.getCompanyId());
+ List<ActivitySignAwardSet> activityAwardSets = activitySignAwardSetDao.selectByMap(columnMap);
+ addLuckyDrawSetVo.setActivityluckyDrawSets(activityAwardSets);
+ }
+ result.putInMap("addLuckyDrawSetVo", addLuckyDrawSetVo);
+ return result;
+ }
+ /**
+ * 保存
+ */
+ @PostMapping(value = "/updateLuckyDrawSet")
+ public @ResponseBody
+ AjaxResult updateLuckyDrawSet(@RequestBody UpdateLuckyDrawSetDto updateLuckyDrawSetDto) {
+ //获取当前登录人员信息
+ QueryUtil.setQueryLimitCom(updateLuckyDrawSetDto);
+ SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ Long actId = updateLuckyDrawSetDto.getActMainId();
+ Long companyId = user.getCompanyId();
+ ShopActivities shopActivity = shopActivitiesDao.selectById(actId);
+ //更新活动主表信息
+ shopActivity.setActName(updateLuckyDrawSetDto.getActName());
+ shopActivity.setActCode(updateLuckyDrawSetDto.getActCode());
+ shopActivity.setActBeginTime(updateLuckyDrawSetDto.getBeginTime());
+ shopActivity.setActEndTime(updateLuckyDrawSetDto.getEndTime());
+ shopActivity.setCompanyId(companyId);
+ shopActivity.setCreateBy(user.getSuName());
+ shopActivity.setUpdateBy(user.getSuName());
+ //将基本信息转换成JSON字符串存储到活动主表的act_content字段
+ LuckyDrawBasicJsonDto luckyDrawBasicJsonDto = updateLuckyDrawSetDto.getLuckyDrawBasicJsonDto();
+ String json=JSON.toJSONString(luckyDrawBasicJsonDto);
+ shopActivity.setActContent(json);
+ shopActivitiesDao.updateByModel(shopActivity);
+ /**
+ * 比较两个奖品名单,多的新增,减少的更新为已失效,不变的更新
+ */
+ //原有的奖品
+ ArrayList<Long> arrayListOld = new ArrayList<>();
+ Map<String, Object> columnMap = new HashMap<String, Object>();
+ columnMap.put("activity_id", actId);
+ columnMap.put("company_id", updateLuckyDrawSetDto.getCompanyId());
+ List<ActivitySignAwardSet> activitySignAwardSetOld = activitySignAwardSetDao.selectByMap(columnMap);
+ if(CollUtil.isNotEmpty(activitySignAwardSetOld)) {
+ for(ActivitySignAwardSet activitySignAwardSetUpdate : activitySignAwardSetOld) {
+ Long actSubid = activitySignAwardSetUpdate.getId();
+ arrayListOld.add(actSubid);
+ }
+ }
+ //修改后的奖品
+ List<ActivitySignAwardSet> activitySignAwardSetsUpdate = updateLuckyDrawSetDto.getActivityAwardSets();
+ ArrayList<Long> arrayListUpdate = new ArrayList<>();
+ if(CollUtil.isNotEmpty(activitySignAwardSetsUpdate)) {
+ for(ActivitySignAwardSet activitySignAwardSetUpdate : activitySignAwardSetsUpdate) {
+ Long actSubid = activitySignAwardSetUpdate.getId();
+ //如果ID为空则新增,不为空则修改
+ if(ObjectUtil.isEmpty(actSubid)) {
+ activitySignAwardSetUpdate.setCreateBy(user.getSuName());
+ activitySignAwardSetUpdate.setCreateTime(new Date());
+ activitySignAwardSetUpdate.setUpdateTime(new Date());
+ activitySignAwardSetUpdate.setUpdateBy(user.getSuName());
+ activitySignAwardSetUpdate.setCompanyId(companyId);
+ activitySignAwardSetUpdate.setActivityId(actId);
+ activitySignAwardSetUpdate.setAwardState(ActivitySignAwardSet.AWARDSTATE_WORK);
+ activitySignAwardSetDao.insert(activitySignAwardSetUpdate);
+ }else {
+ activitySignAwardSetUpdate.setAwardState(ActivitySignAwardSet.AWARDSTATE_WORK);
+ activitySignAwardSetDao.updateById(activitySignAwardSetUpdate);
+ arrayListUpdate.add(actSubid);
+ }
+ }
+ }
+ //比较获取原来的比现在多出来的奖品,修改状态为失效
+ boolean removeAll = arrayListOld.removeAll(arrayListUpdate);
+ if(removeAll && CollUtil.isNotEmpty(arrayListOld)) {
+ for(long id : arrayListOld) {
+ ActivitySignAwardSet activitySignAwardSetDel = activitySignAwardSetDao.selectById(id);
+ activitySignAwardSetDel.setAwardState(ActivitySignAwardSet.AWARDSTATE_UNWORK);
+ activitySignAwardSetDao.updateById(activitySignAwardSetDel);
+ }
+ }
+
+ //生成中奖顺序
+ List<ActivitySignAwardSet> activitySignAwardSetList = activitySignAwardSetDao
+ .selectActivitySignAwardSetByActIDAndCompanyIdAndAwardType(actId, companyId, ActivitySignAwardSet.AWARDSTATE_WORK,ActivitySignAwardSet.AWARDRULE_CUMULATIVEDAY);
+ if(CollUtil.isNotEmpty(activitySignAwardSetList)){
+ String awrdList = getAwrdList(activitySignAwardSetList).toString();
+ ShopActivities shopActivitiesAward = shopActivitiesDao.selectById(actId);
+ String actContent = shopActivitiesAward.getActContent();
+ LuckyDrawAwardCodeListVo luckyDrawAwardCodeListVo = JSON.parseObject(actContent, LuckyDrawAwardCodeListVo.class);
+ luckyDrawAwardCodeListVo.setAwardLine(awrdList);
+ luckyDrawAwardCodeListVo.setAwrdLineIndex(0);
+ String awardJson= JSON.toJSONString(luckyDrawAwardCodeListVo);
+ shopActivitiesAward.setActContent(awardJson);
+ shopActivitiesDao.updateByModel(shopActivitiesAward);
+ }
+ return new AjaxResult(AjaxResult.STATUS_SUCCESS, "保存成功");
+ }
+
+ public IPage<ActivitiesListVo> findActivitiesList(Page<ActivitiesListVo> page,
+ ActivitiesListDto activitiesListDto) {
+ return shopActivitiesDao.findActivitiesList(page,activitiesListDto);
+ }
/**
* 马上创建签到活动
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignAwardSetDao.java b/zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignAwardSetDao.java
index bff7cc7..1061314 100644
--- a/zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignAwardSetDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignAwardSetDao.java
@@ -17,4 +17,10 @@
List<ActivitySignAwardSetVo> selectListByActIDAndCompanyId(@Param("actId")Long actId, @Param("companyId")Long companyId,@Param("awardState")int awardstateWork);
+ List<ActivitySignAwardSetVo> selectListByActIDAndCompanyIdAndAwardType(@Param("actId")Long actId, @Param("companyId")Long companyId
+ ,@Param("awardState")int awardstateWork,@Param("awardRule")int awardRule);
+
+ List<ActivitySignAwardSet> selectActivitySignAwardSetByActIDAndCompanyIdAndAwardType(@Param("actId")Long actId, @Param("companyId")Long companyId
+ ,@Param("awardState")int awardstateWork,@Param("awardRule")int awardRule);
+
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignRecordDao.java b/zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignRecordDao.java
index 41a6db3..b7c5eb1 100644
--- a/zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignRecordDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignRecordDao.java
@@ -21,4 +21,7 @@
@Param("userId")Long userId, @Param("format")Date format);
List<ActivitySignRecordVo> selectRecordByMonth(@Param("actId")Long actId, @Param("userId")Long userId, @Param("date") DateTime date);
+
+ List<ActivitySignRecord> selectListByActIdAndUserIdLikesignTime(@Param("actId")long actId,
+ @Param("userId")Long userId, @Param("format")Date format);
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/dto/AddLuckyDrawSetDto.java b/zq-erp/src/main/java/com/matrix/system/activity/dto/AddLuckyDrawSetDto.java
new file mode 100644
index 0000000..b559a2c
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/activity/dto/AddLuckyDrawSetDto.java
@@ -0,0 +1,28 @@
+package com.matrix.system.activity.dto;
+
+import com.matrix.system.activity.entity.ActivitySignAwardSet;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+@ApiModel(value = "AddLuckyDrawSetDto", description = "查询参数")
+public class AddLuckyDrawSetDto {
+
+ @ApiModelProperty(value ="活动名称")
+ private String actName;
+ @ApiModelProperty(value ="活动编码")
+ private String actCode;
+ @ApiModelProperty(value ="活动开始时间")
+ private Date beginTime;
+ @ApiModelProperty(value ="活动结束时间")
+ private Date endTime;
+
+ private LuckyDrawBasicJsonDto luckyDrawBasicJsonDto;
+
+ private List<ActivitySignAwardSet> luckyDrawAwardSets;
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/dto/LuckyDrawBasicJsonDto.java b/zq-erp/src/main/java/com/matrix/system/activity/dto/LuckyDrawBasicJsonDto.java
new file mode 100644
index 0000000..f1ba92d
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/activity/dto/LuckyDrawBasicJsonDto.java
@@ -0,0 +1,53 @@
+package com.matrix.system.activity.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "LuckyDrawBasicJsonDto", description = "查询参数")
+public class LuckyDrawBasicJsonDto {
+
+ @ApiModelProperty(value ="头部图片")
+ private String imageUrlHead;
+ @ApiModelProperty(value ="开始按钮")
+ private String imageUrlTitle;
+ @ApiModelProperty(value ="转盘背景")
+ private String imageUrlButton;
+ @ApiModelProperty(value ="状态图片")
+ private String imageUrlState;
+ @ApiModelProperty(value ="奖品划分线")
+ private String imageLine;
+
+ @ApiModelProperty(value ="规则内容")
+ private String ruleExplain;
+ @ApiModelProperty(value ="字体颜色")
+ private String typographyColor;
+ @ApiModelProperty(value ="背景颜色")
+ private String backgroundColor;
+ @ApiModelProperty(value ="字体大小")
+ private Integer typographyNum;
+ @ApiModelProperty(value ="字体透明度")
+ private Integer typographyLight;
+
+ /**
+ * 抽奖规则
+ */
+ //每人每日有10次无门槛抽奖机会
+ private Integer wmkcjjh;
+ //可用积分兑换1次抽奖机会,
+ private Integer dhycjfs;
+ // 每日最多兑换
+ //10
+ //次抽奖机会
+ private Integer jfdhcs;
+ // 每人最多可中奖
+ //10
+ //次
+ private Integer zzjcs;
+ // 总中奖率
+ //10
+ //%
+ private Integer zzjl;
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/dto/LuckyDrawForUpdateDto.java b/zq-erp/src/main/java/com/matrix/system/activity/dto/LuckyDrawForUpdateDto.java
new file mode 100644
index 0000000..1d02334
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/activity/dto/LuckyDrawForUpdateDto.java
@@ -0,0 +1,17 @@
+package com.matrix.system.activity.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "LuckyDrawForUpdateDto", description = "参数")
+public class LuckyDrawForUpdateDto {
+
+ @ApiModelProperty(value ="活动主表ID")
+ private Long actId;
+
+ @ApiModelProperty(hidden = true)
+ private Long companyId;
+
+}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateLuckyDrawSetDto.java b/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateLuckyDrawSetDto.java
new file mode 100644
index 0000000..536191a
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateLuckyDrawSetDto.java
@@ -0,0 +1,34 @@
+package com.matrix.system.activity.dto;
+
+import com.matrix.system.activity.entity.ActivitySignAwardSet;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+@ApiModel(value = "UpdateLuckyDrawSetDto", description = "查询参数")
+public class UpdateLuckyDrawSetDto {
+
+ @ApiModelProperty(value ="活动名称")
+ private String actName;
+ @ApiModelProperty(value ="活动编码")
+ private String actCode;
+ @ApiModelProperty(value ="活动开始时间")
+ private Date beginTime;
+ @ApiModelProperty(value ="活动结束时间")
+ private Date endTime;
+
+ private LuckyDrawBasicJsonDto luckyDrawBasicJsonDto;
+
+ private List<ActivitySignAwardSet> activityAwardSets;
+
+ @ApiModelProperty(value ="活动主表ID")
+ private Long actMainId;
+
+ @ApiModelProperty(hidden = true)
+ private Long companyId;
+
+}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateSignAwardSetDto.java b/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateSignAwardSetDto.java
index 20134c2..11ec9f6 100644
--- a/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateSignAwardSetDto.java
+++ b/zq-erp/src/main/java/com/matrix/system/activity/dto/UpdateSignAwardSetDto.java
@@ -11,23 +11,23 @@
@Data
@ApiModel(value = "UpdateSignAwardSetDto", description = "查询参数")
public class UpdateSignAwardSetDto {
-
+
@ApiModelProperty(value ="活动名称")
- private String actName;
+ private String actName;
@ApiModelProperty(value ="活动编码")
private String actCode;
@ApiModelProperty(value ="活动开始时间")
private Date beginTime;
@ApiModelProperty(value ="活动结束时间")
private Date endTime;
-
+
private SignSetBasicJsonDto signSetBasicJsonDto;
-
+
private List<ActivitySignAwardSet> activitySignAwardSets;
-
+
@ApiModelProperty(value ="活动主表ID")
private Long actMainId;
-
+
@ApiModelProperty(hidden = true)
private Long companyId;
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java b/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java
index c203dae..905c4fa 100644
--- a/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java
+++ b/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java
@@ -111,11 +111,8 @@
if(ObjectUtil.isEmpty(shopActivity)) {
return AjaxResult.buildFailInstance("网络不通畅,请刷新页面");
}
- /**
- * 未发布状态即使达到活动时间也不进入进行中状态
- */
- //未发布状态点击发布,状态变成未开始,且是开启状态
- shopActivity.setActStatus(ShopActivities.ACTSTATUS_STATUS_READY);
+ //未发布状态点击发布,状态变成进行中,且是开启状态
+ shopActivity.setActStatus(ShopActivities.ACTSTATUS_STATUS_ING);
shopActivity.setIsStart(ShopActivities.ACTIVITIES_STATUS_OPEN);
shopActivitiesDao.updateByModel(shopActivity);
return AjaxResult.buildSuccessInstance("操作成功");
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/vo/AddLuckyDrawSetVo.java b/zq-erp/src/main/java/com/matrix/system/activity/vo/AddLuckyDrawSetVo.java
new file mode 100644
index 0000000..f8ff24e
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/activity/vo/AddLuckyDrawSetVo.java
@@ -0,0 +1,34 @@
+package com.matrix.system.activity.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.matrix.system.activity.entity.ActivitySignAwardSet;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class AddLuckyDrawSetVo {
+ /**
+ * 主键
+ */
+ private Long id;
+
+ @ApiModelProperty(value ="活动名称")
+ private String actName;
+ @ApiModelProperty(value ="活动编码")
+ private String actCode;
+ @ApiModelProperty(value ="活动开始时间")
+ @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8")
+ private Date beginTime;
+ @ApiModelProperty(value ="活动结束时间")
+ @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8")
+ private Date endTime;
+
+ private LuckyDrawBasicJsonVo luckyDrawBasicJsonVo;
+
+ private List<ActivitySignAwardSet> activityluckyDrawSets;
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/vo/LuckyDrawAwardCodeListVo.java b/zq-erp/src/main/java/com/matrix/system/activity/vo/LuckyDrawAwardCodeListVo.java
new file mode 100644
index 0000000..80eb8b6
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/activity/vo/LuckyDrawAwardCodeListVo.java
@@ -0,0 +1,57 @@
+package com.matrix.system.activity.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class LuckyDrawAwardCodeListVo {
+
+ @ApiModelProperty(value ="头部图片")
+ private String imageUrlHead;
+ @ApiModelProperty(value ="开始按钮")
+ private String imageUrlTitle;
+ @ApiModelProperty(value ="转盘背景")
+ private String imageUrlButton;
+ @ApiModelProperty(value ="状态图片")
+ private String imageUrlState;
+ @ApiModelProperty(value ="奖品划分线")
+ private String imageLine;
+
+ @ApiModelProperty(value ="规则内容")
+ private String ruleExplain;
+ @ApiModelProperty(value ="字体颜色")
+ private String typographyColor;
+ @ApiModelProperty(value ="背景颜色")
+ private String backgroundColor;
+ @ApiModelProperty(value ="字体大小")
+ private Integer typographyNum;
+ @ApiModelProperty(value ="字体透明度")
+ private Integer typographyLight;
+
+
+ //@ApiModelProperty(value ="中奖顺序")
+ private String awardLine;
+ //@ApiModelProperty(value ="中奖顺序索引")
+ private Integer awrdLineIndex;
+
+ /**
+ * 抽奖规则
+ */
+ //每人每日有10次无门槛抽奖机会
+ private Integer wmkcjjh;
+ //可用积分兑换1次抽奖机会,
+ private Integer dhycjfs;
+ // 每日最多兑换
+ //10
+ //次抽奖机会
+ private Integer jfdhcs;
+ // 每人最多可中奖
+ //10
+ //次
+ private Integer zzjcs;
+ // 总中奖率
+ //10
+ //%
+ private Integer zzjl;
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/vo/LuckyDrawBasicJsonVo.java b/zq-erp/src/main/java/com/matrix/system/activity/vo/LuckyDrawBasicJsonVo.java
new file mode 100644
index 0000000..f945879
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/activity/vo/LuckyDrawBasicJsonVo.java
@@ -0,0 +1,51 @@
+package com.matrix.system.activity.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class LuckyDrawBasicJsonVo {
+
+ @ApiModelProperty(value ="头部图片")
+ private String imageUrlHead;
+ @ApiModelProperty(value ="开始按钮")
+ private String imageUrlTitle;
+ @ApiModelProperty(value ="转盘背景")
+ private String imageUrlButton;
+ @ApiModelProperty(value ="状态图片")
+ private String imageUrlState;
+ @ApiModelProperty(value ="奖品划分线")
+ private String imageLine;
+
+ @ApiModelProperty(value ="规则内容")
+ private String ruleExplain;
+ @ApiModelProperty(value ="字体颜色")
+ private String typographyColor;
+ @ApiModelProperty(value ="背景颜色")
+ private String backgroundColor;
+ @ApiModelProperty(value ="字体大小")
+ private Integer typographyNum;
+ @ApiModelProperty(value ="字体透明度")
+ private Integer typographyLight;
+
+ /**
+ * 抽奖规则
+ */
+ //每人每日有10次无门槛抽奖机会
+ private Integer wmkcjjh;
+ //可用积分兑换1次抽奖机会,
+ private Integer dhycjfs;
+ // 每日最多兑换
+ //10
+ //次抽奖机会
+ private Integer jfdhcs;
+ // 每人最多可中奖
+ //10
+ //次
+ private Integer zzjcs;
+ // 总中奖率
+ //10
+ //%
+ private Integer zzjl;
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/vo/SignReceiveListVo.java b/zq-erp/src/main/java/com/matrix/system/activity/vo/SignReceiveListVo.java
index 661707f..7b7d959 100644
--- a/zq-erp/src/main/java/com/matrix/system/activity/vo/SignReceiveListVo.java
+++ b/zq-erp/src/main/java/com/matrix/system/activity/vo/SignReceiveListVo.java
@@ -12,7 +12,9 @@
* 主键
*/
private Long id;
-
+ //活动类型
+ private int actType;
+
@ApiModelProperty(value = "用户")
private String nickName;
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 894cdf2..08f9c22 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
@@ -521,7 +521,7 @@
/**
* 免免邮金额
*/
- public static final String FREE_PACKAGE_PRICE = "FREE_PACKAGE_PRICE";
+ public static final String FREE_PACKAGE_PRICE = "FREE_PACKAGE_PRICE";
/**
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 2c08183..fe414cc 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
@@ -3,6 +3,8 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import com.matrix.core.anotations.Extend;
import com.matrix.core.tools.DateUtil;
+import com.matrix.system.app.dto.BasePageDto;
+import com.matrix.system.common.bean.EntityDTOExt;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
@@ -11,7 +13,7 @@
*
* @date 2019-03-24 23:55
*/
-public class AchieveNew implements Serializable{
+public class AchieveNew extends EntityDTOExt {
@Extend
private static final long serialVersionUID = 1L;
@@ -26,7 +28,7 @@
/**
- * 美疗师id
+ * 美疗师id 把这个字段视为正式的业绩归属人
*/
private Long beaultId;
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveRule.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveRule.java
new file mode 100644
index 0000000..07e7594
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveRule.java
@@ -0,0 +1,33 @@
+package com.matrix.system.hive.bean;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.matrix.system.hiveErp.pojo.AchieveRuleItem;
+import com.matrix.system.score.entity.BaseEntity;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+/**
+ * 业绩规则
+ * @author JIANGYOUYAO
+ * @date 2021/6/3 0003
+ */
+@Data
+@TableName("achieve_rule")
+public class AchieveRule extends BaseEntity {
+
+ @NotEmpty(message = "规则名称不能为空")
+ private String name;
+
+
+ private String rules;
+
+ private Long companyId;
+
+ @TableField(exist=false)
+ @NotEmpty(message = "规则不能为空")
+ private List<AchieveRuleItem> ruleItemList;
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java
index d0a63cb..0787c91 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/MoneyCardUse.java
@@ -1,6 +1,8 @@
package com.matrix.system.hive.bean;
+import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.matrix.core.anotations.Extend;
import com.matrix.core.tools.DateUtil;
@@ -14,9 +16,10 @@
*
* @date 2016-09-17 10:17
*/
+
public class MoneyCardUse {
-
+ @TableId(value = "id",type = IdType.AUTO)
private Long id;
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java
index 7dfeeff..9824694 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java
@@ -433,12 +433,38 @@
* 任选套餐是否无限次 N-否 Y-是
*/
private String isInfinite;
+ /**
+ *业绩规则id
+ */
+ private Long achieveRuleId;
+
+ /**
+ *业绩规则名称
+ */
+ @Extend
+ private String achieveRuleName;
/**
* 支付方式 1-充值本金 2-赠送金额 3-积分
*/
private String payMethods;
+ public String getAchieveRuleName() {
+ return achieveRuleName;
+ }
+
+ public void setAchieveRuleName(String achieveRuleName) {
+ this.achieveRuleName = achieveRuleName;
+ }
+
+ public Long getAchieveRuleId() {
+ return achieveRuleId;
+ }
+
+ public void setAchieveRuleId(Long achieveRuleId) {
+ this.achieveRuleId = achieveRuleId;
+ }
+
public String getPayMethods() {
return payMethods;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java
index 835d02c..f160d12 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java
@@ -42,7 +42,7 @@
private Date orderTime;
/**
- * 收款
+ * calculationType: 1,
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private Date payTime;
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
index d8421e3..bcde36d 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
@@ -1,10 +1,15 @@
package com.matrix.system.hive.dao;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.vo.OrderDetailAchieveItemVo;
import com.matrix.system.app.vo.RankingVo;
import com.matrix.system.app.vo.UserAchieveVo;
import com.matrix.system.hive.bean.AchieveNew;
+import com.matrix.system.hive.dto.AchieveNewStatisticsDto;
+import com.matrix.system.hive.vo.AchieveNewStatisticsVo;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
@@ -18,7 +23,7 @@
*/
-public interface AchieveNewDao{
+public interface AchieveNewDao extends BaseMapper<AchieveNew> {
public int insert(@Param("item") AchieveNew achieveNew);
@@ -82,4 +87,5 @@
int updateAchieveNumOfPeople(@Param("list") List<AchieveNew> list, @Param("num") Double num);
+ IPage<AchieveNewStatisticsVo> achieveNewStatistics(Page<AchieveNewStatisticsVo> page, @Param("record")AchieveNewStatisticsDto queryDto);
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveRuleDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveRuleDao.java
new file mode 100644
index 0000000..08034c3
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveRuleDao.java
@@ -0,0 +1,11 @@
+package com.matrix.system.hive.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.matrix.system.hive.bean.AchieveRule;
+
+/**
+ * 业绩规则dao
+ */
+public interface AchieveRuleDao extends BaseMapper<AchieveRule> {
+
+}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderItemDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderItemDao.java
index 5446b22..1abccec 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderItemDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderItemDao.java
@@ -64,4 +64,6 @@
List<OrderDetailItemVo> selectApiOrderDetailItemsByOrderId(@Param("orderId") Long orderId);
List<ErpOrderDetailItemVo> selectErpOrderItemByOrderId(String orderId);
+
+ List<SysOrderItem> selectDgd();
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipInfoDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipInfoDao.java
index 1295c04..747dc87 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipInfoDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipInfoDao.java
@@ -212,4 +212,6 @@
public SysVipInfo findByOpenId(String openId);
int unbundlingSaleMan(Long userId);
+
+ int bindingRecommend(@Param("recommendId") Long recommendId,@Param("userId") Long userId);
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dto/AchieveNewStatisticsDto.java b/zq-erp/src/main/java/com/matrix/system/hive/dto/AchieveNewStatisticsDto.java
new file mode 100644
index 0000000..f4b4816
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dto/AchieveNewStatisticsDto.java
@@ -0,0 +1,41 @@
+package com.matrix.system.hive.dto;
+
+import com.google.common.base.CaseFormat;
+import com.matrix.core.pojo.BasePageQueryDto;
+import com.matrix.core.tools.StringUtils;
+import lombok.Data;
+
+@Data
+public class AchieveNewStatisticsDto extends BasePageQueryDto {
+
+ //规则名称
+ String achieveRuleId;
+
+
+ //业绩归属人id
+ String staffName;
+
+
+ //门店名称
+ Long shopId;
+
+ //公司id
+ Long companyId;
+
+ //订单类型
+ String orderType;
+
+ @Override
+ public void setSort(String sort) {
+ if(StringUtils.isNotBlank(sort)){
+ if ("ruleName".equals(sort)) {
+ super.setSort("u.name");
+ } else {
+ super.setSort(CaseFormat.LOWER_CAMEL.to
+ (CaseFormat.LOWER_UNDERSCORE, sort));
+ }
+ }else{
+ super.setSort(sort);
+ }
+ }
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/AchieveRuleService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/AchieveRuleService.java
new file mode 100644
index 0000000..601c8fe
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/AchieveRuleService.java
@@ -0,0 +1,33 @@
+package com.matrix.system.hive.service;
+
+import cn.hutool.json.JSONUtil;
+import com.matrix.system.hive.bean.AchieveRule;
+import com.matrix.system.hive.dao.AchieveRuleDao;
+import com.matrix.system.hiveErp.pojo.AchieveRuleItem;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+/**
+ * 业绩规则服务
+ * @author JIANGYOUYAO
+ * @date 2021/6/3 0003
+ */
+@Service
+@AllArgsConstructor
+public class AchieveRuleService {
+
+ AchieveRuleDao achieveRuleDao;
+
+
+ /**
+ * 根据id查询 AchieveRule
+ * @param id
+ * @return
+ */
+ public AchieveRule selectById(Long id){
+ AchieveRule achieveRule = achieveRuleDao.selectById(id);
+ achieveRule.setRuleItemList(JSONUtil.toList(JSONUtil.parseArray(achieveRule.getRules()), AchieveRuleItem.class));
+ return achieveRule;
+ }
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
index f0c6d88..14a1e97 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
@@ -1,6 +1,7 @@
package com.matrix.system.hive.service.imp;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.json.JSONUtil;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.pojo.PaginationVO;
@@ -16,13 +17,11 @@
import com.matrix.system.common.dao.SysUsersDao;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.hive.bean.*;
-import com.matrix.system.hive.dao.AchieveNewDao;
-import com.matrix.system.hive.dao.ShoppingGoodsDao;
-import com.matrix.system.hive.dao.SysBeauticianStateDao;
-import com.matrix.system.hive.dao.SysProjUseDao;
+import com.matrix.system.hive.dao.*;
import com.matrix.system.hive.plugin.util.CollectionUtils;
import com.matrix.system.hive.service.AchieveNewService;
import com.matrix.system.hive.service.SysProjServicesService;
+import com.matrix.system.hiveErp.pojo.AchieveRuleItem;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -185,8 +184,14 @@
// 是否为赠送业绩
if (Dictionary.TAOCAN_SOURCE_ZS.equals(projUse.getSource())) {
achieveNew.setFreeConsume(projUse.getPrice()*beauticianState.getCount());
+ //计算提成
+ achieveNew.setProjPercentage(
+ calculationProjPercentage(AchieveRuleItem.ACHIEVE_TYPE_ZS,achieveNew.getFreeConsume(),beauticianState.getProjId()));
} else {
achieveNew.setHisConsume(projUse.getPrice()*beauticianState.getCount());
+ //计算提成
+ achieveNew.setProjPercentage(
+ calculationProjPercentage(AchieveRuleItem.ACHIEVE_TYPE_BJ,achieveNew.getHisConsume(),beauticianState.getProjId()));
}
achieveNew.setT2(projUse.getSource());
achieveNew.setDatatime(new Date());
@@ -199,12 +204,14 @@
if (flag) {
// if (!achieveId.equals(beauticianState.getStaffId())) {
- AchieveNew saleMan = new AchieveNew();
- BeanUtils.copyProperties(achieveNew, saleMan);
- saleMan.setBeaultId(achieveId);
+ AchieveNew saleManAchieve = new AchieveNew();
+ BeanUtils.copyProperties(achieveNew, saleManAchieve);
+ saleManAchieve.setBeaultId(achieveId);
- saleAchieveNumOfPeople(saleMan);
- achieveNewList.add(saleMan);
+ saleAchieveNumOfPeople(saleManAchieve);
+ //销售人员不计算项目提成
+ saleManAchieve.setProjPercentage(0D);
+ achieveNewList.add(saleManAchieve);
// }
}
@@ -239,6 +246,36 @@
}
+ @Autowired
+ AchieveRuleDao achieveRuleDao;
+
+ private Double calculationProjPercentage(int type, Double consume, Long goodsId) {
+ ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(goodsId);
+ if(shoppingGoods.getAchieveRuleId()!=null){
+
+ AchieveRule achieveRule = achieveRuleDao.selectById(shoppingGoods.getAchieveRuleId());
+ if(achieveRule!=null){
+ List<AchieveRuleItem> achieveRuleItems = JSONUtil.toList(JSONUtil.parseArray(achieveRule.getRules()), AchieveRuleItem.class);
+ double percentage=0D;
+ for(AchieveRuleItem item:achieveRuleItems){
+ if(item.getAchieveType()==type
+ && (item.getLower() == consume
+ || (item.getLower()< consume && consume < item.getUpper() ))){
+
+ if(AchieveRuleItem.ACHIEVE_TYPE_FIXED==item.getCalculationType()){
+ percentage=item.getAchieve();
+ }else{
+ percentage= consume * (item.getAchieve()/100);
+ }
+ break;
+ }
+ }
+ return percentage;
+ }
+ }
+ return 0D;
+ }
+
/**
* 顾问人头业绩
* @param achieveNew
@@ -264,7 +301,6 @@
for (AchieveNew achieveNew : orderItem.getAchieveList()) {
if (achieveNew !=null && achieveNew.getGoodsCash()!=null) {
buildAchieve(pageOrder, orderItem, achieveNew);
- // 新增美疗师业绩
achieveNewList.add(achieveNew);
}
}
@@ -290,7 +326,10 @@
}
achieveNew.setVipId(pageOrder.getVipId());
- achieveNew.setSaleId(pageOrder.getStaffId());
+ if(achieveNew.getSaleId()==null){
+ achieveNew.setSaleId(pageOrder.getStaffId());
+ }
+
if (pageOrder.getPayTime() != null) {
achieveNew.setDatatime(pageOrder.getPayTime());
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
index 3d19de0..0384cfd 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -497,6 +497,12 @@
if (!Dictionary.ORDER_STATU_DFK.equals(pageOrder.getStatu())) {
throw new GlobleException("该订单已经收过款,请刷新页面再试!");
}
+
+ //交易业绩设置是否合理
+
+ checkAchieveIsOk(pageOrder);
+
+
// 更新收款时间
pageOrder.setPayTime(new Date());
pageOrder.setStatu(Dictionary.ORDER_STATU_YFK);
@@ -530,6 +536,28 @@
//设置会员积分
addVipScore(pageOrder);
+ }
+
+ /**
+ * 交易业绩设置是否合理
+ * @param pageOrder
+ */
+ private void checkAchieveIsOk(SysOrder pageOrder) {
+ double huakouSum = pageOrder.getItems().stream()
+ .mapToDouble(
+ item ->
+ item.getAchieveList().stream()
+ .filter(achieveNew -> "划扣".equals(achieveNew.getPayMethod()))
+ .mapToDouble(achieve -> achieve.getGoodsCash()).sum()
+ ).sum();
+
+ double czkPay= pageOrder.getFlows().stream()
+ .filter(sysOrderFlow -> "储值卡".equals(sysOrderFlow.getPayMethod()))
+ .mapToDouble(sysOrderFlow ->sysOrderFlow.getAmount().doubleValue()).sum();
+
+ if(czkPay!=huakouSum){
+ throw new GlobleException("划扣业绩不等于储值卡扣款金额,请修改业绩设置!");
+ }
}
/**
@@ -1205,13 +1233,20 @@
} else {
puse.setPrice(goodsAssemble.getPrice() * zk);
}
- puse.setBalance(MoneyUtil.mul(puse.getPrice(), Double.valueOf(puse.getSurplusCount())));
+
// 赠送和打折后金额为0的都视为赠送项目
if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0) {
puse.setSource(Dictionary.TAOCAN_SOURCE_GM);
} else {
+ //赠送产品按原价计算消耗
puse.setSource(Dictionary.TAOCAN_SOURCE_ZS);
+ if (taocanId == null) {
+ puse.setPrice(goodsAssemble.getShoppingGoods().getPrice() );
+ } else {
+ puse.setPrice(goodsAssemble.getPrice());
+ }
}
+ puse.setBalance(MoneyUtil.mul(puse.getPrice(), Double.valueOf(puse.getSurplusCount())));
puse.setFailTime(failTime);
sysProjUseDao.insert(puse);
return puse;
@@ -1291,18 +1326,22 @@
puse.setVipId(order.getVipId());
puse.setStatus(Dictionary.TAOCAN_STATUS_YX);
puse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM);
- puse.setBalance(sysOrderItem.getZkPrice());
- puse.setPrice(sysOrderItem.getZkPrice());
+
+
puse.setProjName(sysOrderItem.getShoppingGoods().getName());
// 赠送和打折后金额为0的都视为赠送项目
if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0) {
puse.setSource(Dictionary.TAOCAN_SOURCE_GM);
+ puse.setPrice(sysOrderItem.getZkPrice());
} else {
puse.setSource(Dictionary.TAOCAN_SOURCE_ZS);
+ //赠送产品按原价计算消耗
+ puse.setPrice(sysOrderItem.getShoppingGoods().getSealPice());
}
// 设置失效时间
Date invalidTime = shoppingGoodsService.calInvalidTime(sysOrderItem.getShoppingGoods(), 1, null);
puse.setFailTime(invalidTime);
+ puse.setBalance(sysOrderItem.getShoppingGoods().getSealPice()*puse.getSurplusCount());
sysProjUseDao.insert(puse);
}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
index b5a3280..78e2713 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
@@ -119,7 +119,10 @@
throw new GlobleException(sysVipInfo.getPhone()+"手机已被注册!");
}
}
-
+ SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ if(user!=null){
+ sysVipInfo.setCompanyId(user.getCompanyId());
+ }
sysVipInfo.setCreateTime(new Date());
sysVipInfo.setPointAll(0);
sysVipInfo.setIsDeal(SysVipInfo.UNDEAL_VIP);
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java b/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java
index 95ac4ed..ba436dc 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java
@@ -1,5 +1,7 @@
package com.matrix.system.hive.statistics;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.PaginationVO;
@@ -13,14 +15,17 @@
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.AchieveNew;
import com.matrix.system.hive.dao.AchieveNewDao;
+import com.matrix.system.hive.dto.AchieveNewStatisticsDto;
import com.matrix.system.hive.plugin.util.CollectionUtils;
import com.matrix.system.hive.service.AchieveNewService;
import com.matrix.system.hive.service.SysOrderItemService;
import com.matrix.system.hive.service.SysOrderService;
+import com.matrix.system.hive.vo.AchieveNewStatisticsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -53,6 +58,25 @@
@Autowired
private AchieveNewDao achieveNewDao;
+
+
+ /**
+ * 员工业绩统计
+ */
+ @PostMapping(value = "/achieveNewStatistics")
+ public @ResponseBody
+ AjaxResult achieveNewStatistics(@RequestBody AchieveNewStatisticsDto queryDto){
+ SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
+
+ queryDto.setCompanyId(sysUsers.getCompanyId());
+
+ Page<AchieveNewStatisticsVo> page = new Page(queryDto.getPageNum(), queryDto.getPageSize());
+ IPage<AchieveNewStatisticsVo> rows = achieveNewDao.achieveNewStatistics(page,queryDto);
+ AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal());
+ return result;
+ }
+
+
/**
* 门店每日单据明细表
*/
@@ -74,11 +98,16 @@
*/
@RequestMapping(value = "/findDailyInfoNew")
public @ResponseBody
- AjaxResult findDailyInfoNew(AchieveNew achieveNew, PaginationVO pageVo) {
+ AjaxResult findDailyInfoNew(@RequestBody AchieveNew achieveNew) {
SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
+ achieveNew.setCompanyId(sysUsers.getCompanyId());
if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){
achieveNew.setShopId(sysUsers.getShopId());
}
+ PaginationVO pageVo = new PaginationVO();
+
+ pageVo.setOffset(achieveNew.getOffset());
+ pageVo.setLimit(achieveNew.getLimit());
pageVo.setSort("datatime");
pageVo.setOrder("desc");
AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, achieveNewService.findDayFlow(achieveNew, pageVo),
@@ -86,6 +115,55 @@
return result;
}
+ @RequestMapping(value = "/exportAchieveNewStatisticsExcel")
+ public void exportAchieveNewStatisticsExcel(ModelMap model, HttpServletRequest request, HttpServletResponse response, AchieveNewStatisticsDto queryDto) throws IOException {
+ //这里是从数据库里查数据并组装成我们想要的数据结构的过程
+ List<ExcelSheetPO> res = new ArrayList<>();
+ ExcelSheetPO orderSheet = new ExcelSheetPO();
+ String title = "员工业绩统计";
+ orderSheet.setSheetName(title);
+ orderSheet.setTitle(title);
+ String[] header = {"规则名称", "门店名称", "业绩归属人", "业绩创建人", "订单金额", "现金", "划扣", "本金消耗", "赠送消耗"
+ , "服务提成", "人头", "项目个数", "服务时间", "订单类型"};
+ orderSheet.setHeaders(header);
+ SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
+ if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){
+ queryDto.setShopId(sysUsers.getShopId());
+ }
+ queryDto.setCompanyId(sysUsers.getCompanyId());
+ Page<AchieveNewStatisticsVo> page = new Page(1, Long.MAX_VALUE);
+ IPage<AchieveNewStatisticsVo> rows = achieveNewDao.achieveNewStatistics(page,queryDto);
+ List<AchieveNewStatisticsVo> dataList = rows.getRecords();
+ List<List<Object>> list = new ArrayList<>();
+ if (dataList.size() > 0) {
+ for (AchieveNewStatisticsVo item : dataList) {
+ List<Object> temp = new ArrayList<>();
+ temp.add(item.getRuleName());
+ temp.add(item.getShopName());
+ temp.add(item.getGuwen());
+ temp.add(item.getCreateBy());
+ temp.add(item.getZkTotal());
+ temp.add(item.getGoodsCash());
+ temp.add(item.getCardCash());
+ temp.add(item.getHisConsume());
+ temp.add(item.getFreeConsume());
+ temp.add(item.getProjPercentage());
+ temp.add(item.getNumberOfPeople());
+ temp.add(item.getProjNum());
+ temp.add(item.getProjTime());
+ temp.add(item.getOrderType());
+ list.add(temp);
+ }
+ }
+ orderSheet.setDataList(list);
+ res.add(orderSheet);
+ response = ResponseHeadUtil.setExcelHead(response);
+ response.setHeader("Content-Disposition",
+ "attachment;filename=" + java.net.URLEncoder.encode(title + DateUtil.getTimeMark() + ".xlsx".trim(), "UTF-8"));
+ OutputStream os = response.getOutputStream();
+ com.matrix.core.tools.excl.ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, res, os, true);
+ }
+
@RequestMapping(value = "/exportDailyInfoNew")
public void exportDailyInfoNew(ModelMap model, HttpServletRequest request, HttpServletResponse response, AchieveNew achieveNew) throws IOException {
//这里是从数据库里查数据并组装成我们想要的数据结构的过程
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/vo/AchieveNewStatisticsVo.java b/zq-erp/src/main/java/com/matrix/system/hive/vo/AchieveNewStatisticsVo.java
new file mode 100644
index 0000000..b48a597
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/hive/vo/AchieveNewStatisticsVo.java
@@ -0,0 +1,42 @@
+package com.matrix.system.hive.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class AchieveNewStatisticsVo {
+ //规则名称
+ String ruleName;
+ //业绩归属人
+ String guwen;
+ //业绩归属人id
+ Long gwid;
+ //订单创建人
+ String createBy;
+ //创建人id
+ Long createId;
+ //订单金额
+ BigDecimal zkTotal;
+ //消耗金额
+ BigDecimal hisConsume;
+ //赠送消耗
+ BigDecimal freeConsume;
+ //项目提成
+ BigDecimal projPercentage;
+ // 人头数
+ Double numberOfPeople;
+ //项目数
+ Double projNum;
+ //项目时长
+ Integer projTime;
+ //现金支付
+ BigDecimal goodsCash;
+ //卡项支付
+ BigDecimal cardCash;
+ //门店名称
+ String shopName;
+ //订单类型
+ String orderType;
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java
new file mode 100644
index 0000000..ee9deaf
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/AchieveRuleAction.java
@@ -0,0 +1,129 @@
+package com.matrix.system.hiveErp.action;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.matrix.core.constance.MatrixConstance;
+import com.matrix.core.pojo.AjaxResult;
+import com.matrix.core.pojo.BasePageQueryDto;
+import com.matrix.core.tools.StringUtils;
+import com.matrix.core.tools.WebUtil;
+import com.matrix.system.common.bean.SysUsers;
+import com.matrix.system.common.dao.SysUsersDao;
+import com.matrix.system.hive.action.util.QueryUtil;
+import com.matrix.system.hive.bean.AchieveRule;
+import com.matrix.system.hive.dao.AchieveRuleDao;
+import com.matrix.system.hiveErp.pojo.AchieveRuleItem;
+import lombok.AllArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 业绩规则Api
+ *
+ * @author jiangyouyao
+ * @date 2021-06-03
+ **/
+@RestController
+@AllArgsConstructor
+@RequestMapping(value = "/admin/achieveRule")
+public class AchieveRuleAction {
+
+ private AchieveRuleDao achieveRuleDao;
+
+
+ private SysUsersDao sysUsersDao;
+
+
+ /**
+ * 新增业绩规则
+ * @param achieveRule
+ * @return
+ */
+ @PostMapping("/add")
+ public AjaxResult add(@RequestBody @Validated AchieveRule achieveRule) {
+
+
+
+ String rules = JSONUtil.toJsonStr(achieveRule.getRuleItemList());
+ achieveRule.setRules(rules);
+
+ QueryUtil.setQueryLimitCom(achieveRule);
+ SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ achieveRule.setCreateTime(DateTime.now());
+ achieveRule.setUpdateTime(DateTime.now());
+ achieveRule.setCreateBy(user.getSuName());
+ achieveRule.setUpdateBy(user.getSuName());
+ achieveRuleDao.insert(achieveRule);
+ return AjaxResult.buildSuccessInstance("新增成功");
+ }
+
+ /**
+ * 修改业绩规则
+ *
+ * @param achieveRule
+ * @return
+ */
+ @PostMapping("/update")
+ public AjaxResult update(@RequestBody @Validated AchieveRule achieveRule) {
+
+ if (achieveRule.getId() == null) {
+ return AjaxResult.buildFailInstance("id不能为空");
+ }
+
+ String rules = JSONUtil.toJsonStr(achieveRule.getRuleItemList());
+ achieveRule.setRules(rules);
+
+ SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ achieveRule.setUpdateBy(user.getSuName());
+ achieveRule.setUpdateTime(DateTime.now());
+ achieveRuleDao.updateById(achieveRule);
+ return AjaxResult.buildSuccessInstance("修改成功");
+ }
+
+ /**
+ * 删除id
+ *
+ * @param id
+ * @return
+ */
+ @GetMapping("/removeById/{id}")
+ public AjaxResult removeById(@PathVariable Long id) {
+ achieveRuleDao.deleteById(id);
+ return AjaxResult.buildSuccessInstance("删除成功");
+ }
+
+
+ /**
+ * 分页查询规则
+ *
+ * @param pageDto
+ * @return
+ */
+ @PostMapping("/selectList")
+ public AjaxResult selectList(@RequestBody BasePageQueryDto pageDto) {
+
+ SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ Page<AchieveRule> page = new Page<>(pageDto.getPageNum(), pageDto.getPageSize());
+ LambdaQueryWrapper<AchieveRule> lambdaQueryWrapper = new LambdaQueryWrapper<AchieveRule>()
+ .eq(AchieveRule::getCompanyId, user.getCompanyId());
+ if (StringUtils.isNotBlank(pageDto.getKeywords())) {
+ lambdaQueryWrapper.like(AchieveRule::getName, pageDto.getKeywords());
+ }
+ IPage<AchieveRule> achieveRuleIPage = achieveRuleDao.selectPage(page, lambdaQueryWrapper);
+ achieveRuleIPage.getRecords().stream().forEach(item->{
+ item.setRuleItemList(JSONUtil.toList(JSONUtil.parseArray(item.getRules()), AchieveRuleItem.class));
+ item.setRules(null);
+ });
+
+ AjaxResult result = AjaxResult.buildSuccessInstance(achieveRuleIPage.getRecords(), achieveRuleIPage.getTotal());
+ return result;
+ }
+
+ @PostMapping("/selectListForm")
+ public AjaxResult selectListForm(BasePageQueryDto pageDto) {
+ return selectList(pageDto);
+ }
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/hiveErp/pojo/AchieveRuleItem.java b/zq-erp/src/main/java/com/matrix/system/hiveErp/pojo/AchieveRuleItem.java
new file mode 100644
index 0000000..8eec4db
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/hiveErp/pojo/AchieveRuleItem.java
@@ -0,0 +1,56 @@
+package com.matrix.system.hiveErp.pojo;
+
+import lombok.Data;
+
+/**
+ * 绩效规则明细
+ * @author JIANGYOUYAO
+ * @date 2021/6/3 0003
+ */
+@Data
+public class AchieveRuleItem {
+ /**
+ * 类型,1本金消耗
+ */
+ public static final int ACHIEVE_TYPE_BJ=1;
+ /**
+ * 类型,2赠送消耗
+ */
+ public static final int ACHIEVE_TYPE_ZS =2;
+ /**
+ * 计算类型 1 固定值
+ */
+ public static final int ACHIEVE_TYPE_FIXED=1;
+ /**
+ * 计算类型 2百分比
+ */
+ public static final int ACHIEVE_TYPE_PERCENTAGE=2;
+
+
+ /**
+ * 类型,1本金消耗,2赠送消耗
+ */
+ private Integer achieveType;
+
+ /**
+ * 计算类型 1 固定值,2百分比
+ */
+ private Integer calculationType;
+
+ /**
+ * 区间-低
+ */
+ private Double Lower ;
+
+ /**
+ * 区间-高
+ */
+ private Double upper ;
+
+ /**
+ * 业绩值
+ */
+ private Double achieve;
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java
index dded875..48276f1 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopRefundRecordAction.java
@@ -17,6 +17,7 @@
import com.matrix.core.tools.WebUtil;
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.hive.action.util.QueryUtil;
import com.matrix.system.shopXcx.api.service.WXShopOrderService;
import com.matrix.system.shopXcx.api.service.WxShopRefundRecordService;
@@ -81,6 +82,8 @@
@Autowired
private RabiitMqTemplate rabiitMqTemplate;
+ @Autowired
+ BusParameterSettingsDao parameterSettingsDao;
/**
* 列表显示
@@ -525,8 +528,12 @@
modifyMap.put("refundCharge", shopRefundRecord.getRefundMoney());
shopOrderDao.updateByMap(modifyMap);
+
+
+
rabiitMqTemplate.sendMsg(MQTaskRouting.SHOP_ORDER_REFUND+evn,shopRefundRecord.getOrderId()+"");
+
}catch (Exception e){
LogUtil.debug("退款成功,修改退款表和订单表状态出错。。。", id);
e.printStackTrace();
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxRefundRecordAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxRefundRecordAction.java
index daf749a..1d471ab 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxRefundRecordAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxRefundRecordAction.java
@@ -1,6 +1,5 @@
package com.matrix.system.shopXcx.api.action;
-import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.component.redis.RedisUserLoginUtils;
import com.matrix.component.tools.WxUtils;
import com.matrix.core.pojo.AjaxResult;
@@ -9,6 +8,7 @@
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.dao.CustomerDataDictionaryDao;
+import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.shopXcx.api.service.WxShopRefundRecordService;
import com.matrix.system.shopXcx.api.tools.SMSTools;
import com.matrix.system.shopXcx.bean.ShopDeliveryInfo;
@@ -103,6 +103,7 @@
return Double.valueOf(moneyStr);
}
+
/**
* 接收保存退款退货数据
*/
@@ -135,13 +136,13 @@
if (i == 0) {
return new AjaxResult(AjaxResult.STATUS_FAIL, "保存失败");
}
-
+ ShopOrder order = shopOrderDao.selectById(refundRecord.getOrderId());
//未发货的订单取消订单不走后台审核直接退款
List<ShopRefundRecord> refundRecordsList = refundRecordDao.selectByModel(record);
if(CollectionUtils.isNotEmpty(refundRecordsList)){
ShopRefundRecord shopRecord = refundRecordsList.get(0);
Integer orderId = shopRecord.getOrderId();
- ShopOrder order = shopOrderDao.selectById(orderId);
+
if (order == null) {
return new AjaxResult(AjaxResult.STATUS_FAIL, "未发货直接退款未找到订单信息");
}
@@ -160,6 +161,10 @@
if(flag){
ShopRefundRecord fundRecord = refundRecordDao.selectById(shopRecord.getId());
refundRecordService.updateGroupBuyStatus(orderId.longValue());
+
+
+
+
return new AjaxResult(AjaxResult.STATUS_SUCCESS, "退款成功");
}
return new AjaxResult(AjaxResult.STATUS_FAIL, "退款失败");
@@ -172,6 +177,8 @@
modifyMap.put("id", orderId);
modifyMap.put("orderStatus", ShopOrder.ORDER_STATUS_APPLY_MONEYBACK);
shopOrderDao.updateByMap(modifyMap);
+
+
return new AjaxResult(AjaxResult.STATUS_SUCCESS, "保存成功");
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java
index 611820b..faf6fc3 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java
@@ -1,10 +1,15 @@
package com.matrix.system.shopXcx.api.action;
+import com.matrix.component.redis.RedisUserLoginUtils;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.interceptor.HostInterceptor;
+import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao;
+import com.matrix.system.fenxiao.entity.ShopSalesmanGrade;
+import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.shopXcx.api.dto.SaleProductDto;
import com.matrix.system.shopXcx.bean.ShopProduct;
+import com.matrix.system.shopXcx.bean.ShopSku;
import com.matrix.system.shopXcx.dao.ShopProductAttributeDao;
import com.matrix.system.shopXcx.dao.ShopProductDao;
import com.matrix.system.shopXcx.dao.ShopSkuDao;
@@ -19,7 +24,9 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import java.math.BigDecimal;
import java.util.List;
+import java.util.Objects;
/**
* @author jyy
@@ -35,9 +42,12 @@
@Autowired
private ShopProductAttributeDao shopProductAttributeDao;
-
+ @Autowired
+ private ShopSalesmanGradeDao shopSalesmanGradeDao;
@Autowired
private ShopSkuDao shopSkuDao;
+ @Autowired
+ private RedisUserLoginUtils redisUserLoginUtils;
@ApiOperation(value = "查询推广商品", notes = "")
@PostMapping(value = "/getSalesProductList")
@@ -54,7 +64,25 @@
shopProduct.setAbleSales(ShopProduct.ABLE_SALES);
shopProduct.setCompanyId(HostInterceptor.getCompanyId());
List<ShopProduct> shopProducts = shopProductDao.selectByModelWx(shopProduct);
- shopProducts.forEach(item->item.setSkus(shopSkuDao.selectByPid(item.getId())));
+ SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class);
+ ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectById(sysVipInfo.getSalesmanGrade());
+ shopProducts.forEach(item->{
+ List<ShopSku> shopSkus = shopSkuDao.selectByPid(item.getId());
+ //计算产品佣金
+ shopSkus.forEach(shopSku -> {
+ if(Objects.isNull(shopSku.getInvitationPrice())){
+ shopSku.setInvitationPrice(shopSku.getPrice().multiply(BigDecimal.valueOf(shopSalesmanGrade.getInvitationCommission())).divide(BigDecimal.valueOf(100)));
+ }
+ if(Objects.isNull(shopSku.getSealesPrice())){
+ shopSku.setSealesPrice(shopSku.getPrice().multiply(BigDecimal.valueOf(shopSalesmanGrade.getSealesCommission())).divide(BigDecimal.valueOf(100)));
+ }
+ if(Objects.isNull(shopSku.getSelfPrice())){
+ shopSku.setSelfPrice(shopSku.getPrice().multiply(BigDecimal.valueOf(shopSalesmanGrade.getSelfCommission())).divide(BigDecimal.valueOf(100)));
+ }
+ });
+ item.setSkus(shopSkus);
+
+ });
AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, shopProducts);
return result;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
index 7e39d58..ee96c85 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
@@ -168,11 +168,7 @@
return AjaxResult.buildSuccessInstance("已经被绑定");
} else {
if (loginUser.getRecommendId()==null) {
- Map<String, Object> updateParam = new HashMap<>();
- updateParam.put("id", loginUser.getId());
- loginUser.setRecommendId(invitationUser.getId());
- loginUser.setBindingParentTime(new Date());
- sysVipInfoDao.update(loginUser);
+ sysVipInfoDao.bindingRecommend(invitationUser.getId(),loginUser.getId());
return AjaxResult.buildSuccessInstance("绑定成功");
} else {
return AjaxResult.buildSuccessInstance("已经存在上级");
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesLuckydrawAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesLuckydrawAction.java
new file mode 100644
index 0000000..c54e9ac
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesLuckydrawAction.java
@@ -0,0 +1,542 @@
+package com.matrix.system.shopXcx.api.action;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.matrix.component.redis.RedisUserLoginUtils;
+import com.matrix.core.pojo.AjaxResult;
+import com.matrix.core.tools.StringUtils;
+import com.matrix.system.activity.dao.ActivitySignAwardSetDao;
+import com.matrix.system.activity.dao.ActivitySignReceiveRecordDao;
+import com.matrix.system.activity.dao.ActivitySignRecordDao;
+import com.matrix.system.activity.dao.ActivitySignWriteoffDao;
+import com.matrix.system.activity.entity.ActivitySignAwardSet;
+import com.matrix.system.activity.entity.ActivitySignReceiveRecord;
+import com.matrix.system.activity.entity.ActivitySignRecord;
+import com.matrix.system.activity.entity.ActivitySignWriteoff;
+import com.matrix.system.common.constance.AppConstance;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.score.dao.ScoreVipDetailDao;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import com.matrix.system.score.service.ScoreVipDetailService;
+import com.matrix.system.shopXcx.api.service.WxShopLogisticsQueryService;
+import com.matrix.system.shopXcx.api.tools.WxShopCouponUtil;
+import com.matrix.system.shopXcx.api.vo.ActivitySignAwardSetVo;
+import com.matrix.system.shopXcx.api.vo.LuckyDrawBasicInfoJsonVo;
+import com.matrix.system.shopXcx.api.vo.LuckyDrawInfoVo;
+import com.matrix.system.shopXcx.api.vo.LuckyDrawSuccessVo;
+import com.matrix.system.shopXcx.bean.ShopActivities;
+import com.matrix.system.shopXcx.bean.ShopCoupon;
+import com.matrix.system.shopXcx.bean.ShopCouponRecord;
+import com.matrix.system.shopXcx.dao.*;
+import io.swagger.annotations.Api;
+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.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Api(tags = "转盘抽奖活动接口类")
+@RestController
+@RequestMapping(value = "/wxapi/luckydraw")
+public class WxShopActivitiesLuckydrawAction {
+
+ @Autowired
+ private ShopActivitiesDao shopActivitiesDao;
+
+ @Autowired
+ private RedisUserLoginUtils redisUserLoginUtils;
+
+ @Autowired
+ private ActivitySignAwardSetDao activitySignAwardSetDao;
+
+ @Autowired
+ private ActivitySignReceiveRecordDao activitySignReceiveRecordDao;
+
+ @Autowired
+ private ActivitySignWriteoffDao activitySignWriteoffDao;
+
+ @Autowired
+ private ActivitySignRecordDao activitySignRecordDao;
+
+ @Autowired
+ ShopDeliveryInfoDao shopDeliveryInfoDao;
+
+ @Autowired
+ private ShopLogisticsInfoDao shopLogisticsInfoDao;
+ @Autowired
+ private ShopReceiveAddressDao shopReceiveAddressDao;
+
+ @Autowired
+ private WxShopLogisticsQueryService wxShopLogisticsQueryService;
+ @Autowired
+ private ScoreVipDetailService scoreVipDetailService;
+ @Autowired
+ private ShopCouponDao shopCouponDao;
+ @Autowired
+ private WxShopCouponUtil wxShopCouponUtil;
+ @Autowired
+ private ShopCouponRecordDao shopCouponRecordDao;
+ @Autowired
+ private ScoreVipDetailDao scoreVipDetailDao;
+
+ @ApiOperation(value = "获取抽奖基本信息", notes = "")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "ok", response = LuckyDrawInfoVo.class)
+ })
+ @GetMapping(value = "/getLuckydrawBasicInfo")
+ public AjaxResult getLuckydrawBasicInfo() {
+ //获取登录人信息
+ SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class);
+ Long companyId = loginUser.getCompanyId();
+ Long userId = loginUser.getId();
+ //获取抽奖活动的信息
+ LuckyDrawInfoVo luckyDrawInfoVo = new LuckyDrawInfoVo();
+ AjaxResult ajaxResult = new AjaxResult();
+
+ ShopActivities shopActivities = shopActivitiesDao.selectOneByCompanyIdAndActTypeAndActStatus(companyId,ShopActivities.ACTIVITIES_TYPE_LUCKYDRAW,ShopActivities.ACTSTATUS_STATUS_ING);
+ if(ObjectUtil.isEmpty(shopActivities)){
+ ajaxResult = AjaxResult.buildFailInstance("活动还没有开始");
+ ajaxResult.setData(luckyDrawInfoVo);
+ return ajaxResult;
+ }
+ Long actId = shopActivities.getId();
+ luckyDrawInfoVo.setActName(shopActivities.getActName());
+ luckyDrawInfoVo.setActCode(shopActivities.getActCode());
+ luckyDrawInfoVo.setId(shopActivities.getId());
+ String actContent = shopActivities.getActContent();
+ LuckyDrawBasicInfoJsonVo luckyDrawBasicInfoJsonVo = JSON.parseObject(actContent, LuckyDrawBasicInfoJsonVo.class);
+ luckyDrawInfoVo.setLuckyDrawBasicInfoJsonVo(luckyDrawBasicInfoJsonVo);
+
+ List<ActivitySignAwardSetVo> activitySignAwardSetVos = activitySignAwardSetDao
+ .selectListByActIDAndCompanyId(actId,companyId, ActivitySignAwardSet.AWARDSTATE_WORK);
+ luckyDrawInfoVo.setActivitySignAwardSetVos(activitySignAwardSetVos);
+
+ /**
+ * 今日是否能参与
+ * 用户今日剩余抽奖次数
+ * 今日参与次数<每日允许最大参与次数都可以抽奖
+ */
+ //获取活动设置的参与次数
+ Integer wmkcjjh = luckyDrawBasicInfoJsonVo.getWmkcjjh();
+ //获取今日参与次数
+ List<ActivitySignRecord> activityRecords = activitySignRecordDao.selectListByActIdAndUserIdLikesignTime(actId,userId,new Date());
+ if(CollUtil.isNotEmpty(activityRecords)){
+ if(activityRecords.size() >= wmkcjjh){
+ luckyDrawInfoVo.setJoinState(LuckyDrawInfoVo.JOINSTATE_NOT);
+ luckyDrawInfoVo.setLuckyDrawTime(0);
+ }else{
+ luckyDrawInfoVo.setJoinState(LuckyDrawInfoVo.JOINSTATE_YES);
+ luckyDrawInfoVo.setLuckyDrawTime(wmkcjjh-activityRecords.size());
+ }
+ }else{
+ luckyDrawInfoVo.setJoinState(LuckyDrawInfoVo.JOINSTATE_YES);
+ luckyDrawInfoVo.setLuckyDrawTime(wmkcjjh);
+ }
+
+ //获取用户当前积分
+ int totalScore = scoreVipDetailDao.selectUserTotalScore(userId);
+ luckyDrawInfoVo.setTotalScore(totalScore);
+ ajaxResult = AjaxResult.buildSuccessInstance("");
+ ajaxResult.setData(luckyDrawInfoVo);
+ return ajaxResult;
+ }
+
+ /**
+ * 点击抽奖
+ *
+ */
+ @ApiOperation(value = "点击抽奖", notes = "")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "ok", response = LuckyDrawSuccessVo.class)
+ })
+
+ @GetMapping(value = "/clickLuckyDraw/{actId}")
+ @ResponseBody
+ @Transactional
+ public AjaxResult clickLuckyDraw(@PathVariable("actId") long actId) {
+ SysVipInfo user = redisUserLoginUtils.getLoginUser(SysVipInfo.class);
+ Long userId = user.getId();
+ Long companyId = user.getCompanyId();
+ /**
+ * 活动是否存在
+ * 活动是否已经开始
+ * 免费抽奖还是积分抽奖
+ * 积分抽奖一次一次换
+ * 减少积分
+ * 是否中奖
+ * 中奖规则
+ * 奖品处理
+ *
+ */
+ //活动是否存在
+ ShopActivities shopActivities = shopActivitiesDao.selectById(actId);
+ if (ObjectUtil.isEmpty(shopActivities)) {
+ return AjaxResult.buildFailInstance("活动不存在");
+ }
+ //活动是否已经开始
+ Integer actStatus = shopActivities.getActStatus();
+ if(ShopActivities.ACTSTATUS_STATUS_ING != actStatus) {
+ return AjaxResult.buildFailInstance("活动未开始");
+ }
+ //获取今日抽奖总次数
+ String actContent = shopActivities.getActContent();
+ LuckyDrawBasicInfoJsonVo luckyDrawBasicInfoJsonVo = JSON.parseObject(actContent, LuckyDrawBasicInfoJsonVo.class);
+ List<ActivitySignRecord> activityRecords = activitySignRecordDao.selectListByActIdAndUserIdLikesignTime(actId,userId, DateUtil.date());
+ if(CollUtil.isNotEmpty(activityRecords)){
+ Integer wmkcjjh = luckyDrawBasicInfoJsonVo.getWmkcjjh();
+ Integer jfdhcs = luckyDrawBasicInfoJsonVo.getJfdhcs();
+ if(activityRecords.size() >= (wmkcjjh+jfdhcs)){
+ return AjaxResult.buildFailInstance("明天再来抽奖吧");
+ }
+ }
+
+ //生成抽奖记录
+ ActivitySignRecord activitySignRecordAdd = new ActivitySignRecord();
+ activitySignRecordAdd.setCompanyId(companyId);
+ activitySignRecordAdd.setCreateBy(user.getVipName());
+ activitySignRecordAdd.setCreateTime(DateUtil.date());
+ activitySignRecordAdd.setUpdateBy(user.getVipName());
+ activitySignRecordAdd.setUpdateTime(DateUtil.date());
+ activitySignRecordAdd.setActivityId(actId);
+ activitySignRecordAdd.setSignTime(DateUtil.date());
+ activitySignRecordAdd.setUserId(userId);
+ activitySignRecordDao.insert(activitySignRecordAdd);
+
+ /**
+ 获取中奖概率
+ 中奖了获取奖品ID
+ 没有中奖则获取谢谢参与的奖品ID
+ 每个人最多中奖次数
+ */
+
+ List<LuckyDrawSuccessVo> luckyDrawSuccessVos = new ArrayList<>();
+
+ //获取谢谢参与奖
+ QueryWrapper<ActivitySignAwardSet> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("award_rule",ActivitySignAwardSet.AWARDRULE_NORMAL);
+ queryWrapper.eq("company_id",companyId);
+ queryWrapper.eq("activity_id",actId);
+ ActivitySignAwardSet activitySignAwardSetNormal = activitySignAwardSetDao.selectOne(queryWrapper);
+ //每个人最多中奖次数
+ Integer zzjcs = luckyDrawBasicInfoJsonVo.getZzjcs();
+ QueryWrapper<ActivitySignReceiveRecord> queryWrapperActivitySignReceiveRecord = new QueryWrapper<>();
+ queryWrapperActivitySignReceiveRecord.eq("company_id", companyId);
+ queryWrapperActivitySignReceiveRecord.eq("activity_id", actId);
+ queryWrapperActivitySignReceiveRecord.eq("user_id", userId);
+ queryWrapperActivitySignReceiveRecord.ne("award_id", activitySignAwardSetNormal.getId());
+ List<ActivitySignReceiveRecord> activitySignReceiveRecordDone = activitySignReceiveRecordDao.selectList(queryWrapperActivitySignReceiveRecord);
+ if(CollUtil.isNotEmpty(activitySignReceiveRecordDone)){
+ if(activitySignReceiveRecordDone.size() >= zzjcs){
+ //生成领取记录
+ ActivitySignReceiveRecord activitySignReceiveRecord = new ActivitySignReceiveRecord();
+ activitySignReceiveRecord.setUserId(userId);
+ activitySignReceiveRecord.setReceiveTime(DateUtil.date());
+ activitySignReceiveRecord.setAwardId(activitySignAwardSetNormal.getId());
+ activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE);
+ activitySignReceiveRecord.setActivityId(actId);
+ activitySignReceiveRecord.setCompanyId(companyId);
+ activitySignReceiveRecord.setCreateBy(user.getVipName());
+ activitySignReceiveRecord.setCreateTime(new Date());
+ activitySignReceiveRecord.setUpdateBy(user.getVipName());
+ activitySignReceiveRecord.setUpdateTime(new Date());
+ activitySignReceiveRecordDao.insert(activitySignReceiveRecord);
+
+ LuckyDrawSuccessVo luckyDrawSuccessVo = new LuckyDrawSuccessVo();
+ luckyDrawSuccessVo.setType(1);
+ luckyDrawSuccessVo.setAwardName(activitySignAwardSetNormal.getAwardName());
+ luckyDrawSuccessVo.setAwardImg(activitySignAwardSetNormal.getIntroduceImg());
+ luckyDrawSuccessVos.add(luckyDrawSuccessVo);
+
+ AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+ ajaxResult.setData(luckyDrawSuccessVos);
+ return ajaxResult;
+ }
+ }
+ //总中奖率
+ int zzjl = luckyDrawBasicInfoJsonVo.getZzjl();
+ int randomInt = RandomUtil.randomInt(1, 100);
+ //不中奖的分界线
+ int failureScope = 100 - zzjl;
+ if(failureScope >= randomInt){
+ //生成领取记录
+ ActivitySignReceiveRecord activitySignReceiveRecord = new ActivitySignReceiveRecord();
+ activitySignReceiveRecord.setUserId(userId);
+ activitySignReceiveRecord.setReceiveTime(DateUtil.date());
+ activitySignReceiveRecord.setAwardId(activitySignAwardSetNormal.getId());
+ activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE);
+ activitySignReceiveRecord.setActivityId(actId);
+ activitySignReceiveRecord.setCompanyId(companyId);
+ activitySignReceiveRecord.setCreateBy(user.getVipName());
+ activitySignReceiveRecord.setCreateTime(new Date());
+ activitySignReceiveRecord.setUpdateBy(user.getVipName());
+ activitySignReceiveRecord.setUpdateTime(new Date());
+ activitySignReceiveRecordDao.insert(activitySignReceiveRecord);
+
+ LuckyDrawSuccessVo luckyDrawSuccessVo = new LuckyDrawSuccessVo();
+ luckyDrawSuccessVo.setType(1);
+ luckyDrawSuccessVo.setAwardName(activitySignAwardSetNormal.getAwardName());
+ luckyDrawSuccessVo.setAwardImg(activitySignAwardSetNormal.getIntroduceImg());
+ luckyDrawSuccessVos.add(luckyDrawSuccessVo);
+
+ AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+ ajaxResult.setData(luckyDrawSuccessVos);
+ return ajaxResult;
+ }
+ //中奖
+ if(failureScope < randomInt){
+ //获取奖品
+ ActivitySignAwardSet activitySignAwardSetCumulativeDay = updateShopActivityAndAwardSet(actId);
+
+ if(ObjectUtil.isNotEmpty(activitySignAwardSetCumulativeDay)){
+ LuckyDrawSuccessVo luckyDrawSuccessVo = new LuckyDrawSuccessVo();
+ luckyDrawSuccessVo.setType(2);
+ luckyDrawSuccessVo.setAwardType(activitySignAwardSetCumulativeDay.getAwardType());
+ luckyDrawSuccessVo.setAwardName(activitySignAwardSetCumulativeDay.getAwardName());
+ luckyDrawSuccessVo.setAwardImg(activitySignAwardSetCumulativeDay.getIntroduceImg());
+ luckyDrawSuccessVo.setAwardState(activitySignAwardSetCumulativeDay.getAwardState());
+ //新增奖品领取记录
+ ActivitySignReceiveRecord activitySignReceiveRecord = new ActivitySignReceiveRecord();
+ activitySignReceiveRecord.setUserId(userId);
+ activitySignReceiveRecord.setReceiveTime(DateUtil.date());
+ activitySignReceiveRecord.setAwardId(activitySignAwardSetCumulativeDay.getId());
+ activitySignReceiveRecord.setActivityId(actId);
+ activitySignReceiveRecord.setCompanyId(companyId);
+ activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE);
+ activitySignReceiveRecord.setCreateBy(user.getVipName());
+ activitySignReceiveRecord.setCreateTime(new Date());
+ activitySignReceiveRecord.setUpdateBy(user.getVipName());
+ activitySignReceiveRecord.setUpdateTime(new Date());
+ /**
+ * 奖项类型(1:自定义产品2:积分3:优惠券4:店铺商品)
+ *
+ * todo:4:店铺商品
+ */
+ //1:自定义产品
+ if(ActivitySignAwardSet.AWARDTYPE_CUSTOMIZE == activitySignAwardSetCumulativeDay.getAwardType()) {
+ activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_ING);
+ String randomString = StringUtils.getRandomString(8);
+ activitySignReceiveRecord.setWriteOffCode(randomString);
+
+ /**
+ * 获取对应奖品的领取方式(兑奖方式(1:线下兑换2:物流配送3:客服兑换)
+ */
+ luckyDrawSuccessVo.setWriteOffCode(randomString);
+ luckyDrawSuccessVo.setAwardWay(activitySignAwardSetCumulativeDay.getAwardWay());
+ //2:物流配送
+ luckyDrawSuccessVo.setOperationTip(activitySignAwardSetCumulativeDay.getOperationTip());
+ //1:线下兑换
+ if(ActivitySignAwardSet.AWARDWAY_ONE == activitySignAwardSetCumulativeDay.getAwardWay()) {
+ luckyDrawSuccessVo.setIntroduceTip(activitySignAwardSetCumulativeDay.getIntroduceTip());
+ luckyDrawSuccessVo.setPrizeAddress(activitySignAwardSetCumulativeDay.getPrizeAddress());
+ luckyDrawSuccessVo.setPrizeStartTime(activitySignAwardSetCumulativeDay.getPrizeStartTime());
+ luckyDrawSuccessVo.setPrizeEndTime(activitySignAwardSetCumulativeDay.getPrizeEndTime());
+ }
+ //3:客服兑换
+ if(ActivitySignAwardSet.AWARDWAY_THREE == activitySignAwardSetCumulativeDay.getAwardWay()) {
+ luckyDrawSuccessVo.setWechatImg(activitySignAwardSetCumulativeDay.getWechatImg());
+ luckyDrawSuccessVo.setPrizeStartTime(activitySignAwardSetCumulativeDay.getPrizeStartTime());
+ luckyDrawSuccessVo.setPrizeEndTime(activitySignAwardSetCumulativeDay.getPrizeEndTime());
+ }
+ }
+ //2:积分
+ if(ActivitySignAwardSet.AWARDTYPE_SCORE == activitySignAwardSetCumulativeDay.getAwardType()) {
+ luckyDrawSuccessVo.setScoreCnt(activitySignAwardSetCumulativeDay.getScoreCnt());
+ }
+ //3:优惠券
+ if(ActivitySignAwardSet.AWARDTYPE_COUPON == activitySignAwardSetCumulativeDay.getAwardType()) {
+ luckyDrawSuccessVo.setCouponName(activitySignAwardSetCumulativeDay.getCouponName());
+ //获取优惠券
+ int couponId = Integer.parseInt(activitySignAwardSetCumulativeDay.getCouponId());
+ ShopCoupon shopCoupon = shopCouponDao.selectById(couponId);
+ // 如果没有找到该优惠券
+ if (shopCoupon == null) {
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "没有找到该优惠券!");
+ }
+ // 如果优惠券有数量限制并且已经领完
+ if (shopCoupon.getMaxQuantity() >= 0 && (shopCoupon.getMaxQuantity() <= shopCoupon.getQuantityReceive())) {
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "优惠券已领完!");
+ }
+ boolean newPeople = wxShopCouponUtil.verifyIsNewPeople(userId);
+ // 如果改券是新人专属且当前用户不是新人
+ if (AppConstance.COUPON_GET_LIMT_NEW.equals(shopCoupon.getGetLimit()) && !newPeople) {
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "该优惠券为新人专享优惠券!");
+ }
+ ShopCouponRecord insertRecord = new ShopCouponRecord();
+ insertRecord.setCreateBy(AppConstance.SYSTEM_USER);
+ insertRecord.setUpdateBy(AppConstance.SYSTEM_USER);
+ insertRecord.setCId(couponId);
+ insertRecord.setUserId(userId);
+ insertRecord.setIsUsing(2);
+ int i = shopCouponRecordDao.insert(insertRecord);
+ // 如果插入领取记录表失败
+ if (i < 0) {
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "优惠券领取失败!");
+ }
+ shopCoupon.setQuantityReceive(shopCoupon.getQuantityReceive() + 1);
+ shopCouponDao.updateByModel(shopCoupon);
+ }
+ activitySignReceiveRecordDao.insert(activitySignReceiveRecord);
+ //累计奖励积分,对应用户积分加减
+ if(ActivitySignAwardSet.AWARDTYPE_SCORE == activitySignAwardSetCumulativeDay.getAwardType()) {
+ int awardType = activitySignAwardSetCumulativeDay.getAwardType();
+ if(ActivitySignAwardSet.AWARDTYPE_SCORE == awardType){
+ int scoreCnt = activitySignAwardSetCumulativeDay.getScoreCnt();
+ if(scoreCnt > 0){
+ scoreVipDetailService.addScore(userId,null,null,scoreCnt,
+ activitySignReceiveRecord.getId(), ScoreVipDetail.SCORE_VIP_TYPE_JOIN_ACTIVE,"积分");
+ }
+ }
+ }
+ //生成核销记录
+ if(ActivitySignAwardSet.AWARDTYPE_CUSTOMIZE == activitySignAwardSetCumulativeDay.getAwardType()) {
+ ActivitySignWriteoff activitySignWriteoff = new ActivitySignWriteoff();
+ //线下兑换和客服兑换
+ if(ActivitySignAwardSet.AWARDWAY_ONE == activitySignAwardSetCumulativeDay.getAwardWay()
+ || ActivitySignAwardSet.AWARDWAY_THREE == activitySignAwardSetCumulativeDay.getAwardWay()) {
+ activitySignWriteoff.setWriteoffCode(activitySignReceiveRecord.getWriteOffCode());
+ }
+ activitySignWriteoff.setActId(actId);
+ activitySignWriteoff.setAwardId(activitySignAwardSetCumulativeDay.getId());
+ activitySignWriteoff.setWinTime(DateUtil.date());
+ if(ActivitySignAwardSet.AWARDWAY_TWO == activitySignAwardSetCumulativeDay.getAwardWay()) {
+ activitySignWriteoff.setState(ActivitySignWriteoff.STATE_TWO);
+ }else {
+ activitySignWriteoff.setState(ActivitySignWriteoff.STATE_ONE);
+ }
+ activitySignWriteoff.setUserId(userId);
+ activitySignWriteoff.setCompanyId(companyId);
+ activitySignWriteoff.setReceiveId(activitySignReceiveRecord.getId());
+ activitySignWriteoff.setCreateBy(user.getVipName());
+ activitySignWriteoff.setCreateTime(new Date());
+ activitySignWriteoff.setUpdateBy(user.getVipName());
+ activitySignWriteoff.setUpdateTime(new Date());
+ activitySignWriteoffDao.insert(activitySignWriteoff);
+ }
+ luckyDrawSuccessVos.add(luckyDrawSuccessVo);
+ }else{
+ //生成领取记录
+ ActivitySignReceiveRecord activitySignReceiveRecord = new ActivitySignReceiveRecord();
+ activitySignReceiveRecord.setUserId(userId);
+ activitySignReceiveRecord.setReceiveTime(DateUtil.date());
+ activitySignReceiveRecord.setAwardId(activitySignAwardSetNormal.getId());
+ activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE);
+ activitySignReceiveRecord.setActivityId(actId);
+ activitySignReceiveRecord.setCompanyId(companyId);
+ activitySignReceiveRecord.setCreateBy(user.getVipName());
+ activitySignReceiveRecord.setCreateTime(new Date());
+ activitySignReceiveRecord.setUpdateBy(user.getVipName());
+ activitySignReceiveRecord.setUpdateTime(new Date());
+ activitySignReceiveRecordDao.insert(activitySignReceiveRecord);
+
+ LuckyDrawSuccessVo luckyDrawSuccessVo = new LuckyDrawSuccessVo();
+ luckyDrawSuccessVo.setType(1);
+ luckyDrawSuccessVo.setAwardName(activitySignAwardSetNormal.getAwardName());
+ luckyDrawSuccessVo.setAwardImg(activitySignAwardSetNormal.getIntroduceImg());
+ luckyDrawSuccessVos.add(luckyDrawSuccessVo);
+
+ AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+ ajaxResult.setData(luckyDrawSuccessVos);
+ return ajaxResult;
+ }
+ }
+ AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+ ajaxResult.setData(luckyDrawSuccessVos);
+ return ajaxResult;
+ }
+
+ //获取奖品并索引+1 已领取+1
+ public synchronized ActivitySignAwardSet updateShopActivityAndAwardSet(Long actId){
+ //通过活动ID获取对应的活动
+ ShopActivities shopActivities = shopActivitiesDao.selectById(actId);
+ String actContent = shopActivities.getActContent();
+ LuckyDrawBasicInfoJsonVo luckyDrawBasicInfoJsonVo = JSON.parseObject(actContent, LuckyDrawBasicInfoJsonVo.class);
+
+ //中奖索引
+ Integer awrdLineIndex = luckyDrawBasicInfoJsonVo.getAwrdLineIndex();
+ //中奖序列
+ String awardLine = luckyDrawBasicInfoJsonVo.getAwardLine();
+ ActivitySignAwardSet activitySignAwardSet = null;
+ if(awardLine.length() > 0) {
+ String substring = awardLine.substring(1, awardLine.length() - 1);
+ List<String> awardList = StrUtil.splitTrim(substring, ",");
+ if(awrdLineIndex < awardList.size()){
+ //中奖
+ Long awardId = Long.parseLong(awardList.get(awrdLineIndex + 1));
+ ActivitySignAwardSet activitySignAwardSetGet = activitySignAwardSetDao.selectById(awardId);
+ //奖项库存数量
+ int awardInventoryCnt = activitySignAwardSetGet.getAwardInventoryCnt();
+ //已派发数量
+ int awardDistributeCnt = activitySignAwardSetGet.getAwardDistributeCnt();
+ if(awardDistributeCnt < awardInventoryCnt){
+ activitySignAwardSet = activitySignAwardSetGet;
+ activitySignAwardSetGet.setAwardDistributeCnt(awardDistributeCnt +1);
+ activitySignAwardSetDao.updateById(activitySignAwardSetGet);
+
+ //将基本信息转换成JSON字符串存储到活动主表的act_content字段
+ luckyDrawBasicInfoJsonVo.setAwrdLineIndex(awrdLineIndex + 1);
+ String json= JSON.toJSONString(luckyDrawBasicInfoJsonVo);
+ shopActivities.setActContent(json);
+ shopActivitiesDao.updateByModel(shopActivities);
+ }
+ }
+ }
+ return activitySignAwardSet;
+ }
+
+ /**
+ * 是否可以积分兑换
+ *
+ * @param
+ * @return
+ */
+ @ApiOperation(value = "是否可以积分兑换", notes = "")
+ @GetMapping(value = "scoreLuckyDraw/{actId}")
+ @ResponseBody
+ public AjaxResult logisticsInsureById(@PathVariable("actId") Long actId) {
+ SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class);
+ Long userId = loginUser.getId();
+ Long companyId = loginUser.getCompanyId();
+ //获取用户总积分
+ int scoreAll = scoreVipDetailDao.selectUserTotalScore(userId);
+ //获取活动的积分换取
+ ShopActivities shopActivities = shopActivitiesDao.selectById(actId);
+ String actContent = shopActivities.getActContent();
+ LuckyDrawBasicInfoJsonVo luckyDrawBasicInfoJsonVo = JSON.parseObject(actContent, LuckyDrawBasicInfoJsonVo.class);
+ Integer dhycjfs = luckyDrawBasicInfoJsonVo.getDhycjfs();
+ if(dhycjfs == 0){
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "积分兑换不能兑换抽奖次数");
+ }
+ if(scoreAll < dhycjfs){
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "积分不足");
+ }
+ //获取今日抽奖总次数
+ List<ActivitySignRecord> activityRecords = activitySignRecordDao.selectListByActIdAndUserIdLikesignTime(actId,userId, DateUtil.date());
+ if(CollUtil.isNotEmpty(activityRecords)){
+ Integer wmkcjjh = luckyDrawBasicInfoJsonVo.getWmkcjjh();
+ Integer jfdhcs = luckyDrawBasicInfoJsonVo.getJfdhcs();
+ if(activityRecords.size() >= (wmkcjjh+jfdhcs)){
+ return AjaxResult.buildFailInstance("明天再来抽奖吧");
+ }
+ }
+ //换取次数,减去积分
+ scoreVipDetailService.deductionScore(userId,null,null,dhycjfs,
+ null, ScoreVipDetail.SCORE_VIP_TYPE_JOIN_ACTIVE,"兑换抽奖机会");
+ return new AjaxResult(AjaxResult.STATUS_SUCCESS, "兑换成功!");
+ }
+
+
+
+
+
+}
+
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java
index 977b543..5eb9595 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java
@@ -107,7 +107,7 @@
shopSku.setSealesPrice(shopSku.getPrice().multiply(BigDecimal.valueOf(shopSalesmanGrade.getSealesCommission())).divide(BigDecimal.valueOf(100)));
}
if(Objects.isNull(shopSku.getSelfPrice())){
- shopSku.setSealesPrice(shopSku.getPrice().multiply(BigDecimal.valueOf(shopSalesmanGrade.getSelfCommission())).divide(BigDecimal.valueOf(100)));
+ shopSku.setSelfPrice(shopSku.getPrice().multiply(BigDecimal.valueOf(shopSalesmanGrade.getSelfCommission())).divide(BigDecimal.valueOf(100)));
}
});
}
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 6466163..97af9ae 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
@@ -15,7 +15,9 @@
import com.matrix.system.constance.Dictionary;
import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant;
import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao;
+import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao;
import com.matrix.system.fenxiao.entity.ShopSalesmanApply;
+import com.matrix.system.fenxiao.entity.ShopSalesmanGrade;
import com.matrix.system.fenxiao.service.ShopSalesmanApplyService;
import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.hive.dao.MoneyCardUseDao;
@@ -145,6 +147,8 @@
}
+ @Autowired
+ ShopSalesmanGradeDao shopSalesmanGradeDao;
/**
* 查询用户信息
@@ -160,6 +164,15 @@
res.putInMap("couponCount", shopCouponRecordDao.countUnuseCouponRecord(loginUser.getId()));
res.putInMap("prizeCount",activitySignReceiveRecordDao.getSignAwardReceiveCount(loginUser.getId(),loginUser.getCompanyId()));
res.putInMap("userInfo", sysVipInfo);
+ //查询会员等级
+ if(sysVipInfo.getSalesmanGrade()!=null){
+ ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectById(sysVipInfo.getSalesmanGrade());
+ res.putInMap("vipLevel", shopSalesmanGrade.getName());
+ }else if(sysVipInfo.getVipLevel()!=null){
+ res.putInMap("vipLevel", sysVipInfo.getVipLevel().getLevelName());
+ }else{
+ res.putInMap("vipLevel", "初级会员");
+ }
res.setStatus(AjaxResult.STATUS_SUCCESS);
return res;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
index 9a44280..38a88a4 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
@@ -16,6 +16,7 @@
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.dao.CustomerDataDictionaryDao;
import com.matrix.system.common.interceptor.HostInterceptor;
+import com.matrix.system.constance.Dictionary;
import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.hive.dao.ShoppingGoodsDao;
import com.matrix.system.hive.dao.SysVipInfoDao;
@@ -346,9 +347,11 @@
//计算运费
- discountExplain.setPostage(calculationPostage(discountExplain.getPayPrice(), HostInterceptor.getCompanyId()));
-
-
+ if(ShopOrder.SHIPPING_METHOD_WL==shopOrderDto.getDeliverySelect()){
+ discountExplain.setPostage(calculationPostage(billPrice, HostInterceptor.getCompanyId()));
+ }else{
+ discountExplain.setPostage(BigDecimal.ZERO);
+ }
//账单总金额
discountExplain.setBillPrice(billPrice.add(discountExplain.getPostage()));
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
index 28e33f6..0b3bfc7 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
@@ -1,12 +1,14 @@
package com.matrix.system.shopXcx.api.service.impl;
import com.matrix.component.rabbitmq.RabiitMqTemplate;
-import com.matrix.component.tools.WxTempLateMsgUtil;
import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil;
import com.matrix.core.exception.GlobleException;
-import com.matrix.core.tools.DateUtil;
+import com.matrix.core.tools.DingDingRobotUtil;
import com.matrix.core.tools.LogUtil;
+import com.matrix.core.tools.StringUtils;
+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.shopXcx.api.service.WXShopOrderService;
import com.matrix.system.shopXcx.api.service.WxShopRefundRecordService;
import com.matrix.system.shopXcx.bean.*;
@@ -16,10 +18,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -48,6 +48,10 @@
@Autowired
private ShopActivitiesGroupJoinDao shopActivitiesGroupJoinDao;
+
+ @Autowired
+ private BusParameterSettingsDao busParameterSettingsDao;
+
@Value("${wx_pay_debug_onoff}")
private boolean isDebug;
@@ -146,6 +150,16 @@
rabiitMqTemplate.sendMsg(MQTaskRouting.SHOP_ORDER_REFUND+evn,shopRefundRecord.getOrderId()+"");
+ //发送退款通知
+ BusParameterSettings wxOrderNoticeDingdingToken = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WX_ORDER_NOTICE_DINGDING_TOKEN, shopOrder.getCompanyId());
+ if (wxOrderNoticeDingdingToken != null && StringUtils.isNotBlank(wxOrderNoticeDingdingToken.getParamValue())) {
+ DingDingRobotUtil.sendText(wxOrderNoticeDingdingToken.getParamValue(),
+ "订单退款,微商城订单编号 "+shopOrder.getOrderNo()
+ +"; 订单金额:¥"+shopOrder.getOrderMoney()
+ +";收货电话:"+ shopOrder.getUserTel()+",收货人:"+ shopOrder.getUserName()
+ ,"");
+ }
+
}catch (Exception e){
LogUtil.debug("退款成功,修改退款表和订单表状态出错。。。", id);
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawBasicInfoJsonVo.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawBasicInfoJsonVo.java
new file mode 100644
index 0000000..2501f29
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawBasicInfoJsonVo.java
@@ -0,0 +1,60 @@
+package com.matrix.system.shopXcx.api.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "LuckyDrawBasicInfoJsonVo", description = "活动")
+public class LuckyDrawBasicInfoJsonVo {
+
+ @ApiModelProperty(value ="头部图片")
+ private String imageUrlHead;
+ @ApiModelProperty(value ="开始按钮")
+ private String imageUrlTitle;
+ @ApiModelProperty(value ="转盘背景")
+ private String imageUrlButton;
+ @ApiModelProperty(value ="状态图片")
+ private String imageUrlState;
+ @ApiModelProperty(value ="奖品划分线")
+ private String imageLine;
+
+ @ApiModelProperty(value ="规则内容")
+ private String ruleExplain;
+ @ApiModelProperty(value ="字体颜色")
+ private String typographyColor;
+ @ApiModelProperty(value ="背景颜色")
+ private String backgroundColor;
+ @ApiModelProperty(value ="字体大小")
+ private Integer typographyNum;
+ @ApiModelProperty(value ="字体透明度")
+ private Integer typographyLight;
+
+
+ //@ApiModelProperty(value ="中奖顺序")
+ private String awardLine;
+ //@ApiModelProperty(value ="中奖顺序索引")
+ private Integer awrdLineIndex;
+
+ /**
+ * 抽奖规则
+ */
+ //每人每日有10次无门槛抽奖机会
+ private Integer wmkcjjh;
+ //可用积分兑换1次抽奖机会,
+ private Integer dhycjfs;
+ // 每日最多兑换
+ //10
+ //次抽奖机会
+ private Integer jfdhcs;
+ // 每人最多可中奖
+ //10
+ //次
+ private Integer zzjcs;
+ // 总中奖率
+ //10
+ //%
+ private Integer zzjl;
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawInfoVo.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawInfoVo.java
new file mode 100644
index 0000000..31f40da
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawInfoVo.java
@@ -0,0 +1,44 @@
+package com.matrix.system.shopXcx.api.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+
+@ApiModel(value = "LuckyDrawInfoVo", description = "抽奖活动")
+public class LuckyDrawInfoVo {
+ /**
+ * 主键
+ */
+ private Long id;
+ @ApiModelProperty(value ="活动今日是否可参与 1:是 2:否")
+ private int joinState;
+ @ApiModelProperty(value ="用户总积分")
+ private int totalScore;
+
+ @ApiModelProperty(value ="用户今日剩余抽奖次数")
+ private int luckyDrawTime;
+
+ public static final int JOINSTATE_YES = 1;
+ public static final int JOINSTATE_NOT = 2;
+
+ @ApiModelProperty(value ="活动名称")
+ private String actName;
+ @ApiModelProperty(value ="活动编码")
+ private String actCode;
+ @ApiModelProperty(value ="活动开始时间")
+ @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8")
+ private Date beginTime;
+ @ApiModelProperty(value ="活动结束时间")
+ @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8")
+ private Date endTime;
+ @ApiModelProperty(value ="活动基本参数")
+ private LuckyDrawBasicInfoJsonVo luckyDrawBasicInfoJsonVo;
+ @ApiModelProperty(value ="奖品信息")
+ private List<ActivitySignAwardSetVo> activitySignAwardSetVos;
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawSuccessVo.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawSuccessVo.java
new file mode 100644
index 0000000..3e2573e
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/LuckyDrawSuccessVo.java
@@ -0,0 +1,150 @@
+package com.matrix.system.shopXcx.api.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+@Data
+
+@ApiModel(value = "LuckyDrawSuccessVo", description = "抽奖活动")
+public class LuckyDrawSuccessVo {
+
+ @ApiModelProperty(value ="奖励类型 1:日常奖励 2:累计奖励")
+ private int type;
+
+ @ApiModelProperty(value ="累计奖励名称")
+ private String awardName;
+ @ApiModelProperty(value ="累计奖励图片")
+ private String awardImg;
+ @ApiModelProperty(value ="累计奖励核销码")
+ private String writeOffCode;
+
+ @ApiModelProperty(value ="奖项类型(1:自定义产品2:积分3:优惠券4:店铺商品)")
+ private int awardType;
+
+
+ public static final int AWARDTYPE_CUSTOMIZE = 1;
+ public static final int AWARDTYPE_SCORE = 2;
+ public static final int AWARDTYPE_COUPON = 3;
+ public static final int AWARDTYPE_GOODS = 4;
+
+ @ApiModelProperty(value ="文字介绍")
+ private String introduceTip;
+
+ /**
+ * 奖项库存数量
+ */
+
+
+ @ApiModelProperty(value ="奖项库存数量")
+ private int awardInventoryCnt;
+
+ /**
+ * 已派发数量
+ */
+
+
+ @ApiModelProperty(value ="已派发数量")
+ private int awardDistributeCnt;
+
+ /**
+ * 兑奖方式(1:线下兑换2:物流配送3:客服兑换)
+ */
+
+
+ @ApiModelProperty(value ="兑奖方式(1:线下兑换2:物流配送3:客服兑换)")
+ private int awardWay;
+
+ /**
+ * 奖品是否有效(1:有效 2:无效)
+ */
+ @ApiModelProperty(value ="奖品是否有效(1:有效 2:无效)")
+ private int awardState;
+ public static final int AWARDSTATE_WORK = 1;
+ public static final int AWARDSTATE_UNWORK = 2;
+
+ /**
+ * 操作提示
+ */
+
+ @ApiModelProperty(value ="操作提示")
+ private String operationTip;
+
+ /**
+ * 兑奖地址
+ */
+
+ @ApiModelProperty(value ="兑奖地址")
+ private String prizeAddress;
+
+ /**
+ * 兑奖期限开始日期
+ */
+
+
+ @ApiModelProperty(value ="兑奖期限开始日期")
+ @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8")
+ private Date prizeStartTime;
+
+ /**
+ * 兑奖期限结束日期
+ */
+
+ @ApiModelProperty(value ="兑奖期限结束日期")
+ @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8")
+ private Date prizeEndTime;
+
+ /**
+ * 客服微信
+ */
+
+ @ApiModelProperty(value ="客服微信")
+ private String wechatImg;
+
+ /**
+ * 积分数量
+ */
+
+
+ @ApiModelProperty(value ="积分数量")
+ private int scoreCnt;
+
+ /**
+ * 优惠券ID
+ */
+
+ @ApiModelProperty(value ="优惠券")
+ private String couponName;
+
+ @ApiModelProperty(value ="优惠券ID")
+ private String couponId;
+
+ /**
+ * 商品ID
+ */
+
+ @ApiModelProperty(value ="商品")
+ private String goodsName;
+
+ @ApiModelProperty(value ="商品ID")
+ private String goodsId;
+
+ /**
+ * 活动主表ID
+ */
+
+
+ @ApiModelProperty(value ="活动主表ID")
+ private Long activityId;
+
+ /**
+ * 公司ID
+ */
+
+
+ @ApiModelProperty(value ="公司ID")
+ private Long companyId;
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopActivities.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopActivities.java
index 5cbb9a8..84d0d00 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopActivities.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopActivities.java
@@ -34,6 +34,10 @@
* 活动类型 签到
*/
public static final int ACTIVITIES_TYPE_SIGN = 4;
+ /**
+ * 活动类型转盘抽奖
+ */
+ public static final int ACTIVITIES_TYPE_LUCKYDRAW = 5;
/**
* 活动状态 开启
@@ -86,7 +90,7 @@
private Integer actStatus;
//未发布
- public static final int ACTSTATUS_STATUS_RELEASE = 2;
+ public static final int ACTSTATUS_STATUS_RELEASE = 1;
//未开始
public static final int ACTSTATUS_STATUS_READY = 2;
//进行中
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderDingDingNoticeTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderDingDingNoticeTask.java
index 41bc09c..2ea6cb0 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderDingDingNoticeTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderDingDingNoticeTask.java
@@ -7,10 +7,11 @@
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.hive.dao.SysVipInfoDao;
+import com.matrix.system.shopXcx.bean.ShopDeliveryInfo;
import com.matrix.system.shopXcx.bean.ShopOrder;
import com.matrix.system.shopXcx.bean.ShopOrderDetails;
+import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao;
import com.matrix.system.shopXcx.dao.ShopOrderDao;
import com.matrix.system.shopXcx.dao.ShopOrderDetailsDao;
import com.rabbitmq.client.DeliverCallback;
@@ -41,11 +42,15 @@
@Autowired
SysVipInfoDao sysVipInfoDao;
+ @Autowired
+ ShopDeliveryInfoDao shopDeliveryInfoDao;
+
@Override
public void handle(String consumerTag, Delivery message) throws IOException {
- String orderId = new String(message.getBody(), "UTF-8");
+ String orderIdStr = new String(message.getBody(), "UTF-8");
+ Integer orderId=Integer.valueOf(orderIdStr);
//获取订单信息
- ShopOrder order = shopOrderDao.selectById(Integer.valueOf(orderId));
+ ShopOrder order = shopOrderDao.selectById(orderId);
LogUtil.debug("收到创建订单通知任务orderId={}", orderId);
BusParameterSettings wxOrderNoticeDingdingToken = parameterSettingsDao.selectCompanyParamByCode(AppConstance.WX_ORDER_NOTICE_DINGDING_TOKEN, order.getCompanyId());
if (wxOrderNoticeDingdingToken != null && StringUtils.isNotBlank(wxOrderNoticeDingdingToken.getParamValue())) {
@@ -54,8 +59,19 @@
StringBuilder content = new StringBuilder();
orderDetails.stream().forEach(i -> content.append(i.getsTitle()).append("*").append(
i.getCount()).append(";"));
+ ShopDeliveryInfo addInfo = shopDeliveryInfoDao.selectByOrderId(orderId);
- DingDingRobotUtil.sendText(wxOrderNoticeDingdingToken.getParamValue(),"微商城订单 ("+order.getUserName()+") | 订单金额:¥"+order.getOrderMoney()+",订单内容:"+ content.toString(),"");
+ String shippingMethod="物流配送";
+ if(AppConstance.SHIPPING_METHOD_SELF .equals(order.getShippingMethod())){
+ shippingMethod="门店自提";
+ }
+ DingDingRobotUtil.sendText(wxOrderNoticeDingdingToken.getParamValue(),
+ "新订单,微商城订单编号 "+order.getOrderNo()
+ +"; 订单金额:¥"+order.getOrderMoney()
+ +";订单内容:"+ content.toString()
+ +";收货电话:"+ order.getUserTel()+",收货人:"+ order.getUserName()+",收货地址:"+ addInfo.getReceiveAddress()
+ +"配送方式:"+shippingMethod
+ ,"");
}else{
LogUtil.debug("未配置订单钉钉提醒");
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
index d7eab53..8b52165 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
@@ -16,6 +16,7 @@
import org.springframework.stereotype.Component;
import java.io.IOException;
+import java.util.List;
/**
* 分销订单退款
@@ -44,13 +45,19 @@
LogUtil.debug("收到分销订单退款任务orderId={}", orderId);
QueryWrapper queryWrapper=new QueryWrapper();
queryWrapper.eq("order_id",orderId);
- ShopSalesmanOrder shopSalesmanOrder = shopSalesmanOrderDao.selectOne(queryWrapper);
- if(shopSalesmanOrder!=null){
- shopSalesmanOrder.setOrderStatus(ShopSalesmanOrder.STATUS_YTK);
- shopSalesmanOrderDao.updateById(shopSalesmanOrder);
- }else{
- LogUtil.debug("改订单为生成分销订单={}", orderId);
- }
+ List<ShopSalesmanOrder> list = shopSalesmanOrderDao.selectList(queryWrapper);
+
+ list.forEach(shopSalesmanOrder->{
+
+ if(shopSalesmanOrder!=null){
+ shopSalesmanOrder.setOrderStatus(ShopSalesmanOrder.STATUS_YTK);
+ shopSalesmanOrderDao.updateById(shopSalesmanOrder);
+ }else{
+ LogUtil.debug("改订单为生成分销订单={}", orderId);
+ }
+
+
+ });
ShopOrder order=shopOrderDao.selectById(Integer.parseInt(orderId));
//如果是积分支付则需要返还积分
diff --git a/zq-erp/src/main/java/filecopy.java b/zq-erp/src/main/java/filecopy.java
new file mode 100644
index 0000000..544d6cb
--- /dev/null
+++ b/zq-erp/src/main/java/filecopy.java
@@ -0,0 +1,80 @@
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * 文件对比复制
+ * @author JIANGYOUYAO
+ * @date 2021/6/7 0007
+ */
+public class filecopy {
+
+
+ static String targetFilePath="/mnt/sdc/webresource";
+
+ static String sourceFilePaht="/mnt/sdc/webresourceback";
+
+ public static void main(String[] args) throws IOException {
+
+
+ File sourceFile=new File(sourceFilePaht);
+ traverseFolder(sourceFile);
+
+
+ }
+
+
+ public static void traverseFolder(File file) throws IOException {
+
+ if (file.exists()) {
+ File[] files = file.listFiles();
+ if (null == files || files.length == 0) {
+ System.out.println("文件夹是空的!");
+ return;
+ } else {
+ for (File file2 : files) {
+ if (file2.isDirectory()) {
+ //对比target是否存在
+ final String s = file2.getCanonicalPath().replaceAll("webresourceback", "webresource");
+ File f=new File(s);
+ if(!f.exists()){
+ System.out.println("复制文件:" + file2.getAbsolutePath());
+ f.mkdir();
+ }else{
+ System.out.println("文件:" + file2.getAbsolutePath()+"存在");
+ }
+ traverseFolder(file2);
+ } else {
+
+ //对比target是否存在,不存在则copy
+ final String s = file2.getCanonicalPath().replaceAll("webresourceback", "webresource");
+ File f=new File(s);
+ if(!f.exists()){
+ System.out.println("复制文件:" + file2.getAbsolutePath());
+ FileInputStream in=new FileInputStream(file2);
+ FileOutputStream out=new FileOutputStream(f);
+ byte[] buff=new byte[1024];
+ int length=in.read(buff);
+ while (length>0){
+ out.write(buff,0,length);
+ length=in.read(buff);
+ }
+ out.close();
+ in.close();
+
+ }else{
+ System.out.println("文件:" + file2.getAbsolutePath()+"存在");
+ }
+
+ }
+ }
+ }
+ } else {
+ System.out.println("文件不存在!");
+ }
+ }
+
+
+
+}
diff --git a/zq-erp/src/main/resources/config/application.properties b/zq-erp/src/main/resources/config/application.properties
index 14fb986..a8e3206 100644
--- a/zq-erp/src/main/resources/config/application.properties
+++ b/zq-erp/src/main/resources/config/application.properties
@@ -72,5 +72,6 @@
default.vip.photo.woman=https://filehive2.jyymatrix.cc/uploadeFile/20210125/db53552e688040afb286686f081e1e68f3fe946f75624598828f01898635152e.png
default.vip.photo.man=https://filehive2.jyymatrix.cc/uploadeFile/20210125/3642f1d827c44c76832fea106c85e0f89e089c16cbcc4dd0a82bb52b9ac700f4.png
+mybatis-plus.global-config.db-config.id-type=auto
mybatis-plus.config-location=classpath:mybatis/mybatis-config.xml
mybatis-plus.mapper-locations=classpath*:mybatis/mapper/**/*.xml
diff --git a/zq-erp/src/main/resources/config/test/application.properties b/zq-erp/src/main/resources/config/test/application.properties
index cd48b66..cc4b62c 100644
--- a/zq-erp/src/main/resources/config/test/application.properties
+++ b/zq-erp/src/main/resources/config/test/application.properties
@@ -6,7 +6,7 @@
spring.datasource.username=ct_test
spring.datasource.password=123456
-spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
+spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test_meidu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
#spring.datasource.username=chuhuan
#spring.datasource.password=chuhuan
diff --git a/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignAwardSetDao.xml b/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignAwardSetDao.xml
index 886a2fe..6d8b000 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignAwardSetDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignAwardSetDao.xml
@@ -15,4 +15,28 @@
and a.award_state = #{awardState}
</select>
+ <select id="selectListByActIDAndCompanyIdAndAwardType" resultType="com.matrix.system.shopXcx.api.vo.ActivitySignAwardSetVo">
+ SELECT
+ *
+ FROM
+ activity_sign_award_set a
+ where
+ a.activity_id = #{actId}
+ and a.company_id = #{companyId}
+ and a.award_state = #{awardState}
+ and a.award_rule = #{awardRule}
+ </select>
+
+ <select id="selectActivitySignAwardSetByActIDAndCompanyIdAndAwardType" resultType="com.matrix.system.activity.entity.ActivitySignAwardSet">
+ SELECT
+ *
+ FROM
+ activity_sign_award_set a
+ where
+ a.activity_id = #{actId}
+ and a.company_id = #{companyId}
+ and a.award_state = #{awardState}
+ and a.award_rule = #{awardRule}
+ </select>
+
</mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignReceiveRecordDao.xml b/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignReceiveRecordDao.xml
index 221ca35..d15125a 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignReceiveRecordDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignReceiveRecordDao.xml
@@ -16,11 +16,13 @@
c.award_name awardName,
c.coupon_name couponName,
c.score_cnt scoreCnt,
+ d.act_type actType,
c.award_rule awardRule
FROM
activity_sign_receive_record a
LEFT JOIN sys_vip_info b ON a.user_id = b.id
LEFT JOIN activity_sign_award_set c ON a.award_id = c.id
+ LEFT JOIN shop_activities d ON a.award_id = d.id
<where>
a.company_id = #{record.companyId}
and a.activity_id = #{record.actId}
diff --git a/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignRecordDao.xml b/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignRecordDao.xml
index f84a474..140d8ff 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignRecordDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignRecordDao.xml
@@ -24,4 +24,15 @@
and a.user_id = #{userId}
</select>
+ <select id="selectListByActIdAndUserIdLikesignTime" resultType="com.matrix.system.activity.entity.ActivitySignRecord">
+ SELECT
+ *
+ FROM
+ activity_sign_record a
+ where
+ a.activity_id = #{actId}
+ and a.user_id = #{userId}
+ and a.sign_time like concat('%',DATE(#{format}),'%')
+</select>
+
</mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/common/SysUsersDao.xml b/zq-erp/src/main/resources/mybatis/mapper/common/SysUsersDao.xml
index ee69a10..df93edb 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/common/SysUsersDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/common/SysUsersDao.xml
@@ -323,7 +323,7 @@
<set>
update_time=now(),
<if test="updateBy!=null">
- update_by = #{btnKey},
+ update_by = #{updateBy},
</if>
<if
test="(suName!=null and suName!='') or (suName!='' and suName==0)">
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 fb605a0..651ca07 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -95,6 +95,7 @@
left join sys_proj_services l on a.service_order_id=l.id
left join sys_order_item j on a.order_item_id=j.ID
<where>
+ and a.company_id = #{record.companyId}
<if test="record!=null">
<if
test="(record.shopId!=null and record.shopId!='') or (record.shopId!='' and record.shopId==0) ">
@@ -118,9 +119,7 @@
<if test="record.beaultId != null and record.beaultId !='' ">
and a.beault_id = #{record.beaultId}
</if>
- <if test="record.companyId != null and record.companyId !='' ">
- and a.company_id = #{record.companyId}
- </if>
+
<if test="record.beaultId != null and record.beaultId !='' ">
and a.beault_id = #{record.beaultId}
</if>
@@ -196,7 +195,41 @@
</where>
</select>
+<!--
+ 统计员工业绩
+
+select
+ u.name,
+ g.su_name guwen,
+ cast(SUM(b.ZK_TOTAL) AS decimal(15,2)) as zk_total,
+ cast(SUM(a.his_consume) AS decimal(15,2)),
+ cast(SUM(a.free_consume) AS decimal(15,2)),
+ cast(SUM(a.proj_percentage) AS decimal(15,2)),
+ cast(SUM(a.number_of_people) AS decimal(15,2)),
+ cast(SUM(a.proj_num) AS decimal(15,2)),
+ cast(SUM(a.proj_time) AS decimal(15,2)),
+ h.shop_short_name shop_name,
+ a.order_type,
+ a.achieveType
+ from
+ achieve_new a
+ left join sys_order b on a.order_id=b.id
+ left join sys_vip_info c on a.vip_id=c.id
+ left join sys_vip_level d on c.LEVEL_ID=d.id
+ left join shopping_goods e on a.shopping_goods_id=e.id
+ LEFT JOIN sys_users f on a.beault_id=f.su_id
+ LEFT JOIN sys_users g on a.sale_id = g.su_id
+ LEFT JOIN sys_shop_info h ON a.SHOP_ID = h.ID
+ LEFT JOIN shopping_goods_category i ON e.cate_id = i.id
+ left join sys_proj_services l on a.service_order_id=l.id
+ left join sys_order_item j on a.order_item_id=j.ID
+ left join achieve_rule u on u.id=e.achieve_rule_id
+ where h.shop_short_name='龙华店'
+ GROUP BY g.su_name , a.order_type, h.id,a.achieveType
+ ORDER BY g.su_name
+
+-->
<select id="findSumDailyInfoNew" resultMap="AchieveNewMap">
@@ -1090,6 +1123,68 @@
and date_format(datatime, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
</select>
+ <select id="achieveNewStatistics" resultType="com.matrix.system.hive.vo.AchieveNewStatisticsVo">
+
+ select
+ u.name ruleName,
+ f.su_name guwen,
+ f.su_id gwid,
+ g.su_name createBy,
+ g.su_id createId,
+ cast(SUM(b.ZK_TOTAL) AS decimal(15,2)) as zk_total,
+ cast(SUM(a.his_consume) AS decimal(15,2)) his_consume,
+ cast(SUM(a.free_consume) AS decimal(15,2)) free_consume,
+ cast(SUM(a.proj_percentage) AS decimal(15,2)) proj_percentage,
+ cast(SUM(a.number_of_people) AS decimal(15,2)) number_of_people,
+ cast(SUM(a.proj_num) AS decimal(15,2)) proj_num,
+ cast(SUM(case when a.pay_method = '划扣' then goods_cash end )AS decimal(15,2)) card_cash,
+ cast(SUM(a.proj_time) AS decimal(15,2)) proj_time,
+ cast(SUM(case when a.pay_method = '现金' then goods_cash end )AS decimal(15,2)) goods_cash,
+ h.shop_short_name shop_name,
+ a.order_type
+ from
+ achieve_new a
+ left join sys_order b on a.order_id=b.id
+ left join sys_vip_info c on a.vip_id=c.id
+ left join sys_vip_level d on c.LEVEL_ID=d.id
+ left join shopping_goods e on a.shopping_goods_id=e.id
+ LEFT JOIN sys_users f on a.beault_id=f.su_id
+ LEFT JOIN sys_users g on a.sale_id = g.su_id
+ LEFT JOIN sys_shop_info h ON a.SHOP_ID = h.ID
+ LEFT JOIN shopping_goods_category i ON e.cate_id = i.id
+ left join sys_proj_services l on a.service_order_id=l.id
+ left join sys_order_item j on a.order_item_id=j.ID
+ left join achieve_rule u on u.id=e.achieve_rule_id
+ <where>
+ and a.company_id = #{record.companyId}
+ <if test="record.shopId != null">
+ and a.shop_id = #{record.shopId}
+ </if>
+ <if test="record.achieveRuleId != null">
+ and u.id = #{record.achieveRuleId}
+ </if>
+
+ <if test="record.staffName != null and record.staffName!=''">
+ <!-- 创建人和归属人都有业绩 -->
+ and (f.su_name like concat('%',#{record.staffName},'%') or g.su_name like concat('%',#{record.staffName},'%') )
+ </if>
+
+ <if test="record.orderType != null and record.orderType != '' ">
+ and a.order_type= #{record.orderType}
+ </if>
+ <if test="record.beginTime != null ">
+ and a.datatime >= #{record.beginTime}
+ </if>
+ <if test="record.endTime != null ">
+ <![CDATA[and a.datatime <= #{record.endTime}]]>
+ </if>
+
+ </where>
+ GROUP BY g.su_id , f.su_id, a.order_type, h.id,a.achieveType,u.name
+ <if test="record.sort !=null and record.sort!=''"> order by ${record.sort} ${record.order}</if>
+
+ </select>
+
<update id="updateAchieveNumOfPeople">
<foreach collection="list" item="item" index="index"
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveRuleDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveRuleDao.xml
new file mode 100644
index 0000000..a6c3707
--- /dev/null
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveRuleDao.xml
@@ -0,0 +1,7 @@
+<?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.matrix.system.hive.dao.AchieveRuleDao">
+
+</mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/OnlinebookingDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/OnlinebookingDao.xml
index a60b9d8..4bb2b75 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/OnlinebookingDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/OnlinebookingDao.xml
@@ -17,7 +17,7 @@
<result property="staffId" column="staff_id" />
<result property="vipName" column="vip_name" />
<result property="tel" column="tel" />
- <result property="bizUserId" column="sys_vip_info_id" />
+ <result property="bizUserId" column="biz_user_id" />
<result property="formId" column="form_id" />
<result property="productId" column="product_id" />
@@ -42,7 +42,7 @@
<result property="staffId" column="staff_id" />
<result property="vipName" column="vip_name" />
<result property="tel" column="tel" />
- <result property="bizUserId" column="sys_vip_info_id" />
+ <result property="bizUserId" column="biz_user_id" />
<result property="productId" column="product_id" />
<result property="orderNo" column="order_no" />
<result property="formId" column="form_id" />
@@ -66,7 +66,7 @@
staff_id,
vip_name,
tel,
- sys_vip_info_id,
+ biz_user_id,
product_id,
order_no,
form_id
@@ -129,7 +129,7 @@
tel = #{tel},
</if>
<if test="(bizUserId!=null and bizUserId!='') or (bizUserId!='' and bizUserId==0)">
- sys_vip_info_id = #{bizUserId},
+ biz_user_id = #{bizUserId},
</if>
<if test="(productId!=null and productId!='') or (productId!='' and productId==0)">
product_id = #{productId},
@@ -199,7 +199,7 @@
staff_id,
vip_name,
tel,
- sys_vip_info_id,
+ biz_user_id,
product_id,
order_no,
form_id,
@@ -303,7 +303,7 @@
staff_id,
vip_name,
tel,
- sys_vip_info_id,
+ biz_user_id,
product_id
from onlinebooking
where 1=1
@@ -417,7 +417,7 @@
staff_id,
vip_name,
tel,
- sys_vip_info_id,
+ biz_user_id,
product_id,
order_no
from onlinebooking
@@ -442,7 +442,7 @@
staff_id,
vip_name,
tel,
- sys_vip_info_id,
+ biz_user_id,
product_id
from onlinebooking
where 1=1
@@ -495,7 +495,7 @@
staff_id,
vip_name,
tel,
- sys_vip_info_id,
+ biz_user_id,
product_id,
order_no
from onlinebooking
@@ -547,7 +547,7 @@
staff_id,
vip_name,
tel,
- sys_vip_info_id,
+ biz_user_id,
product_id,
order_no,
form_id,
@@ -565,7 +565,7 @@
and vip_Id = #{record.vipId}
</if>
<if test="(record.bizUserId!=null and record.bizUserId!='') or (record.bizUserId!='' and record.bizUserId==0)">
- and sys_vip_info_id = #{record.bizUserId}
+ and biz_user_id = #{record.bizUserId}
</if>
<if test="(record.time!=null and record.time!='') or (record.time!='' and record.time==0)">
and time = #{record.time}
@@ -611,7 +611,7 @@
and vip_Id = #{record.vipId}
</if>
<if test="(record.bizUserId!=null and record.bizUserId!='') or (record.bizUserId!='' and record.bizUserId==0)">
- and sys_vip_info_id = #{record.bizUserId}
+ and biz_user_id = #{record.bizUserId}
</if>
<if test="(record.time!=null and record.time!='') or (record.time!='' and record.time==0)">
and time = #{record.time}
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml
index 0c6cb3c..d0ff42f 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml
@@ -85,12 +85,15 @@
<result property="goodsSortName" column="goodsSortName" />
+ <result property="achieveRuleName" column="achieveRuleName" />
+
<result property="payMethods" column="pay_methods" />
<result property="invalidTime" column="invalid_time" />
<result property="useValid" column="use_valid" />
<result property="buyValid" column="buy_valid" />
<result property="isInfinite" column="is_infinite" />
+ <result property="achieveRuleId" column="achieve_rule_id" />
@@ -160,11 +163,14 @@
<!-- 服务项目信息 -->
<result property="proReward" column="proReward" />
<result property="timeLength" column="TIME_LENGTH" />
+ <result property="achieveRuleId" column="achieve_rule_id" />
<!-- 扩展属性 -->
<result property="cateName" column="cate_name" />
<result property="goodsSortName" column="goodsSortName" />
+ <result property="achieveRuleName" column="achieveRuleName" />
+
</resultMap>
@@ -301,7 +307,9 @@
use_valid,
invalid_time,
pay_methods,
- is_infinite
+ is_infinite,
+ achieve_rule_id
+
)
VALUES (
#{id},
@@ -362,7 +370,9 @@
#{useValid},
#{invalidTime},
#{payMethods},
- #{isInfinite}
+ #{isInfinite},
+ #{achieveRuleId}
+
)
</insert>
@@ -538,6 +548,10 @@
<if test="isInfinite != null and isInfinite !='' ">
is_infinite = #{isInfinite},
</if>
+
+ <if test="achieveRuleId != null and achieveRuleId !='' ">
+ achieve_rule_id = #{achieveRuleId},
+ </if>
invalid_time = #{invalidTime},
buy_valid = #{buyValid},
use_valid = #{useValid},
@@ -576,8 +590,9 @@
<select id="selectInPage" resultMap="ShoppingGoodsMap">
select
a.*,
- (select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
- (select NAME from shopping_goods_category t where t.id=a.cate_id) cate_name,
+ (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
+ (select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) as goodsSortName,
+ (select NAME from shopping_goods_category t where t.id=a.cate_id) as cate_name,
(select shop_name from sys_shop_info h where a.SHOP_ID=h.ID ) as shop_name
from shopping_goods a
where 1=1
@@ -652,6 +667,11 @@
</if>
+ <if test="record.achieveRuleId != null and record.achieveRuleId !='' ">
+ and achieve_rule_id = #{record.achieveRuleId}
+ </if>
+
+
<if test="record.headquarters != null and record.headquarters !='' ">
and headquarters = #{record.headquarters}
@@ -718,7 +738,9 @@
<if test="record.isVipCar != null and record.isVipCar !='' ">
and is_vip_car = #{record.isVipCar}
</if>
-
+ <if test="record.achieveRuleId != null and record.achieveRuleId !='' ">
+ and achieve_rule_id = #{record.achieveRuleId}
+ </if>
<if test="record.isCourse != null and record.isCourse !=''">
and is_course = #{record.isCourse}
@@ -763,6 +785,7 @@
<select id="selectAll" resultMap="ShoppingGoodsSimpleMap">
select
*,
+ (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
(select NAME from
shopping_goods_category t where t.id=cate_id)
@@ -868,6 +891,7 @@
<select id="findByCode" resultMap="ShoppingGoodsMap">
select
*,
+ (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
(select NAME from shopping_goods_category t where
t.id=cate_id)
@@ -880,6 +904,7 @@
<select id="selectSimpleMapById" resultMap="ShoppingGoodsSimpleMap">
select
*,
+ (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
(select NAME from
shopping_goods_category t where t.id=cate_id)
@@ -899,6 +924,7 @@
<select id="selectByModel" resultMap="ShoppingGoodsMap">
select
*,
+ (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
(select NAME from
shopping_goods_category t where t.id=cate_id)
@@ -978,6 +1004,7 @@
<select id="selectByModel1" resultMap="ShoppingGoodsMap">
select
*,
+ (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
(select NAME from
shopping_goods_category t where t.id=cate_id)
@@ -1056,6 +1083,7 @@
<select id="selectInPageNoTaocan" resultMap="ShoppingGoodsMap">
select
*,
+ (select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
(select NAME from
shopping_goods_category t where t.id=cate_id)
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderItemDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderItemDao.xml
index 846e27b..6c658ad 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderItemDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderItemDao.xml
@@ -557,4 +557,11 @@
where a.ORDER_ID=#{orderId}
</select>
+ <!-- 临时数据处理sql -->
+ <select id="selectDgd" resultMap="SysOrderItemMap">
+ SELECT a.* from sys_order_item a
+ left join sys_order b on a.ORDER_ID=b.id
+ where a.type='家居产品' and DATE_FORMAT(a.create_time,'%Y-%m')='2021-04' and b.company_id=17 and b.STATU='已付款';
+ </select>
+
</mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
index 9724622..68afb0d 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
@@ -499,9 +499,7 @@
<if test="isDeal != null ">
is_deal = #{isDeal},
</if>
- <if test="recommendId != null ">
- recommend_id = #{recommendId},
- </if>
+
<if test="province != null and province !='' ">
province = #{province},
</if>
@@ -552,6 +550,9 @@
<update id="unbundlingSaleMan">
UPDATE sys_vip_info set recommend_id = NULL where id=#{userId};
</update>
+ <update id="bindingRecommend">
+ UPDATE sys_vip_info set recommend_id = #{recommendId} where id=#{userId};
+ </update>
<!-- 批量删除 -->
<delete id="deleteByIds" parameterType="java.util.List">
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
index e020304..56a7c07 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
@@ -574,15 +574,15 @@
select
#{item.beginTime} time,
(select ifnull(sum(ifnull(card_cash,0) + ifnull(consume,0)),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) orderAmount,
- (select ifnull(sum(case b.pay_method when '现金' then goods_cash else 0 end),0)
+ (select ifnull(sum(case a.pay_method when '现金' then goods_cash else 0 end),0)
from achieve_new a
inner join sys_order_item b on a.order_item_id=b.ID
where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cashAmount,
- (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0)
+ (select ifnull(sum(case a.pay_method when '划扣' then goods_cash else 0 end),0)
from achieve_new a
inner join sys_order_item b on a.order_item_id=b.ID
where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardAmount,
- (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0)
+ (select ifnull(sum(case a.pay_method when '划扣' then goods_cash else 0 end),0)
from achieve_new a
inner join sys_order_item b on a.order_item_id=b.ID
where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardUseAmount,
@@ -615,7 +615,7 @@
<select id="selectStaffCashAchieve" resultType="java.util.TreeMap">
select
<foreach collection="list" index="index" item="item" separator="," >
- (select ifnull(sum(case b.pay_method when '现金' then goods_cash else 0 end),0)
+ (select ifnull(sum(case a.pay_method when '现金' then goods_cash else 0 end),0)
from achieve_new a
inner join sys_order_item b on a.order_item_id=b.ID
where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>
@@ -630,7 +630,7 @@
<select id="selectStaffCardAchieve" resultType="java.util.TreeMap">
select
<foreach collection="list" index="index" item="item" separator="," >
- (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0)
+ (select ifnull(sum(case a.pay_method when '划扣' then goods_cash else 0 end),0)
from achieve_new a
inner join sys_order_item b on a.order_item_id=b.ID
where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>
diff --git a/zq-erp/src/main/resources/static/images/luckyDraw/line.png b/zq-erp/src/main/resources/static/images/luckyDraw/line.png
new file mode 100644
index 0000000..7df2255
--- /dev/null
+++ b/zq-erp/src/main/resources/static/images/luckyDraw/line.png
Binary files differ
diff --git a/zq-erp/src/main/resources/static/images/luckyDraw/oAward.png b/zq-erp/src/main/resources/static/images/luckyDraw/oAward.png
new file mode 100644
index 0000000..4e78626
--- /dev/null
+++ b/zq-erp/src/main/resources/static/images/luckyDraw/oAward.png
Binary files differ
diff --git a/zq-erp/src/main/resources/static/images/luckyDraw/sAward.png b/zq-erp/src/main/resources/static/images/luckyDraw/sAward.png
new file mode 100644
index 0000000..97f5ab7
--- /dev/null
+++ b/zq-erp/src/main/resources/static/images/luckyDraw/sAward.png
Binary files differ
diff --git a/zq-erp/src/main/resources/static/images/luckyDraw/start.png b/zq-erp/src/main/resources/static/images/luckyDraw/start.png
new file mode 100644
index 0000000..2dc6ec6
--- /dev/null
+++ b/zq-erp/src/main/resources/static/images/luckyDraw/start.png
Binary files differ
diff --git a/zq-erp/src/main/resources/static/images/luckyDraw/tAward.png b/zq-erp/src/main/resources/static/images/luckyDraw/tAward.png
new file mode 100644
index 0000000..2752767
--- /dev/null
+++ b/zq-erp/src/main/resources/static/images/luckyDraw/tAward.png
Binary files differ
diff --git a/zq-erp/src/main/resources/static/images/luckyDraw/xiexiecanyu.png b/zq-erp/src/main/resources/static/images/luckyDraw/xiexiecanyu.png
new file mode 100644
index 0000000..7df35a1
--- /dev/null
+++ b/zq-erp/src/main/resources/static/images/luckyDraw/xiexiecanyu.png
Binary files differ
diff --git a/zq-erp/src/main/resources/static/images/luckyDraw/zhuanpan.png b/zq-erp/src/main/resources/static/images/luckyDraw/zhuanpan.png
new file mode 100644
index 0000000..1cbf542
--- /dev/null
+++ b/zq-erp/src/main/resources/static/images/luckyDraw/zhuanpan.png
Binary files differ
diff --git a/zq-erp/src/main/resources/static/images/luckyDraw/zhuanpanchoujian.png b/zq-erp/src/main/resources/static/images/luckyDraw/zhuanpanchoujian.png
new file mode 100644
index 0000000..65b216b
--- /dev/null
+++ b/zq-erp/src/main/resources/static/images/luckyDraw/zhuanpanchoujian.png
Binary files differ
diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-list.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-list.html
index a0a285b..1054379 100644
--- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-list.html
@@ -88,22 +88,23 @@
<span v-if="scope.row.actType == 2">秒杀</span>
<span v-if="scope.row.actType == 3">沙龙</span>
<span v-if="scope.row.actType == 4">每日签到</span>
+ <span v-if="scope.row.actType == 5">转盘抽奖</span>
</template>
</el-table-column>
<el-table-column
label="状态">
<template slot-scope="scope">
- <div v-if="scope.row.actType == 4">
+ <div v-if="scope.row.actType == 4 || scope.row.actType == 5">
<span v-if="scope.row.actStatus == 1">未发布</span>
</div>
- <div v-if="scope.row.actType != 4">
+ <div v-if="scope.row.actType != 4 && scope.row.actType != 5">
<span v-if="scope.row.actStatus == 1">开启</span>
</div>
- <div v-if="scope.row.actType == 4">
+ <div v-if="scope.row.actType == 4 || scope.row.actType == 5">
<span v-if="scope.row.actStatus == 2">未开始</span>
</div>
- <div v-if="scope.row.actType != 4">
+ <div v-if="scope.row.actType != 4 && scope.row.actType != 5">
<span v-if="scope.row.actStatus == 2">关闭</span>
</div>
<span v-if="scope.row.actStatus == 3">进行中</span>
@@ -133,7 +134,7 @@
</el-table-column>
<el-table-column label="操作" width="400">
<template slot-scope="scope">
- <el-row style="display:flex;" v-if="scope.row.actType == 4">
+ <el-row style="display:flex;" v-if="[4].includes(scope.row.actType)">
<el-button type="primary" v-if="scope.row.actStatus == 1" size="mini" @click="beReady(scope.row)">发布</el-button>
<el-button type="primary" v-if="[1,2,3].includes(scope.row.actStatus)" @click="beUpdate(scope.row)" size="mini">修改</el-button>
<el-button type="primary" v-if="scope.row.actStatus == 3" size="mini">推广</el-button>
@@ -141,7 +142,15 @@
<el-button type="primary" v-if="scope.row.actStatus == 3" @click="beClose(scope.row)" size="mini">关闭</el-button>
<el-button type="danger" v-if="scope.row.actStatus != 5" size="mini" @click="delRow(scope.row)">删除</el-button>
</el-row>
- <el-row style="display:flex;" v-if="scope.row.actType != 4">
+ <el-row style="display:flex;" v-if="[5].includes(scope.row.actType)">
+ <el-button type="primary" v-if="scope.row.actStatus == 1" size="mini" @click="beReady(scope.row)">发布</el-button>
+ <el-button type="primary" v-if="[1,2,3].includes(scope.row.actStatus)" @click="beUpdateLuckdraw(scope.row)" size="mini">修改</el-button>
+ <el-button type="primary" v-if="scope.row.actStatus == 3" size="mini">推广</el-button>
+ <el-button type="primary" v-if="[3,4,5].includes(scope.row.actStatus)" @click="openLuckdrawReceive(scope.row)" size="mini">活动统计</el-button>
+ <el-button type="primary" v-if="scope.row.actStatus == 3" @click="beClose(scope.row)" size="mini">关闭</el-button>
+ <el-button type="danger" v-if="scope.row.actStatus != 5" size="mini" @click="delRow(scope.row)">删除</el-button>
+ </el-row>
+ <el-row style="display:flex;" v-if="[1,2,3].includes(scope.row.actType)">
<el-button type="primary" @click="openEdit(scope.row)" size="mini">编辑</el-button>
<el-button type="primary" @click="activityStatistics(scope.row)" size="mini">活动统计</el-button>
<el-button type="primary" @click="closeAct(scope.row)" size="mini">关闭</el-button>
@@ -345,6 +354,17 @@
content : [ basePath + '/admin/redirect/activity/activity-sign-update?actId=' + row.id]
}));
},
+ //修改
+ beUpdateLuckdraw(row){
+ layer.full(layer.open({
+ type: 2,
+ title: "修改",
+ maxmin: true,
+ area: [MUI.SIZE_L, '500px'],
+ content : [ basePath + '/admin/redirect/activity/activity-luckyDraw-update?actId=' + row.id]
+ }));
+ },
+
//活动统计
openSignReceive(row){
layer.full(layer.open({
@@ -355,6 +375,16 @@
content : [ basePath + '/admin/redirect/activity/activity-sign-receive?actId=' + row.id]
}));
},
+ //活动统计
+ openLuckdrawReceive(row){
+ layer.full(layer.open({
+ type: 2,
+ title: "活动统计",
+ maxmin: true,
+ area: [MUI.SIZE_L, '500px'],
+ content : [ basePath + '/admin/redirect/activity/activity-luckdraw-receive?actId=' + row.id]
+ }));
+ },
//发布
beReady(row){
let _this = this;
diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-luckdraw-receive.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-luckdraw-receive.html
new file mode 100644
index 0000000..17d0308
--- /dev/null
+++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-luckdraw-receive.html
@@ -0,0 +1,279 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
+<head>
+ <meta charset="utf-8">
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <meta name="renderer" content="webkit|ie-comp|ie-stand">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport"
+ content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
+ <meta http-equiv="Cache-Control" content="no-siteapp"/>
+ <!-- 本框架基本脚本和样式 -->
+ <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script>
+ <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">
+ <link rel="stylesheet" th:href="@{/plugin/bootstrap-3.3.5/css/bootstrap.min.css}">
+ <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/>
+
+ <!-- 富文本编辑器 -->
+ <script type="text/javascript" charset="utf-8"
+ th:src="@{/plugin/beditor/ueditor.config.js}"></script>
+ <script type="text/javascript" charset="utf-8"
+ th:src="@{/plugin/beditor/ueditor.all.js}">
+ </script>
+ <script type="text/javascript" charset="utf-8"
+ th:src="@{/plugin/beditor/lang/zh-cn/zh-cn.js}"></script>
+ <style>
+ .panel-body{
+ overflow: hidden;
+ }
+ .paginationStyle{
+ background: #ffffff;
+ padding: 10px 10px;
+ margin: 0px 0px 10px 0px;
+ text-align: right;
+ }
+ </style>
+</head>
+
+<body>
+<div class="panel-body" id="app" v-cloak>
+ <el-row>
+ <el-row justify="space-between" type="flex">
+ <el-col>
+ <el-form ref="form" :model="form" inline >
+ <el-form-item label="用户名称" prop="yhmc" >
+ <el-input v-model="form.yhmc" placeholder="用户名称"></el-input>
+ </el-form-item>
+ <el-form-item prop="qdsj" label="签到时间">
+ <el-date-picker
+ v-model="form.qdsj"
+ type="datetimerange"
+ :picker-options="pickerOptions"
+ range-separator="至"
+ start-placeholder="开始日期"
+ end-placeholder="结束日期"
+ align="right">
+ </el-date-picker>
+ </el-form-item>
+ <el-button type="primary" @click="searchFormSignReceive" >搜索</el-button>
+ <el-button @click="resetFormSignReceive('form')">重置</el-button>
+ </el-form>
+ </el-col>
+ </el-row>
+
+ <el-row class="table-style" >
+ <el-table ref="multipleTable"
+ :data="signReceiveList.rows"
+ :height="height"
+ stripe:true
+ @sort-change="sortChange"
+ @selection-change="handleSelectionChange">
+ <el-table-column
+ type="selection">
+ </el-table-column>
+ <el-table-column
+ prop="nickName"
+ label="用户"
+ show-overflow-tooltip>
+ </el-table-column>
+ <el-table-column
+ prop="reciveTime"
+ label="抽奖时间"
+ show-overflow-tooltip>
+ </el-table-column>
+ <el-table-column
+ label="状态"
+ show-overflow-tooltip>
+ <template slot-scope="scope">
+ <span v-if="scope.row.state == 1">待领取</span>
+ <span v-if="scope.row.state == 2">已领取</span>
+ <span v-if="scope.row.state == 3">待配送</span>
+ <span v-if="scope.row.state == 4">待收货</span>
+ <span v-if="scope.row.state == 5">已失效</span>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="奖品类型">
+ <template slot-scope="scope">
+ <span v-if="scope.row.awardType == 1">自定义礼品</span>
+ <span v-if="scope.row.awardType == 2">积分</span>
+ <span v-if="scope.row.awardType == 3">优惠券</span>
+ <span v-if="scope.row.awardType == 4">店铺商品</span>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="awardName"
+ label="获得奖励"
+ show-overflow-tooltip>
+ </el-table-column>
+
+ <el-table-column
+ label="奖励名称"
+ show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{scope.row.awardName}}
+ <span v-if="scope.row.awardType == 3">({{scope.row.couponName}})</span>
+ <span v-if="scope.row.awardType == 2">(*{{scope.row.scoreCnt}})</span>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-row>
+ <el-row class="paginationStyle" >
+ <el-pagination background
+ @size-change="changePageSignReceive"
+ @current-change="changeCurrentPageSignReceive"
+ :current-page="signReceiveList.currentPage"
+ :page-sizes="[10, 20, 30, 50]"
+ :page-size="signReceiveList.pageSize"
+ layout="total, sizes, prev, pager, next, jumper"
+ :total="signReceiveList.total">
+ </el-pagination>
+ </el-row>
+ </el-row>
+</div>
+</body>
+<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/bootstrap-3.3.5/js/bootstrap.min.js}"></script>
+<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
+<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
+
+<script>
+ //获取传输的活动对象
+ var actId = $.query.get("actId");
+
+ var app = new Vue({
+ el: '#app',
+ data: {
+ height:'calc(100vh - 200px)',
+ //--时间选择
+ pickerOptions: {
+ shortcuts: [{
+ text: '最近一周',
+ onClick(picker) {
+ const end = new Date();
+ const start = new Date();
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+ picker.$emit('pick', [start, end]);
+ }
+ }, {
+ text: '最近一个月',
+ onClick(picker) {
+ const end = new Date();
+ const start = new Date();
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+ picker.$emit('pick', [start, end]);
+ }
+ }, {
+ text: '最近三个月',
+ onClick(picker) {
+ const end = new Date();
+ const start = new Date();
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+ picker.$emit('pick', [start, end]);
+ }
+ }]
+ },
+ // 条件查询
+ form:{
+ yhmc:'',
+ qdsj:'',
+ order:'',
+ sort:''
+ },
+ //活动列表
+ signReceiveList:{
+ rows:[],
+ total:0,
+ pageSize:10,
+ currentPage:1,
+ },
+ },
+ created: function () {
+ this.loadInfo();
+ },
+ mounted: function () {
+ },
+ methods: {
+ //加载分类
+ loadInfo() {
+ let _this = this;
+ _this.loadSignReceiveList();
+ },
+ //--列表
+ loadSignReceiveList() {
+ let _this = this;
+ let data=_this.getRequestParamSignReceive();
+ data.pageSize=_this.signReceiveList.pageSize;
+ data.pageNum=_this.signReceiveList.currentPage;
+ AjaxProxy.requst({
+ app: _this,
+ data:data,
+ url: basePath + '/admin/activitySignAwardSet/findSignReceiveList',
+ callback: function (data) {
+ _this.signReceiveList.rows = data.rows;
+ _this.signReceiveList.total = data.total;
+ }
+ });
+ },//查询参数
+ getRequestParamSignReceive(){
+ let _this = this;
+ let startTime = '';
+ let endTime = '';
+ if(_this.form.qdsj.length > 0){
+ startTime = _this.form.qdsj[0];
+ endTime = _this.form.qdsj[1];
+ }
+ return {
+ yhmc:_this.form.yhmc,
+ startTime:startTime,
+ endTime:endTime,
+ actId:actId,
+ order:_this.form.order,
+ sort:_this.form.sort,
+ }
+ },
+ //查询
+ searchFormSignReceive:function(){
+ this.signReceiveList.currentPage=1;
+ this.loadSignReceiveList();
+ },
+ //重置
+ resetFormSignReceive(formName) {
+ this.$refs[formName].resetFields();
+ },
+ changePageSignReceive(val) {
+ this.signReceiveList.pageSize = val;
+ this.loadSignReceiveList();
+ },
+ changeCurrentPageSignReceive(val) {
+ this.signReceiveList.currentPage = val;
+ this.loadSignReceiveList();
+ },
+ //排序
+ sortChange:function (column){
+ if(column.order){
+ if(column.order.indexOf("desc")){
+ this.form.order="desc";
+ }else{
+ this.form.order="asc";
+ }
+ this.form.sort=column.prop;
+ this.loadInfo();
+ }
+ },
+ //选择
+ handleSelectionChange(val) {
+ let _this = this;
+ _this.multipleSelection = val;
+ },
+ }
+ })
+</script>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-luckyDraw-update.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-luckyDraw-update.html
new file mode 100644
index 0000000..4c3ec30
--- /dev/null
+++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-luckyDraw-update.html
@@ -0,0 +1,1116 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
+<head>
+ <meta charset="utf-8">
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <meta name="renderer" content="webkit|ie-comp|ie-stand">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport"
+ content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
+ <meta http-equiv="Cache-Control" content="no-siteapp"/>
+ <!-- 本框架基本脚本和样式 -->
+ <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script>
+ <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">
+ <link rel="stylesheet" th:href="@{/plugin/bootstrap-3.3.5/css/bootstrap.min.css}">
+ <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/>
+
+ <!-- 富文本编辑器 -->
+ <script type="text/javascript" charset="utf-8"
+ th:src="@{/plugin/beditor/ueditor.config.js}"></script>
+ <script type="text/javascript" charset="utf-8"
+ th:src="@{/plugin/beditor/ueditor.all.js}">
+ </script>
+ <script type="text/javascript" charset="utf-8"
+ th:src="@{/plugin/beditor/lang/zh-cn/zh-cn.js}"></script>
+ <style>
+
+ .el-aside {
+ background-color: #D3DCE6;
+ color: #333;
+ text-align: center;
+ }
+ .el-main {
+ background-color: #E9EEF3;
+ color: #333;
+ }
+ body > .el-container {
+ margin-bottom: 1000px;
+ }
+ .button {
+ padding: 5px;
+ text-align: center;
+ }
+
+ .imageOne {
+ display: block;
+ height: 50px;
+ padding: 5px 5px;
+ text-align: center;
+ }
+ .imageTwo {
+ display: block;
+ height: 280px;
+ padding: 5px 5px;
+ text-align: center;
+ }
+ .imageThree {
+ display: block;
+ padding: 5px 5px;
+ text-align: center;
+ }
+
+ .box-card {
+ padding: 5px 5px;
+ }
+
+ </style>
+</head>
+
+<body>
+<div class="panel-body" id="app" v-cloak>
+ <el-form :model="ruleForm" :rules="rules" class="form-horizontal" id="dataform" ref="ruleForm" label-width="120px">
+
+ <el-container>
+ <el-aside width="30%">
+ <el-card class="box-card" :body-style="{ padding: '10px 10px'}">
+ <el-row>
+ <div @click="uploadImg()" class="imageTwo" >
+ <img v-if="imageUrlHead" :src="imageUrlHead" style="width: 100%;height: 100%">
+ <el-button type="primary" v-show="imageUrlHead == ''" round><span style="font-size: 20px;">头部</span><span style="padding:5px;font-size: 15px;color: red;">(上传图片)</span></span></el-button>
+ </div>
+ </el-row>
+ <el-row style="display:flex;">
+ <el-col>
+ <div style="padding:5px;font-size: 15px;text-align: left;">
+ <el-button type="primary" size="mini" round>
+ <span>拥有积分:</span>
+ </el-button>
+ </div>
+ </el-col>
+ </el-row>
+
+ <el-row>
+ <div @click="uploadImg()" class="imageThree" >
+ <el-button type="primary" v-show="imageUrlButton == ''" round><span style="font-size: 20px;">签到按钮</span><span style="padding:5px;font-size: 15px;color: red;">(上传图片)</span></span></el-button>
+ <img v-if="imageUrlButton" :src="imageUrlButton" style="width: 100%;">
+ </div>
+ </el-row>
+
+
+ <el-row>
+ <div style="text-align: center;padding: 5px;" @click="gzsmSet()">
+ <div class="col-sm-8 col-sm-offset-2" style="text-align: left;">
+ <span style="padding:5px;font-size: 30px;">-- 规则说明--</span>
+ </div>
+ <div class="el-col-sm-24" style="text-align: center;">
+ <span style="padding:5px;font-size: 15px;color: red;">(点击,编辑规则内容,背景颜色,字体颜色、大小、透明度)</span>
+ </div>
+ <div class="col-sm-8 col-sm-offset-2" style="text-align: left;">
+ <span style="padding:5px;font-size: 15px;">1、每天参与签到可获得积分换取抽奖机会</span>
+ </div>
+ <div class="col-sm-8 col-sm-offset-2" style="text-align: left;">
+ <span style="padding:5px;font-size: 15px;">2、每天参与签到可获得积分换取抽奖机会</span>
+ </div>
+ <div class="col-sm-8 col-sm-offset-2" style="text-align: left;">
+ <span style="padding:5px;font-size: 15px;">3、每天参与签到可获得积分换取抽奖机会</span>
+ </div>
+ </div>
+ </el-row>
+ </el-card>
+ </el-aside>
+
+ <el-main width="70%">
+ <div>
+ <el-tabs v-model="activeName" @tab-click="clickSecondTab">
+ <el-tab-pane label="活动设置" name="first">
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="活动名称" prop="actName">
+ <el-input v-model="ruleForm.actName" placeholder="请输入活动名称"></el-input>
+ </el-form-item>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="活动编码" prop="actCode">
+ <el-input v-model.number="ruleForm.actCode" placeholder="请输入最大开团数量"></el-input>
+ </el-form-item>
+ </div>
+ <div class="col-sm-4 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="活动时间" prop="actTime">
+ <div class="block">
+ <el-date-picker
+ v-model="ruleForm.actTime"
+ type="daterange"
+ range-separator="至"
+ start-placeholder="开始日期"
+ end-placeholder="结束日期">
+ </el-date-picker>
+ </div>
+ </el-form-item>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <p class="el-big-title" style="text-align: left;">抽奖规则</p>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="每日抽奖机会">
+ <el-form-item label="每人每日有" prop="wmkcjjh">
+ <el-input-number v-model="ruleForm.wmkcjjh" :min="1" :max="10" label="描述文字"></el-input-number> 次无门槛抽奖机会
+ </el-form-item>
+ </el-form-item>
+ <el-form-item>
+ <el-form-item label="可用" prop="dhycjfs">
+ <el-input-number v-model="ruleForm.dhycjfs" :min="1" :max="200" label="描述文字"></el-input-number> 积分兑换1次抽奖机会,每日最多兑换
+ </el-form-item>
+ </el-form-item>
+ <el-form-item>
+ <el-form-item label="每日最多兑换" prop="jfdhcs">
+ <el-input-number v-model="ruleForm.jfdhcs" :min="1" :max="10" label="描述文字"></el-input-number> 次抽奖机会
+ </el-form-item>
+ </el-form-item>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="中奖概率">
+ <el-form-item label="每人最多中奖" prop="zzjcs">
+ <el-input-number v-model="ruleForm.zzjcs" :min="1" :max="100" label="描述文字"></el-input-number> 次
+ </el-form-item>
+ </el-form-item>
+ <el-form-item>
+ <el-form-item label="总中奖率" prop="zzjl">
+ <el-input-number v-model="ruleForm.zzjl" :min="1" :max="100" label="描述文字"></el-input-number> %
+ </el-form-item>
+ </el-form-item>
+ </div>
+ </el-tab-pane>
+
+ <el-tab-pane label="奖品设置" name="second">
+ <el-row style="display:flex;">
+ <el-col :span="20">
+ <el-tabs v-model="editableTabsValue" type="card" closable @tab-click="clickTab" @tab-remove="removeTab">
+ <el-tab-pane v-for="(item, index) in editableTabs" :key="item.name" :label="item.title" :name="item.name">
+ <el-row v-show="editableTabsValue !== '1'">
+ </el-row>
+ <el-row >
+ <el-col>
+ <el-form-item label="奖项名称">
+ <el-input v-model="item.content.awardName" placeholder="奖项名称"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row >
+ <el-col>
+ <el-form-item label="图片介绍">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="introduceImgSuccess">
+ <img v-if="item.content.introduceImg" :src="item.content.introduceImg" style="max-width: 200px;">
+ </el-upload>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <div v-show="item.name !== '1'">
+ <el-row>
+ <el-form-item label="奖项类型">
+ <el-col>
+ <el-radio-group v-model="item.content.awardType" @change="jxlxChange">
+ <el-radio :label="1">自定义奖品</el-radio>
+ <el-radio :label="2">积分</el-radio>
+ <el-radio :label="3">优惠券</el-radio>
+ <el-radio :label="4">商品</el-radio>
+ </el-radio-group>
+ </el-col>
+ </el-form-item >
+ </el-row>
+
+ <div>
+ <el-row style="display:flex;">
+ <el-col>
+ <el-form-item label="奖项库存">
+ <el-input v-model="item.content.awardInventoryCnt" oninput ="value=value.replace(/[^0-9.]/g,'')"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col>
+ <el-form-item label="已派发">
+ <el-input v-model="item.content.awardDistributeCnt"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ <div v-show="item.content.awardType === 1">
+ <el-row >
+ <el-col>
+ <el-form-item label="文字介绍">
+ <el-input type="textarea" v-model="item.content.introduceTip"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row >
+ <el-col>
+ <el-form-item label="兑奖方式">
+ <el-col>
+ <el-radio-group v-model="item.content.awardWay" @change="awardWayChange">
+ <el-radio :label="'1'">线下兑换</el-radio>
+ <el-radio :label="'2'">物流配送</el-radio>
+ <el-radio :label="'3'">客服兑换</el-radio>
+ </el-radio-group>
+ </el-col>
+ </el-form-item >
+ </el-col>
+ </el-row>
+ <el-row >
+ <el-col>
+ <el-form-item label="操作提示">
+ <el-input v-model="item.content.operationTip"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <div v-show="item.content.awardWay === '1'">
+ <el-row >
+ <el-col>
+ <el-form-item label="兑奖地址">
+ <el-input v-model="item.content.prizeAddress"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+
+ </div>
+ <div v-show="item.content.awardWay === '3'">
+ <el-row >
+ <el-col>
+ <el-form-item label="客服微信">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="wechatImgSuccess">
+ <img v-if="item.content.wechatImg" :src="item.content.wechatImg" style="max-width: 200px;">
+ </el-upload>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ <div v-show="[1,3].includes(item.content.awardWay)">
+ <el-row >
+ <el-col>
+ <el-form-item label="客服电话">
+ <el-input v-model="item.content.customerPhone"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ <div v-show="item.content.awardWay !== '2'">
+ <el-row >
+ <el-col>
+ <el-form-item label="兑奖期限">
+ <div class="block">
+ <el-date-picker
+ v-model="item.content.prizeTime"
+ type="daterange"
+ range-separator="至"
+ start-placeholder="开始日期"
+ end-placeholder="结束日期">
+ </el-date-picker>
+ </div>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ </div>
+ <div v-show="item.content.awardType === 2">
+ <el-row >
+ <el-col>
+ <el-form-item label="积分数量">
+ <el-input v-model="item.content.scoreCnt" oninput ="value=value.replace(/[^0-9.]/g,'')"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ <div v-show="item.content.awardType === 3">
+ <el-row style="display:flex;">
+ <el-col>
+ <el-form-item label="优惠券名称">
+ <el-input v-model="item.content.couponName"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col>
+ <el-form-item label="优惠券">
+ <el-input v-model="item.content.couponId"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col>
+ <el-button type="primary" @click="chooseCoupon(item.content.couponName,item.name)">
+ 选择优惠券
+ </el-button>
+ </el-col>
+ </el-row>
+
+ <el-drawer
+ title="选择商城优惠券"
+ :visible.sync="drawerCoupon"
+ :direction="directionCoupon"
+ size="90%">
+ <el-row style="margin-left: 50px;">
+ <el-col :span="24">
+ <el-row>
+ <el-form ref="formCoupon" :model="formCoupon" inline >
+ <el-form-item prop="yhjmc">
+ <el-input v-model="formCoupon.yhjmc" placeholder="请输入优惠券名称"></el-input>
+ </el-form-item>
+ <el-button type="primary" @click="searchFormCoupon" >搜索</el-button>
+ <el-button @click="resetFormCoupon('formCoupon')">重置</el-button>
+ </el-form>
+ </el-row>
+
+ <el-row class="table-style" >
+ <el-table ref="multipleTable"
+ :data="couponList.rows"
+ :height="tableHeightCoupon"
+ stripe:true
+ style="width: 100%">
+ <el-table-column
+ prop="cname"
+ label="优惠券名称"
+ show-overflow-tooltip>
+ </el-table-column>
+ <el-table-column
+ prop="endTime"
+ label="截止日期"
+ show-overflow-tooltip>
+ </el-table-column>
+ <el-table-column
+ prop="address"
+ label="操作">
+ <template slot-scope="scope">
+ <el-button type="primary"
+ size="mini"
+ @click="chooseOneCoupon(scope.row)">选择
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-row>
+ <el-row class="paginationStyle" >
+ <el-pagination background
+ @size-change="changePageSizeCoupon"
+ @current-change="changeCurrentPageCoupon"
+ :current-page="couponList.currentPage"
+ :page-sizes="[10, 20, 30, 50]"
+ :page-size="couponList.pageSize"
+ layout="total, sizes, prev, pager, next, jumper"
+ :total="couponList.total">
+ </el-pagination>
+ </el-row>
+ </el-col>
+ </el-row>
+ </el-drawer>
+ </div>
+ <div v-show="item.content.awardType === 4">
+ <el-row style="display:flex;">
+ <el-col>
+ <el-form-item label="品项名称">
+ <el-input v-model="item.content.goodsName"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col>
+ <el-form-item label="品项">
+ <el-input v-model="item.content.goodsId"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col>
+ <el-button type="primary" @click="chooseGoods(item.content.goodsName,item.name)">
+ 选择品项
+ </el-button>
+ </el-col>
+ </el-row>
+
+ <el-drawer
+ title="选择ERP产品"
+ :visible.sync="drawerGoods"
+ :direction="directionGoods"
+ size="90%">
+ <el-row style="margin-left: 50px;">
+ <el-col :span="24">
+ <el-row>
+ <el-form ref="formGoods" :model="formGoods" inline >
+ <el-form-item prop="cpmc">
+ <el-input v-model="formGoods.cpmc" placeholder="请输入产品名称"></el-input>
+ </el-form-item>
+ <el-button type="primary" @click="searchFormGoods" >搜索</el-button>
+ <el-button @click="resetFormGoods('formGoods')">重置</el-button>
+ </el-form>
+ </el-row>
+
+ <el-row class="table-style" >
+ <el-table ref="multipleTable"
+ :data="goodsList.rows"
+ :height="tableHeightGoods"
+ stripe:true
+ style="width: 100%">
+ <el-table-column
+ prop="name"
+ label="名称"
+ show-overflow-tooltip>
+ </el-table-column>
+ <el-table-column
+ prop="address"
+ label="操作">
+ <template slot-scope="scope">
+ <el-button type="primary"
+ size="mini"
+ @click="chooseOneGoods(scope.row)">选择
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-row>
+ <el-row class="paginationStyle" >
+ <el-pagination background
+ @size-change="changePageSizeGoods"
+ @current-change="changeCurrentPageGoods"
+ :current-page="goodsList.currentPage"
+ :page-sizes="[10, 20, 30, 50]"
+ :page-size="goodsList.pageSize"
+ layout="total, sizes, prev, pager, next, jumper"
+ :total="goodsList.total">
+ </el-pagination>
+ </el-row>
+ </el-col>
+ </el-row>
+ </el-drawer>
+ </div>
+ </div>
+ </el-tab-pane>
+ </el-tabs>
+ </el-col>
+ <el-col :span="4">
+ <el-button type="primary" @click="addTab(editableTabsValue)">
+ 新增奖品
+ </el-button>
+ </el-col>
+ </el-row>
+ </el-tab-pane>
+
+ <el-tab-pane label="背景图片上传" name="third">
+ <!--<div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="标题">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="imageUrlTitleSuccess">
+ <img v-if="imageUrlTitle" :src="imageUrlTitle" style="max-width: 300px;">
+ </el-upload>
+ </el-form-item>
+ </div>-->
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="头部">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="imageUrlHeadSuccess">
+ <img v-if="imageUrlHead" :src="imageUrlHead" style="max-width: 300px;">
+ </el-upload>
+ </el-form-item>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="开始按钮">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="imageUrlTitleSuccess">
+ <img v-if="imageUrlTitle" :src="imageUrlTitle" style="max-width: 300px;">
+ </el-upload>
+ </el-form-item>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="奖品划分线">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="imageLineSuccess">
+ <img v-if="imageLine" :src="imageLine" style="max-width: 300px;">
+ </el-upload>
+ </el-form-item>
+ </div>
+
+ <!--<div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="转盘背景">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="imageUrlButtonSuccess">
+ <img v-if="imageUrlButton" :src="imageUrlButton" style="max-width: 300px;">
+ <i v-else></i>
+ </el-upload>
+ </el-form-item>
+ </div>-->
+ </el-tab-pane>
+
+ <el-tab-pane label="规则说明" name="fourth">
+ <div class="col-sm-8 col-sm-offset-1">
+ <el-form-item label="规则内容" prop="ruleExplain" style="padding: 10px">
+ <el-input type="textarea" v-model="ruleForm.ruleExplain"></el-input>
+ </el-form-item>
+ <el-form-item label="背景颜色" style="padding: 10px">
+ <el-color-picker v-model="backgroundColor"></el-color-picker>
+ </el-form-item>
+ <el-form-item label="字体颜色" style="padding: 10px">
+ <el-color-picker v-model="typographyColor"></el-color-picker>
+ </el-form-item>
+ <el-form-item label="字体大小" style="padding: 10px">
+ <el-input-number v-model="typographyNum" :min="10" :max="50" label="描述文字"></el-input-number>
+ </el-form-item>
+ <!--<el-form-item label="字体透明度" style="padding: 10px">
+ <el-input-number v-model="typographyLight" :min="1" :max="100" label="描述文字">%</el-input-number>
+ </el-form-item>-->
+ </div>
+ </el-tab-pane>
+ </el-tabs>
+ </div>
+
+ <div class="form-group ">
+ <div class="col-sm-12 text-center">
+ <el-button type="primary" @click="updateSignAwardSet('ruleForm')">保存</el-button>
+ <el-button type="danger" @click="cancelSubmit">关闭</el-button>
+ </div>
+ </div>
+ </el-main>
+
+ </el-container>
+
+ </el-form>
+</div>
+</body>
+<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/bootstrap-3.3.5/js/bootstrap.min.js}"></script>
+<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
+<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
+
+<script>
+ //获取传输的活动对象
+ var actId = $.query.get("actId");
+ const prize = {
+ //奖品基本信息
+ id:'',
+ cumulativeDay:'',
+ awardType:1,
+ awardName:'',
+ introduceImg:'',
+ introduceTip:'',
+ awardInventoryCnt:'',
+ awardDistributeCnt:'',
+ awardWay:1,
+ operationTip:'',
+ prizeAddress:'',
+ prizeTime: '',
+ wechatImg:'',
+ scoreCnt:'',
+ couponId:'',
+ customerPhone:'',
+ goodsId:'',
+ couponName:'',
+ goodsName:'',
+ }
+ var app = new Vue({
+ el: '#app',
+ data: {
+ activeName: 'first',
+ formLabelWidth: '120px',
+ //标题图片
+ imageLine: "../../../images/luckyDraw/line.png",
+ imageUrlTitle: "../../../images/luckyDraw/start.png",
+ imageUrlButton: "",
+ imageUrlHead: "../../../images/luckyDraw/zhuanpan.png",
+
+ activeClickTab:0,
+
+ //优惠券搜索弹出
+ drawerCoupon: false,
+ directionCoupon: 'rtl',
+ tableHeightCoupon: 500,
+ //--优惠券
+ formCoupon:{
+ yhjmc:'',
+ order:'',
+ sort:''
+ },
+ couponList:{
+ rows:[],
+ total:0,
+ pageSize:10,
+ currentPage:1,
+ },
+
+ //品项搜索弹出
+ drawerGoods: false,
+ directionGoods: 'rtl',
+ tableHeightGoods: 500,
+ //--品项
+ formGoods:{
+ cpmc:'',
+ order:'',
+ sort:''
+ },
+ goodsList:{
+ rows:[],
+ total:0,
+ pageSize:10,
+ currentPage:1,
+ },
+
+ //字体颜色
+ typographyColor: '#409EFF',
+ //背景颜色
+ backgroundColor: '#409EFF',
+ //字体大小
+ typographyNum: '5',
+ //字体透明度
+ typographyLight: '50',
+ //奖品设置
+ prize:JSON.parse(JSON.stringify(prize)),
+ editableTabsValue: '1',
+ editableTabs: [{
+ title: '谢谢参与',
+ name: '1',
+ content: JSON.parse(JSON.stringify(prize))
+ }],
+ tabIndex: 1,
+
+ ruleForm : {
+ //商品基本信息
+ actName : '',
+ actCode : '',
+ actTime : '',
+ //抽奖规则
+ wmkcjjh : '5',
+ dhycjfs : '20',
+ jfdhcs : '10',
+ zzjcs : '5',
+ zzjl : '10',
+ //规则说明
+ ruleExplain : '',
+ },
+ rules : {
+ //商品基本信息
+ actName : [
+ { required: true, message: '请输入活动名称', trigger: 'blur' }
+ ],
+ actCode : [
+ { required: true, message: '请输入活动编码', trigger: 'blur' }
+ ],
+ actTime : [
+ { required: true, message: '请选择日期', trigger: 'change' }
+ ],
+ wmkcjjh : [
+ { required: true, message: '请输入1到10的数字', trigger: 'blur' }
+ ],
+ dhycjfs : [
+ { required: true, message: '请输入1到200的数字', trigger: 'blur' }
+ ],
+ jfdhcs : [
+ { required: true, message: '请输入1到10的数字', trigger: 'blur' }
+ ],
+ zzjcs : [
+ { required: true, message: '请输入1到100的数字', trigger: 'blur' }
+ ],
+ zzjl : [
+ { required: true, message: '请输入1到100的数字', trigger: 'blur' }
+ ],
+ ruleExplain : [
+ { required: true, message: '请输入规则内容', trigger: 'blur' }
+ ]
+ },
+ },
+ created: function () {
+ this.loadInfo();
+ },
+ methods: {
+ //选择优惠券
+ chooseCoupon(val,name){
+ let _this = this;
+ _this.drawerCoupon = true;
+ _this.activeClickTab = parseInt(name);
+
+ console.log(_this.activeClickTab);
+ _this.formCoupon.yhjmc = val;
+ _this.loadCouponList();
+ },
+ //--优惠券
+ loadCouponList() {
+ let _this = this;
+ let data=_this.getRequestParamCoupon();
+ data.pageSize=_this.couponList.pageSize;
+ data.pageNum=_this.couponList.currentPage;
+ AjaxProxy.requst({
+ app: _this,
+ data:data,
+ url: basePath + '/admin/activitySignAwardSet/selectCouponList',
+ callback: function (data) {
+ _this.couponList.rows = data.rows;
+ _this.couponList.total = data.total;
+ }
+ });
+ },
+ //查询参数
+ getRequestParamCoupon(){
+ let _this = this;
+ return {
+ yhjmc:_this.formCoupon.yhjmc,
+ order:_this.formCoupon.order,
+ sort:_this.formCoupon.sort,
+ }
+ },
+ //查询
+ searchFormCoupon:function(){
+ this.couponList.currentPage=1;
+ this.loadCouponList();
+ },
+ //重置
+ resetFormCoupon(formName) {
+ (this.$refs[formName])[0].resetFields();
+ },
+ changePageSizeCoupon(val) {
+ this.couponList.pageSize = val;
+ this.loadCouponList();
+ },
+ changeCurrentPageCoupon(val) {
+ this.couponList.currentPage = val;
+ this.loadCouponList();
+ },
+ //选择
+ chooseOneCoupon(row) {
+ let _this = this;
+ _this.editableTabs[_this.activeClickTab-1].content.couponId = row.id;
+ _this.editableTabs[_this.activeClickTab-1].content.couponName = row.cname;
+ _this.drawerCoupon = false;
+ },
+
+ //选择品项
+ chooseGoods(val,name){
+ let _this = this;
+ _this.drawerGoods = true;
+ _this.activeClickTab = parseInt(name);
+ _this.formGoods.cpmc = val;
+ _this.loadGoodsList();
+ },
+ //--品项
+ loadGoodsList() {
+ let _this = this;
+ let data=_this.getRequestParamGoods();
+ data.pageSize=_this.goodsList.pageSize;
+ data.pageNum=_this.goodsList.currentPage;
+ AjaxProxy.requst({
+ app: _this,
+ data:data,
+ url: basePath + '/admin/activitySignAwardSet/selectGoodsList',
+ callback: function (data) {
+ _this.goodsList.rows = data.rows;
+ _this.goodsList.total = data.total;
+ }
+ });
+ },
+ //查询参数
+ getRequestParamGoods(){
+ let _this = this;
+ return {
+ cpmc:_this.formCoupon.cpmc,
+ order:_this.formCoupon.order,
+ sort:_this.formCoupon.sort,
+ }
+ },
+ //查询
+ searchFormGoods:function(){
+ this.goodsList.currentPage=1;
+ this.loadGoodsList();
+ },
+ //重置
+ resetFormGoods(formName) {
+ (this.$refs[formName])[0].resetFields();
+ },
+ changePageSizeGoods(val) {
+ this.goodsList.pageSize = val;
+ this.loadGoodsList();
+ },
+ changeCurrentPageGoods(val) {
+ this.goodsList.currentPage = val;
+ this.loadGoodsList();
+ },
+ //选择
+ chooseOneGoods(row) {
+ let _this = this;
+ _this.editableTabs[_this.activeClickTab-1].content.goodsId = row.id;
+ _this.editableTabs[_this.activeClickTab-1].content.goodsName = row.name;
+ _this.drawerGoods = false;
+ },
+
+ //加载活动详情
+ loadInfo() {
+ let _this = this;
+ _this.loadSign();
+ },
+ loadSign() {
+ let _this = this;
+ let data={
+ actId:actId,
+ };
+ AjaxProxy.requst({
+ app: _this,
+ data:data,
+ url: basePath + '/admin/activitySignAwardSet/findLuckyDrawForUpdate',
+ callback: function (data) {
+ _this.ruleForm.actName = data.mapInfo.addLuckyDrawSetVo.actName;
+ _this.ruleForm.actCode = data.mapInfo.addLuckyDrawSetVo.actCode;
+ let arrayObj = new Array();
+ arrayObj.push(new Date(data.mapInfo.addLuckyDrawSetVo.beginTime));
+ arrayObj.push(new Date(data.mapInfo.addLuckyDrawSetVo.endTime));
+ _this.ruleForm.actTime = arrayObj;
+ //抽奖规则
+ _this.ruleForm.wmkcjjh = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.wmkcjjh;
+ _this.ruleForm.dhycjfs = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.dhycjfs;
+ _this.ruleForm.jfdhcs = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.jfdhcs;
+ _this.ruleForm.zzjcs = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.zzjcs;
+ _this.ruleForm.zzjl = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.zzjl;
+ //字体颜色
+ _this.ruleForm.ruleExplain = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.ruleExplain;
+ _this.typographyColor = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.typographyColor;
+ _this.backgroundColor = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.backgroundColor;
+ _this.typographyNum = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.typographyNum;
+ _this.typographyLight = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.typographyLight;
+ _this.imageUrlTitle = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.imageUrlTitle;
+ _this.imageUrlHead = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.imageUrlHead;
+ _this.imageUrlButton = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.imageUrlButton;
+ _this.imageUrlState = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.imageUrlState;
+ _this.imageLine = data.mapInfo.addLuckyDrawSetVo.luckyDrawBasicJsonVo.imageLine;
+
+ for (let i = 0; i < data.mapInfo.addLuckyDrawSetVo.activityluckyDrawSets.length; i++) {
+ _this.tabIndex = data.mapInfo.addLuckyDrawSetVo.activityluckyDrawSets.length;
+ let prizeVo = data.mapInfo.addLuckyDrawSetVo.activityluckyDrawSets[i];
+ let arrayObjs = new Array();
+ arrayObjs.push(new Date(prizeVo.prizeStartTime));
+ arrayObjs.push(new Date(prizeVo.prizeEndTime));
+ let content = JSON.parse(JSON.stringify(prize));
+ content = {
+ id: prizeVo.id,
+ cumulativeDay: prizeVo.cumulativeDay,
+ awardType: parseInt(prizeVo.awardType),
+ awardName: prizeVo.awardName,
+ introduceImg: prizeVo.introduceImg,
+ customerPhone: prizeVo.customerPhone,
+ introduceTip: prizeVo.introduceTip,
+ awardInventoryCnt: prizeVo.awardInventoryCnt,
+ awardDistributeCnt: prizeVo.awardDistributeCnt,
+ awardWay: parseInt(prizeVo.awardWay),
+ operationTip: prizeVo.operationTip,
+ prizeAddress: prizeVo.prizeAddress,
+ wechatImg: prizeVo.wechatImg,
+ scoreCnt: prizeVo.scoreCnt,
+ couponId: prizeVo.couponId,
+ goodsId: prizeVo.goodsId,
+ couponName: prizeVo.couponName,
+ goodsName: prizeVo.goodsName,
+ prizeTime: arrayObjs,
+ }
+ if(i === 0){
+ _this.editableTabs[0].content = content;
+ }else{
+ let newTabName = i+1 +'';
+ _this.editableTabs.push({
+ title: "商品奖励"+"("+newTabName+")",
+ name: newTabName,
+ content: content,
+ });
+ this.editableTabsValue = newTabName;
+ }
+ }
+ }
+ });
+ },
+ //保存
+ updateSignAwardSet : function(formName) {
+ const _this = this;
+ let flag = false;
+ _this.$refs[formName].validate((valid) => {
+ if (!valid) {
+ _this.$notify({
+ title: '提示',
+ message: '请完善转盘抽奖活动信息',
+ type: 'warning'
+ });
+ flag = true;
+ return;
+ }
+ });
+ if (flag) {
+ return;
+ }
+ //活动基本信息
+ let luckyDrawBasicJsonDto = {
+ ruleExplain: _this.ruleForm.ruleExplain,
+ //字体颜色
+ typographyColor: _this.typographyColor,
+ //背景颜色
+ backgroundColor: _this.backgroundColor,
+ //字体大小
+ typographyNum: _this.typographyNum,
+ //标题图片
+ imageUrlTitle: _this.imageUrlTitle,
+ imageLine: _this.imageLine,
+ imageUrlHead: _this.imageUrlHead,
+ imageUrlButton: _this.imageUrlButton,
+ //抽奖规则
+ wmkcjjh: _this.ruleForm.wmkcjjh,
+ dhycjfs: _this.ruleForm.dhycjfs,
+ jfdhcs: _this.ruleForm.jfdhcs,
+ zzjcs: _this.ruleForm.zzjcs,
+ zzjl: _this.ruleForm.zzjl,
+ }
+ //奖品信息
+ let activityAwardSets = [];
+ for (let i = 0; i < _this.editableTabs.length; i++) {
+ let prize = _this.editableTabs[i].content;
+ let name = _this.editableTabs[i].title;
+ let awardRule = 2;
+ if(name == "谢谢参与"){
+ awardRule = 1;
+ }
+ let activitySignAwardSet = {
+ id: prize.id,
+ cumulativeDay: prize.cumulativeDay,
+ awardRule: awardRule,
+ awardType: prize.awardType,
+ awardName: prize.awardName,
+ introduceImg: prize.introduceImg,
+ introduceTip: prize.introduceTip,
+ awardInventoryCnt: prize.awardInventoryCnt,
+ awardDistributeCnt: prize.awardDistributeCnt,
+ awardWay: prize.awardWay,
+ operationTip: prize.operationTip,
+ customerPhone: prize.customerPhone,
+ prizeAddress: prize.prizeAddress,
+ wechatImg: prize.wechatImg,
+ scoreCnt: prize.scoreCnt,
+ couponId: prize.couponId,
+ goodsId: prize.goodsId,
+ couponName: prize.couponName,
+ goodsName: prize.goodsName,
+ prizeStartTime: prize.prizeTime[0],
+ prizeEndTime: prize.prizeTime[1],
+ }
+ activityAwardSets.push(activitySignAwardSet);
+ }
+ let resultData = {
+ actMainId: actId,
+ actName: _this.ruleForm.actName,
+ actCode: _this.ruleForm.actCode,
+ beginTime : _this.ruleForm.actTime[0],
+ endTime : _this.ruleForm.actTime[1],
+ luckyDrawBasicJsonDto,
+ activityAwardSets,
+ }
+ AjaxProxy.requst({
+ app: _this,
+ data: resultData,
+ url: basePath + '/admin/activitySignAwardSet/updateLuckyDrawSet',
+ callback: function (data) {
+ _this.$message({
+ message: data.info,
+ type: 'success',
+ });
+ }
+ });
+ },
+ //奖品设置
+ addTab(targetName) {
+ let newTabName = ++this.tabIndex + '';
+ this.editableTabs.push({
+ title: "转盘奖品"+"("+newTabName+")",
+ name: newTabName,
+ content: JSON.parse(JSON.stringify(prize)),
+ });
+ this.editableTabsValue = newTabName;
+ this.activeClickTab = parseInt(newTabName);
+ },
+ clickSecondTab(targetName) {
+ this.activeClickTab = 1;
+ },
+ clickTab(targetName) {
+ console.log(targetName.name);
+ this.activeClickTab = parseInt(targetName.name);
+ },
+ removeTab(targetName) {
+ let tabs = this.editableTabs;
+ let activeName = this.editableTabsValue;
+ if(activeName === '1' || targetName === '1'){
+ this.$notify({
+ title: '提示',
+ message: '【谢谢参与】不能删除',
+ type: 'warning'
+ });
+ }else{
+ if (activeName === targetName) {
+ tabs.forEach((tab, index) => {
+ if (tab.name === targetName && tab.title !== "谢谢参与") {
+ let nextTab = tabs[index + 1] || tabs[index - 1];
+ if (nextTab) {
+ activeName = nextTab.name;
+ }
+ }
+ });
+ }
+ this.editableTabsValue = activeName;
+ this.editableTabs = tabs.filter(tab => tab.name !== targetName);
+ this.tabIndex = this.editableTabs.length;
+ }
+ },
+ //切换奖项类型,显示不同内容
+ jxlxChange(val){
+ let _this = this;
+ _this.isShow=val;
+ },
+ //切换兑奖方式,显示不同内容
+ awardWayChange(val){
+ let _this = this;
+ _this.isShow=val;
+ },
+ //跳转到图片上传
+ uploadImg(){
+ this.activeName = 'third';
+ },
+ //跳转到规则说明
+ gzsmSet(){
+ this.activeName = 'fourth';
+ },
+ //标题图片
+ imageUrlTitleSuccess(res, file) {
+ this.imageUrlTitle = res.path;
+ },
+ imageLineSuccess(res, file) {
+ this.imageLine = res.path;
+ },
+ imageUrlHeadSuccess(res, file) {
+ this.imageUrlHead = res.path;
+ },
+ imageUrlButtonSuccess(res, file) {
+ this.imageUrlButton = res.path;
+ },
+ //奖品设置的图片介绍
+ introduceImgSuccess(res, file) {
+ this.editableTabs[this.activeClickTab-1].content.introduceImg = res.path;
+ },
+ //奖品设置的客服微信
+ wechatImgSuccess(res, file) {
+ this.editableTabs[this.activeClickTab-1].content.wechatImg = res.path;
+ },
+ cancelSubmit() {
+ this.closeFrame();
+ },
+ closeFrame() {
+ parent.layer.close(parent.layer.getFrameIndex(window.name));
+ },
+ }
+ })
+</script>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-luckyDraw.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-luckyDraw.html
new file mode 100644
index 0000000..b8c948a
--- /dev/null
+++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-luckyDraw.html
@@ -0,0 +1,1027 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
+<head>
+ <meta charset="utf-8">
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <meta name="renderer" content="webkit|ie-comp|ie-stand">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport"
+ content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
+ <meta http-equiv="Cache-Control" content="no-siteapp"/>
+ <!-- 本框架基本脚本和样式 -->
+ <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script>
+ <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">
+ <link rel="stylesheet" th:href="@{/plugin/bootstrap-3.3.5/css/bootstrap.min.css}">
+ <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/>
+
+ <!-- 富文本编辑器 -->
+ <script type="text/javascript" charset="utf-8"
+ th:src="@{/plugin/beditor/ueditor.config.js}"></script>
+ <script type="text/javascript" charset="utf-8"
+ th:src="@{/plugin/beditor/ueditor.all.js}">
+ </script>
+ <script type="text/javascript" charset="utf-8"
+ th:src="@{/plugin/beditor/lang/zh-cn/zh-cn.js}"></script>
+ <style>
+
+ .paginationStyle{
+ background: #ffffff;
+ padding: 10px 10px;
+ margin: 0px 0px 10px 0px;
+ text-align: right;
+ }
+
+ .el-aside {
+ background-color: #D3DCE6;
+ color: #333;
+ text-align: center;
+ }
+ .el-main {
+ background-color: #E9EEF3;
+ color: #333;
+ }
+ body > .el-container {
+ margin-bottom: 1000px;
+ }
+ .button {
+ padding: 5px;
+ text-align: center;
+ }
+
+ .imageOne {
+ display: block;
+ height: 50px;
+ padding: 5px 5px;
+ text-align: center;
+ }
+ .imageTwo {
+ display: block;
+ height: 280px;
+ padding: 5px 5px;
+ text-align: center;
+ }
+ .imageThree {
+ display: block;
+ padding: 5px 5px;
+ text-align: center;
+ }
+
+ .box-card {
+ padding: 5px 5px;
+ }
+
+ </style>
+</head>
+
+<body>
+<div class="panel-body" id="app" v-cloak>
+ <el-form :model="ruleForm" :rules="rules" class="form-horizontal" id="dataform" ref="ruleForm" label-width="120px">
+
+ <el-container>
+ <el-aside width="30%">
+ <el-card class="box-card" :body-style="{ padding: '10px 10px'}">
+ <el-row>
+ <div @click="uploadImg()" class="imageTwo" >
+ <img v-if="imageUrlHead" :src="imageUrlHead" style="width: 100%;height: 100%">
+ <el-button type="primary" v-show="imageUrlHead == ''" round><span style="font-size: 20px;">头部</span><span style="padding:5px;font-size: 15px;color: red;">(上传图片)</span></span></el-button>
+ </div>
+ </el-row>
+ <el-row style="display:flex;">
+ <el-col>
+ <div style="padding:5px;font-size: 15px;text-align: left;">
+ <el-button type="primary" size="mini" round>
+ <span>拥有积分:</span>
+ </el-button>
+ </div>
+ </el-col>
+ </el-row>
+
+ <el-row>
+ <div @click="uploadImg()" class="imageThree" >
+ <el-button type="primary" v-show="imageUrlButton == ''" round><span style="font-size: 20px;">签到按钮</span><span style="padding:5px;font-size: 15px;color: red;">(上传图片)</span></span></el-button>
+ <img v-if="imageUrlButton" :src="imageUrlButton" style="width: 100%;">
+ </div>
+ </el-row>
+
+
+ <el-row>
+ <div style="text-align: center;padding: 5px;" @click="gzsmSet()">
+ <div class="col-sm-8 col-sm-offset-2" style="text-align: left;">
+ <span style="padding:5px;font-size: 30px;">-- 规则说明--</span>
+ </div>
+ <div class="el-col-sm-24" style="text-align: center;">
+ <span style="padding:5px;font-size: 15px;color: red;">(点击,编辑规则内容,背景颜色,字体颜色、大小、透明度)</span>
+ </div>
+ <div class="col-sm-8 col-sm-offset-2" style="text-align: left;">
+ <span style="padding:5px;font-size: 15px;">1、每天参与签到可获得积分换取抽奖机会</span>
+ </div>
+ <div class="col-sm-8 col-sm-offset-2" style="text-align: left;">
+ <span style="padding:5px;font-size: 15px;">2、每天参与签到可获得积分换取抽奖机会</span>
+ </div>
+ <div class="col-sm-8 col-sm-offset-2" style="text-align: left;">
+ <span style="padding:5px;font-size: 15px;">3、每天参与签到可获得积分换取抽奖机会</span>
+ </div>
+ </div>
+ </el-row>
+ </el-card>
+ </el-aside>
+
+ <el-main width="70%">
+ <div>
+ <el-tabs v-model="activeName" @tab-click="clickSecondTab">
+ <el-tab-pane label="活动设置" name="first">
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="活动名称" prop="actName">
+ <el-input v-model="ruleForm.actName" placeholder="请输入活动名称"></el-input>
+ </el-form-item>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="活动编码" prop="actCode">
+ <el-input v-model.number="ruleForm.actCode" placeholder="请输入最大开团数量"></el-input>
+ </el-form-item>
+ </div>
+ <div class="col-sm-4 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="活动时间" prop="actTime">
+ <div class="block">
+ <el-date-picker
+ v-model="ruleForm.actTime"
+ type="daterange"
+ range-separator="至"
+ start-placeholder="开始日期"
+ end-placeholder="结束日期">
+ </el-date-picker>
+ </div>
+ </el-form-item>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <p class="el-big-title" style="text-align: left;">抽奖规则</p>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="每日抽奖机会">
+ <el-form-item label="每人每日有" prop="wmkcjjh">
+ <el-input-number v-model="ruleForm.wmkcjjh" :min="1" :max="10" label="描述文字"></el-input-number> 次无门槛抽奖机会
+ </el-form-item>
+ </el-form-item>
+ <el-form-item>
+ <el-form-item label="可用" prop="dhycjfs">
+ <el-input-number v-model="ruleForm.dhycjfs" :min="1" :max="200" label="描述文字"></el-input-number> 积分兑换1次抽奖机会,每日最多兑换
+ </el-form-item>
+ </el-form-item>
+ <el-form-item>
+ <el-form-item label="每日最多兑换" prop="jfdhcs">
+ <el-input-number v-model="ruleForm.jfdhcs" :min="1" :max="10" label="描述文字"></el-input-number> 次抽奖机会
+ </el-form-item>
+ </el-form-item>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="中奖概率">
+ <el-form-item label="每人最多中奖" prop="zzjcs">
+ <el-input-number v-model="ruleForm.zzjcs" :min="1" :max="100" label="描述文字"></el-input-number> 次
+ </el-form-item>
+ </el-form-item>
+ <el-form-item>
+ <el-form-item label="总中奖率" prop="zzjl">
+ <el-input-number v-model="ruleForm.zzjl" :min="1" :max="100" label="描述文字"></el-input-number> %
+ </el-form-item>
+ </el-form-item>
+ </div>
+ </el-tab-pane>
+
+ <el-tab-pane label="奖品设置" name="second">
+ <el-row style="display:flex;">
+ <el-col :span="20">
+ <el-tabs v-model="editableTabsValue" type="card" closable @tab-click="clickTab" @tab-remove="removeTab">
+ <el-tab-pane v-for="(item, index) in editableTabs" :key="item.name" :label="item.title" :name="item.name">
+ <el-row v-show="editableTabsValue !== '1'">
+ </el-row>
+ <el-row >
+ <el-col>
+ <el-form-item label="奖项名称">
+ <el-input v-model="item.content.awardName" placeholder="奖项名称"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row >
+ <el-col>
+ <el-form-item label="图片介绍">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="introduceImgSuccess">
+ <img v-if="item.content.introduceImg" :src="item.content.introduceImg" style="max-width: 200px;">
+ </el-upload>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <div v-show="item.name !== '1'">
+ <el-row>
+ <el-form-item label="奖项类型">
+ <el-col>
+ <el-radio-group v-model="item.content.awardType" @change="jxlxChange">
+ <el-radio :label="'1'">自定义奖品</el-radio>
+ <el-radio :label="'2'">积分</el-radio>
+ <el-radio :label="'3'">优惠券</el-radio>
+ <el-radio :label="'4'">商品</el-radio>
+ </el-radio-group>
+ </el-col>
+ </el-form-item >
+ </el-row>
+
+ <div>
+ <el-row style="display:flex;">
+ <el-col>
+ <el-form-item label="奖项库存">
+ <el-input v-model="item.content.awardInventoryCnt" oninput ="value=value.replace(/[^0-9.]/g,'')"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col>
+ <el-form-item label="已派发">
+ <el-input v-model="item.content.awardDistributeCnt"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ <div v-show="item.content.awardType === '1'">
+ <el-row >
+ <el-col>
+ <el-form-item label="文字介绍">
+ <el-input type="textarea" v-model="item.content.introduceTip"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row >
+ <el-col>
+ <el-form-item label="兑奖方式">
+ <el-col>
+ <el-radio-group v-model="item.content.awardWay" @change="awardWayChange">
+ <el-radio :label="'1'">线下兑换</el-radio>
+ <el-radio :label="'2'">物流配送</el-radio>
+ <el-radio :label="'3'">客服兑换</el-radio>
+ </el-radio-group>
+ </el-col>
+ </el-form-item >
+ </el-col>
+ </el-row>
+ <el-row >
+ <el-col>
+ <el-form-item label="操作提示">
+ <el-input v-model="item.content.operationTip"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <div v-show="item.content.awardWay === '1'">
+ <el-row >
+ <el-col>
+ <el-form-item label="兑奖地址">
+ <el-input v-model="item.content.prizeAddress"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+
+ </div>
+ <div v-show="item.content.awardWay === '3'">
+ <el-row >
+ <el-col>
+ <el-form-item label="客服微信">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="wechatImgSuccess">
+ <img v-if="item.content.wechatImg" :src="item.content.wechatImg" style="max-width: 200px;">
+ </el-upload>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ <div v-show="[1,3].includes(item.content.awardWay)">
+ <el-row >
+ <el-col>
+ <el-form-item label="客服电话">
+ <el-input v-model="item.content.customerPhone"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ <div v-show="item.content.awardWay !== '2'">
+ <el-row >
+ <el-col>
+ <el-form-item label="兑奖期限">
+ <div class="block">
+ <el-date-picker
+ v-model="item.content.prizeTime"
+ type="daterange"
+ range-separator="至"
+ start-placeholder="开始日期"
+ end-placeholder="结束日期">
+ </el-date-picker>
+ </div>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ </div>
+ <div v-show="item.content.awardType === '2'">
+ <el-row >
+ <el-col>
+ <el-form-item label="积分数量">
+ <el-input v-model="item.content.scoreCnt" oninput ="value=value.replace(/[^0-9.]/g,'')"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ <div v-show="item.content.awardType === '3'">
+ <el-row style="display:flex;">
+ <el-col>
+ <el-form-item label="优惠券名称">
+ <el-input v-model="item.content.couponName"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col>
+ <el-form-item label="优惠券">
+ <el-input v-model="item.content.couponId"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col>
+ <el-button type="primary" @click="chooseCoupon(item.content.couponName,item.name)">
+ 选择优惠券
+ </el-button>
+ </el-col>
+ </el-row>
+
+ <el-drawer
+ title="选择商城优惠券"
+ :visible.sync="drawerCoupon"
+ :direction="directionCoupon"
+ size="90%">
+ <el-row style="margin-left: 50px;">
+ <el-col :span="24">
+ <el-row>
+ <el-form ref="formCoupon" :model="formCoupon" inline >
+ <el-form-item prop="yhjmc">
+ <el-input v-model="formCoupon.yhjmc" placeholder="请输入优惠券名称"></el-input>
+ </el-form-item>
+ <el-button type="primary" @click="searchFormCoupon" >搜索</el-button>
+ <el-button @click="resetFormCoupon('formCoupon')">重置</el-button>
+ </el-form>
+ </el-row>
+
+ <el-row class="table-style" >
+ <el-table ref="multipleTable"
+ :data="couponList.rows"
+ :height="tableHeightCoupon"
+ stripe:true
+ style="width: 100%">
+ <el-table-column
+ prop="cname"
+ label="优惠券名称"
+ show-overflow-tooltip>
+ </el-table-column>
+ <el-table-column
+ prop="endTime"
+ label="截止日期"
+ show-overflow-tooltip>
+ </el-table-column>
+ <el-table-column
+ prop="address"
+ label="操作">
+ <template slot-scope="scope">
+ <el-button type="primary"
+ size="mini"
+ @click="chooseOneCoupon(scope.row)">选择
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-row>
+ <el-row class="paginationStyle" >
+ <el-pagination background
+ @size-change="changePageSizeCoupon"
+ @current-change="changeCurrentPageCoupon"
+ :current-page="couponList.currentPage"
+ :page-sizes="[10, 20, 30, 50]"
+ :page-size="couponList.pageSize"
+ layout="total, sizes, prev, pager, next, jumper"
+ :total="couponList.total">
+ </el-pagination>
+ </el-row>
+ </el-col>
+ </el-row>
+ </el-drawer>
+ </div>
+ <div v-show="item.content.awardType === '4'">
+ <el-row style="display:flex;">
+ <el-col>
+ <el-form-item label="品项名称">
+ <el-input v-model="item.content.goodsName"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col>
+ <el-form-item label="品项">
+ <el-input v-model="item.content.goodsId"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col>
+ <el-button type="primary" @click="chooseGoods(item.content.goodsName,item.name)">
+ 选择品项
+ </el-button>
+ </el-col>
+ </el-row>
+
+ <el-drawer
+ title="选择ERP产品"
+ :visible.sync="drawerGoods"
+ :direction="directionGoods"
+ size="90%">
+ <el-row style="margin-left: 50px;">
+ <el-col :span="24">
+ <el-row>
+ <el-form ref="formGoods" :model="formGoods" inline >
+ <el-form-item prop="cpmc">
+ <el-input v-model="formGoods.cpmc" placeholder="请输入产品名称"></el-input>
+ </el-form-item>
+ <el-button type="primary" @click="searchFormGoods" >搜索</el-button>
+ <el-button @click="resetFormGoods('formGoods')">重置</el-button>
+ </el-form>
+ </el-row>
+
+ <el-row class="table-style" >
+ <el-table ref="multipleTable"
+ :data="goodsList.rows"
+ :height="tableHeightGoods"
+ stripe:true
+ style="width: 100%">
+ <el-table-column
+ prop="name"
+ label="名称"
+ show-overflow-tooltip>
+ </el-table-column>
+ <el-table-column
+ prop="address"
+ label="操作">
+ <template slot-scope="scope">
+ <el-button type="primary"
+ size="mini"
+ @click="chooseOneGoods(scope.row)">选择
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-row>
+ <el-row class="paginationStyle" >
+ <el-pagination background
+ @size-change="changePageSizeGoods"
+ @current-change="changeCurrentPageGoods"
+ :current-page="goodsList.currentPage"
+ :page-sizes="[10, 20, 30, 50]"
+ :page-size="goodsList.pageSize"
+ layout="total, sizes, prev, pager, next, jumper"
+ :total="goodsList.total">
+ </el-pagination>
+ </el-row>
+ </el-col>
+ </el-row>
+ </el-drawer>
+ </div>
+ </div>
+ </el-tab-pane>
+ </el-tabs>
+ </el-col>
+ <el-col :span="4">
+ <el-button type="primary" @click="addTab(editableTabsValue)">
+ 新增奖品
+ </el-button>
+ </el-col>
+ </el-row>
+ </el-tab-pane>
+
+ <el-tab-pane label="背景图片上传" name="third">
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="头部">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="imageUrlHeadSuccess">
+ <img v-if="imageUrlHead" :src="imageUrlHead" style="max-width: 300px;">
+ </el-upload>
+ </el-form-item>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="开始按钮">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="imageUrlTitleSuccess">
+ <img v-if="imageUrlTitle" :src="imageUrlTitle" style="max-width: 300px;">
+ </el-upload>
+ </el-form-item>
+ </div>
+ <div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="奖品划分线">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="imageLineSuccess">
+ <img v-if="imageLine" :src="imageLine" style="max-width: 300px;">
+ </el-upload>
+ </el-form-item>
+ </div>
+
+ <!--<div class="col-sm-8 col-sm-offset-1" style="padding: 10px">
+ <el-form-item label="转盘背景">
+ <el-upload
+ action="/admin/multipleUploadFile/doUpload"
+ :show-file-list="false"
+ :on-success="imageUrlButtonSuccess">
+ <img v-if="imageUrlButton" :src="imageUrlButton" style="max-width: 300px;">
+ <i v-else></i>
+ </el-upload>
+ </el-form-item>
+ </div>-->
+ </el-tab-pane>
+
+ <el-tab-pane label="规则说明" name="fourth">
+ <div class="col-sm-8 col-sm-offset-1">
+ <el-form-item label="规则内容" prop="ruleExplain" style="padding: 10px">
+ <el-input type="textarea" v-model="ruleForm.ruleExplain"></el-input>
+ </el-form-item>
+ <el-form-item label="背景颜色" style="padding: 10px">
+ <el-color-picker v-model="backgroundColor"></el-color-picker>
+ </el-form-item>
+ <el-form-item label="字体颜色" style="padding: 10px">
+ <el-color-picker v-model="typographyColor"></el-color-picker>
+ </el-form-item>
+ <el-form-item label="字体大小" style="padding: 10px">
+ <el-input-number v-model="typographyNum" :min="10" :max="50" label="描述文字"></el-input-number>
+ </el-form-item>
+ <!--<el-form-item label="字体透明度" style="padding: 10px">
+ <el-input-number v-model="typographyLight" :min="1" :max="100" label="描述文字">%</el-input-number>
+ </el-form-item>-->
+ </div>
+ </el-tab-pane>
+ </el-tabs>
+ </div>
+
+ <div class="form-group ">
+ <div class="col-sm-12 text-center">
+ <el-button type="primary" @click="dataSubmit('ruleForm')">保存</el-button>
+ <el-button type="danger" @click="cancelSubmit">关闭</el-button>
+ </div>
+ </div>
+ </el-main>
+
+ </el-container>
+
+ </el-form>
+</div>
+</body>
+<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/bootstrap-3.3.5/js/bootstrap.min.js}"></script>
+<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
+<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
+
+<script>
+ //获取传输的活动对象
+ var actId = $.query.get("actId");
+ const prize = {
+ //奖品基本信息
+ awardType:'1',
+ awardName:'',
+ introduceImg:'',
+ introduceTip:'',
+ awardInventoryCnt:'',
+ awardDistributeCnt:'',
+ awardWay:'1',
+ operationTip:'',
+ prizeAddress:'',
+ prizeTime: '',
+ wechatImg:'',
+ scoreCnt:'',
+ couponId:'',
+ goodsId:'',
+ couponName:'',
+ customerPhone:'',
+ goodsName:'',
+ }
+ var app = new Vue({
+ el: '#app',
+ data: {
+ activeName: 'first',
+ formLabelWidth: '120px',
+
+ activeClickTab:0,
+ //优惠券搜索弹出
+ drawerCoupon: false,
+ directionCoupon: 'rtl',
+ tableHeightCoupon: 500,
+ //--优惠券
+ formCoupon:{
+ yhjmc:'',
+ order:'',
+ sort:''
+ },
+ couponList:{
+ rows:[],
+ total:0,
+ pageSize:10,
+ currentPage:1,
+ },
+
+ //品项搜索弹出
+ drawerGoods: false,
+ directionGoods: 'rtl',
+ tableHeightGoods: 500,
+ //--品项
+ formGoods:{
+ cpmc:'',
+ order:'',
+ sort:''
+ },
+ goodsList:{
+ rows:[],
+ total:0,
+ pageSize:10,
+ currentPage:1,
+ },
+
+ //标题图片
+ imageLine: "../../../images/luckyDraw/line.png",
+ imageUrlTitle: "../../../images/luckyDraw/start.png",
+ imageUrlButton: "",
+ imageUrlHead: "../../../images/luckyDraw/zhuanpan.png",
+
+ //字体颜色
+ typographyColor: '#409EFF',
+ //背景颜色
+ backgroundColor: '#409EFF',
+ //字体大小
+ typographyNum: '5',
+ //字体透明度
+ typographyLight: '50',
+ //奖品设置
+ prize:JSON.parse(JSON.stringify(prize)),
+ editableTabsValue: '1',
+ editableTabs: [{
+ title: '谢谢参与',
+ name: '1',
+ content: JSON.parse(JSON.stringify(prize))
+ }],
+ tabIndex: 1,
+
+ ruleForm : {
+ //商品基本信息
+ actName : '',
+ actCode : '',
+ actTime : '',
+ //抽奖规则
+ wmkcjjh : '5',
+ dhycjfs : '20',
+ jfdhcs : '10',
+ zzjcs : '5',
+ zzjl : '10',
+
+ //规则说明
+ ruleExplain : '',
+ },
+ rules : {
+ //商品基本信息
+ actName : [
+ { required: true, message: '请输入活动名称', trigger: 'blur' }
+ ],
+ actCode : [
+ { required: true, message: '请输入活动编码', trigger: 'blur' }
+ ],
+ actTime : [
+ { required: true, message: '请选择日期', trigger: 'change' }
+ ],
+ wmkcjjh : [
+ { required: true, message: '请输入1到10的数字', trigger: 'blur' }
+ ],
+ dhycjfs : [
+ { required: true, message: '请输入1到200的数字', trigger: 'blur' }
+ ],
+ jfdhcs : [
+ { required: true, message: '请输入1到10的数字', trigger: 'blur' }
+ ],
+ zzjcs : [
+ { required: true, message: '请输入1到100的数字', trigger: 'blur' }
+ ],
+ zzjl : [
+ { required: true, message: '请输入1到100的数字', trigger: 'blur' }
+ ],
+ ruleExplain : [
+ { required: true, message: '请输入规则内容', trigger: 'blur' }
+ ]
+ },
+ },
+ created: function () {
+ },
+ methods: {
+ //选择优惠券
+ chooseCoupon(val,name){
+ let _this = this;
+ _this.drawerCoupon = true;
+ _this.activeClickTab = parseInt(name);
+ _this.formCoupon.yhjmc = val;
+ _this.loadCouponList();
+ },
+ //--优惠券
+ loadCouponList() {
+ let _this = this;
+ let data=_this.getRequestParamCoupon();
+ data.pageSize=_this.couponList.pageSize;
+ data.pageNum=_this.couponList.currentPage;
+ AjaxProxy.requst({
+ app: _this,
+ data:data,
+ url: basePath + '/admin/activitySignAwardSet/selectCouponList',
+ callback: function (data) {
+ _this.couponList.rows = data.rows;
+ _this.couponList.total = data.total;
+ }
+ });
+ },
+ //查询参数
+ getRequestParamCoupon(){
+ let _this = this;
+ return {
+ yhjmc:_this.formCoupon.yhjmc,
+ order:_this.formCoupon.order,
+ sort:_this.formCoupon.sort,
+ }
+ },
+ //查询
+ searchFormCoupon:function(){
+ this.couponList.currentPage=1;
+ this.loadCouponList();
+ },
+ //重置
+ resetFormCoupon(formName) {
+ // this.formCoupon.yhjmc = ''
+ // console.log(this.$refs[formName].resetFields)
+ (this.$refs[formName])[0].resetFields();
+ },
+ changePageSizeCoupon(val) {
+ this.couponList.pageSize = val;
+ this.loadCouponList();
+ },
+ changeCurrentPageCoupon(val) {
+ this.couponList.currentPage = val;
+ this.loadCouponList();
+ },
+ //选择
+ chooseOneCoupon(row) {
+ let _this = this;
+ _this.editableTabs[_this.activeClickTab-1].content.couponId = row.id;
+ _this.editableTabs[_this.activeClickTab-1].content.couponName = row.cname;
+ _this.drawerCoupon = false;
+ },
+
+ //选择品项
+ chooseGoods(val,name){
+ let _this = this;
+ _this.drawerGoods = true;
+ _this.activeClickTab = parseInt(name);
+ _this.formGoods.cpmc = val;
+ _this.loadGoodsList();
+ },
+ //--品项
+ loadGoodsList() {
+ let _this = this;
+ let data=_this.getRequestParamGoods();
+ data.pageSize=_this.goodsList.pageSize;
+ data.pageNum=_this.goodsList.currentPage;
+ AjaxProxy.requst({
+ app: _this,
+ data:data,
+ url: basePath + '/admin/activitySignAwardSet/selectGoodsList',
+ callback: function (data) {
+ _this.goodsList.rows = data.rows;
+ _this.goodsList.total = data.total;
+ }
+ });
+ },
+ //查询参数
+ getRequestParamGoods(){
+ let _this = this;
+ return {
+ cpmc:_this.formCoupon.cpmc,
+ order:_this.formCoupon.order,
+ sort:_this.formCoupon.sort,
+ }
+ },
+ //查询
+ searchFormGoods:function(){
+ this.goodsList.currentPage=1;
+ this.loadGoodsList();
+ },
+ //重置
+ resetFormGoods(formName) {
+ (this.$refs[formName])[0].resetFields();
+ },
+ changePageSizeGoods(val) {
+ this.goodsList.pageSize = val;
+ this.loadGoodsList();
+ },
+ changeCurrentPageGoods(val) {
+ this.goodsList.currentPage = val;
+ this.loadGoodsList();
+ },
+ //选择
+ chooseOneGoods(row) {
+ let _this = this;
+ _this.editableTabs[_this.activeClickTab-1].content.goodsId = row.id;
+ _this.editableTabs[_this.activeClickTab-1].content.goodsName = row.name;
+ _this.drawerGoods = false;
+ },
+
+ //保存
+ dataSubmit : function(formName) {
+ const _this = this;
+ let flag = false;
+ _this.$refs[formName].validate((valid) => {
+ if (!valid) {
+ _this.$notify({
+ title: '提示',
+ message: '请完善转盘抽奖活动信息',
+ type: 'warning'
+ });
+ flag = true;
+ return;
+ }
+ });
+ if (flag) {
+ return;
+ }
+ //活动基本信息
+ let luckyDrawBasicJsonDto = {
+ ruleExplain: _this.ruleForm.ruleExplain,
+ //字体颜色
+ typographyColor: _this.typographyColor,
+ //背景颜色
+ backgroundColor: _this.backgroundColor,
+ //字体大小
+ typographyNum: _this.typographyNum,
+ //标题图片
+ imageUrlTitle: _this.imageUrlTitle,
+ imageLine: _this.imageLine,
+ imageUrlHead: _this.imageUrlHead,
+ imageUrlButton: _this.imageUrlButton,
+ //抽奖规则
+ wmkcjjh: _this.ruleForm.wmkcjjh,
+ dhycjfs: _this.ruleForm.dhycjfs,
+ jfdhcs: _this.ruleForm.jfdhcs,
+ zzjcs: _this.ruleForm.zzjcs,
+ zzjl: _this.ruleForm.zzjl,
+ }
+ //奖品信息
+ let luckyDrawAwardSets = [];
+ for (let i = 0; i < _this.editableTabs.length; i++) {
+ let prize = _this.editableTabs[i].content;
+ let name = _this.editableTabs[i].title;
+ let awardRule = 2;
+ if(name == "谢谢参与"){
+ awardRule = 1;
+ }
+ let activitySignAwardSet = {
+ awardRule: awardRule,
+ awardType: prize.awardType,
+ awardName: prize.awardName,
+ introduceImg: prize.introduceImg,
+ introduceTip: prize.introduceTip,
+ awardInventoryCnt: prize.awardInventoryCnt,
+ awardDistributeCnt: prize.awardDistributeCnt,
+ awardWay: prize.awardWay,
+ operationTip: prize.operationTip,
+ prizeAddress: prize.prizeAddress,
+ wechatImg: prize.wechatImg,
+ customerPhone: prize.customerPhone,
+ scoreCnt: prize.scoreCnt,
+ couponId: prize.couponId,
+ goodsId: prize.goodsId,
+ couponName: prize.couponName,
+ goodsName: prize.goodsName,
+ prizeStartTime: prize.prizeTime[0],
+ prizeEndTime: prize.prizeTime[1],
+ }
+ luckyDrawAwardSets.push(activitySignAwardSet);
+ }
+ let resultData = {
+ actName: _this.ruleForm.actName,
+ actCode: _this.ruleForm.actCode,
+ beginTime : _this.ruleForm.actTime[0],
+ endTime : _this.ruleForm.actTime[1],
+ luckyDrawBasicJsonDto,
+ luckyDrawAwardSets,
+ }
+ AjaxProxy.requst({
+ app: _this,
+ data: resultData,
+ url: basePath + '/admin/activitySignAwardSet/addLuckyDrawSet',
+ callback: function (data) {
+ _this.$message({
+ message: data.info,
+ type: 'success',
+ });
+ parent.layer.close(parent.layer.getFrameIndex(window.name));
+ }
+ });
+ },
+ //奖品设置
+ addTab(targetName) {
+ let newTabName = ++this.tabIndex + '';
+ this.editableTabs.push({
+ title: "转盘奖品"+"("+newTabName+")",
+ name: newTabName,
+ content: JSON.parse(JSON.stringify(prize)),
+ });
+ this.editableTabsValue = newTabName;
+ this.activeClickTab = parseInt(newTabName);
+ },
+ clickSecondTab(targetName) {
+ this.activeClickTab = 1;
+ },
+ clickTab(targetName) {
+ console.log(targetName.name);
+ this.activeClickTab = parseInt(targetName.name);
+ },
+ removeTab(targetName) {
+ let tabs = this.editableTabs;
+ let activeName = this.editableTabsValue;
+ if(activeName === '1' || targetName === '1'){
+ this.$notify({
+ title: '提示',
+ message: '【谢谢参与】不能删除',
+ type: 'warning'
+ });
+ }else{
+ if (activeName === targetName) {
+ tabs.forEach((tab, index) => {
+ if (tab.name === targetName && tab.title !== "谢谢参与") {
+ let nextTab = tabs[index + 1] || tabs[index - 1];
+ if (nextTab) {
+ activeName = nextTab.name;
+ }
+ }
+ });
+ }
+ this.editableTabsValue = activeName;
+ this.editableTabs = tabs.filter(tab => tab.name !== targetName);
+ this.tabIndex = this.editableTabs.length;
+ }
+ },
+ //切换奖项类型,显示不同内容
+ jxlxChange(val){
+ let _this = this;
+ _this.isShow=val;
+ },
+ //切换兑奖方式,显示不同内容
+ awardWayChange(val){
+ let _this = this;
+ _this.isShow=val;
+ },
+ //跳转到图片上传
+ uploadImg(){
+ this.activeName = 'third';
+ },
+ //跳转到规则说明
+ gzsmSet(){
+ this.activeName = 'fourth';
+ },
+ //标题图片
+ imageUrlTitleSuccess(res, file) {
+ this.imageUrlTitle = res.path;
+ },
+ imageLineSuccess(res, file) {
+ this.imageLine = res.path;
+ },
+ imageUrlHeadSuccess(res, file) {
+ this.imageUrlHead = res.path;
+ },
+ imageUrlButtonSuccess(res, file) {
+ this.imageUrlButton = res.path;
+ },
+ //奖品设置的图片介绍
+ introduceImgSuccess(res, file) {
+ this.editableTabs[this.activeClickTab-1].content.introduceImg = res.path;
+ },
+ //奖品设置的客服微信
+ wechatImgSuccess(res, file) {
+ this.editableTabs[this.activeClickTab-1].content.wechatImg = res.path;
+ },
+ cancelSubmit() {
+ this.closeFrame();
+ },
+ closeFrame() {
+ parent.layer.close(parent.layer.getFrameIndex(window.name));
+ },
+ }
+ })
+</script>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-market.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-market.html
index f235797..00050a1 100644
--- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-market.html
+++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-market.html
@@ -54,7 +54,7 @@
<body>
<div class="panel-body" id="app" v-cloak>
- <el-row>
+ <el-row style="padding:20px;">
<el-col :span="4">
<el-card class="box-card" :body-style="{ padding: '10px 10px'}">
<img src="../../../images/sign/meiriqiandao.png" class="image">
@@ -100,6 +100,19 @@
</el-card>
</el-col>
</el-row>
+ <el-row style="padding:20px;">
+ <el-col :span="4">
+ <el-card class="box-card" :body-style="{ padding: '10px 10px'}">
+ <img src="../../../images/luckyDraw/zhuanpanchoujian.png" class="image">
+ <div style="padding: 5px;">
+ <span style="padding:5px;font-size: 18px;">转盘抽奖</span>
+ <div class="bottom clearfix">
+ <el-button type="primary" size="mini" class="button" @click="createLuckyDraw()" round>马上创建</el-button>
+ </div>
+ </div>
+ </el-card>
+ </el-col>
+ </el-row>
</div>
</body>
@@ -125,6 +138,25 @@
created: function () {
},
methods: {
+ //跳转到设置转盘抽奖
+ createLuckyDraw(){
+ $.AjaxProxy().invoke(basePath + "/admin/activitySignAwardSet/createLuckyDrawSet", function(loj) {
+ if (loj[0].result.status == '200') {
+ layer.full(layer.open({
+ type: 2,
+ title: "转盘抽奖管理",
+ maxmin: true,
+ area: [MUI.SIZE_L, '500px'],
+ content : [ basePath + '/admin/redirect/activity/activity-luckyDraw']
+ }));
+ }else{
+ _this.$message({
+ message: data.info,
+ type: 'success',
+ });
+ }
+ });
+ },
//跳转到设置签到活动
createSign(){
$.AjaxProxy().invoke(basePath + "/admin/activitySignAwardSet/createSignAwardSet", function(loj) {
@@ -170,7 +202,7 @@
openSalon() {
layer.full(layer.open({
type : 2,
- title : "新建秒杀",
+ title : "新建沙龙",
area : [ MUI.SIZE_L, MUI.SIZE_L ],
maxmin : true,
content : [ basePath+'/admin/redirect/shop/activities/activitiesSalon-form']
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html
new file mode 100644
index 0000000..c82e927
--- /dev/null
+++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/products/achieverule-list.html
@@ -0,0 +1,402 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
+<head>
+ <meta charset="utf-8">
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <meta name="renderer" content="webkit|ie-comp|ie-stand">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport"
+ content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
+ <meta http-equiv="Cache-Control" content="no-siteapp"/>
+ <LINK rel="Bookmark" href="../images/favicon.ico">
+ <!-- 本框架基本脚本和样式 -->
+ <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script>
+ <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">
+ <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/>
+ <title></title>
+ <style>
+ .panel-body {
+ overflow: hidden;
+ }
+
+ .buttonPanel {
+ background: #ffffff;
+ padding: 10px 10px;
+ margin: 0px 0px 10px 0px;
+ }
+
+ .rowPanel {
+ background: #ffffff;
+ padding: 0px 10px;
+ padding-top: 10px;
+ margin: 0px 0px 10px 0px;
+ }
+
+ .paginationStyle {
+ background: #ffffff;
+ padding: 10px 10px;
+ margin: 0px 0px 10px 0px;
+ text-align: right;
+ }
+ </style>
+</head>
+<body>
+<div class="panel-body" id="app">
+
+ <el-row class="buttonPanel">
+ <el-button @click="openForm('add')" type="primary">新增</el-button>
+ </el-row>
+
+ <el-row class="rowPanel">
+ <el-form ref="form" :model="form" inline>
+ <el-form-item label="规则名称" prop="queryKey">
+ <el-input v-model="form.keyword" placeholder="请输入规则名称"></el-input>
+ </el-form-item>
+ <el-button type="primary" @click="search">搜索</el-button>
+ <el-button @click="resetForm('form')">重置</el-button>
+ </el-form>
+ </el-row>
+
+ <el-row class="table-style">
+
+ <el-table id="proj" :data="table.rows" :height="height" stripe @sort-change="sortChange">
+ <el-table-column
+ prop="name"
+ label="规则名称">
+ </el-table-column>
+ <el-table-column
+ prop="updateTime"
+ sortable="custom"
+ label="修改时间"
+ show-overflow-tooltip
+ width="180">
+ </el-table-column>
+ <el-table-column
+ prop="updateBy"
+ label="修改人">
+ </el-table-column>
+
+ <el-table-column
+ prop="createTime"
+ sortable="custom"
+ label="创建时间"
+ show-overflow-tooltip
+ width="180">
+ </el-table-column>
+ <el-table-column
+ prop="createBy"
+ label="创建人"
+ width="180">
+ </el-table-column>
+
+ <el-table-column label="操作">
+ <template slot-scope="scope">
+ <el-button type="text" @click="openForm('modify', scope.row)" size="small">修改</el-button>
+ <el-button type="text" @click="remove(scope.$index, scope.row)" size="small">删除</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-row>
+ <el-row class="paginationStyle">
+ <el-pagination background
+ @size-change="changePageSize"
+ @current-change="changeCurrentPage"
+ :current-page="table.currentPage"
+ :page-sizes="[10, 20, 30, 50]"
+ :page-size="table.pageSize"
+ layout="total, sizes, prev, pager, next, jumper"
+ :total="table.total">
+ </el-pagination>
+ </el-row>
+
+ <el-dialog
+ :title="title"
+ :visible.sync="dialogVisible"
+ width="60%"
+ :before-close="handleClose">
+
+ <el-form :model="formData" ref="ruleForm" label-width="100px" class="demo-ruleForm">
+
+ <el-form-item label="规则名称" >
+ <el-input style="width: 200px" v-model="formData.name"></el-input>
+ <el-button type="primary" @click="addRuleItem()" size="small">添加规则</el-button>
+ </el-form-item>
+
+ <el-form-item label="绩效方案" >
+ <el-table
+ :data="formData.ruleItemList"
+ style="width: 100%">
+ <el-table-column
+ label="业绩类型"
+ >
+ <template slot-scope="scope">
+ <el-select v-model="scope.row.achieveType" placeholder="请选择业绩类型">
+ <el-option label="本金消耗" :value="1"></el-option>
+ <el-option label="赠送消耗" :value="2"></el-option>
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="计算方式"
+ >
+ <template slot-scope="scope">
+ <el-select v-model="scope.row.calculationType" placeholder="请选择计算方式">
+ <el-option label="固定金额" :value="1"></el-option>
+ <el-option label="百分比(%)" :value="2"></el-option>
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="区间"
+ width="240">
+ <template slot-scope="scope">
+ <el-input style="width: 100px" v-model="scope.row.lower"></el-input>
+ -
+ <el-input style="width: 100px" v-model="scope.row.upper"></el-input>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="业绩">
+ <template slot-scope="scope">
+ <el-input v-model="scope.row.achieve"></el-input>
+ </template>
+ </el-table-column>
+ <el-table-column label="操作">
+ <template slot-scope="scope">
+ <el-button type="text" @click="removeRuleItem(scope.$index, scope.row)" size="small">删除</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-form-item>
+
+
+
+ </el-form>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="dialogVisible = false">取 消</el-button>
+ <el-button type="primary" @click="submitForm">确 定</el-button>
+ </span>
+</el-dialog>
+
+
+</div>
+</body>
+<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script>
+<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
+<script type="text/javascript" th:inline="javascript">
+
+ var vue = new Vue({
+ el: '#app',
+ data: {
+ table: {
+ rows: [],
+ total: 0,
+ pageSize: 10,
+ currentPage: 1,
+ },
+ form: {
+ queryKey: null,
+ },
+
+ height: 'calc(100vh - 240px)',
+ dialogVisible: false,
+ title: '',
+ formData: {
+ name: '',
+ ruleItemList: [
+ {
+ achieveType: 1,
+ calculationType: 1,
+ lower: '',
+ upper: '',
+ achieve: '',
+ }
+ ]
+ },
+
+ type: '',
+
+ },
+ created: function () {
+ this.loadData();
+ window.addEventListener("keydown", this.keydown);
+ },
+ methods: {
+ changePageSize(val) {
+ this.table.pageSize = val;
+ this.loadData();
+ },
+ changeCurrentPage(val) {
+ this.table.currentPage = val;
+ this.loadData();
+ },
+ resetForm(formName) {
+ this.$refs[formName].resetFields();
+ },
+ sortChange: function (column) {
+ if (column.order) {
+ if (column.order.indexOf("desc")) {
+ this.form.order = "desc";
+ } else {
+ this.form.order = "asc";
+ }
+ this.form.sort = column.prop;
+ this.loadData();
+ }
+ },
+ loadData: function () {
+ let _this = this;
+ let data = _this.getRequestParam();
+ data.pageSize = _this.table.pageSize;
+ data.pageNum = _this.table.currentPage;
+ AjaxProxy.requst({
+ app: _this,
+ data: data,
+ url: basePath + '/admin/achieveRule/selectList',
+ callback: function (data) {
+ _this.table.rows = data.rows;
+ _this.table.total = data.total;
+ }
+ });
+ },
+ getRequestParam() {
+ let _this = this;
+ return {
+ queryKey: _this.form.queryKey,
+ }
+ },
+ search: function () {
+ this.table.currentPage = 1;
+ this.loadData();
+ },
+ keydown(evt) {
+ if (evt.keyCode == 13) {
+ this.search();
+ }
+ },
+
+ remove(index, row) {
+ let _this = this;
+ this.$confirm('确认删除该规则吗?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ AjaxProxy.requst({
+ app: _this,
+ type: 'GET',
+ url: basePath + "/admin/achieveRule/removeById/" + row.id,
+ callback: function (data) {
+ _this.loadData();
+ _this.$message({
+ type: 'success',
+ message: data.info,
+ });
+ }
+ });
+ }).catch(() => {
+ this.$message({
+ type: 'info',
+ message: '已取消删除'
+ });
+ });
+ },
+ //开启表单弹窗
+ openForm(type, data) {
+
+ if (type == 'add') {
+ this.title = '新增规则';
+ //this.$refs['formName'].resetFields();
+
+ } else {
+ this.title = '修改规则';
+ this.formData = data;
+ }
+ this.type = type;
+ this.dialogVisible = true;
+ },
+ //提交表单
+ submitForm() {
+ let url = basePath + "/admin/achieveRule/add";
+ if (this.type == 'modify') {
+ url = basePath + "/admin/achieveRule/update";
+ }
+ let data=this.formData;
+
+ if(MTools.isBlank(data.name)){this.$message.error("请输入规则名称");return;}
+
+ if(data.ruleItemList.length<1){
+ this.$message.error("最少需要一个计算规则");;return;}
+ let flag=true;
+ data.ruleItemList.forEach(item=>{
+ if(MTools.isBlank(item.lower)){
+ this.$message.error("请输入业绩下限");flag=false;}
+ else if(MTools.isBlank(item.upper)){
+ this.$message.error("请输入业绩上限");flag=false;}
+ else if(MTools.isBlank(item.achieve)){
+ this.$message.error("请输入业绩金额或者比例");flag=false;}
+ })
+ if(flag){
+ var _this=this;
+ AjaxProxy.requst({
+ app: _this,
+ data:data,
+ url:url,
+ callback: function (data) {
+ _this.$message.success(data.info);
+ _this.loadData();
+ _this.dialogVisible = false;
+ _this.formData={
+ name: '',
+ ruleItemList: [
+ {
+ achieveType: 1,
+ calculationType: 1,
+ lower: '',
+ upper: '',
+ achieve: '',
+ }
+ ]
+ };
+ }
+ });
+
+ }
+ },
+ handleClose(done) {
+ this.$confirm('确认关闭?')
+ .then(_ => {
+ done();
+ })
+ .catch(_ => {
+ });
+ },
+ addRuleItem(){
+ this.formData.ruleItemList.push(
+ {
+ achieveType: 1,
+ calculationType: 1,
+ lower: '',
+ upper: '',
+ achieve: '',
+ }
+ );
+ },
+ removeRuleItem(index,row){
+ this.formData.ruleItemList.splice(index, 1);
+ },
+
+
+ }
+
+ });
+
+
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/achieveNewStatiostics.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/achieveNewStatiostics.html
new file mode 100644
index 0000000..34ecd48
--- /dev/null
+++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/achieveNewStatiostics.html
@@ -0,0 +1,366 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
+<head>
+ <meta charset="utf-8">
+ <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+ <meta name="renderer" content="webkit|ie-comp|ie-stand">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport"
+ content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
+ <meta http-equiv="Cache-Control" content="no-siteapp"/>
+ <LINK rel="Bookmark" href="../images/favicon.ico">
+ <!-- 本框架基本脚本和样式 -->
+ <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script>
+ <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">
+ <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/>
+ <title></title>
+ <style>
+ .panel-body{
+ overflow: hidden;
+ }
+ .buttonPanel{
+ background: #ffffff;
+ padding: 10px 10px ;
+ margin: 0px 0px 10px 0px;
+ }
+ .rowPanel{
+ background: #ffffff;
+ padding: 0px 10px ;
+ padding-top: 10px;
+ margin: 0px 0px 10px 0px;
+ }
+ .paginationStyle{
+ background: #ffffff;
+ padding: 10px 10px;
+ margin: 0px 0px 10px 0px;
+ text-align: right;
+ }
+ </style>
+</head>
+<body>
+<div class="panel-body" id="app">
+
+ <el-row class="buttonPanel">
+ <el-button @click="exportExcel" type="primary" >导出</el-button>
+ </el-row>
+
+ <el-row class="rowPanel" >
+ <el-form ref="form" :model="form" inline >
+
+ <el-form-item label="业绩规则" >
+ <el-select v-model="form.achieveRuleId" filterable placeholder="请选择业绩规则">
+ <el-option
+ v-for="item in achieveRulsList"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ </el-form-item>
+
+ <el-form-item label="员工姓名" >
+ <el-input v-model="form.staffName"></el-input>
+ </el-form-item>
+
+
+ <el-form-item label="统计门店" >
+ <el-select v-model="form.shopId" placeholder="请选择">
+ <el-option
+ v-for="item in shopList"
+ :key="item.shopShortName"
+ :label="item.shopShortName"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ </el-form-item>
+
+
+ <el-form-item label="订单类型" >
+ <el-select v-model="form.orderType" placeholder="请选择">
+ <el-option
+ v-for="item in orderTypeList"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value">
+ </el-option>
+ </el-select>
+ </el-form-item>
+
+ <el-form-item label="统计时间" prop="datetimeArr">
+ <el-date-picker
+ v-model="form.datetimeArr"
+ type="daterange"
+ range-separator="至" format="yyyy-MM-dd HH:mm"
+ start-placeholder="开始日期"
+ end-placeholder="结束日期">
+ </el-date-picker>
+ </el-form-item>
+
+ <el-button type="primary" @click="search" >搜索</el-button>
+ <el-button @click="resetForm('form')">重置</el-button>
+ </el-form>
+ </el-row>
+
+ <el-row class="table-style" >
+
+ <el-table id="proj" :data="table.rows" :height="height" stripe @sort-change="sortChange">
+ <el-table-column
+ sortable="custom"
+ prop="ruleName"
+ label="规则名称"
+ width="180">
+ </el-table-column>
+ <el-table-column
+ prop="shopName"
+ label="门店名称"
+ show-overflow-tooltip
+ width="240">
+ </el-table-column>
+ <el-table-column
+ prop="guwen"
+ label="业绩归属人"
+ show-overflow-tooltip
+ width="180">
+ </el-table-column>
+ <el-table-column
+ prop="createBy"
+ label="业绩创建人"
+ show-overflow-tooltip
+ width="180">
+ </el-table-column>
+ <el-table-column
+ sortable="custom"
+ prop="zkTotal"
+ label="订单金额">
+ </el-table-column>
+ <el-table-column
+ sortable="custom"
+ prop="goodsCash"
+ label="现金">
+ </el-table-column>
+ <el-table-column
+ sortable="custom"
+ prop="cardCash"
+ label="划扣">
+ </el-table-column>
+ <el-table-column
+ sortable="custom"
+ prop="hisConsume"
+ label="本金消耗">
+ </el-table-column>
+ <el-table-column
+ sortable="custom"
+ prop="freeConsume"
+ label="赠送消耗">
+ </el-table-column>
+ <el-table-column
+ sortable="custom"
+ prop="projPercentage"
+ label="服务提成">
+ </el-table-column>
+ <el-table-column
+ sortable="custom"
+ prop="numberOfPeople"
+ label="人头">
+ </el-table-column>
+
+ <el-table-column
+ sortable="custom"
+ prop="projNum"
+ label="项目个数">
+ </el-table-column>
+
+ <el-table-column
+ sortable="custom"
+ prop="projTime"
+ label="服务时间">
+ </el-table-column>
+
+ <el-table-column
+ sortable="custom"
+ prop="orderType"
+ label="订单类型">
+ </el-table-column>
+
+ </el-table>
+ </el-row>
+ <el-row class="paginationStyle" >
+ <el-pagination background
+ @size-change="changePageSize"
+ @current-change="changeCurrentPage"
+ :current-page="table.currentPage"
+ :page-sizes="[10, 20, 30, 50]"
+ :page-size="table.pageSize"
+ layout="total, sizes, prev, pager, next, jumper"
+ :total="table.total">
+ </el-pagination>
+ </el-row>
+
+</div>
+</body>
+<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script>
+<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
+<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
+<script type="text/javascript" th:inline="javascript">
+
+ var vue = new Vue({
+ el: '#app',
+ data: {
+ table:{
+ rows:[],
+ total:0,
+ pageSize:10,
+ currentPage:1,
+ },
+ form:{
+ achieveRuleId:null,
+ staffName:null,
+ shopId:null,
+ orderType:'',
+ order:'',
+ sort:'',
+ beginTime:'',
+ endTime:'',
+ },
+ height:'calc(100vh - 240px)',
+
+ //提成规则
+ achieveRulsList:[],
+ //业绩用户列表
+ userList: [],
+ shopList:[{id:0,shopShortName:'全部'}],
+
+ orderTypeList:[
+ {value:'',label:'全部'},
+ {value:'订单',label:'订单'},
+ {value:'服务单',label:'服务单'},
+
+ ],
+ },
+ created: function () {
+ let _this=this;
+ //获取业绩用户列表
+ AjaxProxy.requst({
+ app: _this,
+ url: basePath + '/admin/shopAll',
+ callback: function (data) {
+ _this.userList = data.rows;
+ }
+ });
+ AjaxProxy.requst({
+ app:_this,
+ url:basePath+"/admin/shopInfo/findAll",
+ callback:function (data) {
+ data.rows.forEach(shop=>{
+ _this.shopList.push(shop);
+ });
+ }
+
+ })
+ this.getAchieveRule();
+ this.loadData();
+ window.addEventListener("keydown", this.keydown);
+ },
+ methods: {
+ changePageSize(val) {
+ this.table.pageSize = val;
+ this.loadData();
+ },
+ changeCurrentPage(val) {
+ this.table.currentPage = val;
+ this.loadData();
+ },
+ resetForm(formName) {
+ this.$refs[formName].resetFields();
+ this.form={
+ achieveRuleId:null,
+ staffName:null,
+ shopId:null,
+ orderType:'',
+ order:'',
+ sort:'',
+ beginTime:'',
+ endTime:'',
+ };
+ },
+ sortChange:function (column){
+ if(column.order){
+ if(column.order.indexOf("desc")){
+ this.form.order="desc";
+ }else{
+ this.form.order="asc";
+ }
+ this.form.sort=column.prop;
+ this.loadData();
+ }
+ },
+ loadData:function(){
+ let _this = this;
+ let data=_this.getRequestParam();
+ data.pageSize=_this.table.pageSize;
+ data.pageNum=_this.table.currentPage;
+ AjaxProxy.requst({
+ app: _this,
+ data:data,
+ url: basePath + '/admin/achieve/achieveNewStatistics',
+ callback: function (data) {
+ _this.table.rows = data.rows;
+ _this.table.total=data.total;
+ }
+ });
+ },
+
+ /**
+ * 获取规则
+ */
+ getAchieveRule(){
+ let _this = this;
+ AjaxProxy.requst({
+ app: _this,
+ data: {pageNum:1,pageSize:1000},
+ url: basePath + "/admin/achieveRule/selectList",
+ callback: function (data) {
+ _this.achieveRulsList=data.rows;
+ }
+ });
+ },
+
+ getRequestParam(){
+ let _this = this;
+ return {
+ achieveRuleId:_this.form.achieveRuleId,
+ staffName:_this.form.staffName,
+ shopId:_this.form.shopId,
+ orderType:_this.form.orderType,
+ beginTime:_this.form.datetimeArr?moment(_this.form.datetimeArr[0]).format("YYYY-MM-DD HH:mm"):'',
+ endTime:_this.form.datetimeArr?moment(_this.form.datetimeArr[1]).format("YYYY-MM-DD HH:mm"):'',
+ order:_this.form.order,
+ sort:_this.form.sort,
+ }
+ },
+ search:function(){
+ this.table.currentPage=1;
+ this.loadData();
+ },
+ keydown(evt){
+ if(evt.keyCode==13) {
+ this.search();
+ }
+ },
+
+ //导出
+ exportExcel(){
+ window.location.href=basePath+"/admin/achieve/exportAchieveNewStatisticsExcel?"+MTools.jsonToUrlParam(this.getRequestParam());
+ }
+
+ }
+ });
+
+
+</script>
+</body>
+</html>
\ 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 f19c967..2243f43 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
@@ -149,7 +149,6 @@
<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
-<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script>
<script type="text/javascript" th:inline="javascript">
var vue = new Vue({
el : "#app",
@@ -184,10 +183,11 @@
},
methods : {
queryTableData () {
+
let _this = this;
- var form = _this.form;
- var page = _this.page;
- var params = _this.form;
+ let form = _this.form;
+ let page = _this.page;
+ let params = _this.form;
params.limit = page.size;
params.offset = (page.currentPage - 1) * page.size;
@@ -195,11 +195,14 @@
params.beginTime = form.timeRange?moment(form.timeRange[0]).format("YYYY-MM-DD HH:mm"):'';
params.endTime = form.timeRange?moment(form.timeRange[1]).format("YYYY-MM-DD HH:mm"):'';
}
- $.AjaxProxy({
- p:params
- }).invoke(basePath + "/admin/achieve/findDailyInfoNew", function (loj) {
- _this.tableData = loj.getValue("rows");
- _this.page.total = loj.getResult().total;
+ AjaxProxy.requst({
+ app: _this,
+ data: params,
+ url: basePath + "/admin/achieve/findDailyInfoNew",
+ callback: function (loj) {
+ _this.tableData = loj.rows;
+ _this.page.total = loj.total;
+ }
});
},
queryCustomColumns() {
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 ffc1769..6cec73e 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
@@ -947,7 +947,7 @@
// if (optionType != 1) {
//直接修改支付金额不重置支付金额
- item.payMoney =( zkPrice * count).toFixed(2);
+ item.payMoney = (zkPrice * count).toFixed(2);
// }
_this.order.payMoney += parseFloat(item.payMoney);
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html
index 225ed3c..212a682 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html
@@ -83,6 +83,19 @@
</el-form-item>
</el-col>
+ <el-col :offset="2" :span="10" v-if="form.goodType!='家居产品'">
+ <el-form-item label="业绩规则" prop="achieveRuleId">
+ <el-select v-model="form.achieveRuleId" filterable placeholder="请选择业绩规则">
+ <el-option
+ v-for="item in achieveRulsList"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+
</el-row>
<el-row>
@@ -1097,7 +1110,8 @@
loading_zhk: false,
/******综合卡表格数据END********/
-
+ //提成规则
+ achieveRulsList:[],
//默认充值卡选中项
defaultCates: [],
@@ -1145,6 +1159,8 @@
useDateNum : '',
buyDateNum : '',
payMethods : '',
+ achieveRuleId:'',
+
},
submitUrl: '/admin/shoppinggoods/addShoppingGoods',
modifySubmitUrl: '/admin/shoppinggoods/modifyShoppingGoods',
@@ -1174,6 +1190,7 @@
this.getGoodstype();
this.getDictionary();
this.getShopInfo();
+ this.getAchieveRule();
if(goodType=='家居产品'){
this.getSupplierList();
}
@@ -1194,6 +1211,21 @@
methods: {
/**
+ * 获取规则
+ */
+ getAchieveRule(){
+ let _this = this;
+ AjaxProxy.requst({
+ app: _this,
+ data: {pageNum:1,pageSize:1000},
+ url: basePath + "/admin/achieveRule/selectList",
+ callback: function (data) {
+ _this.achieveRulsList=data.rows;
+ }
+ });
+ },
+
+ /**
* 商品分类树形组件格式化
*/
normalizer(node) {
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-md-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-md-list.html
index 8608af7..77b6bba 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-md-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-md-list.html
@@ -62,6 +62,16 @@
<option value=''>请选择项目状态</option>
</select>
</div>
+ <div class="form-group mr-20">
+ <label for="staus">业绩规则</label>
+ <select class="form-control autoFull" name="achieveRuleId"
+ data-filed="name"
+ data-value="id"
+ th:data-url="@{/admin/achieveRule/selectListForm}"
+ data-param="{pageNum:1,pageSize:1000}">
+ <option value=''>请选择业绩规则</option>
+ </select>
+ </div>
<div class="form-group mr-20">
<label for="isPresent">是否赠送</label>
@@ -114,6 +124,7 @@
<th data-field="isPresent">是否赠送</th>
<th data-field="goodType" data-sortable="true">类型</th>
<th data-field="cateName">分类</th>
+ <th data-field="achieveRuleName" >业绩规则</th>
<th data-field="createTime" data-sortable="true" data-formatter="MGrid.getTime">创建时间</th>
</tr>
</thead>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-zb-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-zb-list.html
index b2d8c30..a9e5af4 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-zb-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/products/shoppinggoods-zb-list.html
@@ -63,6 +63,16 @@
<option value=''>请选择项目状态</option>
</select>
</div>
+ <div class="form-group mr-20">
+ <label for="staus">业绩规则</label>
+ <select class="form-control autoFull" name="achieveRuleId"
+ data-filed="name"
+ data-value="id"
+ th:data-url="@{/admin/achieveRule/selectListForm}"
+ data-param="{pageNum:1,pageSize:1000}">
+ <option value=''>请选择业绩规则</option>
+ </select>
+ </div>
<div class="form-group mr-20">
<label for="isPresent">是否赠送</label>
@@ -110,6 +120,7 @@
<th data-field="isPresent">是否赠送</th>
<th data-field="goodType" data-sortable="true">类型</th>
<th data-field="cateName" >分类</th>
+ <th data-field="achieveRuleName" >业绩规则</th>
<th data-field="createTime" data-sortable="true" data-formatter="MGrid.getTime">创建时间</th>
</tr>
</thead>
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 611e200..8da1de1 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
@@ -151,7 +151,6 @@
<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
-<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script>
<script type="text/javascript" th:inline="javascript">
var vue = new Vue({
el : "#app",
@@ -187,10 +186,11 @@
},
methods : {
queryTableData () {
+
let _this = this;
- var form = _this.form;
- var page = _this.page;
- var params = _this.form;
+ let form = _this.form;
+ let page = _this.page;
+ let params = _this.form;
params.limit = page.size;
params.offset = (page.currentPage - 1) * page.size;
@@ -198,11 +198,14 @@
params.beginTime = form.timeRange?moment(form.timeRange[0]).format("YYYY-MM-DD HH:mm"):'';
params.endTime = form.timeRange?moment(form.timeRange[1]).format("YYYY-MM-DD HH:mm"):'';
}
- $.AjaxProxy({
- p:params
- }).invoke(basePath + "/admin/achieve/findDailyInfoNew", function (loj) {
- _this.tableData = loj.getValue("rows");
- _this.page.total = loj.getResult().total;
+ AjaxProxy.requst({
+ app: _this,
+ data: params,
+ url: basePath + "/admin/achieve/findDailyInfoNew",
+ callback: function (loj) {
+ _this.tableData = loj.rows;
+ _this.page.total = loj.total;
+ }
});
},
queryCustomColumns() {
diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopOrder-form.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopOrder-form.html
index 0030e60..ff23851 100644
--- a/zq-erp/src/main/resources/templates/views/admin/shop/shopOrder-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopOrder-form.html
@@ -94,8 +94,8 @@
<label class="col-sm-2 control-label">配送方式
</label>
<div class="col-sm-4">
- <input autocomplete="off" type="text" class="form-control" readonly="readonly"
- th:value="${orderInfo.shippingMethod}" nullmsg="订单备注不能为空">
+ <input autocomplete="off" type="text" class="form-control" readonly="readonly" th:if="${orderInfo.shippingMethod==1}" th:value="物流配送" >
+ <input autocomplete="off" type="text" class="form-control" readonly="readonly" th:if="${orderInfo.shippingMethod==2}" th:value="门店自提" >
</div>
</div>
<div class="form-group">
diff --git a/zq-erp/src/test/java/com/matrix/FenxiaoSoreInitTest.java b/zq-erp/src/test/java/com/matrix/FenxiaoSoreInitTest.java
index 30b0210..b6d5350 100644
--- a/zq-erp/src/test/java/com/matrix/FenxiaoSoreInitTest.java
+++ b/zq-erp/src/test/java/com/matrix/FenxiaoSoreInitTest.java
@@ -1,58 +1,572 @@
package com.matrix;
+import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.matrix.core.pojo.AjaxResult;
+import com.matrix.core.tools.StringUtils;
import com.matrix.system.activity.dao.ActivitySignAwardSetDao;
import com.matrix.system.activity.dao.ActivitySignReceiveRecordDao;
import com.matrix.system.activity.dao.ActivitySignRecordDao;
import com.matrix.system.activity.dao.ActivitySignWriteoffDao;
import com.matrix.system.activity.entity.ActivitySignAwardSet;
+import com.matrix.system.activity.entity.ActivitySignReceiveRecord;
import com.matrix.system.activity.entity.ActivitySignRecord;
+import com.matrix.system.activity.entity.ActivitySignWriteoff;
+import com.matrix.system.common.constance.AppConstance;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.hive.dao.SysVipInfoDao;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import com.matrix.system.score.service.ScoreVipDetailService;
+import com.matrix.system.shopXcx.api.dto.SeeAwardTextDto;
+import com.matrix.system.shopXcx.api.service.WxShopLogisticsQueryService;
+import com.matrix.system.shopXcx.api.tools.WxShopCouponUtil;
import com.matrix.system.shopXcx.api.vo.ActivitySignAwardSetVo;
-import com.matrix.system.shopXcx.api.vo.ActivitySignRecordVo;
-import com.matrix.system.shopXcx.api.vo.SignBasicInfoJsonVo;
-import com.matrix.system.shopXcx.api.vo.SignBasicInfoVo;
-import com.matrix.system.shopXcx.bean.ShopActivities;
-import com.matrix.system.shopXcx.dao.ShopActivitiesDao;
+import com.matrix.system.shopXcx.api.vo.LuckyDrawBasicInfoJsonVo;
+import com.matrix.system.shopXcx.api.vo.LuckyDrawSuccessVo;
+import com.matrix.system.shopXcx.api.vo.SeeAwardTextVo;
+import com.matrix.system.shopXcx.bean.*;
+import com.matrix.system.shopXcx.dao.*;
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 org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestBody;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ZqErpApplication.class},webEnvironment =SpringBootTest.WebEnvironment.RANDOM_PORT)
public class FenxiaoSoreInitTest {
-
- @Autowired
+
+ @Autowired
private ShopActivitiesDao shopActivitiesDao;
-
- @Autowired
- private ActivitySignAwardSetDao activitySignAwardSetDao;
-
- @Autowired
- private ActivitySignReceiveRecordDao activitySignReceiveRecordDao;
-
- @Autowired
- private ActivitySignWriteoffDao activitgwLinkUsySignWriteoffDao;
-
- @Autowired
- private ActivitySignRecordDao activitySignRecordDao;
-
- public static void main(String[] args) {
- System.out.println(getCurrentMonthDay(DateUtil.date()));
- System.out.println(getMonthFullDay(DateUtil.year(DateUtil.date()),DateUtil.month(DateUtil.date())+1).toString());
- }
+
+ @Autowired
+ private ActivitySignAwardSetDao activitySignAwardSetDao;
+
+ @Autowired
+ private ActivitySignReceiveRecordDao activitySignReceiveRecordDao;
+
+ @Autowired
+ private ActivitySignWriteoffDao activitySignWriteoffDao;
+
+ @Autowired
+ private ActivitySignRecordDao activitySignRecordDao;
+
+ @Autowired
+ ShopDeliveryInfoDao shopDeliveryInfoDao;
+
+ @Autowired
+ private ShopLogisticsInfoDao shopLogisticsInfoDao;
+
+ @Autowired
+ private WxShopLogisticsQueryService wxShopLogisticsQueryService;
+ @Autowired
+ private ScoreVipDetailService scoreVipDetailService;
+ @Autowired
+ private ShopCouponDao shopCouponDao;
+ @Autowired
+ private WxShopCouponUtil wxShopCouponUtil;
+ @Autowired
+ private ShopCouponRecordDao shopCouponRecordDao;
+ @Autowired
+ SysVipInfoDao sysVipInfoDao;
+
+ //获取奖品并索引+1 已领取+1
+ public synchronized ActivitySignAwardSet updateShopActivityAndAwardSet(Long actId){
+ //通过活动ID获取对应的活动
+ ShopActivities shopActivities = shopActivitiesDao.selectById(actId);
+ String actContent = shopActivities.getActContent();
+ LuckyDrawBasicInfoJsonVo luckyDrawBasicInfoJsonVo = JSON.parseObject(actContent, LuckyDrawBasicInfoJsonVo.class);
+
+ //中奖索引
+ Integer awrdLineIndex = luckyDrawBasicInfoJsonVo.getAwrdLineIndex();
+ //中奖序列
+ String awardLine = luckyDrawBasicInfoJsonVo.getAwardLine();
+ ActivitySignAwardSet activitySignAwardSet = null;
+ if(awardLine.length() > 0) {
+ String substring = awardLine.substring(1, awardLine.length() - 1);
+ List<String> awardList = StrUtil.splitTrim(substring, ",");
+ if(awrdLineIndex < awardList.size()){
+ //中奖
+ Long awardId = Long.parseLong(awardList.get(awrdLineIndex + 1));
+ ActivitySignAwardSet activitySignAwardSetGet = activitySignAwardSetDao.selectById(awardId);
+ //奖项库存数量
+ int awardInventoryCnt = activitySignAwardSetGet.getAwardInventoryCnt();
+ //已派发数量
+ int awardDistributeCnt = activitySignAwardSetGet.getAwardDistributeCnt();
+ if(awardDistributeCnt < awardInventoryCnt){
+ activitySignAwardSet = activitySignAwardSetGet;
+ activitySignAwardSetGet.setAwardDistributeCnt(awardDistributeCnt +1);
+ activitySignAwardSetDao.updateById(activitySignAwardSetGet);
+
+ //将基本信息转换成JSON字符串存储到活动主表的act_content字段
+ luckyDrawBasicInfoJsonVo.setAwrdLineIndex(awrdLineIndex + 1);
+ String json= JSON.toJSONString(luckyDrawBasicInfoJsonVo);
+ shopActivities.setActContent(json);
+ shopActivitiesDao.updateByModel(shopActivities);
+ }
+ }
+ }
+ return activitySignAwardSet;
+ }
+
+ @Test
+ public void getLuckDraw(){
+ long actId = 85L;
+ Long userId = 85L;
+ Long companyId = 36L;
+ SysVipInfo user = sysVipInfoDao.selectById(userId);
+ /**
+ * 活动是否存在
+ * 活动是否已经开始
+ * 免费抽奖还是积分抽奖
+ * 积分抽奖一次一次换
+ * 减少积分
+ * 是否中奖
+ * 中奖规则
+ * 奖品处理
+ *
+ */
+ //活动是否存在
+ ShopActivities shopActivities = shopActivitiesDao.selectById(actId);
+ if (ObjectUtil.isEmpty(shopActivities)) {
+ // return AjaxResult.buildFailInstance("活动不存在");
+ }
+ //活动是否已经开始
+ Integer actStatus = shopActivities.getActStatus();
+ if(ShopActivities.ACTSTATUS_STATUS_ING != actStatus) {
+ //return AjaxResult.buildFailInstance("活动未开始");
+ }
+ //获取今日抽奖总次数
+ String actContent = shopActivities.getActContent();
+ LuckyDrawBasicInfoJsonVo luckyDrawBasicInfoJsonVo = JSON.parseObject(actContent, LuckyDrawBasicInfoJsonVo.class);
+ List<ActivitySignRecord> activityRecords = activitySignRecordDao.selectListByActIdAndUserIdLikesignTime(actId,userId, DateUtil.date());
+ if(CollUtil.isNotEmpty(activityRecords)){
+ Integer wmkcjjh = luckyDrawBasicInfoJsonVo.getWmkcjjh();
+ Integer jfdhcs = luckyDrawBasicInfoJsonVo.getJfdhcs();
+ if(activityRecords.size() >= (wmkcjjh+jfdhcs)){
+ //return AjaxResult.buildFailInstance("明天再来抽奖吧");
+ }
+ }
+
+ //生成抽奖记录
+ ActivitySignRecord activitySignRecordAdd = new ActivitySignRecord();
+ activitySignRecordAdd.setCompanyId(companyId);
+ activitySignRecordAdd.setCreateBy(user.getVipName());
+ activitySignRecordAdd.setCreateTime(DateUtil.date());
+ activitySignRecordAdd.setUpdateBy(user.getVipName());
+ activitySignRecordAdd.setUpdateTime(DateUtil.date());
+ activitySignRecordAdd.setActivityId(actId);
+ activitySignRecordAdd.setSignTime(DateUtil.date());
+ activitySignRecordAdd.setUserId(userId);
+ activitySignRecordDao.insert(activitySignRecordAdd);
+
+ /**
+ 获取中奖概率
+ 中奖了获取奖品ID
+ 没有中奖则获取谢谢参与的奖品ID
+ 每个人最多中奖次数
+ */
+
+ List<LuckyDrawSuccessVo> luckyDrawSuccessVos = new ArrayList<>();
+
+ //获取谢谢参与奖
+ QueryWrapper<ActivitySignAwardSet> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("award_rule",ActivitySignAwardSet.AWARDRULE_NORMAL);
+ queryWrapper.eq("company_id",companyId);
+ queryWrapper.eq("activity_id",actId);
+ ActivitySignAwardSet activitySignAwardSetNormal = activitySignAwardSetDao.selectOne(queryWrapper);
+ //每个人最多中奖次数
+ Integer zzjcs = luckyDrawBasicInfoJsonVo.getZzjcs();
+ QueryWrapper<ActivitySignReceiveRecord> queryWrapperActivitySignReceiveRecord = new QueryWrapper<>();
+ queryWrapperActivitySignReceiveRecord.eq("company_id", companyId);
+ queryWrapperActivitySignReceiveRecord.eq("activity_id", actId);
+ queryWrapperActivitySignReceiveRecord.eq("user_id", userId);
+ queryWrapperActivitySignReceiveRecord.ne("award_id", activitySignAwardSetNormal.getId());
+ List<ActivitySignReceiveRecord> activitySignReceiveRecordDone = activitySignReceiveRecordDao.selectList(queryWrapperActivitySignReceiveRecord);
+ if(CollUtil.isNotEmpty(activitySignReceiveRecordDone)){
+ if(activitySignReceiveRecordDone.size() >= zzjcs){
+ //生成领取记录
+ ActivitySignReceiveRecord activitySignReceiveRecord = new ActivitySignReceiveRecord();
+ activitySignReceiveRecord.setUserId(userId);
+ activitySignReceiveRecord.setReceiveTime(DateUtil.date());
+ activitySignReceiveRecord.setAwardId(activitySignAwardSetNormal.getId());
+ activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE);
+ activitySignReceiveRecord.setActivityId(actId);
+ activitySignReceiveRecord.setCompanyId(companyId);
+ activitySignReceiveRecord.setCreateBy(user.getVipName());
+ activitySignReceiveRecord.setCreateTime(new Date());
+ activitySignReceiveRecord.setUpdateBy(user.getVipName());
+ activitySignReceiveRecord.setUpdateTime(new Date());
+ activitySignReceiveRecordDao.insert(activitySignReceiveRecord);
+
+ LuckyDrawSuccessVo luckyDrawSuccessVo = new LuckyDrawSuccessVo();
+ luckyDrawSuccessVo.setType(1);
+ luckyDrawSuccessVo.setAwardName(activitySignAwardSetNormal.getAwardName());
+ luckyDrawSuccessVo.setAwardImg(activitySignAwardSetNormal.getIntroduceImg());
+ luckyDrawSuccessVos.add(luckyDrawSuccessVo);
+
+ AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+ ajaxResult.setData(luckyDrawSuccessVos);
+ //return ajaxResult;
+ }
+ }
+ //总中奖率
+ int zzjl = luckyDrawBasicInfoJsonVo.getZzjl();
+ int randomInt = RandomUtil.randomInt(1, 100);
+ //不中奖的分界线
+ int failureScope = 0;
+ if(failureScope >= randomInt){
+ //生成领取记录
+ ActivitySignReceiveRecord activitySignReceiveRecord = new ActivitySignReceiveRecord();
+ activitySignReceiveRecord.setUserId(userId);
+ activitySignReceiveRecord.setReceiveTime(DateUtil.date());
+ activitySignReceiveRecord.setAwardId(activitySignAwardSetNormal.getId());
+ activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE);
+ activitySignReceiveRecord.setActivityId(actId);
+ activitySignReceiveRecord.setCompanyId(companyId);
+ activitySignReceiveRecord.setCreateBy(user.getVipName());
+ activitySignReceiveRecord.setCreateTime(new Date());
+ activitySignReceiveRecord.setUpdateBy(user.getVipName());
+ activitySignReceiveRecord.setUpdateTime(new Date());
+ activitySignReceiveRecordDao.insert(activitySignReceiveRecord);
+
+ LuckyDrawSuccessVo luckyDrawSuccessVo = new LuckyDrawSuccessVo();
+ luckyDrawSuccessVo.setType(1);
+ luckyDrawSuccessVo.setAwardName(activitySignAwardSetNormal.getAwardName());
+ luckyDrawSuccessVo.setAwardImg(activitySignAwardSetNormal.getIntroduceImg());
+ luckyDrawSuccessVos.add(luckyDrawSuccessVo);
+
+ AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+ ajaxResult.setData(luckyDrawSuccessVos);
+ //return ajaxResult;
+ }
+ //中奖
+ if(failureScope < randomInt){
+ //获取奖品
+ ActivitySignAwardSet activitySignAwardSetCumulativeDay = updateShopActivityAndAwardSet(actId);
+
+ if(ObjectUtil.isNotEmpty(activitySignAwardSetCumulativeDay)){
+ LuckyDrawSuccessVo luckyDrawSuccessVo = new LuckyDrawSuccessVo();
+ luckyDrawSuccessVo.setType(2);
+ luckyDrawSuccessVo.setAwardType(activitySignAwardSetCumulativeDay.getAwardType());
+ luckyDrawSuccessVo.setAwardName(activitySignAwardSetCumulativeDay.getAwardName());
+ luckyDrawSuccessVo.setAwardImg(activitySignAwardSetCumulativeDay.getIntroduceImg());
+ luckyDrawSuccessVo.setAwardState(activitySignAwardSetCumulativeDay.getAwardState());
+ //新增奖品领取记录
+ ActivitySignReceiveRecord activitySignReceiveRecord = new ActivitySignReceiveRecord();
+ activitySignReceiveRecord.setUserId(userId);
+ activitySignReceiveRecord.setReceiveTime(DateUtil.date());
+ activitySignReceiveRecord.setAwardId(activitySignAwardSetCumulativeDay.getId());
+ activitySignReceiveRecord.setActivityId(actId);
+ activitySignReceiveRecord.setCompanyId(companyId);
+ activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE);
+ activitySignReceiveRecord.setCreateBy(user.getVipName());
+ activitySignReceiveRecord.setCreateTime(new Date());
+ activitySignReceiveRecord.setUpdateBy(user.getVipName());
+ activitySignReceiveRecord.setUpdateTime(new Date());
+ /**
+ * 奖项类型(1:自定义产品2:积分3:优惠券4:店铺商品)
+ *
+ * todo:4:店铺商品
+ */
+ //1:自定义产品
+ if(ActivitySignAwardSet.AWARDTYPE_CUSTOMIZE == activitySignAwardSetCumulativeDay.getAwardType()) {
+ activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_ING);
+ String randomString = StringUtils.getRandomString(8);
+ activitySignReceiveRecord.setWriteOffCode(randomString);
+
+ /**
+ * 获取对应奖品的领取方式(兑奖方式(1:线下兑换2:物流配送3:客服兑换)
+ */
+ luckyDrawSuccessVo.setWriteOffCode(randomString);
+ luckyDrawSuccessVo.setAwardWay(activitySignAwardSetCumulativeDay.getAwardWay());
+ //2:物流配送
+ luckyDrawSuccessVo.setOperationTip(activitySignAwardSetCumulativeDay.getOperationTip());
+ //1:线下兑换
+ if(ActivitySignAwardSet.AWARDWAY_ONE == activitySignAwardSetCumulativeDay.getAwardWay()) {
+ luckyDrawSuccessVo.setIntroduceTip(activitySignAwardSetCumulativeDay.getIntroduceTip());
+ luckyDrawSuccessVo.setPrizeAddress(activitySignAwardSetCumulativeDay.getPrizeAddress());
+ luckyDrawSuccessVo.setPrizeStartTime(activitySignAwardSetCumulativeDay.getPrizeStartTime());
+ luckyDrawSuccessVo.setPrizeEndTime(activitySignAwardSetCumulativeDay.getPrizeEndTime());
+ }
+ //3:客服兑换
+ if(ActivitySignAwardSet.AWARDWAY_THREE == activitySignAwardSetCumulativeDay.getAwardWay()) {
+ luckyDrawSuccessVo.setWechatImg(activitySignAwardSetCumulativeDay.getWechatImg());
+ luckyDrawSuccessVo.setPrizeStartTime(activitySignAwardSetCumulativeDay.getPrizeStartTime());
+ luckyDrawSuccessVo.setPrizeEndTime(activitySignAwardSetCumulativeDay.getPrizeEndTime());
+ }
+ }
+ //2:积分
+ if(ActivitySignAwardSet.AWARDTYPE_SCORE == activitySignAwardSetCumulativeDay.getAwardType()) {
+ luckyDrawSuccessVo.setScoreCnt(activitySignAwardSetCumulativeDay.getScoreCnt());
+ }
+ //3:优惠券
+ if(ActivitySignAwardSet.AWARDTYPE_COUPON == activitySignAwardSetCumulativeDay.getAwardType()) {
+ luckyDrawSuccessVo.setCouponName(activitySignAwardSetCumulativeDay.getCouponName());
+ //获取优惠券
+ int couponId = Integer.parseInt(activitySignAwardSetCumulativeDay.getCouponId());
+ ShopCoupon shopCoupon = shopCouponDao.selectById(couponId);
+ // 如果没有找到该优惠券
+ if (shopCoupon == null) {
+ // return new AjaxResult(AjaxResult.STATUS_FAIL, "没有找到该优惠券!");
+ }
+ // 如果优惠券有数量限制并且已经领完
+ if (shopCoupon.getMaxQuantity() >= 0 && (shopCoupon.getMaxQuantity() <= shopCoupon.getQuantityReceive())) {
+ //return new AjaxResult(AjaxResult.STATUS_FAIL, "优惠券已领完!");
+ }
+ boolean newPeople = wxShopCouponUtil.verifyIsNewPeople(userId);
+ // 如果改券是新人专属且当前用户不是新人
+ if (AppConstance.COUPON_GET_LIMT_NEW.equals(shopCoupon.getGetLimit()) && !newPeople) {
+ // return new AjaxResult(AjaxResult.STATUS_FAIL, "该优惠券为新人专享优惠券!");
+ }
+ ShopCouponRecord insertRecord = new ShopCouponRecord();
+ insertRecord.setCreateBy(AppConstance.SYSTEM_USER);
+ insertRecord.setUpdateBy(AppConstance.SYSTEM_USER);
+ insertRecord.setCId(couponId);
+ insertRecord.setUserId(userId);
+ insertRecord.setIsUsing(2);
+ int i = shopCouponRecordDao.insert(insertRecord);
+ // 如果插入领取记录表失败
+ if (i < 0) {
+ //return new AjaxResult(AjaxResult.STATUS_FAIL, "优惠券领取失败!");
+ }
+ shopCoupon.setQuantityReceive(shopCoupon.getQuantityReceive() + 1);
+ shopCouponDao.updateByModel(shopCoupon);
+ }
+ activitySignReceiveRecordDao.insert(activitySignReceiveRecord);
+ //累计奖励积分,对应用户积分加减
+ if(ActivitySignAwardSet.AWARDTYPE_SCORE == activitySignAwardSetCumulativeDay.getAwardType()) {
+ int awardType = activitySignAwardSetCumulativeDay.getAwardType();
+ if(ActivitySignAwardSet.AWARDTYPE_SCORE == awardType){
+ int scoreCnt = activitySignAwardSetCumulativeDay.getScoreCnt();
+ if(scoreCnt > 0){
+ scoreVipDetailService.addScore(userId,null,null,scoreCnt,
+ activitySignReceiveRecord.getId(), ScoreVipDetail.SCORE_VIP_TYPE_JOIN_ACTIVE,"签到积分");
+ }
+ }
+ }
+ //生成核销记录
+ if(ActivitySignAwardSet.AWARDTYPE_CUSTOMIZE == activitySignAwardSetCumulativeDay.getAwardType()) {
+ ActivitySignWriteoff activitySignWriteoff = new ActivitySignWriteoff();
+ //线下兑换和客服兑换
+ if(ActivitySignAwardSet.AWARDWAY_ONE == activitySignAwardSetCumulativeDay.getAwardWay()
+ || ActivitySignAwardSet.AWARDWAY_THREE == activitySignAwardSetCumulativeDay.getAwardWay()) {
+ activitySignWriteoff.setWriteoffCode(activitySignReceiveRecord.getWriteOffCode());
+ }
+ activitySignWriteoff.setActId(actId);
+ activitySignWriteoff.setAwardId(activitySignAwardSetCumulativeDay.getId());
+ activitySignWriteoff.setWinTime(DateUtil.date());
+ if(ActivitySignAwardSet.AWARDWAY_TWO == activitySignAwardSetCumulativeDay.getAwardWay()) {
+ activitySignWriteoff.setState(ActivitySignWriteoff.STATE_TWO);
+ }else {
+ activitySignWriteoff.setState(ActivitySignWriteoff.STATE_ONE);
+ }
+ activitySignWriteoff.setUserId(userId);
+ activitySignWriteoff.setCompanyId(companyId);
+ activitySignWriteoff.setReceiveId(activitySignReceiveRecord.getId());
+ activitySignWriteoff.setCreateBy(user.getVipName());
+ activitySignWriteoff.setCreateTime(new Date());
+ activitySignWriteoff.setUpdateBy(user.getVipName());
+ activitySignWriteoff.setUpdateTime(new Date());
+ activitySignWriteoffDao.insert(activitySignWriteoff);
+ }
+ luckyDrawSuccessVos.add(luckyDrawSuccessVo);
+ }else{
+ //生成领取记录
+ ActivitySignReceiveRecord activitySignReceiveRecord = new ActivitySignReceiveRecord();
+ activitySignReceiveRecord.setUserId(userId);
+ activitySignReceiveRecord.setReceiveTime(DateUtil.date());
+ activitySignReceiveRecord.setAwardId(activitySignAwardSetNormal.getId());
+ activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE);
+ activitySignReceiveRecord.setActivityId(actId);
+ activitySignReceiveRecord.setCompanyId(companyId);
+ activitySignReceiveRecord.setCreateBy(user.getVipName());
+ activitySignReceiveRecord.setCreateTime(new Date());
+ activitySignReceiveRecord.setUpdateBy(user.getVipName());
+ activitySignReceiveRecord.setUpdateTime(new Date());
+ activitySignReceiveRecordDao.insert(activitySignReceiveRecord);
+
+ LuckyDrawSuccessVo luckyDrawSuccessVo = new LuckyDrawSuccessVo();
+ luckyDrawSuccessVo.setType(1);
+ luckyDrawSuccessVo.setAwardName(activitySignAwardSetNormal.getAwardName());
+ luckyDrawSuccessVo.setAwardImg(activitySignAwardSetNormal.getIntroduceImg());
+ luckyDrawSuccessVos.add(luckyDrawSuccessVo);
+
+ AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+ ajaxResult.setData(luckyDrawSuccessVos);
+ //return ajaxResult;
+ }
+ }
+ AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+ ajaxResult.setData(luckyDrawSuccessVos);
+ //return ajaxResult;
+ }
+
+ @Test
+ public void awardInsert() {
+ //获取奖品的抽奖顺序
+ List<ActivitySignAwardSetVo> activitySignAwardSetVos = new ArrayList<>();
+ ActivitySignAwardSetVo activitySignAwardSetVo1 = new ActivitySignAwardSetVo();
+ activitySignAwardSetVo1.setAwardInventoryCnt(10);
+ activitySignAwardSetVo1.setId(1L);
+ activitySignAwardSetVos.add(activitySignAwardSetVo1);
+ ActivitySignAwardSetVo activitySignAwardSetVo2 = new ActivitySignAwardSetVo();
+ activitySignAwardSetVo2.setAwardInventoryCnt(10);
+ activitySignAwardSetVo2.setId(2L);
+ activitySignAwardSetVos.add(activitySignAwardSetVo2);
+ ActivitySignAwardSetVo activitySignAwardSetVo3 = new ActivitySignAwardSetVo();
+ activitySignAwardSetVo3.setAwardInventoryCnt(2);
+ activitySignAwardSetVo3.setId(3L);
+ activitySignAwardSetVos.add(activitySignAwardSetVo3);
+ ActivitySignAwardSetVo activitySignAwardSetVo4 = new ActivitySignAwardSetVo();
+ activitySignAwardSetVo4.setAwardInventoryCnt(1);
+ activitySignAwardSetVo4.setId(4L);
+ activitySignAwardSetVos.add(activitySignAwardSetVo4);
+
+ //插入所有奖品后的集合
+ LinkedList awardIdFinalList = new LinkedList<>();
+ if(CollUtil.isNotEmpty(activitySignAwardSetVos)){
+ //总数
+ int maxCount = 0;
+ HashMap<Long, ActivitySignAwardSetVo> integerStringHashMap = new HashMap<>();
+ for(ActivitySignAwardSetVo activitySignAwardSetVo : activitySignAwardSetVos){
+ //总共派发数量
+ int awardInventoryCnt = activitySignAwardSetVo.getAwardInventoryCnt();
+ integerStringHashMap.put(activitySignAwardSetVo.getId(),activitySignAwardSetVo);
+ maxCount = maxCount + awardInventoryCnt;
+ }
+ HashMap<Long, ActivitySignAwardSetVo> sortHashMap = sortHashMap(integerStringHashMap,2);
+ HashMap<Long, ActivitySignAwardSetVo> sortHashMapAec = sortHashMap(integerStringHashMap,1);
+ //获取奖品最多的ID
+ Long maxAwardIds = sortHashMap.keySet().stream().findFirst().get();
+ Long minAwardIds = sortHashMapAec.keySet().stream().findFirst().get();
+ //获取最大长度的奖品集合
+ List awardIdList = new LinkedList<Long>();
+ for(int i = 0; i< maxCount ; i++){
+ awardIdList.add(maxAwardIds);
+ }
+
+ Iterator<Map.Entry<Long, ActivitySignAwardSetVo>> entries = sortHashMap.entrySet().iterator();
+ //插入奖品
+ while (entries.hasNext()) {
+ Map.Entry<Long, ActivitySignAwardSetVo> entry = entries.next();
+ ActivitySignAwardSetVo activitySignAwardSetVo = entry.getValue();
+ int awardInventoryCnt = activitySignAwardSetVo.getAwardInventoryCnt();
+ Long awardIdNew = entry.getKey();
+ if(awardIdNew != maxAwardIds){
+ //分段之后的List
+ List splitLists = getSplitList(awardInventoryCnt, awardIdList);
+ for(int j = 0; j<awardInventoryCnt; j++){
+ List splitList = (List) splitLists.get(j);
+ //中间插入对应的奖品ID,如果和maxAwardIds相同,则索引+1
+ List<Long> listInsert = getListInsert(maxAwardIds, awardIdNew, splitList);
+ if(minAwardIds == awardIdNew){
+ awardIdFinalList.addAll(listInsert);
+ }
+ }
+ }
+ }
+
+ }
+ String awrdList = awardIdFinalList.toString();
+ String substring = awrdList.substring(1, awrdList.length() - 1);
+ List<String> strings = Arrays.asList(substring);
+ System.out.println(strings);
+
+ }
+
+
+
+ //中间插入对应的奖品ID,如果和maxAwardIds相同,则索引+1
+ public static List<Long> getListInsert(Long awardOld,Long awardNew,List splitList){
+ //中间位置索引
+ LinkedList<Integer> indexs = new LinkedList<>();
+ int groupFlag = splitList.size() % 2 == 0 ? (splitList.size() / 2) : (splitList.size() / 2 + 1);
+ for(int j = groupFlag-1; j < splitList.size();j++){
+ if(splitList.get(j) == awardOld){
+ indexs.add(j);
+ }
+ }
+ if(CollUtil.isNotEmpty(indexs)){
+ splitList.set(indexs.get(0),awardNew);
+ }else{
+ splitList.add(groupFlag,awardNew);
+ }
+ return splitList;
+ }
+
+ //等份平分数组,最后剩余的添加到倒数第二个集合中
+ public static List<List<Long>> getSplitList(int splitNum, List<Long> list) {
+ LinkedList<List<Long>> splitList = new LinkedList<>();
+ // groupFlag >= 1
+ int groupFlag = list.size() % splitNum == 0 ? (list.size() / splitNum) : (list.size() / splitNum);
+ if(groupFlag * splitNum < list.size()){
+ for (int j = 1; j <= splitNum +1; j++) {
+ if ((j * groupFlag) <= list.size() ) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, j * groupFlag));
+ } else if ((j * groupFlag) > list.size()) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, list.size()));
+ }
+ }
+ }else if(groupFlag * splitNum > list.size()){
+ for (int j = 1; j < splitNum; j++) {
+ if ((j * groupFlag) <= list.size() ) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, j * groupFlag));
+ } else if ((j * groupFlag) > list.size()) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, list.size()));
+ }
+ }
+ }else{
+ for (int j = 1; j <= splitNum; j++) {
+ if ((j * groupFlag) <= list.size() ) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, j * groupFlag));
+ } else if ((j * groupFlag) > list.size()) {
+ splitList.add(list.subList(j * groupFlag - groupFlag, list.size()));
+ }
+ }
+ }
+ return splitList;
+ }
+
+
+ //对于奖品排序 1:升序进行排,2是倒序就是o2-o1
+ public static HashMap<Long, ActivitySignAwardSetVo> sortHashMap(HashMap<Long, ActivitySignAwardSetVo> map,int type) {
+ // 首先拿到 map 的键值对集合
+ Set<Map.Entry<Long, ActivitySignAwardSetVo>> entrySet = map.entrySet();
+ // 将 set 集合转为 List 集合,为什么,为了使用工具类的排序方法
+ List<Map.Entry<Long, ActivitySignAwardSetVo>> list = new ArrayList<Map.Entry<Long, ActivitySignAwardSetVo>>(entrySet);
+ // 使用 Collections 集合工具类对 list 进行排序,排序规则使用匿名内部类来实现
+ Collections.sort(list, new Comparator<Map.Entry<Long, ActivitySignAwardSetVo>>() {
+ @Override
+ public int compare(Map.Entry<Long, ActivitySignAwardSetVo> o1, Map.Entry<Long, ActivitySignAwardSetVo> o2) {
+ if(type == 2){
+ //按照要求根据 升序进行排,如果是倒序就是o2-o1
+ return o2.getValue().getAwardInventoryCnt() - o1.getValue().getAwardInventoryCnt();
+ }
+ return o1.getValue().getAwardInventoryCnt() - o2.getValue().getAwardInventoryCnt();
+ }
+ });
+ //创建一个新的有序的 HashMap 子类的集合
+ LinkedHashMap<Long, ActivitySignAwardSetVo> linkedHashMap = new LinkedHashMap<Long, ActivitySignAwardSetVo>();
+ //将 List 中的数据存储在 LinkedHashMap 中
+ for (Map.Entry<Long, ActivitySignAwardSetVo> entry : list) {
+ linkedHashMap.put(entry.getKey(), entry.getValue());
+ }
+ //返回结果
+ return linkedHashMap;
+ }
/**
* 获取当月的 天数
@@ -111,67 +625,36 @@
// }
@Test
public void clickSign() {
- long actId = 74L;
+ long awardId = 10;
Long userId = 30L;
Long companyId = 36L;
- //获取签到活动的信息
- SignBasicInfoVo signBasicInfoVo = new SignBasicInfoVo();
- AjaxResult ajaxResult = new AjaxResult();
+ SeeAwardTextDto seeAwardTextDto = new SeeAwardTextDto();
+ seeAwardTextDto.setAwardId(awardId);
+ seeAwardTextDto.setCompanyId(companyId);
+ seeAwardTextDto.setUserId(userId);
+ logisticsInsure(seeAwardTextDto);
- ShopActivities shopActivities = shopActivitiesDao.selectOneByCompanyIdAndActTypeAndActStatus(companyId,ShopActivities.ACTIVITIES_TYPE_SIGN,ShopActivities.ACTSTATUS_STATUS_ING);
-
- signBasicInfoVo.setActName(shopActivities.getActName());
- signBasicInfoVo.setActCode(shopActivities.getActCode());
- signBasicInfoVo.setId(shopActivities.getId());
- String actContent = shopActivities.getActContent();
- SignBasicInfoJsonVo signBasicInfoJsonVo = JSON.parseObject(actContent, SignBasicInfoJsonVo.class);
- signBasicInfoVo.setSignBasicInfoJsonVo(signBasicInfoJsonVo);
-
- List<ActivitySignAwardSetVo> activitySignAwardSetVos = activitySignAwardSetDao
- .selectListByActIDAndCompanyId(actId,companyId,ActivitySignAwardSet.AWARDSTATE_WORK);
- signBasicInfoVo.setActivitySignAwardSetVos(activitySignAwardSetVos);
-
- //今日是否已经参与
- ActivitySignRecord activitySignRecord = activitySignRecordDao.selectOneByActIdAndUserIdLikesignTime(actId,userId,new Date());
- if(ObjectUtil.isNotEmpty(activitySignRecord)) {
- signBasicInfoVo.setJoinState(SignBasicInfoVo.JOINSTATE_SIGN);
- }else {
- signBasicInfoVo.setJoinState(SignBasicInfoVo.JOINSTATE_NOTSIGN);
+ }
+ public AjaxResult logisticsInsure(@RequestBody @Validated SeeAwardTextDto seeAwardTextDto) {
+ SeeAwardTextVo seeAwardTextVO = activitySignReceiveRecordDao.selectSeeAwardTextVOById(seeAwardTextDto);
+ if(ObjectUtil.isEmpty(seeAwardTextVO)){
+ return AjaxResult.buildFailInstance("奖品信息无法查看");
}
- /**
- * 默认获取当前月份
- * 获取当前月份的天数
- */
- List<ActivitySignRecordVo> activitySignRecordVos = new ArrayList<>();
- //获取当前月的第一天是星期几
- DateTime dateTime = DateUtil.beginOfMonth(DateUtil.date());
- int i = DateUtil.dayOfWeek(dateTime);
- for(int j = 1;j<i;j++){
- ActivitySignRecordVo activitySignRecordVoNull = new ActivitySignRecordVo();
- activitySignRecordVos.add(activitySignRecordVoNull);
- }
- List<String> monthFullDays = getMonthFullDay(DateUtil.year(DateUtil.date()), DateUtil.month(DateUtil.date()) + 1);
- for(String monthFullDay : monthFullDays){
- ActivitySignRecordVo activitySignRecordVo = new ActivitySignRecordVo();
- activitySignRecordVo.setSignTime(monthFullDay);
- activitySignRecordVo.setActivityId(actId);
- activitySignRecordVo.setCompanyId(companyId);
- //对应日期是否已签到
- Date date = DateUtil.parse(monthFullDay);
- ActivitySignRecord activitySignRecordDone = activitySignRecordDao.selectOneByActIdAndUserIdLikesignTime(actId,userId,date);
- if(ObjectUtil.isNotEmpty(activitySignRecordDone)){
- activitySignRecordVo.setState(1);
- }else{
- activitySignRecordVo.setState(2);
+ long receiveId = seeAwardTextVO.getId();
+ //获取核销记录的ID
+ ActivitySignWriteoff activitySignWriteoff = activitySignWriteoffDao.selectActivitySignWriteoffByUserIDAndReceiveId(seeAwardTextDto.getUserId(),receiveId);
+ if(ObjectUtil.isNotEmpty(activitySignWriteoff)){
+ Integer logisticsId = activitySignWriteoff.getLogisticsId();
+ ShopDeliveryInfo shopDeliveryInfo = shopDeliveryInfoDao.selectById(logisticsId);
+ if(ObjectUtil.isNotEmpty(shopDeliveryInfo)){
+ //查看物流信息
+ wxShopLogisticsQueryService.selectLogisticsInfo(shopDeliveryInfo);
+ List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(shopDeliveryInfo.getId());
+ seeAwardTextVO.setShopLogisticsInfos(shopLogisticsInfos);
}
- activitySignRecordVos.add(activitySignRecordVo);
}
- signBasicInfoVo.setActivitySignRecords(activitySignRecordVos);
-
- //累计签到日期
- int cumulativeDay = getCumulativeDay(actId, userId, DateUtil.date(), 0);
- signBasicInfoVo.setActAumulativeDay(cumulativeDay);
- System.out.println(signBasicInfoVo);
+ AjaxResult result=AjaxResult.buildSuccessInstance(seeAwardTextVO);
+ return result;
}
/**
* 获取累计签到天数
diff --git a/zq-erp/src/test/java/com/matrix/JyyTests.java b/zq-erp/src/test/java/com/matrix/JyyTests.java
index 9297740..b955d11 100644
--- a/zq-erp/src/test/java/com/matrix/JyyTests.java
+++ b/zq-erp/src/test/java/com/matrix/JyyTests.java
@@ -1,27 +1,53 @@
package com.matrix;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.matrix.component.redis.RedisClient;
+import com.matrix.core.constance.MatrixConstance;
+import com.matrix.core.tools.LogUtil;
+import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.bean.SysFunction;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant;
+import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao;
+import com.matrix.system.fenxiao.dao.ShopSalesmanOrderDao;
+import com.matrix.system.fenxiao.entity.ShopSalesmanGrade;
+import com.matrix.system.fenxiao.entity.ShopSalesmanOrder;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.hive.dao.SysOrderDao;
+import com.matrix.system.hive.dao.SysOrderItemDao;
+import com.matrix.system.hive.dao.SysVipInfoDao;
+import com.matrix.system.hive.service.CodeService;
+import com.matrix.system.hive.service.ShoppingGoodsService;
+import com.matrix.system.hive.service.SysOrderService;
+import com.matrix.system.hive.service.SysVipInfoService;
import com.matrix.system.hive.service.imp.SysVipInfoServiceImpl;
import com.matrix.system.score.dao.ScoreVipDetailDao;
import com.matrix.system.score.service.ScoreVipDetailService;
+import com.matrix.system.shopXcx.bean.ShopOrder;
+import com.matrix.system.shopXcx.bean.ShopOrderDetails;
+import com.matrix.system.shopXcx.bean.ShopProduct;
+import com.matrix.system.shopXcx.dao.ShopOrderDao;
+import com.matrix.system.shopXcx.dao.ShopOrderDetailsDao;
import com.matrix.system.shopXcx.dao.ShopOrderV2Dao;
+import com.matrix.system.shopXcx.dao.ShopSkuDao;
import com.matrix.system.shopXcx.mqTask.OrderDingDingNoticeTask;
import com.rabbitmq.client.Delivery;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* 测试类示例
@@ -56,8 +82,13 @@
OrderDingDingNoticeTask orderDingDingNoticeTask;
@Test
+ @Rollback
public void testNoticeTask() throws IOException {
- orderDingDingNoticeTask.handle("",new Delivery(null,null,"1295".getBytes()));
+ // orderDingDingNoticeTask.handle("",new Delivery(null,null,"1295".getBytes()));
+
+
+
+
}
diff --git a/zq-erp/src/test/java/com/matrix/JyyTests2.java b/zq-erp/src/test/java/com/matrix/JyyTests2.java
new file mode 100644
index 0000000..0304fff
--- /dev/null
+++ b/zq-erp/src/test/java/com/matrix/JyyTests2.java
@@ -0,0 +1,241 @@
+package com.matrix;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.matrix.component.redis.RedisClient;
+import com.matrix.core.constance.MatrixConstance;
+import com.matrix.core.tools.LogUtil;
+import com.matrix.system.common.bean.BusParameterSettings;
+import com.matrix.system.common.bean.SysFunction;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant;
+import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao;
+import com.matrix.system.fenxiao.dao.ShopSalesmanOrderDao;
+import com.matrix.system.fenxiao.entity.ShopSalesmanGrade;
+import com.matrix.system.fenxiao.entity.ShopSalesmanOrder;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.hive.dao.SysOrderDao;
+import com.matrix.system.hive.dao.SysOrderItemDao;
+import com.matrix.system.hive.dao.SysVipInfoDao;
+import com.matrix.system.hive.service.CodeService;
+import com.matrix.system.hive.service.ShoppingGoodsService;
+import com.matrix.system.hive.service.SysOrderService;
+import com.matrix.system.hive.service.SysVipInfoService;
+import com.matrix.system.hive.service.imp.SysVipInfoServiceImpl;
+import com.matrix.system.score.dao.ScoreVipDetailDao;
+import com.matrix.system.score.service.ScoreVipDetailService;
+import com.matrix.system.shopXcx.bean.ShopOrder;
+import com.matrix.system.shopXcx.bean.ShopOrderDetails;
+import com.matrix.system.shopXcx.bean.ShopProduct;
+import com.matrix.system.shopXcx.dao.ShopOrderDao;
+import com.matrix.system.shopXcx.dao.ShopOrderDetailsDao;
+import com.matrix.system.shopXcx.dao.ShopOrderV2Dao;
+import com.matrix.system.shopXcx.dao.ShopSkuDao;
+import com.matrix.system.shopXcx.mqTask.OrderDingDingNoticeTask;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.Rollback;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * 测试类示例
+ *
+ * @author jiangyouyao
+ * @email 512061637@qq.com
+ * @date 2019年2月25日
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {ZqErpApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class JyyTests2 {
+
+ @Autowired
+ ShopOrderDao shopOrderDao;
+ @Autowired
+ ShopOrderDetailsDao shopOrderDetailsDao;
+
+ @Autowired
+ SysVipInfoService sysVipInfoService;
+
+
+ @Autowired
+ private SysVipInfoDao vipDap;
+
+ @Autowired
+ SysVipInfoDao vipDao;
+
+ @Autowired
+ CodeService codeService;
+
+ @Autowired
+ SysOrderDao sysOrderDao;
+
+ @Autowired
+ ShoppingGoodsService shoppingGoodsService;
+
+ @Autowired
+ SysOrderItemDao orderItemDao;
+
+ @Autowired
+ SysOrderService orderService;
+
+ @Autowired
+ ShopSkuDao shopSkuDao;
+
+ @Autowired
+ BusParameterSettingsDao parameterSettingsDao;
+
+
+ @Autowired
+ private ShopSalesmanOrderDao shopSalesmanOrderDao;
+
+ @Autowired
+ private ShopSalesmanGradeDao shopSalesmanGradeDao;
+
+
+ @Test
+ @Rollback
+ public void testNoticeTask() throws IOException {
+ // orderDingDingNoticeTask.handle("",new Delivery(null,null,"1295".getBytes()));
+
+ ShopOrder order=shopOrderDao.selectById(1353);
+ //判读客户是否存在上级,存在则产生上级的收益
+ SysVipInfo sysVipInfo = sysVipInfoService.findById(order.getUserId());
+ LogUtil.debug("处理分销订单userOpid={}",sysVipInfo.getOpenId());
+ //判断是否重复生成
+ QueryWrapper queryWrapper=new QueryWrapper();
+ queryWrapper.eq("order_id",order.getId());
+ Integer orderCount = shopSalesmanOrderDao.selectCount(queryWrapper);
+ ShopSalesmanOrder salesmanOrder=new ShopSalesmanOrder();
+ salesmanOrder.setCompanyId(order.getCompanyId());
+ salesmanOrder.setCreateBy(MatrixConstance.SYSTEM_USER);
+ salesmanOrder.setUpdateBy(MatrixConstance.SYSTEM_USER);
+ salesmanOrder.setCreateTime(new Date());
+ salesmanOrder.setUpdateTime(new Date());
+ salesmanOrder.setOrderId(Long.parseLong(order.getId()+""));
+ salesmanOrder.setUserId(order.getUserId());
+ salesmanOrder.setRevenueType(ShopSalesmanOrder.REVENUE_TYPE_SALES);
+ salesmanOrder.setOrderStatus(ShopSalesmanOrder.STATUS_DJS);
+ Double selfAmount=0D;
+ Double zk=1D;
+ //分销订单总额
+ Double orderTotal=0D;
+ for (ShopOrderDetails item:order.getDetails() ){
+ if(item.getShopProduct().getAbleSales()==ShopProduct.ABLE_SALES){
+ orderTotal+=item.getTotalPrice().doubleValue();
+ }
+ }
+ //自购返佣
+ Integer isSales = sysVipInfo.getIsSales();
+ if(SysVipInfo.IS_SALES == isSales){
+ for (ShopOrderDetails item:order.getDetails() ){
+ if(item.getShopProduct().getAbleSales()==ShopProduct.ABLE_SALES){
+ //分销规则是否开启自购返佣
+ BusParameterSettings zgfy = parameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_ZGFY, sysVipInfo.getCompanyId());
+ //按分销等级计算
+ ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectById(sysVipInfo.getSalesmanGrade());
+ if(ObjectUtil.isNotEmpty(zgfy)) {
+ //获取商品的自购返佣价格,如果没有设置,在去获取当前推广人的等级的自购返佣比例
+ if(StrUtil.isNotEmpty(zgfy.getParamValue()) &&
+ FenxiaoSettingConstant.FX_ZGFY_YES.equals(zgfy.getParamValue())) {
+ if(item.getShopSku().getSelfPrice() == null
+ ||item.getShopSku().getSealesPrice().doubleValue() == 0){
+ selfAmount+=item.getTotalPrice().doubleValue()*(shopSalesmanGrade.getSelfCommission()/100);
+ }else {
+ //按产品设置的自购返佣金额计算
+ selfAmount+=item.getShopSku().getSelfPrice().doubleValue()*item.getCount();
+ }
+ }
+ }
+ }
+ }
+ //自购返佣记录
+ if(selfAmount > 0) {
+ //整体的优惠金额折算成折扣,* 佣金
+ zk=(order.getOrderMoney().doubleValue()-order.getPostage().doubleValue())/orderTotal;
+ selfAmount=selfAmount*zk;
+ salesmanOrder.setAmount(selfAmount);
+ salesmanOrder.setSalesUserId(order.getUserId());
+ shopSalesmanOrderDao.insert(salesmanOrder);
+ }
+ }
+
+ //存在上级
+ if(sysVipInfo.getRecommendId()!=null) {
+ SysVipInfo salesMan=sysVipInfoService.findById(sysVipInfo.getRecommendId());
+ Double salesAmount=0D;
+ Double invitationAmount=0D;
+ SysVipInfo invitationMan=null;
+ ShopSalesmanOrder invitationOrder=null;
+ boolean hasInvitationMan=salesMan.getRecommendId()!=null;
+ //判断推广员是否还存在上级,存在则计算邀请收益
+ if(hasInvitationMan){
+ invitationMan=sysVipInfoService.findById(salesMan.getRecommendId());
+ invitationOrder=new ShopSalesmanOrder();
+ BeanUtils.copyProperties(salesmanOrder,invitationOrder);
+ invitationOrder.setSalesUserId(invitationMan.getId());
+ invitationOrder.setRevenueType(ShopSalesmanOrder.REVENUE_TYPE_INVITATION);
+ }
+ //收益计算
+ for (ShopOrderDetails item:order.getDetails() ){
+ if(item.getShopProduct().getAbleSales()== ShopProduct.ABLE_SALES){
+ //按分销等级计算
+ ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectById(salesMan.getSalesmanGrade());
+ //推广提成,按分销等级计算或者按产品设置的推广金额计算
+ if(item.getShopSku().getSealesPrice()==null
+ ||item.getShopSku().getSealesPrice().doubleValue()==0){
+ salesAmount+=item.getTotalPrice().doubleValue()*(shopSalesmanGrade.getSealesCommission()/100);
+ }else{
+ salesAmount+=item.getShopSku().getSealesPrice().doubleValue()*item.getCount();
+ }
+ //邀请提成,获取商品的邀请提成价格和是否有上级推广人,如果没有设置,在去获取当前推广人的等级的自购返佣比例
+ if(hasInvitationMan) {
+ if(item.getShopSku().getInvitationPrice() == null
+ ||item.getShopSku().getInvitationPrice().doubleValue() == 0){
+ //获取上级的推广等级设置
+ ShopSalesmanGrade invitationManGrade = shopSalesmanGradeDao.selectById(invitationMan.getSalesmanGrade());
+ invitationAmount+=item.getTotalPrice().doubleValue()*(invitationManGrade.getInvitationCommission()/100);
+ }else {
+ //按产品设置的邀请提成价格计算
+ invitationAmount+=item.getShopSku().getInvitationPrice().doubleValue()*item.getCount();
+ }
+ }
+ }
+ }
+ //推广提成记录
+ if(salesAmount>0){
+ //整体的优惠金额折算成折扣,* 佣金
+ zk=(order.getOrderMoney().doubleValue()-order.getPostage().doubleValue())/orderTotal;
+ salesAmount=salesAmount*zk;
+ salesmanOrder.setAmount(salesAmount);
+ salesmanOrder.setSalesUserId(sysVipInfo.getRecommendId());
+ shopSalesmanOrderDao.insert(salesmanOrder);
+ }
+ //邀请提成记录
+ if(invitationAmount > 0) {
+ //整体的优惠金额折算成折扣,* 佣金
+ invitationAmount=invitationAmount*zk;
+ invitationOrder.setAmount(invitationAmount);
+ shopSalesmanOrderDao.insert(invitationOrder);
+ }
+ }else{
+ LogUtil.debug("不存在父级userOpid={}",sysVipInfo.getOpenId());
+ }
+
+
+
+
+ }
+
+
+
+}
diff --git "a/zq-erp/src/test/java/com/matrix/\345\233\233\346\234\210\344\273\275\345\256\266\345\261\205\344\272\247\345\223\201\344\270\232\347\273\251\346\201\242\345\244\215.java" "b/zq-erp/src/test/java/com/matrix/\345\233\233\346\234\210\344\273\275\345\256\266\345\261\205\344\272\247\345\223\201\344\270\232\347\273\251\346\201\242\345\244\215.java"
new file mode 100644
index 0000000..4b1f86b
--- /dev/null
+++ "b/zq-erp/src/test/java/com/matrix/\345\233\233\346\234\210\344\273\275\345\256\266\345\261\205\344\272\247\345\223\201\344\270\232\347\273\251\346\201\242\345\244\215.java"
@@ -0,0 +1,61 @@
+package com.matrix;
+
+import com.matrix.system.hive.bean.AchieveNew;
+import com.matrix.system.hive.bean.SysOrderItem;
+import com.matrix.system.hive.dao.AchieveNewDao;
+import com.matrix.system.hive.dao.SysOrderDao;
+import com.matrix.system.hive.dao.SysOrderItemDao;
+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.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 四月份家居产品业绩恢复 {
+
+ @Autowired
+ SysOrderDao sysOrderDao;
+
+ @Autowired
+ SysOrderItemDao itemDao;
+
+ @Autowired
+ AchieveNewDao achieveNewDao;
+
+
+ @Test
+ public void recoverAchieve() {
+
+ AchieveNew queryAchieve=new AchieveNew();
+ List<SysOrderItem> items = itemDao.selectDgd();
+ for (SysOrderItem item :
+ items) {
+ if(item.getType().equals("家居产品")){
+ queryAchieve.setOrderItemId(item.getId());
+ List<AchieveNew> achieveNews = achieveNewDao.selectByModel(queryAchieve);
+ for (AchieveNew achieve :
+ achieveNews) {
+ if(achieve.getHisConsume()==null){
+ achieve.setHisConsume(achieve.getGoodsCash());
+ achieveNewDao.updateByModel(achieve);
+ System.out.println("更新业绩"+achieve.getId());
+ }
+ }
+ }
+ }
+
+ }
+
+
+}
diff --git a/zq-xcx/project.config.json b/zq-xcx/project.config.json
index 8b486aa..77acbda 100644
--- a/zq-xcx/project.config.json
+++ b/zq-xcx/project.config.json
@@ -23,18 +23,20 @@
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
+ "useApiHostProcess": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
+ "enableEngineNative": false,
+ "bundle": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
- "enableEngineNative": false,
"minifyWXSS": true
},
"compileType": "miniprogram",
--
Gitblit v1.9.1