Merge branch 'score_shop' into api_score_meger
25 files added
60 files modified
| | |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.system.shopXcx.mqTask.*; |
| | | import com.matrix.system.wechart.templateMsg.Task.UniformMsgSentTask; |
| | | import com.rabbitmq.client.DeliverCallback; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | |
| | | return new ScoreOrderTask(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Bean |
| | | DeliverCallback OrderDingDingNoticeTask() { |
| | | return new OrderDingDingNoticeTask(); |
| | | } |
| | | |
| | | |
| | | OrderTask OrderrCreateTask() { |
| | | return new OrderTask(); |
| | | } |
| | |
| | | taskList.add(new MqTask(MQ_EXCHANGE_TOPIC + evn, MQTaskRouting.CREATE_ORDER + evn,MQTaskRouting.CREATE_ORDER + evn,OrderrCreateTask())); |
| | | taskList.add(new MqTask(MQ_EXCHANGE_TOPIC + evn, MQTaskRouting.SALES_ORDER + evn,MQTaskRouting.CREATE_ORDER + evn,SalesOrderTask())); |
| | | taskList.add(new MqTask(MQ_EXCHANGE_TOPIC + evn, MQTaskRouting.SCORE_ORDER + evn,MQTaskRouting.CREATE_ORDER + evn,ScoreOrderTask())); |
| | | taskList.add(new MqTask(MQ_EXCHANGE_TOPIC + evn, MQTaskRouting.DINGDING_NOTICE + evn,MQTaskRouting.CREATE_ORDER + evn, OrderDingDingNoticeTask())); |
| | | |
| | | |
| | | rabiitMqTemplate.binding(taskList); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | response = httpclient.execute(httppost); |
| | | if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { |
| | | String result = EntityUtils.toString(response.getEntity(), "utf-8"); |
| | | LogUtil.debug("发送钉钉结果"+result); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | |
| | | 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.system.activity.dto.ActivitiesListDto; |
| | | import com.matrix.system.activity.dto.AddSignAwardSetDto; |
| | | import com.matrix.system.activity.dto.BeCloseDto; |
| | | import com.matrix.system.activity.dto.BeReadyDto; |
| | | import com.matrix.system.activity.dto.CouponDto; |
| | | import com.matrix.system.activity.dto.DelRowDto; |
| | | import com.matrix.system.activity.dto.GoodsDto; |
| | | import com.matrix.system.activity.dto.SignForUpdateDto; |
| | | import com.matrix.system.activity.dto.SignReceiveListDto; |
| | | import com.matrix.system.activity.dto.UpdateSignAwardSetDto; |
| | | 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; |
| | | import com.matrix.system.shopXcx.dao.ShopActivitiesDao; |
| | | 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.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @description 奖品设置表 |
| | |
| | | |
| | | @Autowired |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | | * 马上创建签到活动 |
| | | */ |
| | | @PostMapping(value = "/createSignAwardSet") |
| | | public @ResponseBody |
| | | AjaxResult createSignAwardSet() { |
| | | //获取当前登录人员信息 |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | Long companyId = user.getCompanyId(); |
| | | //签到活动的唯一性 |
| | | List<ShopActivities> shopActivitiesDone = shopActivitiesDao.selectOneByCompanyIdAndActType(companyId,ShopActivities.ACTIVITIES_TYPE_SIGN); |
| | | if(CollUtil.isNotEmpty(shopActivitiesDone)){ |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "签到活动已经创建,请去活动管理菜单查看"); |
| | | } |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, ""); |
| | | } |
| | | |
| | | /** |
| | | * 新增签到活动 |
| | |
| | | |
| | | 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); |
| | | |
| | | } |
| | |
| | | @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); |
| | | } |
| | |
| | | ZjrVo selectUsernameByUserId(@Param("userId")Long userId, @Param("receiveId")Long receiveId); |
| | | |
| | | ShopDeliveryInfo selectShopDeliveryInfoByLogisticsId(@Param("logisticsId")Integer logisticsId); |
| | | |
| | | ActivitySignWriteoff selectActivitySignWriteoffByUserIDAndReceiveId(@Param("userId")Long userId, @Param("receiveId")long receiveId); |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | @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; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value ="客服微信") |
| | | private String wechatImg; |
| | | @ApiModelProperty(value ="客服电话") |
| | | private String customerPhone; |
| | | |
| | | /** |
| | | * 积分数量 |
| | |
| | | private Long awardId; |
| | | |
| | | /** |
| | | * 是否已领取(1:待领取2:已领取 3:待配送 4:待收货) |
| | | * 是否已领取(1:待领取2:已领取 3:待配送 4:待收货 5:已失效) |
| | | */ |
| | | |
| | | |
| | |
| | | public static final int STATE_DONE = 2; |
| | | public static final int STATE_THREE = 3; |
| | | public static final int STATE_FOUR = 4; |
| | | public static final int STATE_FIVE = 5; |
| | | |
| | | /** |
| | | * 核销码 |
| | |
| | | private Date winTime; |
| | | |
| | | /** |
| | | * 状态(1:待兑换 2:待发货 3:已兑换 ) |
| | | * 状态(1:待兑换 2:待发货 3:已兑换 4:已失效 ) |
| | | */ |
| | | private Integer state; |
| | | public static final int STATE_ONE = 1; |
| | | public static final int STATE_TWO = 2; |
| | | public static final int STATE_THREE = 3; |
| | | |
| | | public static final int STATE_FOUR = 4; |
| | | |
| | | /** |
| | | * 中奖者ID |
| | | */ |
| | |
| | | //获取当前登录人员信息 |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | Long companyId = user.getCompanyId(); |
| | | /** |
| | | * todo签到活动的唯一性 |
| | | */ |
| | | |
| | | //签到活动的唯一性 |
| | | List<ShopActivities> shopActivitiesDone = shopActivitiesDao.selectOneByCompanyIdAndActType(companyId,ShopActivities.ACTIVITIES_TYPE_SIGN); |
| | | if(CollUtil.isNotEmpty(shopActivitiesDone)){ |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "签到活动只能创建一次"); |
| | | } |
| | | |
| | | //新增活动主表信息 |
| | | ShopActivities shopActivities = new ShopActivities(); |
| | | shopActivities.setActName(addSignAwardSetDto.getActName()); |
| | |
| | | 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("操作成功"); |
| | |
| | | package com.matrix.system.activity.service; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.matrix.system.activity.vo.ZjrVo; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.bean.SystemDictionary; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.SystemDictionaryDao; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.shopXcx.api.service.WxShopLogisticsQueryService; |
| | | import com.matrix.system.shopXcx.bean.ShopActivities; |
| | | import com.matrix.system.shopXcx.bean.ShopDeliveryInfo; |
| | | import com.matrix.system.shopXcx.bean.ShopLogisticsInfo; |
| | |
| | | ShopDeliveryInfoDao shopDeliveryInfoDao; |
| | | @Autowired |
| | | ShopLogisticsInfoDao shopLogisticsInfoDao; |
| | | @Autowired |
| | | private WxShopLogisticsQueryService wxShopLogisticsQueryService; |
| | | |
| | | public IPage<SignWriteoffListVo> findSignWriteoffList(Page<SignWriteoffListVo> page, |
| | | SignWriteoffListDto signWriteoffListDto) { |
| | |
| | | |
| | | //物流跟踪 |
| | | Integer logisticsId = activitySignWriteoffLogistics.getLogisticsId(); |
| | | if(ObjectUtil.isNotEmpty(logisticsId)) { |
| | | List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(logisticsId); |
| | | if(CollUtil.isNotEmpty(shopLogisticsInfos)) { |
| | | ArrayList<LogisticsVo> logisticsVos = new ArrayList<>(); |
| | | for(ShopLogisticsInfo shopLogistics : shopLogisticsInfos) { |
| | | LogisticsVo logisticsVo = new LogisticsVo(); |
| | | logisticsVo.setContent(shopLogistics.getDescribe()); |
| | | logisticsVo.setTimestamp(shopLogistics.getLogisticsTime()); |
| | | logisticsVos.add(logisticsVo); |
| | | } |
| | | signWriteoffVo.setActivities(logisticsVos); |
| | | } |
| | | } |
| | | |
| | | ShopDeliveryInfo shopDeliveryInfo = shopDeliveryInfoDao.selectById(logisticsId); |
| | | if(ObjectUtil.isNotEmpty(shopDeliveryInfo)){ |
| | | signWriteoffVo.setLogisticsNum(shopDeliveryInfo.getWaybillNo()); |
| | | signWriteoffVo.setLogisticsCompany(shopDeliveryInfo.getLogisticsCompany()); |
| | | //查看物流信息 |
| | | wxShopLogisticsQueryService.selectLogisticsInfo(shopDeliveryInfo); |
| | | List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(shopDeliveryInfo.getId()); |
| | | if(CollUtil.isNotEmpty(shopLogisticsInfos)) { |
| | | ArrayList<LogisticsVo> logisticsVos = new ArrayList<>(); |
| | | for(ShopLogisticsInfo shopLogistics : shopLogisticsInfos) { |
| | | LogisticsVo logisticsVo = new LogisticsVo(); |
| | | logisticsVo.setContent(shopLogistics.getDescribe()); |
| | | logisticsVo.setTimestamp(shopLogistics.getLogisticsTime()); |
| | | logisticsVos.add(logisticsVo); |
| | | } |
| | | signWriteoffVo.setActivities(logisticsVos); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | result.putInMap("signWriteoffVo", signWriteoffVo); |
| | |
| | | String writeOffCode = writeoffCodeSubmitDto.getWriteOffCode(); |
| | | /** |
| | | * 验证核销码是不是匹配 |
| | | * 只能核销一次 |
| | | * 更新核销记录 |
| | | * 更新领取记录 |
| | | */ |
| | | //验证核销码是不是匹配 |
| | | ActivitySignWriteoff activitySignWriteoff = activitySignWriteoffDao.selectById(writeoffId); |
| | | if(ActivitySignWriteoff.STATE_ONE != activitySignWriteoff.getState()){ |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "兑奖码已失效"); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(activitySignWriteoff)) { |
| | | String writeoffCodeReal = activitySignWriteoff.getWriteoffCode(); |
| | | if(!writeoffCodeReal.equals(writeOffCode)) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "兑奖码无效"); |
| | | } |
| | | } |
| | | //更新核销记录 |
| | | //线下兑换失效 |
| | | Long awardId = activitySignWriteoff.getAwardId(); |
| | | ActivitySignAwardSet activitySignAwardSet = activitySignAwardSetDao.selectById(awardId); |
| | | if(ActivitySignAwardSet.AWARDWAY_ONE == activitySignAwardSet.getAwardWay() |
| | | || ActivitySignAwardSet.AWARDWAY_THREE == activitySignAwardSet.getAwardWay()){ |
| | | Date prizeStartTime = activitySignAwardSet.getPrizeStartTime(); |
| | | if(DateUtil.date().getTime() < prizeStartTime.getTime()){ |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "兑奖还没开始呢!"); |
| | | } |
| | | Date prizeEndTime = activitySignAwardSet.getPrizeEndTime(); |
| | | if(DateUtil.date().getTime() > prizeEndTime.getTime()){ |
| | | Long receiveId = activitySignWriteoff.getReceiveId(); |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(receiveId); |
| | | if(ObjectUtil.isNotEmpty(activitySignReceiveRecord)){ |
| | | activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_FIVE); |
| | | } |
| | | activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); |
| | | |
| | | activitySignWriteoff.setState(ActivitySignWriteoff.STATE_FOUR); |
| | | activitySignWriteoffDao.updateById(activitySignWriteoff); |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "已超出兑奖结束时间!"); |
| | | } |
| | | } |
| | | //更新核销记录 |
| | | activitySignWriteoff.setState(ActivitySignWriteoff.STATE_THREE); |
| | | activitySignWriteoff.setWriteoffTime(new Date()); |
| | | activitySignWriteoff.setWriteoffUser(sysUsers.getSuName()); |
| | |
| | | shopDeliveryInfo.setLogisticsCompany(systemDictionary.getName()); |
| | | shopDeliveryInfo.setLogisticsCompanyCode(systemDictionary.getCode()); |
| | | shopDeliveryInfo.setDeliveryWay("物流配送"); |
| | | shopDeliveryInfo.setLogisticsStatus(AppConstance.LOGISTICS_STATUS_OF_RECEIVE); |
| | | |
| | | shopDeliveryInfo.setWaybillNo(logisticsSubmitDto.getKddh()); |
| | | shopDeliveryInfo.setUpdateBy(sysUsers.getSuName()); |
| | |
| | | |
| | | shopDeliveryInfo.setDeliveryTime(new Date()); |
| | | shopDeliveryInfoDao.insert(shopDeliveryInfo); |
| | | // Integer id = shopDeliveryInfo.getId(); |
| | | // if(ObjectUtil.isNotEmpty(id)) { |
| | | // List<ShopLogisticsInfo> shopLogisticsList = new ArrayList<ShopLogisticsInfo>(); |
| | | // AjaxResult result = new AjaxResult(); |
| | | // Map<String, String> logisticsInfo = new HashMap<String, String>(); |
| | | // try { |
| | | // if (shopDeliveryInfo == null) { |
| | | // return new AjaxResult(AjaxResult.STATUS_FAIL, "找不到发货信息"); |
| | | // } |
| | | // if (!StringUtils.isNotBlank(shopDeliveryInfo.getWaybillNo()) || !StringUtils.isNotBlank(shopDeliveryInfo.getLogisticsCompanyCode())) { |
| | | // return new AjaxResult(AjaxResult.STATUS_FAIL, "物流公司信息为空"); |
| | | // } |
| | | // logisticsInfo.put("logisticsCompany", shopDeliveryInfo.getLogisticsCompany()); |
| | | // logisticsInfo.put("waybillNo", shopDeliveryInfo.getWaybillNo()); |
| | | // |
| | | // //如果已经签收直接查数据库 |
| | | // if (AppConstance.LOGISTICS_STATUS_OF_SIGN_FOR.equals(shopDeliveryInfo.getLogisticsStatus())) { |
| | | // |
| | | // List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(shopDeliveryInfo.getId()); |
| | | // logisticsInfo.put("logisticsStatus", String.valueOf(AppConstance.LOGISTICS_STATUS_OF_SIGN_FOR)); |
| | | // result.setStatus(AjaxResult.STATUS_SUCCESS); |
| | | // result.setRows(shopLogisticsInfos); |
| | | // result.putInMap("logisticsInfo", logisticsInfo); |
| | | // return result; |
| | | // } |
| | | // Map<String, String> param = new HashMap<String, String>(); |
| | | // param.put("ShipperCode", shopDeliveryInfo.getLogisticsCompanyCode()); |
| | | // param.put("LogisticCode", shopDeliveryInfo.getWaybillNo()); |
| | | // Map<String, String> paramsUrl = getparams(param); |
| | | // LogUtil.info("物流查询参数" + paramsUrl); |
| | | // String logisticsResult = HttpCurlUtil.sendPost(logisticsUrl, paramsUrl); |
| | | // LogUtil.info("查询物流返回信息" + logisticsResult); |
| | | // LogisticsInfoVo logisticsInfoVo = JSON.parseObject(logisticsResult, LogisticsInfoVo.class); |
| | | // if (logisticsInfoVo.isSuccess()) { |
| | | // ShopDeliveryInfo shopDelivery = new ShopDeliveryInfo(); |
| | | // shopDelivery.setLogisticsStatus(Integer.valueOf(logisticsInfoVo.getState())); |
| | | // shopDelivery.setId(shopDeliveryInfo.getId()); |
| | | // logisticsInfo.put("logisticsStatus", logisticsInfoVo.getState()); |
| | | // //更新物流状态 |
| | | // shopDeliveryInfoDao.updateByModel(shopDelivery); |
| | | // if (CollectionUtils.isNotEmpty(logisticsInfoVo.getTraces())) { |
| | | // List<Map<String, String>> mapTraces = logisticsInfoVo.getTraces(); |
| | | // for (int i = 0; i < mapTraces.size(); i++) { |
| | | // ShopLogisticsInfo shopLogisticsInfo = new ShopLogisticsInfo(); |
| | | // shopLogisticsInfo.setCreateBy(AppConstance.SYSTEM_USER); |
| | | // shopLogisticsInfo.setUpdateBy(AppConstance.SYSTEM_USER); |
| | | // shopLogisticsInfo.setLogisticsTime(mapTraces.get(i).get("AcceptTime")); |
| | | // String acceptStation = mapTraces.get(i).get("AcceptStation"); |
| | | // shopLogisticsInfo.setDescribe(acceptStation); |
| | | // shopLogisticsInfo.setDelieryId(shopDeliveryInfo.getId()); |
| | | // if (acceptStation.indexOf(AppConstance.KDN_IS_SIGN) != -1) { |
| | | // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_SIGN_FOR); |
| | | // } else if (acceptStation.indexOf(AppConstance.KDN_IS_RECEIVE) != -1) { |
| | | // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_RECEIVE); |
| | | // } else if (acceptStation.indexOf(AppConstance.KDN_IS_ON_WAY) != -1) { |
| | | // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_ON_WAY); |
| | | // } else if (acceptStation.indexOf(AppConstance.KDN_IS_MISTAKE) != -1) { |
| | | // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_MISTAKE); |
| | | // } else { |
| | | // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_NONE); |
| | | // } |
| | | // shopLogisticsList.add(shopLogisticsInfo); |
| | | // } |
| | | // shopLogisticsInfoDao.deleteByDelieryId(shopDeliveryInfo.getId()); |
| | | // if (CollectionUtils.isNotEmpty(shopLogisticsList)) { |
| | | // shopLogisticsInfoDao.batchInsert(shopLogisticsList); |
| | | // } |
| | | // } |
| | | // } else { |
| | | // throw new GlobleException(logisticsInfoVo.getReason()); |
| | | // } |
| | | // |
| | | // } catch (Exception e) { |
| | | // throw new GlobleException("物流信息查询失败"); |
| | | // } |
| | | //更新核销记录 |
| | | activitySignWriteoff.setState(ActivitySignWriteoff.STATE_THREE); |
| | | activitySignWriteoff.setWriteoffTime(new Date()); |
| | | activitySignWriteoff.setWriteoffUser(sysUsers.getSuName()); |
| | | activitySignWriteoff.setWriteoffUserid(sysUsers.getSuId()); |
| | | activitySignWriteoff.setLogisticsId(shopDeliveryInfo.getId()); |
| | | activitySignWriteoffDao.updateById(activitySignWriteoff); |
| | | //更新领取记录 |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(receiveId); |
| | | activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_THREE); |
| | | activitySignReceiveRecord.setConsignee(logisticsSubmitDto.getShr()); |
| | | activitySignReceiveRecord.setConsigneeAddress(logisticsSubmitDto.getShdz()); |
| | | activitySignReceiveRecord.setConsigneePhone(logisticsSubmitDto.getLxdh()); |
| | | activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); |
| | | // } |
| | | //更新核销记录 |
| | | activitySignWriteoff.setState(ActivitySignWriteoff.STATE_THREE); |
| | | activitySignWriteoff.setWriteoffTime(new Date()); |
| | | activitySignWriteoff.setWriteoffUser(sysUsers.getSuName()); |
| | | activitySignWriteoff.setWriteoffUserid(sysUsers.getSuId()); |
| | | activitySignWriteoff.setLogisticsId(shopDeliveryInfo.getId()); |
| | | activitySignWriteoffDao.updateById(activitySignWriteoff); |
| | | //更新领取记录 |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(receiveId); |
| | | activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_FOUR); |
| | | activitySignReceiveRecord.setConsignee(logisticsSubmitDto.getShr()); |
| | | activitySignReceiveRecord.setConsigneeAddress(logisticsSubmitDto.getShdz()); |
| | | activitySignReceiveRecord.setConsigneePhone(logisticsSubmitDto.getLxdh()); |
| | | activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "发货成功"); |
| | | } |
| | | |
| | |
| | | * 开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8") |
| | | private Date actBeginTime; |
| | | |
| | | |
| | |
| | | * 结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8") |
| | | private Date actEndTime; |
| | | /** |
| | | * 活动状态 |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
| | |
| | | package com.matrix.system.activity.vo; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | 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 AddSignAwardSetVo { |
| | |
| | | @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 SignSetBasicJsonVo signSetBasicJsonDto; |
| | |
| | | package com.matrix.system.activity.vo; |
| | | |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class CouponVo { |
| | |
| | | * 结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8") |
| | | private Date endTime; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | * 主键 |
| | | */ |
| | | private Long id; |
| | | |
| | | //活动类型 |
| | | private int actType; |
| | | |
| | | @ApiModelProperty(value = "用户") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty(value = "签到时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8") |
| | | private Date reciveTime; |
| | | |
| | | @ApiModelProperty(value = "连续签到天数") |
| | | private Integer cumulativeDay; |
| | | |
| | | @ApiModelProperty(value = "数量") |
| | | private Integer scoreCnt; |
| | | |
| | | @ApiModelProperty(value = "奖励类型") |
| | | private String awardType; |
| | | |
| | | @ApiModelProperty(value = "获得奖励") |
| | | private String awardName; |
| | | @ApiModelProperty(value = "优惠券名") |
| | | private String couponName; |
| | | |
| | | @ApiModelProperty(value ="奖项规则(1:每日奖励(默认)2:累计签到天数)") |
| | | private int awardRule; |
| | |
| | | * 核销时间 |
| | | */ |
| | | @ApiModelProperty(value ="核销时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8") |
| | | private Date writeoffTime; |
| | | |
| | | /** |
| | |
| | | * 中奖时间 |
| | | */ |
| | | @ApiModelProperty(value ="中奖时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8") |
| | | private Date winTime; |
| | | |
| | | /** |
| | |
| | | private int state; |
| | | |
| | | @ApiModelProperty(value ="兑奖时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd hh:mm", timezone="GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8") |
| | | private Date djsj; |
| | | |
| | | @ApiModelProperty(value ="收货人") |
| | |
| | | package com.matrix.system.activity.vo; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | @Data |
| | | public class ZjrVo { |
| | | |
| | |
| | | private String zjr; |
| | | |
| | | @ApiModelProperty(value ="中奖时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone="GMT+8") |
| | | private Date zjsj; |
| | | |
| | | } |
| | |
| | | import com.matrix.core.constance.SystemErrorCode; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.RSAUtils; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.core.tools.*; |
| | | import com.matrix.core.web.BaseAction; |
| | | import com.matrix.system.common.authority.DefaultAuthorityManager; |
| | | import com.matrix.system.common.authority.strategy.AccountPasswordLogin; |
| | |
| | | import com.matrix.system.hive.statistics.StatisticsBusinessDataJob; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.security.Key; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @description 通用控制器,本action未经session过验证器 |
| | |
| | | */ |
| | | @RequestMapping(value = "/common") |
| | | @Controller |
| | | @CrossOrigin(origins = "*", maxAge = 3600) |
| | | public class CommonAction extends BaseAction { |
| | | |
| | | @Autowired |
| | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | |
| | | |
| | | /** |
| | | * 官网联系我们通知 |
| | | */ |
| | | @RequestMapping(value = "/gwLinkUs") |
| | | public @ResponseBody |
| | | AjaxResult gwLinkUs(@RequestBody Map<String , Object> param) { |
| | | |
| | | String title = "hive新客户在官网提交联系请求"; |
| | | if(Objects.nonNull(param.get("name"))){ |
| | | String content = "hive=>name:" + param.get("name") + " tel:" + param.get("tel") ; |
| | | DingDingRobotUtil.sendLink("https://oapi.dingtalk.com/robot/send?access_token=62bb902f0e3945f0ece31306b99abae043fc69a66da0ef04d89fd20bf58d88d8", content, title, "", "www.baidu.com"); |
| | | |
| | | } |
| | | |
| | | return AjaxResult.buildSuccessInstance("提交成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 钉钉通知token |
| | | */ |
| | | public static final String WX_ORDER_NOTICE_DINGDING_TOKEN = "wxOrderNoticeDingdingToken"; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | List<OrderDetailItemVo> selectApiOrderDetailItemsByOrderId(@Param("orderId") Long orderId); |
| | | |
| | | List<ErpOrderDetailItemVo> selectErpOrderItemByOrderId(String orderId); |
| | | |
| | | List<SysOrderItem> selectDgd(); |
| | | } |
| | |
| | | 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.common.interceptor.HostInterceptor; |
| | | import com.matrix.system.hive.bean.MoneyCardUse; |
| | | import com.matrix.system.hive.bean.MoneyCardUseFlow; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | |
| | | //设置支付状态为支付成功 |
| | | modifyMap.put("payStatus", ShopOrder.ORDER_PAY_STATUS_SUCCESS); |
| | | //设置订单状态 |
| | | if (ShopOrder.ORDER_TYPE_GOODS == order.getOrderType()) { |
| | | if (ShopOrder.SHIPPING_METHOD_WL == order.getShippingMethod()) { |
| | | //如果是商品订单则进入待发货 |
| | | modifyMap.put("orderStatus", ShopOrder.ORDER_STATUS_WAIT_SEND); |
| | | } else { |
| | | //如果是服务订单则进入待评价 |
| | | modifyMap.put("orderStatus", ShopOrder.ORDER_STATUS_WAIT_REMARK); |
| | | } else if (ShopOrder.SHIPPING_METHOD_MDZT == order.getShippingMethod()) { |
| | | //如果是门店自提则进入待收款 |
| | | modifyMap.put("orderStatus", ShopOrder.ORDER_STATUS_WAIT_RECEIVE); |
| | | } |
| | | shopOrderDao.updateByMap(modifyMap); |
| | | |
New file |
| | |
| | | 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, "兑换成功!"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | 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 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.entity.ScoreVipDetail; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | | import com.matrix.system.shopXcx.api.dto.SeeAwardTextDto; |
| | | import com.matrix.system.shopXcx.api.dto.SignAwardDto; |
| | | import com.matrix.system.shopXcx.api.service.WxShopLogisticsQueryService; |
| | | import com.matrix.system.shopXcx.api.tools.WxShopCouponUtil; |
| | | import com.matrix.system.shopXcx.api.vo.*; |
| | | import com.matrix.system.shopXcx.bean.ShopActivities; |
| | | import com.matrix.system.shopXcx.dao.ShopActivitiesDao; |
| | | import com.matrix.system.shopXcx.bean.*; |
| | | import com.matrix.system.shopXcx.dao.*; |
| | | import com.matrix.system.shopXcx.vo.SalesOrderVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | @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; |
| | | |
| | | @ApiOperation(value = "获取签到基本信息", notes = "") |
| | | @ApiResponses({ |
| | |
| | | ajaxResult.setData(signBasicInfoVo); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | /** |
| | | * 查看历史签到记录 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "查看历史签到记录", notes = "") |
| | | @GetMapping(value = "getSignRecord/{actId}/{month}") |
| | | @ResponseBody |
| | | public AjaxResult getSignRecord(@PathVariable("actId") long actId,@PathVariable("month") String dateStr) { |
| | | //获取登录人信息 |
| | | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | Long companyId = loginUser.getCompanyId(); |
| | | Long userId = loginUser.getId(); |
| | | Date date = DateUtil.parse(dateStr); |
| | | /** |
| | | * 默认获取当前月份 |
| | | * 获取当前月份的天数 |
| | | */ |
| | | List<ActivitySignRecordVo> activitySignRecordVos = new ArrayList<>(); |
| | | //获取当前月的第一天是星期几 |
| | | DateTime dateTime = DateUtil.beginOfMonth(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(dateTime), DateUtil.month(dateTime) + 1); |
| | | for(String monthFullDay : monthFullDays){ |
| | | ActivitySignRecordVo activitySignRecordVo = new ActivitySignRecordVo(); |
| | | activitySignRecordVo.setSignTime(monthFullDay); |
| | | activitySignRecordVo.setActivityId(actId); |
| | | activitySignRecordVo.setCompanyId(companyId); |
| | | //对应日期是否已签到 |
| | | Date dateSign = DateUtil.parse(monthFullDay); |
| | | ActivitySignRecord activitySignRecordDone = activitySignRecordDao.selectOneByActIdAndUserIdLikesignTime(actId,userId,dateSign); |
| | | if(ObjectUtil.isNotEmpty(activitySignRecordDone)){ |
| | | activitySignRecordVo.setState(1); |
| | | }else{ |
| | | activitySignRecordVo.setState(2); |
| | | } |
| | | activitySignRecordVos.add(activitySignRecordVo); |
| | | } |
| | | AjaxResult ajaxResult = new AjaxResult(); |
| | | ajaxResult = AjaxResult.buildSuccessInstance(""); |
| | | ajaxResult.setData(activitySignRecordVos); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | /** |
| | | * java 获取 获取某年某月 所有日期(yyyy-mm-dd格式字符串) |
| | | * @param year |
| | |
| | | * 查询是否有签到奖品 |
| | | * 日常奖励和自定义奖品 |
| | | */ |
| | | SignSuccessVo signSuccessVo = new SignSuccessVo(); |
| | | List<SignSuccessVo> signSuccessVos = new ArrayList<>(); |
| | | //日常奖励,新增奖品领取记录 |
| | | QueryWrapper<ActivitySignAwardSet> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("award_rule",ActivitySignAwardSet.AWARDRULE_NORMAL); |
| | |
| | | activitySignReceiveRecord.setUpdateTime(new Date()); |
| | | activitySignReceiveRecordDao.insert(activitySignReceiveRecord); |
| | | |
| | | SignSuccessVo signSuccessVo = new SignSuccessVo(); |
| | | signSuccessVo.setType(1); |
| | | signSuccessVo.setScoreCnt(activitySignAwardSetNormal.getScoreCnt()); |
| | | signSuccessVo.setNormalAwardName(activitySignAwardSetNormal.getAwardName()); |
| | | signSuccessVo.setNormalAwardImg(activitySignAwardSetNormal.getIntroduceImg()); |
| | | signSuccessVo.setAwardName(activitySignAwardSetNormal.getAwardName()); |
| | | signSuccessVo.setAwardImg(activitySignAwardSetNormal.getIntroduceImg()); |
| | | signSuccessVos.add(signSuccessVo); |
| | | |
| | | //日常奖励积分,对应用户积分加减 |
| | | int awardType = activitySignAwardSetNormal.getAwardType(); |
| | | if(ActivitySignAwardSet.AWARDTYPE_SCORE == awardType){ |
| | | int scoreCnt = activitySignAwardSetNormal.getScoreCnt(); |
| | | if(scoreCnt > 0){ |
| | | scoreVipDetailService.addScore(userId,null,null,scoreCnt, |
| | | activitySignReceiveRecord.getId(), ScoreVipDetail.SCORE_VIP_TYPE_JOIN_ACTIVE,"签到积分"); |
| | | } |
| | | } |
| | | //获取优惠券 |
| | | if(ActivitySignAwardSet.AWARDTYPE_COUPON == awardType){ |
| | | //获取优惠券 |
| | | int couponId = Integer.parseInt(activitySignAwardSetNormal.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); |
| | | } |
| | | } |
| | | //获取当前累计天数 |
| | | int cumulativeDay = getCumulativeDay(actId, userId, date, 0); |
| | |
| | | queryWrapperCumulativeDay.eq("cumulative_day",cumulativeDay); |
| | | queryWrapperCumulativeDay.eq("company_id",companyId); |
| | | queryWrapperCumulativeDay.eq("activity_id",actId); |
| | | ActivitySignAwardSet activitySignAwardSetCumulativeDay = activitySignAwardSetDao.selectOne(queryWrapperCumulativeDay); |
| | | if(ObjectUtil.isNotEmpty(activitySignAwardSetCumulativeDay)) { |
| | | //是否已领取 |
| | | Long id = activitySignAwardSetCumulativeDay.getId(); |
| | | QueryWrapper<ActivitySignReceiveRecord> queryWrapperActivitySignReceiveRecord = new QueryWrapper<>(); |
| | | queryWrapperActivitySignReceiveRecord.eq("award_id", id); |
| | | queryWrapperActivitySignReceiveRecord.eq("company_id", companyId); |
| | | queryWrapperActivitySignReceiveRecord.eq("activity_id", actId); |
| | | queryWrapperActivitySignReceiveRecord.eq("user_id", userId); |
| | | ActivitySignReceiveRecord activitySignReceiveRecordDone = activitySignReceiveRecordDao.selectOne(queryWrapperActivitySignReceiveRecord); |
| | | if (ObjectUtil.isNotEmpty(activitySignReceiveRecordDone)) { |
| | | String awardNameCumulativeDay = activitySignAwardSetCumulativeDay.getAwardName(); |
| | | AjaxResult ajaxResult = AjaxResult.buildSuccessInstance(awardNameCumulativeDay+"已经领取过了"); |
| | | ajaxResult.setData(signSuccessVo); |
| | | return ajaxResult; |
| | | // ActivitySignAwardSet activitySignAwardSetCumulativeDay = activitySignAwardSetDao.selectOne(queryWrapperCumulativeDay); |
| | | List<ActivitySignAwardSet> activitySignAwardSetCumulativeDays = activitySignAwardSetDao.selectList(queryWrapperCumulativeDay); |
| | | if(CollUtil.isNotEmpty(activitySignAwardSetCumulativeDays)){ |
| | | for(ActivitySignAwardSet activitySignAwardSetCumulativeDay : activitySignAwardSetCumulativeDays){ |
| | | if(ObjectUtil.isNotEmpty(activitySignAwardSetCumulativeDay)) { |
| | | //是否已领取 |
| | | Long id = activitySignAwardSetCumulativeDay.getId(); |
| | | QueryWrapper<ActivitySignReceiveRecord> queryWrapperActivitySignReceiveRecord = new QueryWrapper<>(); |
| | | queryWrapperActivitySignReceiveRecord.eq("award_id", id); |
| | | queryWrapperActivitySignReceiveRecord.eq("company_id", companyId); |
| | | queryWrapperActivitySignReceiveRecord.eq("activity_id", actId); |
| | | queryWrapperActivitySignReceiveRecord.eq("user_id", userId); |
| | | ActivitySignReceiveRecord activitySignReceiveRecordDone = activitySignReceiveRecordDao.selectOne(queryWrapperActivitySignReceiveRecord); |
| | | if (ObjectUtil.isNotEmpty(activitySignReceiveRecordDone)) { |
| | | String awardNameCumulativeDay = activitySignAwardSetCumulativeDay.getAwardName(); |
| | | AjaxResult ajaxResult = AjaxResult.buildSuccessInstance(awardNameCumulativeDay+"已经领取过了"); |
| | | ajaxResult.setData(signSuccessVos); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | SignSuccessVo signSuccessVo = new SignSuccessVo(); |
| | | signSuccessVo.setType(2); |
| | | signSuccessVo.setAwardType(activitySignAwardSetCumulativeDay.getAwardType()); |
| | | signSuccessVo.setAwardName(activitySignAwardSetCumulativeDay.getAwardName()); |
| | | signSuccessVo.setAwardImg(activitySignAwardSetCumulativeDay.getIntroduceImg()); |
| | | signSuccessVo.setAwardState(activitySignAwardSetCumulativeDay.getAwardState()); |
| | | //新增奖品领取记录 |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = new ActivitySignReceiveRecord(); |
| | | activitySignReceiveRecord.setUserId(userId); |
| | | activitySignReceiveRecord.setReceiveTime(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:客服兑换) |
| | | */ |
| | | signSuccessVo.setWriteOffCode(randomString); |
| | | signSuccessVo.setAwardWay(activitySignAwardSetCumulativeDay.getAwardWay()); |
| | | //2:物流配送 |
| | | signSuccessVo.setOperationTip(activitySignAwardSetCumulativeDay.getOperationTip()); |
| | | //1:线下兑换 |
| | | if(ActivitySignAwardSet.AWARDWAY_ONE == activitySignAwardSetCumulativeDay.getAwardWay()) { |
| | | signSuccessVo.setIntroduceTip(activitySignAwardSetCumulativeDay.getIntroduceTip()); |
| | | signSuccessVo.setPrizeAddress(activitySignAwardSetCumulativeDay.getPrizeAddress()); |
| | | signSuccessVo.setPrizeStartTime(activitySignAwardSetCumulativeDay.getPrizeStartTime()); |
| | | signSuccessVo.setPrizeEndTime(activitySignAwardSetCumulativeDay.getPrizeEndTime()); |
| | | } |
| | | //3:客服兑换 |
| | | if(ActivitySignAwardSet.AWARDWAY_THREE == activitySignAwardSetCumulativeDay.getAwardWay()) { |
| | | signSuccessVo.setWechatImg(activitySignAwardSetCumulativeDay.getWechatImg()); |
| | | signSuccessVo.setPrizeStartTime(activitySignAwardSetCumulativeDay.getPrizeStartTime()); |
| | | signSuccessVo.setPrizeEndTime(activitySignAwardSetCumulativeDay.getPrizeEndTime()); |
| | | } |
| | | } |
| | | //2:积分 |
| | | if(ActivitySignAwardSet.AWARDTYPE_SCORE == activitySignAwardSetCumulativeDay.getAwardType()) { |
| | | signSuccessVo.setScoreCnt(activitySignAwardSetCumulativeDay.getScoreCnt()); |
| | | } |
| | | //3:优惠券 |
| | | if(ActivitySignAwardSet.AWARDTYPE_COUPON == activitySignAwardSetCumulativeDay.getAwardType()) { |
| | | signSuccessVo.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(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); |
| | | } |
| | | signSuccessVos.add(signSuccessVo); |
| | | } |
| | | } |
| | | //新增奖品领取记录 |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = new ActivitySignReceiveRecord(); |
| | | activitySignReceiveRecord.setUserId(userId); |
| | | activitySignReceiveRecord.setReceiveTime(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:客服兑换) |
| | | */ |
| | | signSuccessVo.setWriteOffCode(randomString); |
| | | signSuccessVo.setAwardType(activitySignAwardSetCumulativeDay.getAwardType()); |
| | | signSuccessVo.setAwardName(activitySignAwardSetCumulativeDay.getAwardName()); |
| | | signSuccessVo.setAwardImg(activitySignAwardSetCumulativeDay.getIntroduceImg()); |
| | | signSuccessVo.setAwardWay(activitySignAwardSetCumulativeDay.getAwardWay()); |
| | | signSuccessVo.setAwardState(activitySignAwardSetCumulativeDay.getAwardState()); |
| | | //2:物流配送 |
| | | signSuccessVo.setOperationTip(activitySignAwardSetCumulativeDay.getOperationTip()); |
| | | //1:线下兑换 |
| | | if(ActivitySignAwardSet.AWARDWAY_ONE == activitySignAwardSetCumulativeDay.getAwardWay()) { |
| | | signSuccessVo.setIntroduceTip(activitySignAwardSetCumulativeDay.getIntroduceTip()); |
| | | signSuccessVo.setPrizeAddress(activitySignAwardSetCumulativeDay.getPrizeAddress()); |
| | | signSuccessVo.setPrizeStartTime(activitySignAwardSetCumulativeDay.getPrizeStartTime()); |
| | | signSuccessVo.setPrizeEndTime(activitySignAwardSetCumulativeDay.getPrizeEndTime()); |
| | | } |
| | | //3:客服兑换 |
| | | if(ActivitySignAwardSet.AWARDWAY_THREE == activitySignAwardSetCumulativeDay.getAwardWay()) { |
| | | signSuccessVo.setWechatImg(activitySignAwardSetCumulativeDay.getWechatImg()); |
| | | signSuccessVo.setPrizeStartTime(activitySignAwardSetCumulativeDay.getPrizeStartTime()); |
| | | signSuccessVo.setPrizeEndTime(activitySignAwardSetCumulativeDay.getPrizeEndTime()); |
| | | } |
| | | } |
| | | //2:积分 |
| | | if(ActivitySignAwardSet.AWARDTYPE_SCORE == activitySignAwardSetCumulativeDay.getAwardType()) { |
| | | signSuccessVo.setScoreCnt(activitySignAwardSetCumulativeDay.getScoreCnt()); |
| | | } |
| | | //3:优惠券 |
| | | if(ActivitySignAwardSet.AWARDTYPE_COUPON == activitySignAwardSetCumulativeDay.getAwardType()) { |
| | | signSuccessVo.setCouponName(activitySignAwardSetCumulativeDay.getCouponName()); |
| | | } |
| | | activitySignReceiveRecordDao.insert(activitySignReceiveRecord); |
| | | //生成核销记录 |
| | | 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(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); |
| | | } |
| | | } |
| | | |
| | | AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("签到成功"); |
| | | ajaxResult.setData(signSuccessVo); |
| | | ajaxResult.setData(signSuccessVos); |
| | | return ajaxResult; |
| | | } |
| | | /** |
| | |
| | | DateTime offsetDay = DateUtil.offsetDay(date, -i); |
| | | return getCumulativeDay(actId,userId,offsetDay,i); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取累计的签到奖品 |
| | | * |
| | |
| | | signAwardDto.setUserId(loginUser.getId()); |
| | | signAwardDto.setCompanyId(loginUser.getCompanyId()); |
| | | IPage<SignAwardListVo> signAwardListVos = activitySignReceiveRecordDao.selectSignAwardList(page,signAwardDto); |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(signAwardListVos.getRecords()); |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(signAwardListVos); |
| | | return result; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 物流配送确认 |
| | | * 物流配送信息查看 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "物流配送确认", notes = "") |
| | | @ApiOperation(value = "物流配送信息查看", notes = "") |
| | | @PostMapping(value = "/logisticsInsure") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = SeeAwardTextVo.class) |
| | |
| | | seeAwardTextDto.setUserId(loginUser.getId()); |
| | | seeAwardTextDto.setCompanyId(loginUser.getCompanyId()); |
| | | SeeAwardTextVo seeAwardTextVO = activitySignReceiveRecordDao.selectSeeAwardTextVOById(seeAwardTextDto); |
| | | if(ObjectUtil.isEmpty(seeAwardTextVO)){ |
| | | return AjaxResult.buildFailInstance("奖品无法查看物流配送信息"); |
| | | } |
| | | long receiveId = seeAwardTextVO.getId(); |
| | | |
| | | //获取核销记录的ID |
| | | ActivitySignWriteoff activitySignWriteoff = activitySignWriteoffDao.selectActivitySignWriteoffByUserIDAndReceiveId(loginUser.getId(),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); |
| | | } |
| | | } |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(seeAwardTextVO); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 物流配送收货地址保存 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "物流配送收货地址保存", notes = "") |
| | | @GetMapping(value = "logisticsInsureAddress/{addressId}/{receiveId}") |
| | | @ResponseBody |
| | | public AjaxResult logisticsInsureAddress(@PathVariable("addressId") int addressId,@PathVariable("receiveId") long receiveId) { |
| | | ShopReceiveAddress shopReceiveAddress = shopReceiveAddressDao.selectById(addressId); |
| | | if(ObjectUtil.isEmpty(shopReceiveAddress)){ |
| | | return AjaxResult.buildFailInstance("收货地址无效"); |
| | | } |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(receiveId); |
| | | //该奖品不是待领取状态 |
| | | if (ActivitySignReceiveRecord.STATE_DONE == activitySignReceiveRecord.getState() |
| | | || ActivitySignReceiveRecord.STATE_FOUR == activitySignReceiveRecord.getState() |
| | | || ActivitySignReceiveRecord.STATE_FIVE == activitySignReceiveRecord.getState()) { |
| | | return AjaxResult.buildFailInstance("无法修改收货信息"); |
| | | } |
| | | activitySignReceiveRecord.setConsigneeAddress(shopReceiveAddress.getAddrRegion()+"-"+shopReceiveAddress.getAddrDetailaddr()+"-"+shopReceiveAddress.getDormitory()); |
| | | activitySignReceiveRecord.setConsignee(shopReceiveAddress.getAddrLiaisonman()); |
| | | activitySignReceiveRecord.setConsigneePhone(shopReceiveAddress.getAddrTelephone()); |
| | | activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_THREE); |
| | | activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "设置成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 物流配送确认收货 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "物流配送确认收货", notes = "") |
| | | @GetMapping(value = "logisticsInsureById/{receiveId}") |
| | | @ResponseBody |
| | | public AjaxResult logisticsInsureById(@PathVariable("receiveId") long receiveId) { |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(receiveId); |
| | | //如果不是待收货状态 |
| | | if (ActivitySignReceiveRecord.STATE_FOUR != activitySignReceiveRecord.getState()) { |
| | | return AjaxResult.buildFailInstance("该奖品不是待收货状态"); |
| | | } |
| | | activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE); |
| | | activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "收货成功!"); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao; |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanGrade; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author pengliang |
| | |
| | | @Autowired |
| | | private ShopProductCommentDao productCommentDao; |
| | | |
| | | @Autowired |
| | | private ShopSalesmanGradeDao shopSalesmanGradeDao; |
| | | |
| | | /** |
| | | * 根据id查询商品信息 |
| | | * |
| | |
| | | @RequestMapping(value = "/getProductById/{shopId}/{id}") |
| | | @ResponseBody |
| | | public AjaxResult getProductById(@PathVariable Long shopId, @PathVariable("id") Integer id) { |
| | | |
| | | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | ShopProduct shopProduct = shopProductDao.selectById(id); |
| | | if (shopProduct == null) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "没有查询到商品"); |
| | | } |
| | | |
| | | List<ShopProductAttrRef> shopProductAttrRefs = shopProductAttrRefDao.selectByPid(id); |
| | | List<ShopProductImg> shopProductImgs = shopProductImgDao.selectByPid(id); |
| | | List<ShopSku> shopSkus = shopSkuDao.selectByPid(id); |
| | | if(SysVipInfo.IS_SALES==sysVipInfo.getIsSales()){ |
| | | ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectById(sysVipInfo.getSalesmanGrade()); |
| | | //计算产品佣金 |
| | | 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.setSealesPrice(shopSku.getPrice().multiply(BigDecimal.valueOf(shopSalesmanGrade.getSelfCommission())).divide(BigDecimal.valueOf(100))); |
| | | } |
| | | }); |
| | | } |
| | | List<ShopProductParamRef> shopProductParamRefs = shopProductParamRefDao.selectByPid(id); |
| | | shopProduct.setAttrRefs(shopProductAttrRefs); |
| | | shopProduct.setProductImgs(shopProductImgs); |
| | |
| | | @ResponseBody |
| | | public AjaxResult findServiceOrderList(@RequestBody @Validated ErpServiceOrderListDto orderListDto) { |
| | | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo vipInfo= vipInfoDao.selectByPhone(sysVipInfo.getPhone(),HostInterceptor.getCompanyId()); |
| | | orderListDto.setVipId(vipInfo.getId()); |
| | | orderListDto.setVipId(sysVipInfo.getId()); |
| | | List<ErpServiceOrderListVo> apiServiceOrderListInPage = projServicesDao.findWxServiceOrderList(orderListDto); |
| | | return AjaxResult.buildSuccessInstance(apiServiceOrderListInPage,"查询成功"); |
| | | } |
| | |
| | | package com.matrix.system.shopXcx.api.dto; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SeeAwardTextDto", description = "查询参数接收类") |
| | | public class SeeAwardTextDto { |
| | | |
| | | |
| | | @NotNull(message = "奖品ID不能为空") |
| | | @ApiModelProperty(value = "奖品ID", example = "1") |
| | | @NotNull(message = "奖品记录ID不能为空") |
| | | @ApiModelProperty(value = "奖品记录ID", example = "1") |
| | | private Long awardId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | |
| | | /** |
| | | * 配送方式(1=物流,2=门店自取) |
| | | */ |
| | | private String deliverySelect; |
| | | private Integer deliverySelect; |
| | | |
| | | /** |
| | | * 配送门店ID |
| | |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Boolean refundToUser(String id, ShopRefundRecord shopRefundRecord) { |
| | | LogUtil.debug("进入退款接口进行退款。。。", id); |
| | | Boolean flag = false; |
| | |
| | | /** |
| | | * 新增发货信息 |
| | | */ |
| | | public int insertSendPackageInfo(ShopOrder shopOrder, String shippingMethod, ShopReceiveAddress receiveAddress) { |
| | | public int insertSendPackageInfo(ShopOrder shopOrder, Integer shippingMethod, ShopReceiveAddress receiveAddress) { |
| | | ShopDeliveryInfo shopDeliveryInfo = new ShopDeliveryInfo(); |
| | | shopDeliveryInfo.setCreateBy(AppConstance.SYSTEM_USER); |
| | | shopDeliveryInfo.setUpdateBy(AppConstance.SYSTEM_USER); |
| | | shopDeliveryInfo.setOrderId(shopOrder.getId()); |
| | | shopDeliveryInfo.setOrderNo(shopOrder.getOrderNo()); |
| | | shopDeliveryInfo.setUserId(shopOrder.getUserId()); |
| | | shopDeliveryInfo.setDeliveryWay(shippingMethod); |
| | | if(ShopOrder.SHIPPING_METHOD_WL==shippingMethod){ |
| | | shopDeliveryInfo.setDeliveryWay("物流配送"); |
| | | }else{ |
| | | shopDeliveryInfo.setDeliveryWay("门店自提"); |
| | | } |
| | | |
| | | shopDeliveryInfo.setShopId(shopOrder.getStoreId().longValue()); |
| | | shopDeliveryInfo.setCompanyId(shopOrder.getCompanyId()); |
| | | StringBuffer receiveAddrStr = new StringBuffer(); |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | package com.matrix.system.shopXcx.api.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.matrix.system.shopXcx.bean.ShopLogisticsInfo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SeeAwardTextVo", description = "劵码信息") |
| | | public class SeeAwardTextVo { |
| | | |
| | | @ApiModelProperty(value ="中奖记录ID") |
| | | private long id; |
| | | |
| | | @ApiModelProperty(value ="奖项名称") |
| | | private String awardName; |
| | |
| | | @ApiModelProperty(value ="客服微信") |
| | | private String wechatImg; |
| | | |
| | | @ApiModelProperty(value =" 是否已领取(1:待领取2:已领取)") |
| | | @ApiModelProperty(value ="客服电话") |
| | | private String customerPhone ; |
| | | |
| | | @ApiModelProperty(value =" 是否已领取(1:待领取2:已领取 3:待配送 4:待收货 5:已失效)") |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 收货人 |
| | | */ |
| | | @ApiModelProperty(value ="收货人") |
| | | private String consignee; |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @ApiModelProperty(value ="联系电话") |
| | | private String consigneePhone; |
| | | /** |
| | | * 收货地址 |
| | | */ |
| | | @ApiModelProperty(value =" 收货地址") |
| | | private String consigneeAddress; |
| | | |
| | | @ApiModelProperty(value ="物流信息记录") |
| | | private List<ShopLogisticsInfo> shopLogisticsInfos; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value ="数量") |
| | | private int total; |
| | | |
| | | @ApiModelProperty(value ="是否已领取(1:待领取2:已领取 3:待配送 4:待收货)") |
| | | @ApiModelProperty(value ="是否已领取(1:待领取2:已领取 3:待配送 4:待收货 5:已失效)") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value ="领取时间") |
| | |
| | | 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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | @Data |
| | | |
| | | @ApiModel(value = "SignSuccessVo", description = "签到活动") |
| | | public class SignSuccessVo { |
| | | |
| | | @ApiModelProperty(value ="日常奖励名称") |
| | | private String normalAwardName; |
| | | @ApiModelProperty(value ="日常奖励图片") |
| | | private String normalAwardImg; |
| | | @ApiModelProperty(value ="奖励类型 1:日常奖励 2:累计奖励") |
| | | private int type; |
| | | |
| | | @ApiModelProperty(value ="累计奖励名称") |
| | | private String awardName; |
| | |
| | | * 活动类型 签到 |
| | | */ |
| | | public static final int ACTIVITIES_TYPE_SIGN = 4; |
| | | /** |
| | | * 活动类型转盘抽奖 |
| | | */ |
| | | public static final int ACTIVITIES_TYPE_LUCKYDRAW = 5; |
| | | |
| | | /** |
| | | * 活动状态 开启 |
| | |
| | | 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; |
| | | //进行中 |
| | |
| | | import com.matrix.core.pojo.EntityDTO; |
| | | import com.matrix.core.anotations.Extend; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | public static final int ACTIVITY_TYPE_SECKILL = 3; |
| | | |
| | | /** |
| | | * 物流配送 |
| | | */ |
| | | public static final int SHIPPING_METHOD_WL = 1; |
| | | |
| | | /** |
| | | * 门店自提 |
| | | */ |
| | | public static final int SHIPPING_METHOD_MDZT = 2; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | |
| | | /** |
| | | * 配送方式(1=物流,2=门店自取) |
| | | */ |
| | | private String shippingMethod; |
| | | private Integer shippingMethod; |
| | | |
| | | /** |
| | | * 配送门店ID |
| | |
| | | this.remarks = remarks; |
| | | } |
| | | |
| | | public String getShippingMethod() { |
| | | public Integer getShippingMethod() { |
| | | return shippingMethod; |
| | | } |
| | | |
| | | public void setShippingMethod(String shippingMethod) { |
| | | public void setShippingMethod(Integer shippingMethod) { |
| | | this.shippingMethod = shippingMethod; |
| | | } |
| | | |
| | |
| | | |
| | | public ShopActivities selectOneByCompanyIdAndActTypeAndActStatus(@Param("companyId")Long companyId, @Param("activitiesTypeSign")int activitiesTypeSign, |
| | | @Param("actstatusStatusIng")int actstatusStatusIng); |
| | | |
| | | List<ShopActivities> selectOneByCompanyIdAndActType(@Param("companyId")Long companyId,@Param("activitiesTypeSign") int activitiesTypeSign); |
| | | } |
| | |
| | | /** |
| | | * 配送方式 |
| | | */ |
| | | private String shippingMethod; |
| | | private Integer shippingMethod; |
| | | |
| | | /** |
| | | * 拼团ID |
| | |
| | | package com.matrix.system.shopXcx.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2020-04-09 15:49 |
| | | **/ |
| | | @Data |
| | | public class CreateSecKillDTO { |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 配送方式 |
| | | */ |
| | | private String shippingMethod; |
| | | private Integer shippingMethod; |
| | | |
| | | private BigDecimal price; |
| | | |
| | |
| | | |
| | | private String openId; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getAddressId() { |
| | | return addressId; |
| | | } |
| | | |
| | | public void setAddressId(Integer addressId) { |
| | | this.addressId = addressId; |
| | | } |
| | | |
| | | public Integer getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(Integer count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public Long getShopId() { |
| | | return shopId; |
| | | } |
| | | |
| | | public void setShopId(Long shopId) { |
| | | this.shopId = shopId; |
| | | } |
| | | |
| | | public String getShippingMethod() { |
| | | return shippingMethod; |
| | | } |
| | | |
| | | public void setShippingMethod(String shippingMethod) { |
| | | this.shippingMethod = shippingMethod; |
| | | } |
| | | |
| | | public BigDecimal getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(BigDecimal price) { |
| | | this.price = price; |
| | | } |
| | | |
| | | public Integer getGoodsId() { |
| | | return goodsId; |
| | | } |
| | | |
| | | public void setGoodsId(Integer goodsId) { |
| | | this.goodsId = goodsId; |
| | | } |
| | | |
| | | public String getOpenId() { |
| | | return openId; |
| | | } |
| | | |
| | | public void setOpenId(String openId) { |
| | | this.openId = openId; |
| | | } |
| | | } |
| | |
| | | String CREATE_ORDER = "CREATE_ORDER"; |
| | | String SALES_ORDER = "SALES_ORDER"; |
| | | String SCORE_ORDER = "SCORE_ORDER"; |
| | | String DINGDING_NOTICE = "DINGDING_NOTICE" ; |
| | | /** |
| | | * 发送微信消息 |
| | | */ |
New file |
| | |
| | | package com.matrix.system.shopXcx.mqTask; |
| | | |
| | | |
| | | 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.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.shopXcx.bean.ShopOrder; |
| | | import com.matrix.system.shopXcx.bean.ShopOrderDetails; |
| | | import com.matrix.system.shopXcx.dao.ShopOrderDao; |
| | | import com.matrix.system.shopXcx.dao.ShopOrderDetailsDao; |
| | | import com.rabbitmq.client.DeliverCallback; |
| | | import com.rabbitmq.client.Delivery; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 微商城订单同步到erp系统 |
| | | */ |
| | | @Component |
| | | public class OrderDingDingNoticeTask implements DeliverCallback { |
| | | |
| | | |
| | | @Autowired |
| | | ShopOrderDao shopOrderDao; |
| | | |
| | | @Autowired |
| | | ShopOrderDetailsDao shopOrderDetailsDao; |
| | | |
| | | |
| | | @Autowired |
| | | BusParameterSettingsDao parameterSettingsDao; |
| | | |
| | | @Autowired |
| | | SysVipInfoDao sysVipInfoDao; |
| | | |
| | | @Override |
| | | public void handle(String consumerTag, Delivery message) throws IOException { |
| | | String orderId = new String(message.getBody(), "UTF-8"); |
| | | //获取订单信息 |
| | | ShopOrder order = shopOrderDao.selectById(Integer.valueOf(orderId)); |
| | | LogUtil.debug("收到创建订单通知任务orderId={}", orderId); |
| | | BusParameterSettings wxOrderNoticeDingdingToken = parameterSettingsDao.selectCompanyParamByCode(AppConstance.WX_ORDER_NOTICE_DINGDING_TOKEN, order.getCompanyId()); |
| | | if (wxOrderNoticeDingdingToken != null && StringUtils.isNotBlank(wxOrderNoticeDingdingToken.getParamValue())) { |
| | | //获取订单详情 |
| | | List<ShopOrderDetails> orderDetails = shopOrderDetailsDao.selectByOrderId(Integer.valueOf(orderId)); |
| | | StringBuilder content = new StringBuilder(); |
| | | orderDetails.stream().forEach(i -> content.append(i.getsTitle()).append("*").append( |
| | | i.getCount()).append(";")); |
| | | |
| | | DingDingRobotUtil.sendText(wxOrderNoticeDingdingToken.getParamValue(),"微商城订单 ("+order.getUserName()+") | 订单金额:¥"+order.getOrderMoney()+",订单内容:"+ content.toString(),""); |
| | | }else{ |
| | | LogUtil.debug("未配置订单钉钉提醒"); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | * |
| | | * @param groupJoin |
| | | */ |
| | | @Transactional |
| | | public void doUnVirtualGroup(ShopActivitiesGroupJoin groupJoin) { |
| | | LogUtil.info("#非虚拟拼团逻辑处理#"); |
| | | groupJoin.setGjStatus(ShopActivitiesGroupJoin.ACTIVITIES_JOIN_FAIL); |
New file |
| | |
| | | update shop_order set shipping_method='1' where shipping_method='物流配送'; |
| | | update shop_order set shipping_method='2' where shipping_method='立即配送'; |
| | | |
| | | ALTER TABLE `shop_order` |
| | | MODIFY COLUMN `shipping_method` int(2) NULL DEFAULT NULL AFTER `remarks`; |
| | |
| | | ALTER TABLE `shop_delivery_info` |
| | | ADD COLUMN `receive_id` bigint(20) NULL COMMENT '奖品领取ID' AFTER `company_id`; |
| | | |
| | | ALTER TABLE `activity_sign_award_set` |
| | | ADD COLUMN `customer_phone` varchar(100) NULL COMMENT '客服电话' AFTER `company_id`; |
| | | |
| | | ALTER TABLE `shop_delivery_info` |
| | | MODIFY COLUMN `order_id` int(11) NULL AFTER `logistics_company`; |
| | | |
| | | ALTER TABLE `shop_delivery_info` |
| | | MODIFY COLUMN `order_no` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `user_id`; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | 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 |
| | |
| | | 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> |
| | |
| | | c.cumulative_day cumulativeDay, |
| | | c.award_type awardType, |
| | | 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 biz_user b ON a.user_id = b.user_id |
| | | 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} |
| | |
| | | SELECT |
| | | a.id id, |
| | | a.state state, |
| | | a.consignee_phone consigneePhone, |
| | | a.consignee_address consigneeAddress, |
| | | a.consignee, |
| | | a.receive_time receiveTime, |
| | | a.write_off_code writeOffCode, |
| | | 1 total, |
| | |
| | | b.prize_start_time prizeStartTime, |
| | | b.award_way awardWay, |
| | | b.introduce_img introduceImg, |
| | | b.customer_phone customerPhone, |
| | | b.award_name awardName |
| | | FROM |
| | | activity_sign_receive_record a |
| | |
| | | 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> |
| | |
| | | f.receive_address receiveAddress |
| | | FROM |
| | | activity_sign_writeoff a |
| | | left join biz_user b on a.user_id= b.user_id |
| | | left join sys_vip_info b on a.user_id= b.id |
| | | left join shop_activities c on a.act_id= c.id |
| | | left join activity_sign_award_set d on a.award_id= d.id |
| | | left join activity_sign_receive_record e on a.receive_id= e.id |
| | |
| | | b.nick_name zjr |
| | | FROM |
| | | activity_sign_receive_record a |
| | | left join biz_user b on a.user_id= b.user_id |
| | | left join sys_vip_info b on a.user_id= b.id |
| | | where a.user_id = #{userId} and a.award_id = #{receiveId} |
| | | </select> |
| | | |
| | |
| | | where a.id = #{logisticsId} |
| | | </select> |
| | | |
| | | <select id="selectActivitySignWriteoffByUserIDAndReceiveId" resultType="com.matrix.system.activity.entity.ActivitySignWriteoff"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | activity_sign_writeoff a |
| | | where a.receive_id = #{receiveId} |
| | | and a.user_id = #{userId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | 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> |
| | |
| | | and a.act_type=#{activitiesTypeSign} |
| | | and a.act_status=#{actstatusStatusIng} |
| | | </select> |
| | | |
| | | <select id="selectOneByCompanyIdAndActType" resultType="com.matrix.system.shopXcx.bean.ShopActivities"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | shop_activities a |
| | | where |
| | | a.company_id=#{companyId} |
| | | and a.act_type=#{activitiesTypeSign} |
| | | and a.act_status != 5 |
| | | </select> |
| | | </mapper> |
| | |
| | | <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> |
| | |
| | | </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> |
| | |
| | | <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> |
| | |
| | | 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({ |
| | |
| | | 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; |
New file |
| | |
| | | <!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> |
New file |
| | |
| | | <!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> |
New file |
| | |
| | | <!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> |
| | |
| | | |
| | | .image { |
| | | width: 100%; |
| | | height: 100%; |
| | | display: block; |
| | | } |
| | | |
| | |
| | | |
| | | <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"> |
| | | <div style="padding: 5px;"> |
| | | <span style="padding:5px;font-size: 30px;">每日签到</span> |
| | | <span style="padding:5px;font-size: 18px;">每日签到</span> |
| | | <div class="bottom clearfix"> |
| | | <el-button type="primary" class="button" @click="createSign()" round>马上创建</el-button> |
| | | <el-button type="primary" size="mini" class="button" @click="createSign()" round>马上创建</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | |
| | | <el-card class="box-card" :body-style="{ padding: '10px 10px'}"> |
| | | <img src="../../../images/sign/tiantianpingtuan.png" class="image"> |
| | | <div style="padding: 5px;"> |
| | | <span style="padding:5px;font-size: 30px;">拼团</span> |
| | | <span style="padding:5px;font-size: 18px;">拼团</span> |
| | | <div class="bottom clearfix"> |
| | | <el-button type="primary" class="button" @click="openAdd(1)" round>马上创建</el-button> |
| | | <el-button type="primary" size="mini" class="button" @click="openAdd(1)" round>马上创建</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | |
| | | <el-card class="box-card" :body-style="{ padding: '10px 10px'}"> |
| | | <img src="../../../images/sign/jisumiaosha.png" class="image"> |
| | | <div style="padding: 5px;"> |
| | | <span style="padding:5px;font-size: 30px;">秒杀</span> |
| | | <span style="padding:5px;font-size: 18px;">秒杀</span> |
| | | <div class="bottom clearfix"> |
| | | <el-button type="primary" class="button" @click="openSecKill()" round>马上创建</el-button> |
| | | <el-button type="primary" size="mini" class="button" @click="openSecKill()" round>马上创建</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | |
| | | <el-card class="box-card" :body-style="{ padding: '10px 10px'}"> |
| | | <img src="../../../images/sign/shalonghuodong.png" class="image"> |
| | | <div style="padding: 5px;"> |
| | | <span style="padding:5px;font-size: 30px;">沙龙</span> |
| | | <span style="padding:5px;font-size: 18px;">沙龙</span> |
| | | <div class="bottom clearfix"> |
| | | <el-button type="primary" class="button" @click="openSalon()" round>马上创建</el-button> |
| | | <el-button type="primary" size="mini" class="button" @click="openSalon()" round>马上创建</el-button> |
| | | </div> |
| | | </div> |
| | | </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> |
| | |
| | | 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(){ |
| | | layer.full(layer.open({ |
| | | type: 2, |
| | | title: "签到管理", |
| | | maxmin: true, |
| | | area: [MUI.SIZE_L, '500px'], |
| | | content : [ basePath + '/admin/redirect/activity/activity-sign'] |
| | | })); |
| | | $.AjaxProxy().invoke(basePath + "/admin/activitySignAwardSet/createSignAwardSet", 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-sign'] |
| | | })); |
| | | }else{ |
| | | _this.$message({ |
| | | message: data.info, |
| | | type: 'success', |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | // 打新增拼团界面 |
| | | openAdd(value) { |
| | |
| | | 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'] |
| | |
| | | <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px"> |
| | | <el-row style="padding: 10px"> |
| | | <el-col class="col-sm-10" > |
| | | <el-form-item label="收货人:" prop="shr"> |
| | | <el-input v-model="ruleForm.shr" :disabled="(formSelect.state == 3 ? true:false)"></el-input> |
| | | <el-form-item label="收货人:" prop="consignee"> |
| | | <el-input v-model="ruleForm.consignee" :disabled="(formSelect.state == 3 ? true:false)"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="padding: 10px"> |
| | | <el-col class="col-sm-10" > |
| | | <el-form-item label="联系电话:" prop="lxdh"> |
| | | <el-input v-model="ruleForm.lxdh" :disabled="(formSelect.state == 3 ? true:false)"></el-input> |
| | | <el-form-item label="联系电话:" prop="consigneePhone"> |
| | | <el-input v-model="ruleForm.consigneePhone" :disabled="(formSelect.state == 3 ? true:false)"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="padding: 10px"> |
| | | <el-col class="col-sm-10" > |
| | | <el-form-item label="收货地址:" prop="shdz"> |
| | | <el-input v-model="ruleForm.shdz" :disabled="(formSelect.state == 3 ? true:false)"></el-input> |
| | | <el-form-item label="收货地址:" prop="consigneeAddress"> |
| | | <el-input v-model="ruleForm.consigneeAddress" :disabled="(formSelect.state == 3 ? true:false)"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="padding: 10px"> |
| | | <el-col class="col-sm-10" > |
| | | <el-col class="col-sm-10" v-show='false'> |
| | | <el-form-item label="快递公司编码:"> |
| | | <el-input v-model="ruleForm.kdgs" :disabled="(formSelect.state == 3 ? true:false)"></el-input> |
| | | </el-form-item> |
| | |
| | | djfs: '', |
| | | state: '', |
| | | djsj: '', |
| | | consignee: '', |
| | | consigneePhone: '', |
| | | consigneeAddress: '', |
| | | }, |
| | | //物流信息 |
| | | logisticsList:[], |
| | | ruleForm : { |
| | | shr:'', |
| | | lxdh:'', |
| | | shdz:'', |
| | | consignee:'', |
| | | consigneePhone:'', |
| | | consigneeAddress:'', |
| | | kdgs:'', |
| | | kddh:'', |
| | | }, |
| | |
| | | activities: [], |
| | | |
| | | rules : { |
| | | shr : [ |
| | | consignee : [ |
| | | { required: true, message: '请输入收货人', trigger: 'blur' } |
| | | ], |
| | | lxdh : [ |
| | | consigneePhone : [ |
| | | { required: true, message: '请输入联系电话', trigger: 'blur' } |
| | | ], |
| | | shdz : [ |
| | | consigneeAddress : [ |
| | | { required: true, message: '请输入收货地址', trigger: 'blur' } |
| | | ], |
| | | kdgs : [ |
| | |
| | | mounted: function () { |
| | | }, |
| | | methods: { |
| | | //加载分类 |
| | | //加载 |
| | | loadInfo() { |
| | | let _this = this; |
| | | //加载配置 |
| | |
| | | url: basePath + '/admin/activitySignWriteoff/findSignWriteoff', |
| | | callback: function (data) { |
| | | _this.formSelect = data.mapInfo.signWriteoffVo; |
| | | _this.ruleForm.consignee = data.mapInfo.signWriteoffVo.consignee; |
| | | _this.ruleForm.consigneePhone = data.mapInfo.signWriteoffVo.consigneePhone; |
| | | _this.ruleForm.consigneeAddress = data.mapInfo.signWriteoffVo.consigneeAddress; |
| | | _this.ruleForm.kdgs = data.mapInfo.signWriteoffVo.logisticsCompany; |
| | | _this.ruleForm.kddh = data.mapInfo.signWriteoffVo.logisticsNum; |
| | | _this.activities = data.mapInfo.signWriteoffVo.activities; |
| | | } |
| | | }); |
| | |
| | | } |
| | | let resultData = { |
| | | writeoffId : writeoffId, |
| | | shr : _this.ruleForm.shr, |
| | | lxdh : _this.ruleForm.lxdh, |
| | | shdz : _this.ruleForm.shdz, |
| | | shr : _this.ruleForm.consignee, |
| | | lxdh : _this.ruleForm.consigneePhone, |
| | | shdz : _this.ruleForm.consigneeAddress, |
| | | kdgs : _this.ruleForm.kdgs, |
| | | kddh : _this.ruleForm.kddh, |
| | | } |
| | |
| | | message: data.info, |
| | | type: 'success', |
| | | }); |
| | | _this.loadInfo(); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | }, |
| | | closeFrame() { |
| | | parent.layer.close(parent.layer.getFrameIndex(window.name)); |
| | | parent.location.reload(); |
| | | }, |
| | | } |
| | | }) |
| | |
| | | <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="获得奖励" |
| | | 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-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-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="20" label="描述文字"></el-input-number> |
| | | <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-form-item label="字体透明度" style="padding: 10px"> |
| | | <el-input-number v-model="typographyLight" :min="1" :max="100" label="描述文字">%</el-input-number> |
| | | </el-form-item> |
| | | </el-form-item>--> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | |
| | | wechatImg:'', |
| | | scoreCnt:'', |
| | | couponId:'', |
| | | customerPhone:'', |
| | | goodsId:'', |
| | | couponName:'', |
| | | goodsName:'', |
| | |
| | | awardType: parseInt(prizeVo.awardType), |
| | | awardName: prizeVo.awardName, |
| | | introduceImg: prizeVo.introduceImg, |
| | | customerPhone: prizeVo.customerPhone, |
| | | introduceTip: prizeVo.introduceTip, |
| | | awardInventoryCnt: prizeVo.awardInventoryCnt, |
| | | awardDistributeCnt: prizeVo.awardDistributeCnt, |
| | |
| | | awardDistributeCnt: prize.awardDistributeCnt, |
| | | awardWay: prize.awardWay, |
| | | operationTip: prize.operationTip, |
| | | customerPhone: prize.customerPhone, |
| | | prizeAddress: prize.prizeAddress, |
| | | wechatImg: prize.wechatImg, |
| | | scoreCnt: prize.scoreCnt, |
| | |
| | | message: data.info, |
| | | type: 'success', |
| | | }); |
| | | parent.layer.close(parent.layer.getFrameIndex(window.name)); |
| | | parent.location.reload(); |
| | | _this.loadInfo(); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | stripe:true |
| | | @sort-change="sortChange"> |
| | | <el-table-column |
| | | prop="writeoffTime" |
| | | label="核销时间" |
| | | prop="receiveName" |
| | | label="中奖者" |
| | | show-overflow-tooltip> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="writeoffUser" |
| | | label="核销员" |
| | | show-overflow-tooltip> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="兑奖码" |
| | | show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.state == 3">{{scope.row.writeoffCode}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="actName" |
| | |
| | | <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> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="receiveName" |
| | | label="中奖者" |
| | | prop="writeoffTime" |
| | | label="核销时间" |
| | | show-overflow-tooltip> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="writeoffUser" |
| | | label="核销员" |
| | | show-overflow-tooltip> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="兑奖码" |
| | | show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.state == 3">{{scope.row.writeoffCode}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="receiveAddress" |
| | | label="收货地址" |
| | | show-overflow-tooltip> |
| | |
| | | </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-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="20" label="描述文字"></el-input-number> |
| | | <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-form-item label="字体透明度" style="padding: 10px"> |
| | | <el-input-number v-model="typographyLight" :min="1" :max="100" label="描述文字">%</el-input-number> |
| | | </el-form-item> |
| | | </el-form-item>--> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | |
| | | couponId:'', |
| | | goodsId:'', |
| | | couponName:'', |
| | | customerPhone:'', |
| | | goodsName:'', |
| | | } |
| | | var app = new Vue({ |
| | |
| | | operationTip: prize.operationTip, |
| | | prizeAddress: prize.prizeAddress, |
| | | wechatImg: prize.wechatImg, |
| | | customerPhone: prize.customerPhone, |
| | | scoreCnt: prize.scoreCnt, |
| | | couponId: prize.couponId, |
| | | goodsId: prize.goodsId, |
| | |
| | | |
| | | // if (optionType != 1) { |
| | | //直接修改支付金额不重置支付金额 |
| | | item.payMoney = zkPrice * count; |
| | | item.payMoney = (zkPrice * count).toFixed(2); |
| | | // } |
| | | _this.order.payMoney += parseFloat(item.payMoney); |
| | | |
| | |
| | | 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.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant; |
| | | import com.matrix.system.score.constant.ScoreSettingConstant; |
| | | 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.SignBasicInfoJsonVo; |
| | | import com.matrix.system.shopXcx.api.vo.SignBasicInfoVo; |
| | | import com.matrix.system.shopXcx.bean.ShopActivities; |
| | | import com.matrix.system.shopXcx.dao.ShopActivitiesDao; |
| | | import org.junit.Assert; |
| | | 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.boot.test.web.client.TestRestTemplate; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @RunWith(SpringRunner.class) |
| | | @SpringBootTest(classes = {ZqErpApplication.class},webEnvironment =SpringBootTest.WebEnvironment.RANDOM_PORT) |
| | | public class FenxiaoSoreInitTest { |
| | | |
| | | @Autowired |
| | | private BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Autowired |
| | | private ShopActivitiesDao shopActivitiesDao; |
| | | |
| | | @Autowired |
| | | private ActivitySignAwardSetDao activitySignAwardSetDao; |
| | | |
| | | @Autowired |
| | | private TestRestTemplate restTemplate; |
| | | private ActivitySignReceiveRecordDao activitySignReceiveRecordDao; |
| | | |
| | | @Autowired |
| | | private ActivitySignWriteoffDao activitySignWriteoffDao; |
| | | |
| | | @Test |
| | | public void getName() { |
| | | String name = restTemplate.getForObject("/common/job", String.class); |
| | | System.out.println(name); |
| | | Assert.assertEquals("1", name); |
| | | @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 getSignBasicInfo() { |
| | | public void getLuckDraw(){ |
| | | long actId = 85L; |
| | | Long userId = 85L; |
| | | Long companyId = 36L; |
| | | //获取签到活动的信息 |
| | | SignBasicInfoVo signBasicInfoVo = new SignBasicInfoVo(); |
| | | ShopActivities shopActivities = shopActivitiesDao.selectOneByCompanyIdAndActTypeAndActStatus(companyId,ShopActivities.ACTIVITIES_TYPE_SIGN,ShopActivities.ACTSTATUS_STATUS_ING); |
| | | Long actId = shopActivities.getId(); |
| | | signBasicInfoVo.setActName(shopActivities.getActName()); |
| | | signBasicInfoVo.setActCode(shopActivities.getActCode()); |
| | | signBasicInfoVo.setId(shopActivities.getId()); |
| | | 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(); |
| | | SignBasicInfoJsonVo signBasicInfoJsonVo = JSON.parseObject(actContent, SignBasicInfoJsonVo.class); |
| | | signBasicInfoVo.setSignBasicInfoJsonVo(signBasicInfoJsonVo); |
| | | 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("明天再来抽奖吧"); |
| | | } |
| | | } |
| | | |
| | | List<ActivitySignAwardSetVo> activitySignAwardSetVos = activitySignAwardSetDao |
| | | .selectListByActIDAndCompanyId(actId,companyId, ActivitySignAwardSet.AWARDSTATE_WORK); |
| | | signBasicInfoVo.setActivitySignAwardSetVos(activitySignAwardSetVos); |
| | | //生成抽奖记录 |
| | | 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(signBasicInfoVo); |
| | | System.out.println(signBasicInfoVo); |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | | * 获取当月的 天数 |
| | | * */ |
| | | public static int getCurrentMonthDay(Date date) { |
| | | Date beginOfMonth = DateUtil.beginOfMonth(date); |
| | | Date endOfMonth = DateUtil.endOfMonth(date); |
| | | long betweenDay = DateUtil.between(beginOfMonth, endOfMonth, DateUnit.DAY); |
| | | return Integer.parseInt(String.valueOf(betweenDay))+1; |
| | | } |
| | | /** |
| | | * java 获取 获取某年某月 所有日期(yyyy-mm-dd格式字符串) |
| | | * @param year |
| | | * @param month |
| | | * @return |
| | | */ |
| | | public static List<String> getMonthFullDay(int year , int month){ |
| | | SimpleDateFormat dateFormatYYYYMMDD = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<String> fullDayList = new ArrayList<>(32); |
| | | // 获得当前日期对象 |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.clear();// 清除信息 |
| | | cal.set(Calendar.YEAR, year); |
| | | // 1月从0开始 |
| | | cal.set(Calendar.MONTH, month-1 ); |
| | | // 当月1号 |
| | | cal.set(Calendar.DAY_OF_MONTH,1); |
| | | int count = cal.getActualMaximum(Calendar.DAY_OF_MONTH); |
| | | for (int j = 1; j <= count ; j++) { |
| | | fullDayList.add(dateFormatYYYYMMDD.format(cal.getTime())); |
| | | cal.add(Calendar.DAY_OF_MONTH,1); |
| | | } |
| | | return fullDayList; |
| | | } |
| | | // @Test |
| | | // public void getinterger() { |
| | | // Long userId = 30L; |
| | | // Long companyId = 36L; |
| | | // int size = activitySignReceiveRecordDao.getSignAwardReceiveCount(userId,companyId); |
| | | // } |
| | | // /** |
| | | // * 获取累计签到天数 |
| | | // * @param actId |
| | | // * @param userId |
| | | // * @param date |
| | | // * @return |
| | | // */ |
| | | // public int getCumulativeDay(long actId, long userId,Date date, int i) { |
| | | // ActivitySignRecord activitySignRecordOld = activitySignRecordDao.selectOneByActIdAndUserIdLikesignTime(actId,userId,date); |
| | | // if(ObjectUtil.isEmpty(activitySignRecordOld)) { |
| | | // return i; |
| | | // } |
| | | // i++; |
| | | // DateTime offsetDay = DateUtil.offsetDay(date, -i); |
| | | // return getCumulativeDay(actId,userId,offsetDay,i); |
| | | // } |
| | | @Test |
| | | public void clickSign() { |
| | | long awardId = 10; |
| | | Long userId = 30L; |
| | | Long companyId = 36L; |
| | | SeeAwardTextDto seeAwardTextDto = new SeeAwardTextDto(); |
| | | seeAwardTextDto.setAwardId(awardId); |
| | | seeAwardTextDto.setCompanyId(companyId); |
| | | seeAwardTextDto.setUserId(userId); |
| | | logisticsInsure(seeAwardTextDto); |
| | | |
| | | } |
| | | public AjaxResult logisticsInsure(@RequestBody @Validated SeeAwardTextDto seeAwardTextDto) { |
| | | SeeAwardTextVo seeAwardTextVO = activitySignReceiveRecordDao.selectSeeAwardTextVOById(seeAwardTextDto); |
| | | if(ObjectUtil.isEmpty(seeAwardTextVO)){ |
| | | return AjaxResult.buildFailInstance("奖品信息无法查看"); |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(seeAwardTextVO); |
| | | return result; |
| | | } |
| | | /** |
| | | * 获取累计签到天数 |
| | | * @param actId |
| | | * @param userId |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public int getCumulativeDay(long actId, long userId,Date date, int i) { |
| | | ActivitySignRecord activitySignRecordOld = activitySignRecordDao.selectOneByActIdAndUserIdLikesignTime(actId,userId,date); |
| | | if(ObjectUtil.isEmpty(activitySignRecordOld)) { |
| | | return i; |
| | | } |
| | | i++; |
| | | DateTime offsetDay = DateUtil.offsetDay(date, -i); |
| | | return getCumulativeDay(actId,userId,offsetDay,i); |
| | | } |
| | | public void InitByCompanyId() { |
| | | //对应的公司ID |
| | |
| | | // //initBusParameterFenxiaoSetting(companyId); |
| | | } |
| | | |
| | | /** |
| | | * 初始化默认积分规则设置 |
| | | */ |
| | | public void initBusParameterSetting(long companyId) { |
| | | List<BusParameterSettings> ruleSettings=new ArrayList<>(); |
| | | |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.VALID_PERIOD_POINTS, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CREDIT_POINTS_CASH, companyId)); |
| | | |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CASH_CONSUMPTION, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.PRINCIPAL_BALANCE_CONSUMPTION, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.BONUS_BALANCE_CONSUMPTION, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.PRINCIPAL_CONSUMPTION, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.GIVE_CONSUMPTION, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.REFERRALS_CONSUMPTION, companyId)); |
| | | |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CASH_CONSUMPTION_SHOP, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.RESERVATION_SERVICE_SHOP, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.EVALUATUIN_ORDER_SHOP, companyId)); |
| | | |
| | | busParameterSettingsDao.batchInsert(ruleSettings); |
| | | } |
| | | |
| | | /** |
| | | * 初始化默认分销规则设置 |
| | | */ |
| | | public void initBusParameterFenxiaoSetting(long companyId) { |
| | | List<BusParameterSettings> ruleSettings=new ArrayList<>(); |
| | | ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_SWITCH, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_MODEL, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_APPLY_WAY, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_AUDIT_METHOD, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_APPLY_CONDITION, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_TG_PLAN, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_TG_POSTER, companyId)); |
| | | ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_ZGFY, companyId)); |
| | | busParameterSettingsDao.batchInsert(ruleSettings); |
| | | } |
| | | |
| | | private BusParameterSettings addScoreRuleSetting(String code,long companyId) { |
| | | BusParameterSettings busParameterSetting = new BusParameterSettings(); |
| | | busParameterSetting.setParamCode(code); |
| | | busParameterSetting.setCompanyId(companyId); |
| | | return busParameterSetting; |
| | | } |
| | | // /** |
| | | // * 初始化默认积分规则设置 |
| | | // */ |
| | | // public void initBusParameterSetting(long companyId) { |
| | | // List<BusParameterSettings> ruleSettings=new ArrayList<>(); |
| | | // |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.VALID_PERIOD_POINTS, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CREDIT_POINTS_CASH, companyId)); |
| | | // |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CASH_CONSUMPTION, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.PRINCIPAL_BALANCE_CONSUMPTION, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.BONUS_BALANCE_CONSUMPTION, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.PRINCIPAL_CONSUMPTION, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.GIVE_CONSUMPTION, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.REFERRALS_CONSUMPTION, companyId)); |
| | | // |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CASH_CONSUMPTION_SHOP, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.RESERVATION_SERVICE_SHOP, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.EVALUATUIN_ORDER_SHOP, companyId)); |
| | | // |
| | | // busParameterSettingsDao.batchInsert(ruleSettings); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 初始化默认分销规则设置 |
| | | // */ |
| | | // public void initBusParameterFenxiaoSetting(long companyId) { |
| | | // List<BusParameterSettings> ruleSettings=new ArrayList<>(); |
| | | // ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_SWITCH, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_MODEL, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_APPLY_WAY, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_AUDIT_METHOD, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_APPLY_CONDITION, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_TG_PLAN, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_TG_POSTER, companyId)); |
| | | // ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_ZGFY, companyId)); |
| | | // busParameterSettingsDao.batchInsert(ruleSettings); |
| | | // } |
| | | // |
| | | // private BusParameterSettings addScoreRuleSetting(String code,long companyId) { |
| | | // BusParameterSettings busParameterSetting = new BusParameterSettings(); |
| | | // busParameterSetting.setParamCode(code); |
| | | // busParameterSetting.setCompanyId(companyId); |
| | | // return busParameterSetting; |
| | | // } |
| | | |
| | | } |
| | |
| | | import com.matrix.system.score.dao.ScoreVipDetailDao; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | | import com.matrix.system.shopXcx.dao.ShopOrderV2Dao; |
| | | 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.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | @Autowired |
| | | RedisClient redisClient; |
| | | |
| | | |
| | | @Autowired |
| | | OrderDingDingNoticeTask orderDingDingNoticeTask; |
| | | |
| | | @Test |
| | | public void testNoticeTask() throws IOException { |
| | | orderDingDingNoticeTask.handle("",new Delivery(null,null,"1295".getBytes())); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void testRedis() { |
| | | |
| | |
| | | newSetting4.setCategory("店务配置"); |
| | | newSettings.add(newSetting4); |
| | | |
| | | ParameterSettings newSetting5=new ParameterSettings(); |
| | | newSetting5.setCode(AppConstance.WX_ORDER_NOTICE_DINGDING_TOKEN); |
| | | newSetting5.setName("钉钉通知token"); |
| | | newSetting5.setType(1); |
| | | newSetting5.setCategory("微商城配置"); |
| | | newSettings.add(newSetting5); |
| | | |
| | | |
| | | for (ParameterSettings newSetting : newSettings) { |
New file |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |