Merge remote-tracking branch 'origin/activity' into activity
This commit is contained in:
commit
c13b8005e6
|
|
@ -0,0 +1,55 @@
|
|||
package com.ruoyi.dto;
|
||||
|
||||
import com.sinosoft.activity.domain.DrawConfig;
|
||||
import com.sinosoft.activity.domain.DrawPrizeInfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class GtPrizeConfigTemp implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3431401981054724955L;
|
||||
private long baseNumer;
|
||||
private long weightLength;
|
||||
private long startNumer;
|
||||
private long endNumber;
|
||||
private DrawConfig config;
|
||||
private DrawPrizeInfo prizeInfo;
|
||||
public long getBaseNumer() {
|
||||
return baseNumer;
|
||||
}
|
||||
public void setBaseNumer(long baseNumer) {
|
||||
this.baseNumer = baseNumer;
|
||||
}
|
||||
public long getWeightLength() {
|
||||
return weightLength;
|
||||
}
|
||||
public void setWeightLength(long weightLength) {
|
||||
this.weightLength = weightLength;
|
||||
}
|
||||
public long getStartNumer() {
|
||||
return startNumer;
|
||||
}
|
||||
public void setStartNumer(long startNumer) {
|
||||
this.startNumer = startNumer;
|
||||
}
|
||||
public long getEndNumber() {
|
||||
return endNumber;
|
||||
}
|
||||
public void setEndNumber(long endNumber) {
|
||||
this.endNumber = endNumber;
|
||||
}
|
||||
public DrawConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
public void setConfig(DrawConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
public DrawPrizeInfo getPrizeInfo() {
|
||||
return prizeInfo;
|
||||
}
|
||||
public void setPrizeInfo(DrawPrizeInfo prizeInfo) {
|
||||
this.prizeInfo = prizeInfo;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,19 +2,34 @@ package com.ruoyi.service;
|
|||
|
||||
import com.ruoyi.cache.Cache;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.dto.GtPrizeConfigTemp;
|
||||
import com.ruoyi.web.vo.Const;
|
||||
import com.sinosoft.activity.domain.DrawConfig;
|
||||
import com.sinosoft.activity.domain.DrawPrizeInfo;
|
||||
import com.sinosoft.activity.domain.DrawRule;
|
||||
import com.sinosoft.activity.service.IDrawConfigService;
|
||||
import com.sinosoft.activity.service.IDrawPrizeInfoService;
|
||||
import com.sinosoft.activity.service.IDrawRuleService;
|
||||
import com.sinosoft.activity.vo.PrizeInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DrawService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DrawService.class);
|
||||
@Autowired
|
||||
private IDrawRuleService drawRuleService;
|
||||
@Autowired
|
||||
private IDrawConfigService drawConfigService;
|
||||
@Autowired
|
||||
private IDrawPrizeInfoService drawPrizeInfoService;
|
||||
/**
|
||||
* 刷新抽奖需要的缓存信息
|
||||
*
|
||||
|
|
@ -41,53 +56,56 @@ public class DrawService {
|
|||
DrawRule drawRule = drawRuleService.selectDrawRuleList(drawRuleParams).get(0);
|
||||
cacheAdd("_" + drawCode + "_" + currentDateStr + "_rule_", drawRule, "_" + drawCode + "_" + yesterdayDateStr + "_rule_", timeOut);
|
||||
// 奖项配置加入缓存
|
||||
QueryRule gtDrawConfigQueryRule = QueryRule.getInstance();
|
||||
gtDrawConfigQueryRule.addEqual("drawCode", drawCode);
|
||||
gtDrawConfigQueryRule.addEqual("state", Constant.DRAW_CONFIG_STATUS_EFFECTIVE);
|
||||
gtDrawConfigQueryRule.addAscOrder("prizeLevel");
|
||||
List<GtDrawConfig> gtDrawConfigs = gtDrawConfigService.queryByQueryRule(gtDrawConfigQueryRule);
|
||||
cacheAdd("_" + drawCode + "_" + currentDateStr + "_config_", gtDrawConfigs, "_" + drawCode + "_" + yesterdayDateStr + "_config_", timeOut);
|
||||
// 空奖品加入缓存
|
||||
QueryRule gtDrawConfigBlankCondition = QueryRule.getInstance();
|
||||
gtDrawConfigBlankCondition.addEqual("drawCode", drawCode);
|
||||
gtDrawConfigBlankCondition.addEqual("state", Constant.DRAW_CONFIG_STATUS_EFFECTIVE);
|
||||
gtDrawConfigBlankCondition.addEqual("prizeLevel", "blank");
|
||||
List<GtDrawConfig> gtDrawConfigBlankList = gtDrawConfigService.queryByQueryRule(gtDrawConfigBlankCondition);
|
||||
if (gtDrawConfigBlankList == null) {
|
||||
// gtDrawConfigQueryRule.addAscOrder("prizeLevel");
|
||||
DrawConfig drawConfigParams = new DrawConfig();
|
||||
drawConfigParams.setDRAWCODE(drawCode);
|
||||
drawConfigParams.setSTATUS(Const.STATUS_VALID);
|
||||
List<DrawConfig> drawConfigs = drawConfigService.selectDrawConfigList(drawConfigParams);
|
||||
cacheAdd("_" + drawCode + "_" + currentDateStr + "_config_", drawConfigs, "_" + drawCode + "_" + yesterdayDateStr + "_config_", timeOut);
|
||||
// 空奖奖项配置
|
||||
DrawConfig drawConfigBlank = null;
|
||||
// 非空奖项配置
|
||||
List<DrawConfig> gtDrawConfigList = new ArrayList<>();
|
||||
for (DrawConfig drawConfig : drawConfigs) {
|
||||
String prizelevel = drawConfig.getPRIZELEVEL();
|
||||
if (Const.PRIZE_LEVEL_BLANK.equals(prizelevel)) {
|
||||
drawConfigBlank = drawConfig;
|
||||
} else {
|
||||
gtDrawConfigList.add(drawConfig);
|
||||
}
|
||||
}
|
||||
if (drawConfigBlank == null) {
|
||||
throw new Exception("空奖品配置错误");
|
||||
}
|
||||
QueryRule blankQueryRule = QueryRule.getInstance();
|
||||
blankQueryRule.addEqual("prizeCode", gtDrawConfigBlankList.get(0).getPrizeCode());
|
||||
blankQueryRule.addEqual("status", "1");
|
||||
GtPrizeInfo blankPrize = gtPrizeInfoService.queryUniqueGtPrizeInfo(blankQueryRule);
|
||||
// 非空奖奖项配置加入缓存
|
||||
cacheAdd("_" + drawCode + "_" + currentDateStr + "_gtDrawConfigList_", gtDrawConfigList, "_" + drawCode + "_" + yesterdayDateStr + "_gtDrawConfigList_", timeOut);
|
||||
// 空奖奖项配置加入缓存
|
||||
Cache.remove("_" + drawCode + "_blankConfig_");
|
||||
Cache.add("_" + drawCode + "_blankConfig_", drawConfigBlank);
|
||||
//空奖奖品加入缓存
|
||||
|
||||
String prizeCodeBlank = drawConfigBlank.getPRIZECODE();
|
||||
PrizeInfo prizeInfoParams = new PrizeInfo();
|
||||
prizeInfoParams.setDRAWCODE(drawCode);
|
||||
prizeInfoParams.setSTATUS(Const.STATUS_VALID);
|
||||
List<DrawPrizeInfo> drawPrizeInfos = drawPrizeInfoService.selectDrawPrizeInfoByDrawCode(prizeInfoParams);
|
||||
Map<String, DrawPrizeInfo> prizeMap = new HashMap<>();
|
||||
for (DrawPrizeInfo prizeInfo : drawPrizeInfos) {
|
||||
String prizeCode = prizeInfo.getPRIZECODE();
|
||||
prizeMap.put(prizeCode, prizeInfo);
|
||||
}
|
||||
DrawPrizeInfo blankPrize = prizeMap.get(prizeCodeBlank);
|
||||
Cache.remove("_" + drawCode + "_blank_");
|
||||
Cache.add("_" + drawCode + "_blank_", blankPrize);
|
||||
// 空奖奖项配置加入缓存
|
||||
QueryRule gtBlankDrawConfigCondition = QueryRule.getInstance();
|
||||
gtBlankDrawConfigCondition.addEqual("drawCode", drawCode);
|
||||
gtBlankDrawConfigCondition.addEqual("prizeLevel", "blank");
|
||||
List<GtDrawConfig> gtBlankDrawConfigList = gtDrawConfigService.queryByQueryRule(gtBlankDrawConfigCondition);
|
||||
if (gtBlankDrawConfigList != null && gtBlankDrawConfigList.size() > 0) {
|
||||
GtDrawConfig gtDrawConfig = gtBlankDrawConfigList.get(0);
|
||||
Cache.remove("_" + drawCode + "_blankConfig_");
|
||||
Cache.add("_" + drawCode + "_blankConfig_", gtDrawConfig);
|
||||
}
|
||||
// 非空奖奖项配置加入缓存
|
||||
QueryRule gtDrawConfigCondition = QueryRule.getInstance();
|
||||
gtDrawConfigCondition.addEqual("drawCode", drawCode);
|
||||
gtDrawConfigCondition.addEqual("state", Constant.DRAW_CONFIG_STATUS_EFFECTIVE);
|
||||
gtDrawConfigCondition.addNotEqual("prizeLevel", "blank");
|
||||
gtDrawConfigCondition.addAscOrder("prizeLevel");
|
||||
List<GtDrawConfig> gtDrawConfigList = gtDrawConfigService.queryByQueryRule(gtDrawConfigCondition);
|
||||
cacheAdd("_" + drawCode + "_" + currentDateStr + "_gtDrawConfigList_", gtDrawConfigList, "_" + drawCode + "_" + yesterdayDateStr + "_gtDrawConfigList_", timeOut);
|
||||
|
||||
// 计算总权重
|
||||
BigDecimal totalProbability = BigDecimal.ZERO;
|
||||
// 最小概率
|
||||
BigDecimal minProbability = BigDecimal.ZERO;
|
||||
if (gtDrawConfigList != null && gtDrawConfigList.size() > 0) {
|
||||
for (int i = 0; i < gtDrawConfigList.size(); i++) {
|
||||
GtDrawConfig gtDrawConfig = gtDrawConfigList.get(i);
|
||||
String prizeWigth = new BigDecimal(gtDrawConfig.getProbability()).divide(new BigDecimal(100)).toString();
|
||||
DrawConfig gtDrawConfig = gtDrawConfigList.get(i);
|
||||
String prizeWigth = new BigDecimal(gtDrawConfig.getPROBABILITY()).divide(new BigDecimal(100)).toString();
|
||||
totalProbability = totalProbability.add(new BigDecimal(prizeWigth));
|
||||
String n = prizeWigth;
|
||||
if (i == 0) {
|
||||
|
|
@ -110,15 +128,12 @@ public class DrawService {
|
|||
long tmp = 0;
|
||||
if (gtDrawConfigList != null && gtDrawConfigList.size() > 0) {
|
||||
for (int i = 0; i < gtDrawConfigList.size(); i++) {
|
||||
GtDrawConfig gtDrawConfig = gtDrawConfigList.get(i);
|
||||
String probability = gtDrawConfig.getProbability();
|
||||
DrawConfig gtDrawConfig = gtDrawConfigList.get(i);
|
||||
String probability = gtDrawConfig.getPROBABILITY();
|
||||
GtPrizeConfigTemp gtPrizeConfigTemp = new GtPrizeConfigTemp();
|
||||
gtPrizeConfigTemp.setBaseNumer(baseNumer.longValue());
|
||||
gtPrizeConfigTemp.setConfig(gtDrawConfig);
|
||||
QueryRule prizeQueryRule = QueryRule.getInstance();
|
||||
prizeQueryRule.addEqual("prizeCode", gtDrawConfig.getPrizeCode());
|
||||
List<GtPrizeInfo> prizeInfo = gtPrizeInfoService.queryByQueryRule(prizeQueryRule);
|
||||
gtPrizeConfigTemp.setPrizeInfo(prizeInfo.get(0));
|
||||
gtPrizeConfigTemp.setPrizeInfo(prizeMap.get(gtDrawConfig.getPRIZECODE()));
|
||||
// 区间1从0开始
|
||||
if (i == 0) {
|
||||
// 区间数从1开始
|
||||
|
|
@ -137,7 +152,7 @@ public class DrawService {
|
|||
tmp = end;
|
||||
}
|
||||
// 奖项开始结束区间加入缓存
|
||||
cacheAdd("_cache_" + drawCode + "_" + currentDateStr + "_" + gtDrawConfig.getPrizeLevel() + "_", gtPrizeConfigTemp, "_cache_" + drawCode + "_" + yesterdayDateStr + "_" + gtDrawConfig.getPrizeLevel() + "_", timeOut);
|
||||
cacheAdd("_cache_" + drawCode + "_" + currentDateStr + "_" + gtDrawConfig.getPRIZELEVEL() + "_", gtPrizeConfigTemp, "_cache_" + drawCode + "_" + yesterdayDateStr + "_" + gtDrawConfig.getPRIZELEVEL() + "_", timeOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,6 @@ public interface Const {
|
|||
|
||||
String STATUS_VALID = "1";
|
||||
String STATUS_INVALID = "0";
|
||||
|
||||
String PRIZE_LEVEL_BLANK = "blank";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,16 +188,20 @@ public class DrawInfoController extends BaseController
|
|||
@Log(title = "抽奖活动管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(DrawInfo drawInfo)
|
||||
{
|
||||
logger.info("修改存储抽奖特殊规则对象传参:"+JSON.toJSONString(drawInfo));
|
||||
drawInfo.setLASTUPDATETIMESTAMP(new Date());
|
||||
drawInfoService.updateDrawInfo(drawInfo);
|
||||
DrawRule drawRule = new DrawRule();
|
||||
BeanUtils.copyProperties(drawInfo,drawRule);
|
||||
logger.info("修改存储抽奖特殊规则对象入参:"+JSON.toJSONString(drawRule));
|
||||
int i = iDrawRuleService.updateDrawRule(drawRule);
|
||||
return toAjax(i);
|
||||
public AjaxResult editSave(ActVO vo)
|
||||
{
|
||||
try{
|
||||
logger.info("前台传参"+ JSON.toJSONString(vo));
|
||||
Date date = new Date();
|
||||
|
||||
int i = drawInfoService.updateActVO(vo);
|
||||
return toAjax(i);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("系统繁忙");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -209,6 +213,8 @@ public class DrawInfoController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
|
||||
|
||||
return toAjax(drawInfoService.deleteDrawInfoByIds(ids));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.ruoyi.common.annotation.Excel;
|
|||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 抽奖活动管理对象 draw_info
|
||||
|
|
@ -78,6 +79,15 @@ public class DrawInfo extends BaseEntity
|
|||
/** */
|
||||
private String VALIDATETYPE;
|
||||
|
||||
private List<String> drawId;
|
||||
|
||||
public List<String> getDrawId() {
|
||||
return drawId;
|
||||
}
|
||||
|
||||
public void setDrawId(List<String> drawId) {
|
||||
this.drawId = drawId;
|
||||
}
|
||||
|
||||
public void setDRAWID(String DRAWID)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,4 +64,10 @@ public interface ActConfigMapper
|
|||
* @return
|
||||
*/
|
||||
public ActConfig selectActConfigByCode(String drawCode);
|
||||
|
||||
/**
|
||||
* 根据活动代码删除活动配置信息
|
||||
* @param toStrArray
|
||||
*/
|
||||
public void deleteActConfigByCode(String[] toStrArray);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,4 +64,10 @@ public interface ActPageConfigGuideMapper
|
|||
* @return
|
||||
*/
|
||||
public ActPageConfigGuide selectActPageConfigGuideByCode(String drawCode);
|
||||
|
||||
/**
|
||||
* 根据活动代码删除活动展示内容配置信息
|
||||
* @param toStrArray
|
||||
*/
|
||||
public void deleteActPageConfigGuideByCode(String[] toStrArray);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,4 +64,10 @@ public interface ActPageConfigSubscribeMapper
|
|||
* @return
|
||||
*/
|
||||
public ActPageConfigSubscribe selectActPageConfigSubscribeByCode(String drawCode);
|
||||
|
||||
/**
|
||||
* 根据活动代码删除活动配置信息
|
||||
* @param toStrArray
|
||||
*/
|
||||
public void deleteActPageConfigSubscribeByCode(String[] toStrArray);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,4 +64,10 @@ public interface ActPageConfigUserinfoMapper
|
|||
* @return
|
||||
*/
|
||||
public ActPageConfigUserinfo selectActPageConfigUserinfoByCode(String drawCode);
|
||||
|
||||
/**
|
||||
* 根据活动代码删除活动收集配置信息
|
||||
* @param toStrArray
|
||||
*/
|
||||
public void deleteActPageConfigUserinfoByCode(String[] toStrArray);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.sinosoft.activity.mapper;
|
|||
|
||||
import java.util.List;
|
||||
import com.sinosoft.activity.domain.DrawPrizeInfo;
|
||||
import com.sinosoft.activity.vo.PrizeInfo;
|
||||
|
||||
/**
|
||||
* 存储奖品的基础信息Mapper接口
|
||||
|
|
@ -34,6 +35,7 @@ public interface DrawPrizeInfoMapper
|
|||
public List<DrawPrizeInfo> selectDrawPrizeInfoList(DrawPrizeInfo drawPrizeInfo);
|
||||
|
||||
List<DrawPrizeInfo> findDrawPrizeInfoList();
|
||||
List<DrawPrizeInfo> selectDrawPrizeInfoByDrawCode(PrizeInfo prizeInfo);
|
||||
|
||||
/**
|
||||
* 新增存储奖品的基础信息
|
||||
|
|
|
|||
|
|
@ -65,4 +65,10 @@ public interface DrawRuleMapper
|
|||
* @return
|
||||
*/
|
||||
public DrawRule selectDrawRuleByCode(String drawCode);
|
||||
|
||||
/**
|
||||
* 根据活动代码删除抽奖活动管理信息
|
||||
* @param toStrArray
|
||||
*/
|
||||
public int deleteDrawRuleByIdCode(String[] toStrArray);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.sinosoft.activity.service;
|
|||
|
||||
|
||||
import com.sinosoft.activity.domain.DrawInfo;
|
||||
import com.sinosoft.activity.vo.ActVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -68,4 +69,5 @@ public interface IDrawInfoService
|
|||
public int deleteDrawInfoById(String DRAWID);
|
||||
|
||||
|
||||
public int updateActVO(ActVO vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.sinosoft.activity.service;
|
|||
|
||||
import java.util.List;
|
||||
import com.sinosoft.activity.domain.DrawPrizeInfo;
|
||||
import com.sinosoft.activity.vo.PrizeInfo;
|
||||
|
||||
/**
|
||||
* 存储奖品的基础信息Service接口
|
||||
|
|
@ -32,6 +33,7 @@ public interface IDrawPrizeInfoService
|
|||
* @return
|
||||
*/
|
||||
List<DrawPrizeInfo> findDrawPrizeInfoList();
|
||||
List<DrawPrizeInfo> selectDrawPrizeInfoByDrawCode(PrizeInfo prizeInfo);
|
||||
|
||||
/**
|
||||
* 新增存储奖品的基础信息
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
package com.sinosoft.activity.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.sinosoft.activity.domain.DrawInfo;
|
||||
import com.sinosoft.activity.mapper.DrawInfoMapper;
|
||||
import com.sinosoft.activity.domain.*;
|
||||
import com.sinosoft.activity.mapper.*;
|
||||
import com.sinosoft.activity.service.IDrawInfoService;
|
||||
import com.sinosoft.activity.vo.ActVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -21,6 +25,17 @@ public class DrawInfoServiceImpl implements IDrawInfoService
|
|||
{
|
||||
@Autowired
|
||||
private DrawInfoMapper drawInfoMapper;
|
||||
@Autowired
|
||||
private ActConfigMapper actConfigMapper;
|
||||
@Autowired
|
||||
private ActPageConfigGuideMapper actPageConfigGuideMapper;
|
||||
@Autowired
|
||||
private ActPageConfigSubscribeMapper actPageConfigSubscribeMapper;
|
||||
@Autowired
|
||||
private ActPageConfigUserinfoMapper actPageConfigUserinfoMapper;
|
||||
@Autowired
|
||||
private DrawRuleMapper drawRuleMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询抽奖活动管理对象
|
||||
|
|
@ -72,11 +87,12 @@ public class DrawInfoServiceImpl implements IDrawInfoService
|
|||
@Override
|
||||
public int updateDrawInfo(DrawInfo drawInfo)
|
||||
{
|
||||
|
||||
return drawInfoMapper.updateDrawInfo(drawInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除抽奖活动管理对象对象
|
||||
* 删除抽奖活动管理及其相关活动配置信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
|
|
@ -84,7 +100,28 @@ public class DrawInfoServiceImpl implements IDrawInfoService
|
|||
@Override
|
||||
public int deleteDrawInfoByIds(String ids)
|
||||
{
|
||||
return drawInfoMapper.deleteDrawInfoByIds(Convert.toStrArray(ids));
|
||||
DrawInfo drawInfo = new DrawInfo();
|
||||
String[] string = ids.split(",");
|
||||
List<String> code = Arrays.asList(string);
|
||||
drawInfo.setDrawId(code);
|
||||
//根据ID查询抽奖活动信息
|
||||
List<DrawInfo> drawInfos = drawInfoMapper.selectDrawInfoList(drawInfo);
|
||||
//删除活动管理信息
|
||||
drawInfoMapper.deleteDrawInfoByIds(Convert.toStrArray(ids));
|
||||
List<String> collect = drawInfos.stream().map(DrawInfo::getDRAWCODE).collect(Collectors.toList());
|
||||
String policyEndorseNos = String.join(",",collect);
|
||||
|
||||
//根据活动代码删除活动配置信息
|
||||
actConfigMapper.deleteActConfigByCode(Convert.toStrArray(policyEndorseNos));
|
||||
//根据活动代码删除活动展示内容配置信息
|
||||
actPageConfigGuideMapper.deleteActPageConfigGuideByCode(Convert.toStrArray(policyEndorseNos));
|
||||
//根据活动代码删除活动配置信息
|
||||
actPageConfigSubscribeMapper.deleteActPageConfigSubscribeByCode(Convert.toStrArray(policyEndorseNos));
|
||||
//根据活动代码删除活动收集配置信息
|
||||
actPageConfigUserinfoMapper.deleteActPageConfigUserinfoByCode(Convert.toStrArray(policyEndorseNos));
|
||||
//根据活动代码删除抽奖活动管理信息
|
||||
int i = drawRuleMapper.deleteDrawRuleByIdCode(Convert.toStrArray(policyEndorseNos));
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -98,4 +135,48 @@ public class DrawInfoServiceImpl implements IDrawInfoService
|
|||
{
|
||||
return drawInfoMapper.deleteDrawInfoById(DRAWID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateActVO(ActVO vo) {
|
||||
Date date = new Date();
|
||||
|
||||
DrawInfo drawInfo = vo.getDrawInfo();
|
||||
drawInfo.setLASTUPDATETIMESTAMP(date);
|
||||
|
||||
//修改抽奖活动管理对象
|
||||
String drawcode = drawInfo.getDRAWCODE();
|
||||
drawInfoMapper.updateDrawInfo(drawInfo);
|
||||
|
||||
//修改活动配置
|
||||
ActConfig actConfig = vo.getActConfig();
|
||||
actConfig.setUpdateTime(date);
|
||||
actConfig.setActCode(drawcode);
|
||||
actConfigMapper.updateActConfig(actConfig);
|
||||
|
||||
//修改活动展示内容配置
|
||||
ActPageConfigGuide actPageConfigGuide = vo.getActPageConfigGuide();
|
||||
actPageConfigGuide.setUpdateTime(date);
|
||||
actPageConfigGuide.setActCode(drawcode);
|
||||
actPageConfigGuideMapper.updateActPageConfigGuide(actPageConfigGuide);
|
||||
|
||||
|
||||
//修改活动收集配置
|
||||
ActPageConfigSubscribe actPageConfigSubscribe = vo.getActPageConfigSubscribe();
|
||||
actPageConfigSubscribe.setUpdateTime(date);
|
||||
actPageConfigSubscribe.setActCode(drawcode);
|
||||
actPageConfigSubscribeMapper.updateActPageConfigSubscribe(actPageConfigSubscribe);
|
||||
|
||||
//修改活动用户信息
|
||||
ActPageConfigUserinfo actPageConfigUserinfo = vo.getActPageConfigUserinfo();
|
||||
actPageConfigUserinfo.setUpdateTime(date);
|
||||
actPageConfigUserinfo.setActCode(drawcode);
|
||||
actPageConfigUserinfoMapper.updateActPageConfigUserinfo(actPageConfigUserinfo);
|
||||
|
||||
//修改查询抽奖活动管理对象
|
||||
DrawRule drawRule = vo.getDrawRule();
|
||||
drawRule.setDRAWCODE(drawcode);
|
||||
drawRule.setLASTUPDATETIMESTAMP(date);
|
||||
int i = drawRuleMapper.updateDrawRule(drawRule);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.sinosoft.activity.service.impl;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.sinosoft.activity.vo.PrizeInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.sinosoft.activity.mapper.DrawPrizeInfoMapper;
|
||||
|
|
@ -49,6 +51,10 @@ public class DrawPrizeInfoServiceImpl implements IDrawPrizeInfoService
|
|||
public List<DrawPrizeInfo> findDrawPrizeInfoList() {
|
||||
return drawPrizeInfoMapper.findDrawPrizeInfoList();
|
||||
}
|
||||
@Override
|
||||
public List<DrawPrizeInfo> selectDrawPrizeInfoByDrawCode(PrizeInfo prizeInfo) {
|
||||
return drawPrizeInfoMapper.selectDrawPrizeInfoByDrawCode(prizeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增存储奖品的基础信息
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
package com.sinosoft.activity.vo;
|
||||
|
||||
import com.sinosoft.activity.domain.DrawPrizeInfo;
|
||||
|
||||
public class PrizeInfo extends DrawPrizeInfo {
|
||||
private String DRAWCODE;
|
||||
|
||||
public String getDRAWCODE() {
|
||||
return DRAWCODE;
|
||||
}
|
||||
|
||||
public void setDRAWCODE(String DRAWCODE) {
|
||||
this.DRAWCODE = DRAWCODE;
|
||||
}
|
||||
}
|
||||
|
|
@ -78,7 +78,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="pageStyle != null">page_style = #{pageStyle},</if>
|
||||
<if test="actType != null">act_type = #{actType},</if>
|
||||
<if test="actCode != null and actCode != ''">act_code = #{actCode},</if>
|
||||
<if test="actName != null">act_name = #{actName},</if>
|
||||
<if test="shareTitle != null">share_title = #{shareTitle},</if>
|
||||
<if test="shareDesc != null">share_desc = #{shareDesc},</if>
|
||||
|
|
@ -87,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
where act_code = #{actCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteActConfigById" parameterType="Integer">
|
||||
|
|
@ -100,5 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteActConfigByCode" parameterType="String">
|
||||
delete from act_config where act_code in
|
||||
<foreach item="actCode" collection="array" open="(" separator="," close=")">
|
||||
#{actCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -76,7 +76,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="updateActPageConfigGuide" parameterType="ActPageConfigGuide">
|
||||
update act_page_config_guide
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="actCode != null and actCode != ''">act_code = #{actCode},</if>
|
||||
<if test="actTitle != null">act_title = #{actTitle},</if>
|
||||
<if test="actDesc != null">act_desc = #{actDesc},</if>
|
||||
<if test="bgImg != null">bg_img = #{bgImg},</if>
|
||||
|
|
@ -87,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
where act_code = #{actCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteActPageConfigGuideById" parameterType="Integer">
|
||||
|
|
@ -100,5 +99,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteActPageConfigGuideByCode" parameterType="String">
|
||||
delete from act_page_config_guide where act_code in
|
||||
<foreach item="actCode" collection="array" open="(" separator="," close=")">
|
||||
#{actCode}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -60,14 +60,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="updateActPageConfigSubscribe" parameterType="ActPageConfigSubscribe">
|
||||
update act_page_config_subscribe
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="actCode != null and actCode != ''">act_code = #{actCode},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="bgImg != null">bg_img = #{bgImg},</if>
|
||||
<if test="qrCode != null">qr_code = #{qrCode},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
where act_code = #{actCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteActPageConfigSubscribeById" parameterType="Integer">
|
||||
|
|
@ -80,5 +79,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteActPageConfigSubscribeByCode" parameterType="String">
|
||||
delete from act_page_config_subscribe where act_code in
|
||||
<foreach item="actCode" collection="array" open="(" separator="," close=")">
|
||||
#{actCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -104,7 +104,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="updateActPageConfigUserinfo" parameterType="ActPageConfigUserinfo">
|
||||
update act_page_config_userinfo
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="actCode != null and actCode != ''">act_code = #{actCode},</if>
|
||||
<if test="title != null">title = #{title},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="bgImg != null">bg_img = #{bgImg},</if>
|
||||
|
|
@ -122,7 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
where act_code = #{actCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteActPageConfigUserinfoById" parameterType="Integer">
|
||||
|
|
@ -135,5 +134,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteActPageConfigUserinfoByCode" parameterType="String">
|
||||
delete from act_page_config_userinfo where act_code in
|
||||
<foreach item="actCode" collection="array" open="(" separator="," close=")">
|
||||
#{actCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -28,7 +28,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectDrawInfoList" parameterType="DrawInfo" resultMap="DrawInfoResult">
|
||||
<include refid="selectDrawInfoVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="drawId != null and drawId != '' ">
|
||||
and DRAWID in
|
||||
<foreach item="DRAWID" collection="drawId" open="(" separator="," close=")">
|
||||
#{DRAWID}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="DRAWCODE != null and DRAWCODE != ''"> and DRAWCODE = #{DRAWCODE}</if>
|
||||
<if test="DRAWTYPE != null and DRAWTYPE != ''"> and DRAWTYPE = #{DRAWTYPE}</if>
|
||||
<if test="DRAWNAME != null and DRAWNAME != ''"> and DRAWNAME like concat('%', #{DRAWNAME}, '%')</if>
|
||||
|
|
|
|||
|
|
@ -22,9 +22,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select PRIZEID, PRIZECODE, PRIZENAME, PRIZETYPE, PRIZEVALUE, COMMENTS, CREATETIMESTAMP, LASTUPDATETIMESTAMP, STATUS, INTEGRALPROJECTCODE, PRIZEIMG from draw_prize_info
|
||||
</sql>
|
||||
|
||||
<select id="selectDrawPrizeInfoByDrawCode" parameterType="com.sinosoft.activity.vo.PrizeInfo" resultMap="DrawPrizeInfoResult">
|
||||
select dpi.* from draw_prize_info dpi left join draw_config dc on dpi.prizecode=dc.prizecode
|
||||
<where>
|
||||
<if test="DRAWCODE != null and DRAWCODE != ''"> and DRAWCODE = #{DRAWCODE}</if>
|
||||
<if test="PRIZECODE != null and PRIZECODE != ''"> and PRIZECODE = #{PRIZECODE}</if>
|
||||
<if test="STATUS != null and STATUS != ''"> and STATUS = #{STATUS}</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectDrawPrizeInfoList" parameterType="com.sinosoft.activity.domain.DrawPrizeInfo" resultMap="DrawPrizeInfoResult">
|
||||
<include refid="selectDrawPrizeInfoVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="PRIZECODE != null and PRIZECODE != ''"> and PRIZECODE = #{PRIZECODE}</if>
|
||||
<if test="PRIZENAME != null and PRIZENAME != ''"> and PRIZENAME like concat('%', #{PRIZENAME}, '%')</if>
|
||||
<if test="PRIZETYPE != null and PRIZETYPE != ''"> and PRIZETYPE = #{PRIZETYPE}</if>
|
||||
|
|
|
|||
|
|
@ -89,7 +89,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="updateDrawRule" parameterType="DrawRule">
|
||||
update draw_rule
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="DRAWCODE != null and DRAWCODE != ''">DRAWCODE = #{DRAWCODE},</if>
|
||||
<if test="FIRSTFLAG != null">FIRSTFLAG = #{FIRSTFLAG},</if>
|
||||
<if test="FIRSTAWARDPRIZE != null">FIRSTAWARDPRIZE = #{FIRSTAWARDPRIZE},</if>
|
||||
<if test="DAILYFLAG != null">DAILYFLAG = #{DAILYFLAG},</if>
|
||||
|
|
@ -102,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="LASTUPDATETIMESTAMP != null">LASTUPDATETIMESTAMP = #{LASTUPDATETIMESTAMP},</if>
|
||||
<if test="WILLDRAWAWARDNUMBER != null">WILLDRAWAWARDNUMBER = #{WILLDRAWAWARDNUMBER},</if>
|
||||
</trim>
|
||||
where DRAWRULEID = #{DRAWRULEID}
|
||||
where DRAWCODE = #{DRAWCODE}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDrawRuleById" parameterType="String">
|
||||
|
|
@ -115,5 +114,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{DRAWRULEID}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteDrawRuleByIdCode" parameterType="String">
|
||||
delete from draw_rule where DRAWCODE in
|
||||
<foreach item="drawCode" collection="array" open="(" separator="," close=")">
|
||||
#{drawCode}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue