抽奖活动前端应用,抽奖主逻辑整合
This commit is contained in:
parent
4172953518
commit
54202e8a8c
|
|
@ -21,6 +21,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
|
|
||||||
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||||
|
|
||||||
|
public static String YYYYMMDDHHMMSSS = "yyyyMMddHHmmssSSS";
|
||||||
|
|
||||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
private static String[] parsePatterns = {
|
private static String[] parsePatterns = {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.Ztree;
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictType;
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
|
|
@ -27,6 +29,8 @@ public interface ISysDictTypeService
|
||||||
*/
|
*/
|
||||||
public List<SysDictType> selectDictTypeAll();
|
public List<SysDictType> selectDictTypeAll();
|
||||||
|
|
||||||
|
Map<String, SysDictData> selectDictMapByType(String dictType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据字典类型查询字典数据
|
* 根据字典类型查询字典数据
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -76,6 +78,15 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||||
* @return 字典数据集合信息
|
* @return 字典数据集合信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
public Map<String, SysDictData> selectDictMapByType(String dictType) {
|
||||||
|
Map<String, SysDictData> map = new HashMap<>();
|
||||||
|
List<SysDictData> sysDictData = selectDictDataByType(dictType);
|
||||||
|
for (SysDictData dict : sysDictData) {
|
||||||
|
map.put(dict.getDictValue(), dict);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public List<SysDictData> selectDictDataByType(String dictType)
|
public List<SysDictData> selectDictDataByType(String dictType)
|
||||||
{
|
{
|
||||||
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
|
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,10 @@
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-system</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>sino-activity</artifactId>
|
<artifactId>sino-activity</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ public class ActWebApplication
|
||||||
{
|
{
|
||||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||||
SpringApplication.run(ActWebApplication.class, args);
|
SpringApplication.run(ActWebApplication.class, args);
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 活动前端服务启动成功 ლ(´ڡ`ლ)゙ \n" +
|
System.out.println("Activity Server Running Successful");
|
||||||
" ''-' `'-' `-..-' ");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.ruoyi.config;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.shiro.cache.ehcache.EhCacheManager;
|
||||||
|
import org.apache.shiro.config.ConfigurationException;
|
||||||
|
import org.apache.shiro.io.ResourceUtils;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限配置加载
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class ShiroConfig
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存管理器 使用Ehcache实现
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public EhCacheManager getEhCacheManager()
|
||||||
|
{
|
||||||
|
net.sf.ehcache.CacheManager cacheManager = net.sf.ehcache.CacheManager.getCacheManager("ruoyi");
|
||||||
|
EhCacheManager em = new EhCacheManager();
|
||||||
|
if (StringUtils.isNull(cacheManager))
|
||||||
|
{
|
||||||
|
em.setCacheManager(new net.sf.ehcache.CacheManager(getCacheManagerConfigFileInputStream()));
|
||||||
|
return em;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
em.setCacheManager(cacheManager);
|
||||||
|
return em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回配置文件流 避免ehcache配置文件一直被占用,无法完全销毁项目重新部署
|
||||||
|
*/
|
||||||
|
protected InputStream getCacheManagerConfigFileInputStream()
|
||||||
|
{
|
||||||
|
String configFile = "classpath:ehcache/ehcache-shiro.xml";
|
||||||
|
InputStream inputStream = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
inputStream = ResourceUtils.getInputStreamForPath(configFile);
|
||||||
|
byte[] b = IOUtils.toByteArray(inputStream);
|
||||||
|
InputStream in = new ByteArrayInputStream(b);
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new ConfigurationException(
|
||||||
|
"Unable to obtain input stream for cacheManagerConfigFile [" + configFile + "]", e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtils.closeQuietly(inputStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,134 @@
|
||||||
|
package com.ruoyi.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class DrawActivityRequest implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -426397448496644788L;
|
||||||
|
|
||||||
|
private String serialNo;
|
||||||
|
|
||||||
|
private String drawCode;
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
private String userType;
|
||||||
|
|
||||||
|
private String drawTime;
|
||||||
|
|
||||||
|
private String merchantCode;
|
||||||
|
|
||||||
|
private String merchantSysCode;
|
||||||
|
|
||||||
|
private String channel;
|
||||||
|
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
private String businessArea;
|
||||||
|
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
public String getSerialNo() {
|
||||||
|
return serialNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerialNo(String serialNo) {
|
||||||
|
this.serialNo = serialNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDrawCode() {
|
||||||
|
return drawCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDrawCode(String drawCode) {
|
||||||
|
this.drawCode = drawCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserType() {
|
||||||
|
return userType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserType(String userType) {
|
||||||
|
this.userType = userType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDrawTime() {
|
||||||
|
return drawTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDrawTime(String drawTime) {
|
||||||
|
this.drawTime = drawTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMerchantCode() {
|
||||||
|
return merchantCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerchantCode(String merchantCode) {
|
||||||
|
this.merchantCode = merchantCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMerchantSysCode() {
|
||||||
|
return merchantSysCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerchantSysCode(String merchantSysCode) {
|
||||||
|
this.merchantSysCode = merchantSysCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChannel() {
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChannel(String channel) {
|
||||||
|
this.channel = channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBusinessArea() {
|
||||||
|
return businessArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBusinessArea(String businessArea) {
|
||||||
|
this.businessArea = businessArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
package com.ruoyi.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class DrawActivityResponse implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 2898381019555914194L;
|
||||||
|
private String drawCode;
|
||||||
|
private String userId;
|
||||||
|
private String userType;
|
||||||
|
private String gateWayTime;
|
||||||
|
private String result;
|
||||||
|
private String prizeCode;
|
||||||
|
private String prizeName;
|
||||||
|
private String prizeType;
|
||||||
|
private String displayOrder;
|
||||||
|
private String prizeLevel;
|
||||||
|
private String gatewayFolw;
|
||||||
|
private String available;
|
||||||
|
private String extId;
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
public String getGatewayFolw() {
|
||||||
|
return gatewayFolw;
|
||||||
|
}
|
||||||
|
public void setGatewayFolw(String gatewayFolw) {
|
||||||
|
this.gatewayFolw = gatewayFolw;
|
||||||
|
}
|
||||||
|
public String getPrizeLevel() {
|
||||||
|
return prizeLevel;
|
||||||
|
}
|
||||||
|
public void setPrizeLevel(String prizeLevel) {
|
||||||
|
this.prizeLevel = prizeLevel;
|
||||||
|
}
|
||||||
|
private String cue;
|
||||||
|
public String getDrawCode() {
|
||||||
|
return drawCode;
|
||||||
|
}
|
||||||
|
public void setDrawCode(String drawCode) {
|
||||||
|
this.drawCode = drawCode;
|
||||||
|
}
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
public String getUserType() {
|
||||||
|
return userType;
|
||||||
|
}
|
||||||
|
public void setUserType(String userType) {
|
||||||
|
this.userType = userType;
|
||||||
|
}
|
||||||
|
public String getGateWayTime() {
|
||||||
|
return gateWayTime;
|
||||||
|
}
|
||||||
|
public void setGateWayTime(String gateWayTime) {
|
||||||
|
this.gateWayTime = gateWayTime;
|
||||||
|
}
|
||||||
|
public String getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public void setResult(String result) {
|
||||||
|
this.result = result;
|
||||||
|
}
|
||||||
|
public String getPrizeCode() {
|
||||||
|
return prizeCode;
|
||||||
|
}
|
||||||
|
public void setPrizeCode(String prizeCode) {
|
||||||
|
this.prizeCode = prizeCode;
|
||||||
|
}
|
||||||
|
public String getPrizeName() {
|
||||||
|
return prizeName;
|
||||||
|
}
|
||||||
|
public void setPrizeName(String prizeName) {
|
||||||
|
this.prizeName = prizeName;
|
||||||
|
}
|
||||||
|
public String getPrizeType() {
|
||||||
|
return prizeType;
|
||||||
|
}
|
||||||
|
public void setPrizeType(String prizeType) {
|
||||||
|
this.prizeType = prizeType;
|
||||||
|
}
|
||||||
|
public String getDisplayOrder() {
|
||||||
|
return displayOrder;
|
||||||
|
}
|
||||||
|
public void setDisplayOrder(String displayOrder) {
|
||||||
|
this.displayOrder = displayOrder;
|
||||||
|
}
|
||||||
|
public String getCue() {
|
||||||
|
return cue;
|
||||||
|
}
|
||||||
|
public void setCue(String cue) {
|
||||||
|
this.cue = cue;
|
||||||
|
}
|
||||||
|
public String getAvailable() {
|
||||||
|
return available;
|
||||||
|
}
|
||||||
|
public void setAvailable(String available) {
|
||||||
|
this.available = available;
|
||||||
|
}
|
||||||
|
public String getExtId() {
|
||||||
|
return extId;
|
||||||
|
}
|
||||||
|
public void setExtId(String extId) {
|
||||||
|
this.extId = extId;
|
||||||
|
}
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.ruoyi.dto;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class DrawActivityResult {
|
||||||
|
/**成功**/
|
||||||
|
public static final String SUCCESS = "0000";
|
||||||
|
/**系统繁忙,请稍后重试**/
|
||||||
|
public final static String EXCEPTION = "GT00000";
|
||||||
|
/**参数错误**/
|
||||||
|
public static final String EXCEPTION_000001="GT00001";
|
||||||
|
/**抽奖失败[{0}]**/
|
||||||
|
public static final String EXCEPTION_000002="GT00002";
|
||||||
|
/**奖品信息**/
|
||||||
|
public static final String EXCEPTION_000003="GT00003";
|
||||||
|
/**查询中奖纪录**/
|
||||||
|
public static final String EXCEPTION_000004="GT00004";
|
||||||
|
/**奖品发放通知**/
|
||||||
|
public static final String EXCEPTION_000005="GT00005";
|
||||||
|
/**增加抽奖机会失败**/
|
||||||
|
public static final String EXCEPTION_000006="GT00006";
|
||||||
|
/**可用抽奖次数不足**/
|
||||||
|
public static final String EXCEPTION_000007="GT00007";
|
||||||
|
/**查询抽奖可用次数失败*/
|
||||||
|
public static final String EXCEPTION_000008="GT00008";
|
||||||
|
/**积分账户不存在**/
|
||||||
|
public static final String EXCEPTION_000009="GT00009";
|
||||||
|
/**积分账户余额不足**/
|
||||||
|
public static final String EXCEPTION_000010="GT00010";
|
||||||
|
public static final String EXCEPTION_000011="GT00011";
|
||||||
|
public static final String EXCEPTION_000012="GT00012";
|
||||||
|
public static final Map<String, String> ERROR = new HashMap<String, String>();
|
||||||
|
static {
|
||||||
|
ERROR.put(SUCCESS, "成功");
|
||||||
|
ERROR.put(EXCEPTION, "系统繁忙,请稍后重试");
|
||||||
|
ERROR.put(EXCEPTION_000001, "参数错误[{0}]");
|
||||||
|
ERROR.put(EXCEPTION_000002, "抽奖失败[{0}]");
|
||||||
|
ERROR.put(EXCEPTION_000003, "查询奖品信息失败[{0}]");
|
||||||
|
ERROR.put(EXCEPTION_000004, "查询中奖纪录失败[{0}]");
|
||||||
|
ERROR.put(EXCEPTION_000005, "奖品发放通知[{0}]");
|
||||||
|
ERROR.put(EXCEPTION_000006, "增加抽奖机会失败[{0}]");
|
||||||
|
ERROR.put(EXCEPTION_000007, "可用抽奖次数不足");
|
||||||
|
ERROR.put(EXCEPTION_000008, "查询抽奖可用次数失败[{0}]");
|
||||||
|
ERROR.put(EXCEPTION_000009, "积分账户不存在");
|
||||||
|
ERROR.put(EXCEPTION_000010, "积分账户余额不足");
|
||||||
|
ERROR.put(EXCEPTION_000011, "活动未开启");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMsg(String code, Object... params) {
|
||||||
|
String message = ERROR.get(code);
|
||||||
|
if (message == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < params.length; i++) {
|
||||||
|
message = message.replaceAll("\\{" + i + "\\}", String.valueOf(params[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.ruoyi.service;
|
||||||
|
|
||||||
|
import com.ruoyi.dto.DrawActivityRequest;
|
||||||
|
import com.ruoyi.thread.AwardThread;
|
||||||
|
import com.ruoyi.thread.ThreadPool;
|
||||||
|
import com.sinosoft.activity.domain.DrawInfo;
|
||||||
|
import com.sinosoft.activity.domain.DrawRecord;
|
||||||
|
|
||||||
|
public class AwardService {
|
||||||
|
public void award(DrawRecord gtDrawRecord, DrawActivityRequest request, DrawInfo gtDrawInfo, String mobile, String awardMethod) {
|
||||||
|
ThreadPool.awardExecutorService.submit(new AwardThread(gtDrawRecord, request,mobile,awardMethod));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,24 +2,31 @@ package com.ruoyi.service;
|
||||||
|
|
||||||
import com.ruoyi.cache.Cache;
|
import com.ruoyi.cache.Cache;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.dto.DrawActivityRequest;
|
||||||
|
import com.ruoyi.dto.DrawActivityResult;
|
||||||
import com.ruoyi.dto.GtPrizeConfigTemp;
|
import com.ruoyi.dto.GtPrizeConfigTemp;
|
||||||
|
import com.ruoyi.thread.DrawActivityThread;
|
||||||
|
import com.ruoyi.thread.ThreadPool;
|
||||||
import com.ruoyi.web.vo.Const;
|
import com.ruoyi.web.vo.Const;
|
||||||
|
import com.ruoyi.web.vo.draw.DrawResult;
|
||||||
import com.sinosoft.activity.domain.DrawConfig;
|
import com.sinosoft.activity.domain.DrawConfig;
|
||||||
|
import com.sinosoft.activity.domain.DrawInfo;
|
||||||
import com.sinosoft.activity.domain.DrawPrizeInfo;
|
import com.sinosoft.activity.domain.DrawPrizeInfo;
|
||||||
import com.sinosoft.activity.domain.DrawRule;
|
import com.sinosoft.activity.domain.DrawRule;
|
||||||
import com.sinosoft.activity.service.IDrawConfigService;
|
import com.sinosoft.activity.service.IDrawConfigService;
|
||||||
|
import com.sinosoft.activity.service.IDrawInfoService;
|
||||||
import com.sinosoft.activity.service.IDrawPrizeInfoService;
|
import com.sinosoft.activity.service.IDrawPrizeInfoService;
|
||||||
import com.sinosoft.activity.service.IDrawRuleService;
|
import com.sinosoft.activity.service.IDrawRuleService;
|
||||||
import com.sinosoft.activity.vo.PrizeInfo;
|
import com.sinosoft.activity.vo.PrizeInfo;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.concurrent.Future;
|
||||||
import java.util.List;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class DrawService {
|
public class DrawService {
|
||||||
|
|
||||||
|
|
@ -30,6 +37,85 @@ public class DrawService {
|
||||||
private IDrawConfigService drawConfigService;
|
private IDrawConfigService drawConfigService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDrawPrizeInfoService drawPrizeInfoService;
|
private IDrawPrizeInfoService drawPrizeInfoService;
|
||||||
|
@Autowired
|
||||||
|
private IDrawInfoService drawInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抽奖实现主方法
|
||||||
|
*/
|
||||||
|
public DrawResult drawActivity(DrawActivityRequest request) {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
long end = 0;
|
||||||
|
long proct = 0;
|
||||||
|
String exception = "";
|
||||||
|
DrawResult drawResult = new DrawResult();
|
||||||
|
long point = System.currentTimeMillis();
|
||||||
|
logger.info("抽奖开始时间:" + request.getSerialNo() + ":" + point);
|
||||||
|
try {
|
||||||
|
// 校验体信息
|
||||||
|
String drawCode = request.getDrawCode();
|
||||||
|
if(StringUtils.isBlank(drawCode)){
|
||||||
|
return processResp(request, DrawActivityResult.EXCEPTION_000001,
|
||||||
|
DrawActivityResult.getMsg(DrawActivityResult.EXCEPTION_000001, "drawCode参数为空"));
|
||||||
|
}
|
||||||
|
long point1 = System.currentTimeMillis();
|
||||||
|
logger.info("抽奖检查点1:" + request.getSerialNo() + ":" + point1 + "与前一个检查点时间差" + (point1 - point));
|
||||||
|
// 查询活动信息
|
||||||
|
DrawInfo queryInfo = new DrawInfo();
|
||||||
|
queryInfo.setDRAWCODE(drawCode);
|
||||||
|
queryInfo.setSTATUS(Const.DRAW_STATUS_EFFECTIVE);
|
||||||
|
List<DrawInfo> drawInfos = drawInfoService.selectDrawInfoList(queryInfo);
|
||||||
|
if (drawInfos == null || drawInfos.size() == 0) {
|
||||||
|
drawResult.setRespCode("-3");
|
||||||
|
drawResult.setRespMsg("活动未开启");
|
||||||
|
return processResp(request, DrawActivityResult.EXCEPTION_000011,
|
||||||
|
DrawActivityResult.getMsg(DrawActivityResult.EXCEPTION_000011));
|
||||||
|
}
|
||||||
|
DrawInfo drawInfo = drawInfos.get(0);
|
||||||
|
Date starttime = drawInfo.getSTARTTIME();
|
||||||
|
Date endtime = drawInfo.getENDTIME();
|
||||||
|
Date currDate = new Date();
|
||||||
|
if (currDate.before(starttime) || currDate.after(endtime)) {
|
||||||
|
return processResp(request, DrawActivityResult.EXCEPTION_000011,
|
||||||
|
DrawActivityResult.getMsg(DrawActivityResult.EXCEPTION_000011));
|
||||||
|
}
|
||||||
|
long point2 = System.currentTimeMillis();
|
||||||
|
logger.info("抽奖检查点2:" + request.getSerialNo() + ":" + point2 + "与前一个检查点时间差" + (point2 - point1));
|
||||||
|
String currentDateStr = DateUtils.dateTime();
|
||||||
|
DrawInfo gtDrawInfo = null;
|
||||||
|
if ("1".equals(gtDrawInfo.getUPDATEFLAG()) || Cache.get("_" + drawCode + "_currentDateStr_") == null
|
||||||
|
|| Cache.get("_" + drawCode + "_" + currentDateStr + "_rule_") == null
|
||||||
|
|| Cache.get("_" + drawCode + "_" + currentDateStr + "_config_") == null
|
||||||
|
|| Cache.get("_" + drawCode + "_blank_") == null || Cache.get("_" + drawCode + "_blankConfig_") == null
|
||||||
|
|| Cache.get("_" + drawCode + "_" + currentDateStr + "_gtDrawConfigList_") == null
|
||||||
|
|| Cache.get("_" + drawCode + "_" + currentDateStr + "_baseNumber_") == null) {
|
||||||
|
// 刷新缓存
|
||||||
|
loadDrawRule(drawCode);
|
||||||
|
gtDrawInfo.setUPDATEFLAG("0");
|
||||||
|
drawInfoService.updateDrawInfo(gtDrawInfo);
|
||||||
|
}
|
||||||
|
long point3 = System.currentTimeMillis();
|
||||||
|
logger.info("抽奖检查点3:" + request.getSerialNo() + ":" + point3 + "与前一个检查点时间差" + (point3 - point2));
|
||||||
|
DrawRule gtDrawRule = (DrawRule) Cache.get("_" + drawCode + "_" + currentDateStr + "_rule_");
|
||||||
|
Future<DrawResult> resFuture = ThreadPool.drawActivityExecutorService.submit(new DrawActivityThread(request, gtDrawInfo, gtDrawRule, drawResult));
|
||||||
|
drawResult = resFuture.get(15 * 1000, TimeUnit.SECONDS);
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
logger.info("抽奖接口返回:" + request.getSerialNo() + "&返回时间" + end + "总时间" + (end - point));
|
||||||
|
return drawResult;
|
||||||
|
} catch (Exception e) {
|
||||||
|
drawResult = processResp(request, DrawActivityResult.EXCEPTION, DrawActivityResult.getMsg(DrawActivityResult.EXCEPTION));
|
||||||
|
logger.error("抽奖接口异常,异常原因:", e);
|
||||||
|
return drawResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DrawResult processResp(DrawActivityRequest request, String resultCode, String resultInfo) {
|
||||||
|
DrawResult response = new DrawResult();
|
||||||
|
response.setRespCode(resultCode);
|
||||||
|
response.setRespMsg(resultInfo);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新抽奖需要的缓存信息
|
* 刷新抽奖需要的缓存信息
|
||||||
*
|
*
|
||||||
|
|
@ -59,7 +145,7 @@ public class DrawService {
|
||||||
// gtDrawConfigQueryRule.addAscOrder("prizeLevel");
|
// gtDrawConfigQueryRule.addAscOrder("prizeLevel");
|
||||||
DrawConfig drawConfigParams = new DrawConfig();
|
DrawConfig drawConfigParams = new DrawConfig();
|
||||||
drawConfigParams.setDRAWCODE(drawCode);
|
drawConfigParams.setDRAWCODE(drawCode);
|
||||||
drawConfigParams.setSTATUS(Const.STATUS_VALID);
|
drawConfigParams.setSTATUS(Const.DRAW_CONFIG_STATUS_EFFECTIVE);
|
||||||
List<DrawConfig> drawConfigs = drawConfigService.selectDrawConfigList(drawConfigParams);
|
List<DrawConfig> drawConfigs = drawConfigService.selectDrawConfigList(drawConfigParams);
|
||||||
cacheAdd("_" + drawCode + "_" + currentDateStr + "_config_", drawConfigs, "_" + drawCode + "_" + yesterdayDateStr + "_config_", timeOut);
|
cacheAdd("_" + drawCode + "_" + currentDateStr + "_config_", drawConfigs, "_" + drawCode + "_" + yesterdayDateStr + "_config_", timeOut);
|
||||||
// 空奖奖项配置
|
// 空奖奖项配置
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.ruoyi.service;
|
||||||
|
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @ClassName: SequenceService
|
||||||
|
* @Description: 生成序列号
|
||||||
|
* @author liuyaoyao
|
||||||
|
* @date 2018年2月8日 下午4:24:32
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SequenceService {
|
||||||
|
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(SequenceService.class);
|
||||||
|
|
||||||
|
public synchronized String getPrizeSequence(){
|
||||||
|
try{
|
||||||
|
String sql = "select lpad(sequenec_prize.nextval,8,0) from dual";
|
||||||
|
return null;
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("通过数据库序列获取帐户ID出错,错误原因:", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDrawActivirtSeq(){
|
||||||
|
try{
|
||||||
|
String sql = "select lpad(gt_draw_activity_seq.nextval,7,0) from dual";
|
||||||
|
return null;
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("通过数据库序列获取帐户ID出错,错误原因:", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public String getDrawActivirtTradeOrderSeq(){
|
||||||
|
try{
|
||||||
|
String sql = "select lpad(gt_draw_activity_tradeorder.nextval,10,0) from dual";
|
||||||
|
return null;
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("通过数据库序列获取帐户ID出错,错误原因:", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGtReqFlagSeq(){
|
||||||
|
try{
|
||||||
|
String sql = "select lpad(gt_req_flag_seq.nextval,10,0) from dual";
|
||||||
|
return null;
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("通过数据库序列获取帐户ID出错,错误原因:", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,379 @@
|
||||||
|
package com.ruoyi.thread;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
|
import com.ruoyi.dto.DrawActivityRequest;
|
||||||
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
|
import com.ruoyi.web.vo.Const;
|
||||||
|
import com.sinosoft.activity.domain.DrawRecord;
|
||||||
|
import com.sinosoft.activity.service.IDrawAwardRecordService;
|
||||||
|
import com.sinosoft.activity.service.IDrawPrizeInfoService;
|
||||||
|
import com.sinosoft.activity.service.IDrawRecordService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class AwardThread implements Runnable {
|
||||||
|
protected static Logger logger = LoggerFactory.getLogger(AwardThread.class);
|
||||||
|
private String mobile;
|
||||||
|
private DrawActivityRequest request;
|
||||||
|
private IDrawPrizeInfoService gtPrizeInfoService;
|
||||||
|
private IDrawAwardRecordService gtAwardRecordService;
|
||||||
|
private ISysDictDataService inCodeService;
|
||||||
|
private DrawRecord gtDrawRecord;
|
||||||
|
private String awardMethod;
|
||||||
|
private IDrawRecordService gtDrawRecordService;
|
||||||
|
/**
|
||||||
|
* 发奖逻辑主方法
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
String prizeType = gtDrawRecord.getPRIZETYPE();
|
||||||
|
try {
|
||||||
|
//积分类奖品发放
|
||||||
|
if (prizeType.equals(Const.PRIZE_TYPE_INTEGRAL)) {
|
||||||
|
// GetIntegralResponse getIntegralResponse = getIntegral(gtDrawRecord);
|
||||||
|
// if (getIntegralResponse == null) {
|
||||||
|
// throw new Exception("积分发放接口异常");
|
||||||
|
// }
|
||||||
|
// GtAwardRecord gtAwardRecord = new GtAwardRecord();
|
||||||
|
// gtAwardRecord.setUserName(gtDrawRecord.getUserName());
|
||||||
|
// gtAwardRecord.setUserId(gtDrawRecord.getUserId());
|
||||||
|
// gtAwardRecord.setCreateTimeStamp(new Date());
|
||||||
|
// gtAwardRecord.setDrawCode(gtDrawRecord.getDrawCode());
|
||||||
|
// gtAwardRecord.setDrawRecordId(gtDrawRecord.getDrawRecordId());
|
||||||
|
// gtAwardRecord.setLastUpdateTimeStamp(new Date());
|
||||||
|
// gtAwardRecord.setPrizeCode(gtDrawRecord.getPrizeCode());
|
||||||
|
// gtAwardRecord.setPrizeType(gtDrawRecord.getPrizeType());
|
||||||
|
// gtAwardRecord.setPrizeLevel(gtDrawRecord.getPrizeLevel());
|
||||||
|
// gtAwardRecord.setReturnCode(getIntegralResponse.getResultCode());
|
||||||
|
// gtAwardRecord.setReturnMessage(getIntegralResponse.getResultInfo());
|
||||||
|
// gtAwardRecord.setMerchantCode(request.getBody().getMerchantCode());
|
||||||
|
// gtAwardRecord.setMerchantSysCode(request.getBody().getMerchantSysCode());
|
||||||
|
// gtAwardRecord.setChannel(request.getBody().getChannel());
|
||||||
|
// gtAwardRecord.setBusinessArea(request.getBody().getBusinessArea());
|
||||||
|
// gtAwardRecord.setDrawTranseqNo(gtDrawRecord.getDrawTranseqNo());
|
||||||
|
// gtAwardRecord.setExtId(gtDrawRecord.getProjectCode());
|
||||||
|
// if (getIntegralResponse.getResultCode().endsWith(WebServiceResult.SUCCESS)) {
|
||||||
|
// gtAwardRecord.setAwardResult(Const.AWARD_RESULT_SUCCESS);
|
||||||
|
// gtAwardRecord.setAwardTime(new Date());
|
||||||
|
// }else{
|
||||||
|
// gtAwardRecord.setAwardResult(Const.AWARD_RESULT_FAIL);
|
||||||
|
// logger.info("积分平台积分发放失败:"+gtDrawRecord.getDrawTranseqNo()+"&失败原因:"+getIntegralResponse.getResultInfo());
|
||||||
|
// }
|
||||||
|
// gtAwardRecordService.addGtAwardRecord(gtAwardRecord);
|
||||||
|
} else if (prizeType.equals(Const.PRIZE_TYPE_CASH)) {
|
||||||
|
//1654 发放一账通现金红包
|
||||||
|
// getCash();
|
||||||
|
} else if (prizeType.equals(Const.PRIZE_TYPE_VOCHER)) {
|
||||||
|
// QueryRule queryRule=QueryRule.getInstance();
|
||||||
|
// queryRule.addEqual("prizeCode", gtDrawRecord.getPrizeCode());
|
||||||
|
// GtPrizeInfo gtPrizeInfo=gtPrizeInfoService.queryUniqueGtPrizeInfo(queryRule);
|
||||||
|
// Map<String, String> coupon_config=inCodeService.findAllCodeAndName("INTERFACE_COUPON");
|
||||||
|
// if(coupon_config==null||gtPrizeInfo==null){
|
||||||
|
// throw new Exception("发券配置参数异常");
|
||||||
|
// }
|
||||||
|
// StringBuffer param = new StringBuffer();
|
||||||
|
// param.append("service_id=" + PropertiesUtil.getProperties("sysConfig.properties", "INTERFACE_COUPON_SERVICE_ID"));
|
||||||
|
// param.append("&accessToken="+coupon_config.get("ACCESS_TOKEN"));
|
||||||
|
// Map<String, Object> dataMap=new HashMap<String, Object>();
|
||||||
|
// Map<String, Object> requestMap=new HashMap<String, Object>();
|
||||||
|
// requestMap.put("oldUserId", gtDrawRecord.getUserId());
|
||||||
|
// requestMap.put("bonusCode", gtPrizeInfo.getIntegralProjectCode());
|
||||||
|
// requestMap.put("channelType", "3");
|
||||||
|
// requestMap.put("platformLimit", "3");
|
||||||
|
// dataMap.put("request", requestMap);
|
||||||
|
// JSONObject jsonObject=JSONObject.fromObject(dataMap);
|
||||||
|
// param.append("&data="+jsonObject.toString());
|
||||||
|
// long iemallStart= System.currentTimeMillis();
|
||||||
|
// logger.info("一账通发券请求:"+gtDrawRecord.getDrawTranseqNo()+"&发送参数:"+param.toString()+"&请求时间:"+iemallStart);
|
||||||
|
// String responseStr=HttpRequestUtil.sendHttpPostRequest(PropertiesUtil.getProperties("sysConfig.properties", "INTERFACE_COUPON_URL"), param.toString());
|
||||||
|
// long iemallEnd= System.currentTimeMillis();
|
||||||
|
// long iemallProct=iemallEnd-iemallStart;
|
||||||
|
// logger.info("一账通发券响应:" +gtDrawRecord.getDrawTranseqNo()+"&响应参数:"+responseStr+"&响应时间:"+ System.currentTimeMillis()+"&处理时间:"+iemallProct);
|
||||||
|
// JSONObject responseJson=JSONObject.fromObject(responseStr);
|
||||||
|
// GtAwardRecord gtAwardRecord = new GtAwardRecord();
|
||||||
|
// gtAwardRecord.setUserName(gtDrawRecord.getUserName());
|
||||||
|
// gtAwardRecord.setUserId(gtDrawRecord.getUserId());
|
||||||
|
// gtAwardRecord.setCreateTimeStamp(new Date());
|
||||||
|
// gtAwardRecord.setDrawCode(gtDrawRecord.getDrawCode());
|
||||||
|
// gtAwardRecord.setDrawRecordId(gtDrawRecord.getDrawRecordId());
|
||||||
|
// gtAwardRecord.setLastUpdateTimeStamp(new Date());
|
||||||
|
// gtAwardRecord.setPrizeCode(gtDrawRecord.getPrizeCode());
|
||||||
|
// gtAwardRecord.setPrizeType(gtDrawRecord.getPrizeType());
|
||||||
|
// gtAwardRecord.setPrizeLevel(gtDrawRecord.getPrizeLevel());
|
||||||
|
// gtAwardRecord.setReturnCode(responseJson.getJSONObject("response").get("errorCode").toString());
|
||||||
|
// gtAwardRecord.setReturnMessage(responseJson.getJSONObject("response").get("errorMsg").toString());
|
||||||
|
// gtAwardRecord.setDrawTranseqNo(gtDrawRecord.getDrawTranseqNo());
|
||||||
|
// gtAwardRecord.setExtId(gtDrawRecord.getProjectCode());
|
||||||
|
// gtAwardRecord.setAwardTranseqNo(responseJson.getJSONObject("response").get("batchNo").toString());
|
||||||
|
// if (responseJson.getJSONObject("response").get("errorCode").toString().endsWith(WebServiceResult.SUCCESS)) {
|
||||||
|
// gtAwardRecord.setAwardResult(Const.AWARD_RESULT_SUCCESS);
|
||||||
|
// gtAwardRecord.setAwardTime(new Date());
|
||||||
|
// } else{
|
||||||
|
// gtAwardRecord.setAwardResult(Const.AWARD_RESULT_FAIL);
|
||||||
|
// logger.info("一账通领券失败"+gtDrawRecord.getDrawTranseqNo()+"&失败原因:"+responseJson.getJSONObject("response").get("errorCode")+responseJson.getJSONObject("response").get("errorMsg"));
|
||||||
|
// }
|
||||||
|
// gtAwardRecord.setReturnCode(responseJson.getJSONObject("response").get("errorCode").toString());
|
||||||
|
// gtAwardRecord.setReturnMessage(responseJson.getJSONObject("response").get("errorMsg").toString());
|
||||||
|
// gtAwardRecord.setDrawTranseqNo(gtDrawRecord.getDrawTranseqNo());
|
||||||
|
// gtAwardRecordService.addGtAwardRecord(gtAwardRecord);
|
||||||
|
// InPortalTransmessage message = new InPortalTransmessage();
|
||||||
|
// message.setTransCode("EXT00001");
|
||||||
|
// message.setTransRefGuid(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
||||||
|
// message.setRequestTime(new Date());
|
||||||
|
// message.setResponseTime(new Date());
|
||||||
|
// message.setRequestMessage(jsonObject.toString());
|
||||||
|
// message.setResponseMessage(responseStr);
|
||||||
|
// message.setProct(iemallProct);
|
||||||
|
// transRecordService.offer(message);
|
||||||
|
}else if(prizeType.equals(Const.PRIZE_TYPE_IEMALL)){
|
||||||
|
if(StringUtils.isNotBlank(mobile)){
|
||||||
|
//调用i购
|
||||||
|
// QueryRule queryRule=QueryRule.getInstance();
|
||||||
|
// queryRule.addEqual("prizeCode", gtDrawRecord.getPrizeCode());
|
||||||
|
// GtPrizeInfo gtPrizeInfo=gtPrizeInfoService.queryUniqueGtPrizeInfo(queryRule);
|
||||||
|
// Map<String, String> iemall_config=inCodeService.findAllCodeAndName("iemallConfig");
|
||||||
|
// if(iemall_config==null||gtPrizeInfo==null){
|
||||||
|
// throw new Exception("发券配置参数异常");
|
||||||
|
// }
|
||||||
|
// String key=iemall_config.get("key");
|
||||||
|
// String timestamp=new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
|
||||||
|
// long voucherId= Long.parseLong(gtPrizeInfo.getIntegralProjectCode());
|
||||||
|
// Md5 md5 = new Md5();
|
||||||
|
// String str="mobile="+mobile+"×tamp="+timestamp+"&voucherId="+voucherId+"&key="+key;
|
||||||
|
// String sign=md5.toMD5(str);
|
||||||
|
// int source=8;
|
||||||
|
// String request="mobile="+mobile+"&voucherId="+voucherId+"×tamp="+timestamp+"&source="+source+"&sign="+sign;
|
||||||
|
// URL url = new URL(PropertiesUtil.getProperties("sysConfig.properties", "INTERFACE_IEMALL_URL")+"?"+request);
|
||||||
|
// long start1= System.currentTimeMillis();
|
||||||
|
// logger.info("I购券发券请求:"+gtDrawRecord.getDrawTranseqNo()+"&发送参数:"+url.toString()+"&请求时间:"+start1);
|
||||||
|
// InetSocketAddress addr=new InetSocketAddress(iemall_config.get("proxy"), Integer.parseInt(iemall_config.get("port")));
|
||||||
|
// HttpURLConnection conn=null;
|
||||||
|
// if(iemall_config.get("isProxy").equals("1")){
|
||||||
|
// Proxy proxy=new Proxy(Proxy.Type.HTTP, addr);
|
||||||
|
// logger.info("启用代理调用i购IP"+proxy.address());
|
||||||
|
// conn = (HttpURLConnection) url.openConnection(proxy);
|
||||||
|
// }else{
|
||||||
|
// conn = (HttpURLConnection) url.openConnection();
|
||||||
|
// }
|
||||||
|
// conn.setRequestProperty("contentType", "utf-8");
|
||||||
|
// conn.setConnectTimeout(5 * 1000);
|
||||||
|
// conn.setRequestMethod("POST");
|
||||||
|
// InputStream inStream = conn.getInputStream();
|
||||||
|
// BufferedReader in = new BufferedReader(new InputStreamReader(inStream, "utf-8"));
|
||||||
|
// StringBuffer buffer = new StringBuffer();
|
||||||
|
// String line = "";
|
||||||
|
// while ((line = in.readLine()) != null) {
|
||||||
|
// buffer.append(line);
|
||||||
|
// }
|
||||||
|
// String responseStr = buffer.toString();
|
||||||
|
// logger.info("I购券发券响应:" +gtDrawRecord.getDrawTranseqNo()+"&响应参数:"+responseStr+"&响应时间:"+ System.currentTimeMillis()+"&处理时间:"+(System.currentTimeMillis()-start1));
|
||||||
|
// JSONObject responseJson=JSONObject.fromObject(responseStr);
|
||||||
|
// GtAwardRecord gtAwardRecord = new GtAwardRecord();
|
||||||
|
// gtAwardRecord.setUserName(gtDrawRecord.getUserName());
|
||||||
|
// gtAwardRecord.setUserId(gtDrawRecord.getUserId());
|
||||||
|
// gtAwardRecord.setCreateTimeStamp(new Date());
|
||||||
|
// gtAwardRecord.setDrawCode(gtDrawRecord.getDrawCode());
|
||||||
|
// gtAwardRecord.setPhone(mobile);
|
||||||
|
// gtAwardRecord.setDrawRecordId(gtDrawRecord.getDrawRecordId());
|
||||||
|
// gtAwardRecord.setLastUpdateTimeStamp(new Date());
|
||||||
|
// gtAwardRecord.setPrizeCode(gtDrawRecord.getPrizeCode());
|
||||||
|
// gtAwardRecord.setPrizeType(gtDrawRecord.getPrizeType());
|
||||||
|
// gtAwardRecord.setPrizeLevel(gtDrawRecord.getPrizeLevel());
|
||||||
|
// gtAwardRecord.setExtId(gtDrawRecord.getProjectCode());
|
||||||
|
// boolean result=responseJson.getBoolean("success");
|
||||||
|
// String awawrState="1";
|
||||||
|
// if(result){
|
||||||
|
// gtAwardRecord.setAwardResult(Const.AWARD_RESULT_SUCCESS);
|
||||||
|
// gtAwardRecord.setAwardTime(new Date());
|
||||||
|
// gtAwardRecord.setReturnCode("0000");
|
||||||
|
// awawrState="2";
|
||||||
|
// }else{
|
||||||
|
// logger.info("I购券领券失败:"+gtDrawRecord.getDrawTranseqNo()+"&失败原因:"+responseJson.getString("message").toString());
|
||||||
|
// gtAwardRecord.setReturnCode(String.valueOf(result));
|
||||||
|
// gtAwardRecord.setAwardResult(Const.AWARD_RESULT_FAIL);
|
||||||
|
// }
|
||||||
|
// gtAwardRecord.setReturnMessage(responseJson.get("message").toString());
|
||||||
|
// gtAwardRecord.setDrawTranseqNo(gtDrawRecord.getDrawTranseqNo());
|
||||||
|
// gtAwardRecordService.addGtAwardRecord(gtAwardRecord);
|
||||||
|
//
|
||||||
|
// if(awardMethod.equals(Const.AWARD_METHOD_MANAL)){
|
||||||
|
// gtDrawRecord.setDrawResult(awawrState);
|
||||||
|
// gtDrawRecordService.updateGtDrawRecord(gtDrawRecord);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// InPortalTransmessage message = new InPortalTransmessage();
|
||||||
|
// message.setTransCode("EXT00002");
|
||||||
|
// message.setTransRefGuid(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
||||||
|
// message.setRequestTime(new Date());
|
||||||
|
// message.setResponseTime(new Date());
|
||||||
|
// message.setRequestMessage(request);
|
||||||
|
// message.setResponseMessage(responseStr);
|
||||||
|
// transRecordService.offer(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("异步发奖异常,异常原因:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一账通现金红包发放接口
|
||||||
|
* @author huayue
|
||||||
|
* @since 2020-08-11
|
||||||
|
* @version 1654
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
// private void getCash() throws Exception {
|
||||||
|
// String url= PropertiesUtil.getProperties("sysConfig.properties", "ecUrl");
|
||||||
|
// String isProxyStr=PropertiesUtil.getProperties("sysConfig.properties", "isProxy");
|
||||||
|
// String serviceCode=PropertiesUtil.getProperties("sysConfig.properties", "cashServiceCode");
|
||||||
|
// String partnerId=PropertiesUtil.getProperties("sysConfig.properties", "partnerId");
|
||||||
|
// String key=PropertiesUtil.getProperties("sysConfig.properties", "key");
|
||||||
|
// boolean isProxy = false;
|
||||||
|
// if("1".equals(isProxyStr)){
|
||||||
|
// isProxy = true;
|
||||||
|
// }
|
||||||
|
// String currentTime = DateUtil.getCurrentDate("yyyyMMddHHmmss");
|
||||||
|
// String userId = gtDrawRecord.getUserId();
|
||||||
|
// //卡券主键id
|
||||||
|
// String bonusCode = gtDrawRecord.getProjectCode();
|
||||||
|
// //掌上国寿app端传1,微信端传2
|
||||||
|
// String type = "2";
|
||||||
|
// if ("APP".equals(gtDrawRecord.getChannel())) {
|
||||||
|
// type = "1";
|
||||||
|
// }
|
||||||
|
// StringBuffer params = new StringBuffer();
|
||||||
|
// params.append("serviceCode=").append(serviceCode).append("&");
|
||||||
|
// params.append("type=").append(type).append("&");
|
||||||
|
// params.append("ecNo=").append(userId).append("&");
|
||||||
|
// params.append("bonusCode=").append(bonusCode).append("&");
|
||||||
|
// params.append("currentTime=").append(currentTime).append("&");
|
||||||
|
// params.append("partnerId=").append(partnerId).append("&");
|
||||||
|
// //待签名字符串= md5(type + ecNo + currentTime + partnerId + key)
|
||||||
|
// params.append("sign=").append(Md5Util.digestByMd5(type+userId+currentTime+partnerId+key));
|
||||||
|
// logger.info("一账通现金红包发放接口入参:" + params);
|
||||||
|
// long start = System.currentTimeMillis();
|
||||||
|
// String responseStr= HttpRequestUtil.sendPost(url, params.toString(), isProxy);
|
||||||
|
// long proct = System.currentTimeMillis()-start;
|
||||||
|
// logger.info("一账通现金红包发放接口响应:" + responseStr + ";耗时:"+proct);
|
||||||
|
// JSONObject respJson = JSONObject.fromObject(responseStr);
|
||||||
|
// String errorCode = respJson.optString("errorCode");
|
||||||
|
// String errorMsg = respJson.optString("errorMsg");
|
||||||
|
// if ("0".equals(errorCode)) {
|
||||||
|
// errorCode = WebServiceResult.SUCCESS;
|
||||||
|
// }
|
||||||
|
// saveAwardRecord(errorCode, errorMsg);
|
||||||
|
// saveTransRecord("EXT00004", params.toString(), responseStr, proct);
|
||||||
|
// }
|
||||||
|
/**
|
||||||
|
* 存储交易报文
|
||||||
|
* @author huayue
|
||||||
|
* @since 2020-08-11
|
||||||
|
* @version 1654
|
||||||
|
*/
|
||||||
|
// private void saveTransRecord(String transCode, String reqMsg, String respMsg, long proct) {
|
||||||
|
// InPortalTransmessage message = new InPortalTransmessage();
|
||||||
|
// message.setTransCode(transCode);
|
||||||
|
// message.setTransRefGuid(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
||||||
|
// message.setRequestTime(new Date());
|
||||||
|
// message.setResponseTime(new Date());
|
||||||
|
// message.setRequestMessage(reqMsg);
|
||||||
|
// message.setProct(proct);
|
||||||
|
// message.setResponseMessage(respMsg);
|
||||||
|
// transRecordService.offer(message);
|
||||||
|
// }
|
||||||
|
/**
|
||||||
|
* 存储中奖记录
|
||||||
|
* @author huayue
|
||||||
|
* @since 2020-08-11
|
||||||
|
* @version 1654
|
||||||
|
*/
|
||||||
|
// private void saveAwardRecord(String returnCode, String returnInfo) {
|
||||||
|
// GtAwardRecord gtAwardRecord = new GtAwardRecord();
|
||||||
|
// gtAwardRecord.setUserName(gtDrawRecord.getUserName());
|
||||||
|
// gtAwardRecord.setUserId(gtDrawRecord.getUserId());
|
||||||
|
// gtAwardRecord.setCreateTimeStamp(new Date());
|
||||||
|
// gtAwardRecord.setDrawCode(gtDrawRecord.getDrawCode());
|
||||||
|
// gtAwardRecord.setDrawRecordId(gtDrawRecord.getDrawRecordId());
|
||||||
|
// gtAwardRecord.setLastUpdateTimeStamp(new Date());
|
||||||
|
// gtAwardRecord.setPrizeCode(gtDrawRecord.getPrizeCode());
|
||||||
|
// gtAwardRecord.setPrizeType(gtDrawRecord.getPrizeType());
|
||||||
|
// gtAwardRecord.setPrizeLevel(gtDrawRecord.getPrizeLevel());
|
||||||
|
// gtAwardRecord.setReturnCode(returnCode);
|
||||||
|
// gtAwardRecord.setReturnMessage(returnInfo);
|
||||||
|
// gtAwardRecord.setMerchantCode(request.getBody().getMerchantCode());
|
||||||
|
// gtAwardRecord.setMerchantSysCode(request.getBody().getMerchantSysCode());
|
||||||
|
// gtAwardRecord.setChannel(request.getBody().getChannel());
|
||||||
|
// gtAwardRecord.setBusinessArea(request.getBody().getBusinessArea());
|
||||||
|
// gtAwardRecord.setDrawTranseqNo(gtDrawRecord.getDrawTranseqNo());
|
||||||
|
// gtAwardRecord.setExtId(gtDrawRecord.getProjectCode());
|
||||||
|
// if (WebServiceResult.SUCCESS.equals(returnCode)) {
|
||||||
|
// gtAwardRecord.setAwardResult(Const.AWARD_RESULT_SUCCESS);
|
||||||
|
// gtAwardRecord.setAwardTime(new Date());
|
||||||
|
// }else{
|
||||||
|
// gtAwardRecord.setAwardResult(Const.AWARD_RESULT_FAIL);
|
||||||
|
// logger.error("积分平台积分发放失败:"+gtDrawRecord.getDrawTranseqNo()+"&失败原因:"+returnInfo);
|
||||||
|
// }
|
||||||
|
// gtAwardRecordService.addGtAwardRecord(gtAwardRecord);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public AwardThread(DrawRecord gtDrawRecord, DrawActivityRequest request, String mobile, String awardMethod) {
|
||||||
|
this.mobile=mobile;
|
||||||
|
this.request = request;
|
||||||
|
this.gtDrawRecord=gtDrawRecord;
|
||||||
|
this.awardMethod=awardMethod;
|
||||||
|
this.gtPrizeInfoService = (IDrawPrizeInfoService) SpringUtils.getBean("drawPrizeInfoService");
|
||||||
|
this.gtAwardRecordService = (IDrawAwardRecordService) SpringUtils.getBean("drawAwardRecordService");
|
||||||
|
this.inCodeService=(ISysDictDataService) SpringUtils.getBean("inCodeService");
|
||||||
|
this.gtDrawRecordService=(IDrawRecordService) SpringUtils.getBean("drawRecordService");
|
||||||
|
}
|
||||||
|
|
||||||
|
// public GetIntegralResponse getIntegral(GtDrawRecord gtDrawRecord) throws RemoteException {
|
||||||
|
// JsonBinder jsonBinder = JsonBinder.buildNormalBinder();
|
||||||
|
// DrawActivityRequestBody drawActivityRequestBody = request.getBody();
|
||||||
|
// GetIntegralServiceStub getIntegralServiceStub = new GetIntegralServiceStub(
|
||||||
|
// PropertiesUtil.getProperties("sysConfig.properties", "URL_INTERFACE_INTEGRAL_GETINTEGRALSERVICE"));
|
||||||
|
// GetIntegralServiceStub.GetIntegral getIntegral = new GetIntegralServiceStub.GetIntegral();
|
||||||
|
// GetIntegralServiceStub.GetIntegralRequest getIntegralRequest = new GetIntegralServiceStub.GetIntegralRequest();
|
||||||
|
// GetIntegralServiceStub.GetIntegralRequestBody getIntegralRequestBody = new GetIntegralServiceStub.GetIntegralRequestBody();
|
||||||
|
// GetIntegralServiceStub.GetIntegralRequestHander getIntegralRequestHander = new GetIntegralServiceStub.GetIntegralRequestHander();
|
||||||
|
// getIntegralRequestHander.setUserName(PropertiesUtil.getProperties("sysConfig.properties", "INTEGRAL_INTERFACE_USER_HANDER"));
|
||||||
|
// getIntegralRequestHander.setTransCode(PropertiesUtil.getProperties("sysConfig.properties", "INTEGRAL_INTERFACE_TRANSCODE_GETINTEGRALSERVICE"));
|
||||||
|
// getIntegralRequestHander.setSysName(PropertiesUtil.getProperties("sysConfig.properties", "INTEGRAL_INTERFACE_SYS_NAME"));
|
||||||
|
// getIntegralRequestHander.setPassword(PropertiesUtil.getProperties("sysConfig.properties", "INTEGRAL_INTERFACE_PASS_HANDER"));
|
||||||
|
// getIntegralRequestHander.setChannel(drawActivityRequestBody.getChannel());
|
||||||
|
// getIntegralRequestHander.setSysCode(drawActivityRequestBody.getMerchantSysCode());
|
||||||
|
// getIntegralRequestHander.setSerialNo(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
||||||
|
// getIntegralRequest.setHander(getIntegralRequestHander);
|
||||||
|
// getIntegralRequestBody.setClassCode("A");
|
||||||
|
// getIntegralRequestBody.setMerchantCode(drawActivityRequestBody.getMerchantCode());
|
||||||
|
// getIntegralRequestBody.setUserId(drawActivityRequestBody.getUserId());
|
||||||
|
// getIntegralRequestBody.setUserType(drawActivityRequestBody.getUserType());
|
||||||
|
// getIntegralRequestBody.setBusiness(drawActivityRequestBody.getBusinessArea());
|
||||||
|
// getIntegralRequestBody.setUserName(drawActivityRequestBody.getUserName());
|
||||||
|
// // 查询奖品信息
|
||||||
|
// QueryRule prizeQueryRule = QueryRule.getInstance();
|
||||||
|
// prizeQueryRule.addEqual("prizeCode", gtDrawRecord.getPrizeCode());
|
||||||
|
// GtPrizeInfo gtPrizeInfo = gtPrizeInfoService.queryUniqueGtPrizeInfo(prizeQueryRule);
|
||||||
|
// getIntegralRequestBody.setIntegralProjectCode(gtPrizeInfo.getIntegralProjectCode());
|
||||||
|
// getIntegralRequestBody.setFunction(gtPrizeInfo.getIntegralProjectCode());
|
||||||
|
// getIntegralRequest.setBody(new GetIntegralServiceStub.GetIntegralRequestBody[] { getIntegralRequestBody });
|
||||||
|
// getIntegral.setRequest(getIntegralRequest);
|
||||||
|
// GetIntegralServiceStub.GetIntegralResponseE responseE = getIntegralServiceStub.getIntegral(getIntegral);
|
||||||
|
// GetIntegralServiceStub.GetIntegralResponse response = responseE.get_return();
|
||||||
|
// InPortalTransmessage message = new InPortalTransmessage();
|
||||||
|
// message.setTransCode("IN0001");
|
||||||
|
// message.setTransRefGuid(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
||||||
|
// message.setRequestTime(new Date());
|
||||||
|
// message.setResponseTime(new Date());
|
||||||
|
// message.setRequestMessage(jsonBinder.toJson(getIntegralRequest));
|
||||||
|
// message.setResponseMessage(jsonBinder.toJson(response));
|
||||||
|
// transRecordService.offer(message);
|
||||||
|
// return response;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.ruoyi.thread;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
public class ThreadPool {
|
||||||
|
// 单例线程池--抽奖逻辑
|
||||||
|
public static final ExecutorService drawActivityExecutorService = Executors.newFixedThreadPool(1000);
|
||||||
|
public static final ExecutorService awardExecutorService = Executors.newFixedThreadPool(1000);
|
||||||
|
//短信发送线程池
|
||||||
|
public static final ExecutorService smsExecutorService= Executors.newFixedThreadPool(100);
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
package com.ruoyi.web.controller.draw;
|
package com.ruoyi.web.controller.draw;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.web.vo.Const;
|
import com.ruoyi.dto.DrawActivityRequest;
|
||||||
import com.ruoyi.web.vo.Result;
|
import com.ruoyi.web.vo.Result;
|
||||||
import com.ruoyi.web.vo.draw.*;
|
import com.ruoyi.web.vo.draw.*;
|
||||||
import com.sinosoft.activity.domain.DrawConfig;
|
import com.sinosoft.activity.domain.DrawConfig;
|
||||||
import com.sinosoft.activity.domain.DrawInfo;
|
|
||||||
import com.sinosoft.activity.service.IDrawConfigService;
|
import com.sinosoft.activity.service.IDrawConfigService;
|
||||||
import com.sinosoft.activity.service.IDrawInfoService;
|
import com.sinosoft.activity.service.IDrawInfoService;
|
||||||
import com.sinosoft.activity.service.IDrawTaskNotifyService;
|
import com.sinosoft.activity.service.IDrawTaskNotifyService;
|
||||||
|
|
@ -24,9 +23,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 抽奖Controller
|
* 抽奖Controller
|
||||||
|
|
@ -133,62 +130,17 @@ public class DrawController {
|
||||||
}
|
}
|
||||||
String openid = userInfo.getOpenid();
|
String openid = userInfo.getOpenid();
|
||||||
String userName = userInfo.getNickname();
|
String userName = userInfo.getNickname();
|
||||||
|
DrawActivityRequest body = new DrawActivityRequest();
|
||||||
DrawInfo queryInfo = new DrawInfo();
|
body.setDrawCode(drawCode);
|
||||||
queryInfo.setDRAWCODE(drawCode);
|
body.setUserId(openid);
|
||||||
queryInfo.setSTATUS(Const.STATUS_VALID);
|
body.setUserType("01");
|
||||||
List<DrawInfo> drawInfos = drawInfoService.selectDrawInfoList(queryInfo);
|
body.setUserName(userName);
|
||||||
if (drawInfos == null || drawInfos.size() == 0) {
|
body.setDrawTime(DateUtils.dateTimeNow(DateUtils.YYYYMMDDHHMMSSS));
|
||||||
result.setRespCode("-3");
|
body.setMerchantCode("MerchantCode");
|
||||||
result.setRespMsg("活动未开启");
|
body.setMerchantSysCode("MerchantSysCode");
|
||||||
return result;
|
body.setBusinessArea("6");
|
||||||
}
|
body.setChannel("WEIXIN");
|
||||||
DrawInfo drawInfo = drawInfos.get(0);
|
body.setSource("24");
|
||||||
Date starttime = drawInfo.getSTARTTIME();
|
|
||||||
Date endtime = drawInfo.getENDTIME();
|
|
||||||
Date currDate = new Date();
|
|
||||||
if (currDate.before(starttime) || currDate.after(endtime)) {
|
|
||||||
result.setRespCode("-3");
|
|
||||||
result.setRespMsg("活动未开始");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// String userAccount = geUserPersonal.getUserAccount();
|
|
||||||
// String mobile = geUserPersonal.getMobliePhone();
|
|
||||||
// DrawActivityRequestBody body = new DrawActivityRequestBody();
|
|
||||||
// body.setDrawCode(drawCode);
|
|
||||||
// body.setUserId(openid);
|
|
||||||
// body.setUserType("01");
|
|
||||||
// body.setUserName(StringUtils.isBlank(userName)?userAccount:userName);
|
|
||||||
// body.setDrawTime(DateUtil.convertDate(new Date(), DateUtil.YYYYMMDDHHMMSSS));
|
|
||||||
// body.setMerchantCode("MerchantCode");
|
|
||||||
// body.setMerchantSysCode("MerchantSysCode");
|
|
||||||
// body.setBusinessArea("6");
|
|
||||||
// body.setChannel("WEIXIN");
|
|
||||||
// body.setSource("24");
|
|
||||||
// body.setPhone(mobile);
|
|
||||||
// DrawActivityResponse drawActivityResponse = activityService.drawActivityService(body).get_return();
|
|
||||||
// DrawActivityResponseHeader header = drawActivityResponse.getHeader();
|
|
||||||
// String resultCode = header.getResultCode();
|
|
||||||
// if (!WSResult.SUCCESS.equals(resultCode)) {
|
|
||||||
// result.setRespCode(resultCode);
|
|
||||||
// result.setRespMsg(WSResult.getMsg(resultCode));
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
// DrawActivityResponseBody responseBody = drawActivityResponse.getBody();
|
|
||||||
// String prizeCode = responseBody.getPrizeCode();
|
|
||||||
// result.setPrizeCode(prizeCode);
|
|
||||||
// String prizeName = responseBody.getPrizeName();
|
|
||||||
// result.setPrizeName(prizeName);
|
|
||||||
// String prizeType = responseBody.getPrizeType();
|
|
||||||
// result.setPrizeType(prizeType);
|
|
||||||
// result.setPrizeLevel(responseBody.getPrizeLevel());
|
|
||||||
// result.setDisplayOrder(responseBody.getDisplayOrder());
|
|
||||||
// result.setCue(responseBody.getCue());
|
|
||||||
// result.setAvailable(responseBody.getAvailable());
|
|
||||||
// String extId = responseBody.getExtId();
|
|
||||||
// result.setExtId(extId);
|
|
||||||
// result.setGatewayFlow(responseBody.getGatewayFolw());
|
|
||||||
// result.setResult(responseBody.getResult());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
result.setRespCode("-1");
|
result.setRespCode("-1");
|
||||||
result.setRespMsg("系统异常,请稍后再试");
|
result.setRespMsg("系统异常,请稍后再试");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
package com.ruoyi.web.vo;
|
package com.ruoyi.web.vo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Huayue
|
* @author Huayue
|
||||||
|
|
@ -29,6 +33,95 @@ public interface Const {
|
||||||
|
|
||||||
String STATUS_VALID = "1";
|
String STATUS_VALID = "1";
|
||||||
String STATUS_INVALID = "0";
|
String STATUS_INVALID = "0";
|
||||||
|
/** 任务完成通知记录状态 **/
|
||||||
|
/** 有效 **/
|
||||||
|
public static final String TASK_NOTIFY_RECORD_STATUS_EFFECTIVE = "1";
|
||||||
|
/** 失效 **/
|
||||||
|
public static final String TASK_NOTIFY_RECORD_STATUS_EXPIRE = "0";
|
||||||
|
/** 活动状态 **/
|
||||||
|
/** 有效 **/
|
||||||
|
public static final String DRAW_STATUS_EFFECTIVE = "1";
|
||||||
|
/** 失效 **/
|
||||||
|
public static final String DRAW_STATUS_EXPIRE = "0";
|
||||||
|
/** 奖项配置状态 **/
|
||||||
|
/** 有效 */
|
||||||
|
public static final String DRAW_CONFIG_STATUS_EFFECTIVE = "1";
|
||||||
|
/** 失效 **/
|
||||||
|
public static final String DRAW_CONFIG_STATUS_EXPIRE = "0";
|
||||||
|
/** 抽奖类型 **/
|
||||||
|
/** 积分抽奖 **/
|
||||||
|
public static final String DRAW_EXPE_INTEGRAL = "integral";
|
||||||
|
/** 次数抽奖 **/
|
||||||
|
public static final String DRAW_EXPE_TASK = "task";
|
||||||
|
/** 抽奖记录状态 **/
|
||||||
|
/** 没中奖 **/
|
||||||
|
public static final String DRAW_RECORD_RESULT_NONE = "0";
|
||||||
|
/** 中奖待发奖---发奖失败 **/
|
||||||
|
public static final String DRAW_RECORD_RESULT_PRIZE = "1";
|
||||||
|
/** 发奖成功 **/
|
||||||
|
public static final String DRAW_RECORD_RESULT_AWARDS = "2";
|
||||||
|
/** 奖品级别--空奖 1654**/
|
||||||
|
public static final String PRIZE_LEVEL_BLANK = "blank";
|
||||||
|
/** 奖品类型 ***/
|
||||||
|
public static final String PRIZE_TYPE_BLANK = "empty";
|
||||||
|
/**一账通**/
|
||||||
|
public static final String PRIZE_TYPE_VOCHER = "vocher";
|
||||||
|
/**实物**/
|
||||||
|
public static final String PRIZE_TYPE_MATERIALOBJECT = "materialObject";
|
||||||
|
/**积分**/
|
||||||
|
public static final String PRIZE_TYPE_INTEGRAL = "integral";
|
||||||
|
/**i购券**/
|
||||||
|
public static final String PRIZE_TYPE_IEMALL = "iemall";
|
||||||
|
/**公开码电子券**/
|
||||||
|
public static final String PRIZE_TYPE_PCOUPON = "pcoupon";
|
||||||
|
/**隐藏码电子券**/
|
||||||
|
public static final String PRIZE_TYPE_SCOUPON = "scoupon";
|
||||||
|
/**1656 积分平台虚拟电子券**/
|
||||||
|
public static final String PRIZE_TYPE_VCOUPON = "vcoupon";
|
||||||
|
/**服务奖品**/
|
||||||
|
public static final String PRIZE_TYPE_SERVICE = "service";
|
||||||
|
/**保险奖品**/
|
||||||
|
public static final String PRIZE_TYPE_INSURANCE = "insurance";
|
||||||
|
/**随机红包**/
|
||||||
|
public static final String PRIZE_TYPE_WELFARE = "welfare";
|
||||||
|
/**一账通现金红包 1654**/
|
||||||
|
public static final String PRIZE_TYPE_CASH = "cash";
|
||||||
|
/**发奖结果**/
|
||||||
|
public static final String AWARD_RESULT_SUCCESS="1";
|
||||||
|
public static final String AWARD_RESULT_FAIL="0";
|
||||||
|
/**活动类型-转盘抽奖**/
|
||||||
|
public static final String DRAW_TYPE_TURN_TABLE="turnTable";
|
||||||
|
/**奖品发放通知类型**/
|
||||||
|
public static final List<String> AWARD_TYPE= Arrays.asList("001", "002", "003", "004", "005", "006");
|
||||||
|
|
||||||
String PRIZE_LEVEL_BLANK = "blank";
|
/**异步发列表**/
|
||||||
|
/**请求类型**/
|
||||||
|
public static final String TASK_TYPE_VALIDATE="1";
|
||||||
|
public static final String TASK_TYPE_SHARE="2";
|
||||||
|
public static final String TASK_TYPE_OTHER="3";
|
||||||
|
/**
|
||||||
|
* 1654
|
||||||
|
* 一账通支付
|
||||||
|
*/
|
||||||
|
public static final String TASK_TYPE_PAY="9";
|
||||||
|
/**一账通验证状态**/
|
||||||
|
public static final String TASK_NOTIFY_VSTATE_TRUE="1";
|
||||||
|
public static final String TASK_NOTIFY_VSTATE_FALSE="0";
|
||||||
|
/**发将限制规则**/
|
||||||
|
public static final String AWARD_TYPE_NONE="none";
|
||||||
|
/**单个活动限制**/
|
||||||
|
public static final String AWARD_TYPE_DISTINCTION="distinction";
|
||||||
|
/**不区分活动限制**/
|
||||||
|
public static final String AWARD_TYPE_NODISTINCTION="nodistinction";
|
||||||
|
/**用户等级**/
|
||||||
|
/**一般用户**/
|
||||||
|
public static final String USER_LEVEL_ORDINARY="1";
|
||||||
|
/**高价值客户**/
|
||||||
|
public static final String USER_LEVEL_SENIOR="2";
|
||||||
|
|
||||||
|
/**领奖方式**/
|
||||||
|
/**自动领取**/
|
||||||
|
public static final String AWARD_METHOD_AUTO="1";
|
||||||
|
/**手动领取**/
|
||||||
|
public static final String AWARD_METHOD_MANAL="0";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,44 @@ public class DrawResult extends Result {
|
||||||
private String available;
|
private String available;
|
||||||
private String extId;
|
private String extId;
|
||||||
private String gatewayFlow;
|
private String gatewayFlow;
|
||||||
|
private String gateWayTime;
|
||||||
|
private String drawCode;
|
||||||
|
private String source;
|
||||||
|
private String userId;
|
||||||
private String result;
|
private String result;
|
||||||
|
|
||||||
|
public String getGateWayTime() {
|
||||||
|
return gateWayTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGateWayTime(String gateWayTime) {
|
||||||
|
this.gateWayTime = gateWayTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDrawCode() {
|
||||||
|
return drawCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDrawCode(String drawCode) {
|
||||||
|
this.drawCode = drawCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPrizeCode() {
|
public String getPrizeCode() {
|
||||||
return prizeCode;
|
return prizeCode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ public interface DrawConfigMapper
|
||||||
* @return 存储奖项配置信息对象集合
|
* @return 存储奖项配置信息对象集合
|
||||||
*/
|
*/
|
||||||
public List<DrawConfig> selectDrawConfigList(DrawConfig drawConfig);
|
public List<DrawConfig> selectDrawConfigList(DrawConfig drawConfig);
|
||||||
|
public DrawConfig selectDrawConfigByDraw(DrawConfig drawConfig);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增存储奖项配置信息对象
|
* 新增存储奖项配置信息对象
|
||||||
|
|
@ -43,6 +44,8 @@ public interface DrawConfigMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateDrawConfig(DrawConfig drawConfig);
|
public int updateDrawConfig(DrawConfig drawConfig);
|
||||||
|
public int updateDrawConfigNumAndStatus(DrawConfig drawConfig);
|
||||||
|
public int updateDrawConfigRollback(DrawConfig drawConfig);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除存储奖项配置信息对象
|
* 删除存储奖项配置信息对象
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ public interface DrawInfoMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateDrawInfo(DrawInfo drawInfo);
|
public int updateDrawInfo(DrawInfo drawInfo);
|
||||||
|
public int updateDrawInfoFlag(String DRAWCODE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除抽奖活动管理对象
|
* 删除抽奖活动管理对象
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ public interface DrawRecordMapper
|
||||||
* @return 抽奖记录信息集合
|
* @return 抽奖记录信息集合
|
||||||
*/
|
*/
|
||||||
public List<DrawRecord> selectDrawRecordList(DrawRecord drawRecord);
|
public List<DrawRecord> selectDrawRecordList(DrawRecord drawRecord);
|
||||||
|
public Long selectDrawRecordCount(DrawRecord drawRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增抽奖记录信息
|
* 新增抽奖记录信息
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ public interface DrawTaskConsumeMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateDrawTaskConsume(DrawTaskConsume drawTaskConsume);
|
public int updateDrawTaskConsume(DrawTaskConsume drawTaskConsume);
|
||||||
|
public int updateDrawTaskConsumeState(DrawTaskConsume drawTaskConsume);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除抽奖次数消费信息
|
* 删除抽奖次数消费信息
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ public interface DrawTaskNotifyMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateDrawTaskNotify(DrawTaskNotify drawTaskNotify);
|
public int updateDrawTaskNotify(DrawTaskNotify drawTaskNotify);
|
||||||
|
public int updateDrawTaskNotifyNum(String TASKNOTIFYID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除活动次数记录信息
|
* 删除活动次数记录信息
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ public interface IDrawConfigService
|
||||||
* @return 存储奖项配置信息列表
|
* @return 存储奖项配置信息列表
|
||||||
*/
|
*/
|
||||||
public DrawConfig selectDrawConfigById(String DRAWCONFIGID);
|
public DrawConfig selectDrawConfigById(String DRAWCONFIGID);
|
||||||
|
public DrawConfig selectDrawConfigByDraw(DrawConfig drawConfig);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询存储奖项配置信息列表列表
|
* 查询存储奖项配置信息列表列表
|
||||||
|
|
@ -43,6 +44,8 @@ public interface IDrawConfigService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateDrawConfig(DrawConfig drawConfig);
|
public int updateDrawConfig(DrawConfig drawConfig);
|
||||||
|
public int updateDrawConfigNumAndStatus(DrawConfig drawConfig);
|
||||||
|
public int updateDrawConfigRollback(DrawConfig drawConfig);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除存储奖项配置信息列表
|
* 批量删除存储奖项配置信息列表
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ public interface IDrawRecordService
|
||||||
* @return 抽奖记录信息集合
|
* @return 抽奖记录信息集合
|
||||||
*/
|
*/
|
||||||
public List<DrawRecord> selectDrawRecordList(DrawRecord drawRecord);
|
public List<DrawRecord> selectDrawRecordList(DrawRecord drawRecord);
|
||||||
|
public Long selectDrawRecordCount(DrawRecord drawRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增抽奖记录信息
|
* 新增抽奖记录信息
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ public interface IDrawTaskConsumeService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateDrawTaskConsume(DrawTaskConsume drawTaskConsume);
|
public int updateDrawTaskConsume(DrawTaskConsume drawTaskConsume);
|
||||||
|
public int updateDrawTaskConsumeState(DrawTaskConsume drawTaskConsume);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除抽奖次数消费信息
|
* 批量删除抽奖次数消费信息
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ public interface IDrawTaskNotifyService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateDrawTaskNotify(DrawTaskNotify drawTaskNotify);
|
public int updateDrawTaskNotify(DrawTaskNotify drawTaskNotify);
|
||||||
|
public String updateDrawTaskNotifyNum(DrawTaskNotify drawTaskNotify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除活动次数记录信息
|
* 批量删除活动次数记录信息
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.sinosoft.activity.domain.DrawConfig;
|
import com.sinosoft.activity.domain.DrawConfig;
|
||||||
import com.sinosoft.activity.mapper.DrawConfigMapper;
|
import com.sinosoft.activity.mapper.DrawConfigMapper;
|
||||||
|
import com.sinosoft.activity.mapper.DrawInfoMapper;
|
||||||
import com.sinosoft.activity.service.IDrawConfigService;
|
import com.sinosoft.activity.service.IDrawConfigService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -21,6 +22,8 @@ public class DrawConfigServiceImpl implements IDrawConfigService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private DrawConfigMapper drawConfigMapper;
|
private DrawConfigMapper drawConfigMapper;
|
||||||
|
@Autowired
|
||||||
|
private DrawInfoMapper drawInfoMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询存储奖项配置信息列表
|
* 查询存储奖项配置信息列表
|
||||||
|
|
@ -33,6 +36,11 @@ public class DrawConfigServiceImpl implements IDrawConfigService
|
||||||
{
|
{
|
||||||
return drawConfigMapper.selectDrawConfigById(DRAWCONFIGID);
|
return drawConfigMapper.selectDrawConfigById(DRAWCONFIGID);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public DrawConfig selectDrawConfigByDraw(DrawConfig drawConfig)
|
||||||
|
{
|
||||||
|
return drawConfigMapper.selectDrawConfigByDraw(drawConfig);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询存储奖项配置信息列表列表
|
* 查询存储奖项配置信息列表列表
|
||||||
|
|
@ -69,6 +77,20 @@ public class DrawConfigServiceImpl implements IDrawConfigService
|
||||||
{
|
{
|
||||||
return drawConfigMapper.updateDrawConfig(drawConfig);
|
return drawConfigMapper.updateDrawConfig(drawConfig);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public int updateDrawConfigNumAndStatus(DrawConfig drawConfig)
|
||||||
|
{
|
||||||
|
int result = drawConfigMapper.updateDrawConfigNumAndStatus(drawConfig);
|
||||||
|
drawInfoMapper.updateDrawInfoFlag(drawConfig.getDRAWCODE());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int updateDrawConfigRollback(DrawConfig drawConfig)
|
||||||
|
{
|
||||||
|
int result = drawConfigMapper.updateDrawConfigRollback(drawConfig);
|
||||||
|
drawInfoMapper.updateDrawInfoFlag(drawConfig.getDRAWCODE());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除存储奖项配置信息列表对象
|
* 删除存储奖项配置信息列表对象
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,11 @@ public class DrawRecordServiceImpl implements IDrawRecordService
|
||||||
{
|
{
|
||||||
return drawRecordMapper.selectDrawRecordList(drawRecord);
|
return drawRecordMapper.selectDrawRecordList(drawRecord);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public Long selectDrawRecordCount(DrawRecord drawRecord)
|
||||||
|
{
|
||||||
|
return drawRecordMapper.selectDrawRecordCount(drawRecord);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增抽奖记录信息
|
* 新增抽奖记录信息
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,11 @@ public class DrawTaskConsumeServiceImpl implements IDrawTaskConsumeService
|
||||||
{
|
{
|
||||||
return drawTaskConsumeMapper.updateDrawTaskConsume(drawTaskConsume);
|
return drawTaskConsumeMapper.updateDrawTaskConsume(drawTaskConsume);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public int updateDrawTaskConsumeState(DrawTaskConsume drawTaskConsume)
|
||||||
|
{
|
||||||
|
return drawTaskConsumeMapper.updateDrawTaskConsumeState(drawTaskConsume);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除抽奖次数消费信息对象
|
* 删除抽奖次数消费信息对象
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
package com.sinosoft.activity.service.impl;
|
package com.sinosoft.activity.service.impl;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.sinosoft.activity.domain.DrawTaskConsume;
|
||||||
|
import com.sinosoft.activity.mapper.DrawTaskConsumeMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.sinosoft.activity.mapper.DrawTaskNotifyMapper;
|
import com.sinosoft.activity.mapper.DrawTaskNotifyMapper;
|
||||||
|
|
@ -19,6 +23,8 @@ public class DrawTaskNotifyServiceImpl implements IDrawTaskNotifyService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private DrawTaskNotifyMapper drawTaskNotifyMapper;
|
private DrawTaskNotifyMapper drawTaskNotifyMapper;
|
||||||
|
@Autowired
|
||||||
|
private DrawTaskConsumeMapper drawTaskConsumeMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询活动次数记录信息
|
* 查询活动次数记录信息
|
||||||
|
|
@ -72,6 +78,36 @@ public class DrawTaskNotifyServiceImpl implements IDrawTaskNotifyService
|
||||||
{
|
{
|
||||||
return drawTaskNotifyMapper.updateDrawTaskNotify(drawTaskNotify);
|
return drawTaskNotifyMapper.updateDrawTaskNotify(drawTaskNotify);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public String updateDrawTaskNotifyNum(DrawTaskNotify drawTaskNotify)
|
||||||
|
{
|
||||||
|
DrawTaskNotify queryParams = new DrawTaskNotify();
|
||||||
|
queryParams.setUSERID(drawTaskNotify.getUSERID());
|
||||||
|
queryParams.setDRAWCODE(drawTaskNotify.getDRAWCODE());
|
||||||
|
queryParams.setSTATE("1");
|
||||||
|
List<DrawTaskNotify> drawTaskNotifies = drawTaskNotifyMapper.selectDrawTaskNotifyList(queryParams);
|
||||||
|
if (drawTaskNotifies == null || drawTaskNotifies.size() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
DrawTaskNotify taskNotify = drawTaskNotifies.get(drawTaskNotifies.size() - 1);
|
||||||
|
String taskNotifyId = taskNotify.getTASKNOTIFYID();
|
||||||
|
int result = drawTaskNotifyMapper.updateDrawTaskNotifyNum(taskNotifyId);
|
||||||
|
if (result > 0) {
|
||||||
|
DrawTaskConsume gtTaskConsume = new DrawTaskConsume();
|
||||||
|
gtTaskConsume.setCONSUMENUMBER(1L);
|
||||||
|
gtTaskConsume.setCreateTime(new Date());
|
||||||
|
gtTaskConsume.setDRAWCODE(taskNotify.getDRAWCODE());
|
||||||
|
gtTaskConsume.setLASTUPDATETIMESTAMP(new Date());
|
||||||
|
gtTaskConsume.setSTATE("0");
|
||||||
|
gtTaskConsume.setTASKID(taskNotify.getTASKID());
|
||||||
|
gtTaskConsume.setTASKNOTIFYID(taskNotifyId);
|
||||||
|
gtTaskConsume.setTYPE(taskNotify.getTYPE());
|
||||||
|
gtTaskConsume.setUSERID(taskNotify.getUSERID());
|
||||||
|
drawTaskConsumeMapper.insertDrawTaskConsume(gtTaskConsume);
|
||||||
|
return gtTaskConsume.getTASKCONSUMEID();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除活动次数记录信息对象
|
* 删除活动次数记录信息对象
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where DRAWCONFIGID = #{DRAWCONFIGID}
|
where DRAWCONFIGID = #{DRAWCONFIGID}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDrawConfigByDraw" parameterType="DrawConfig" resultMap="DrawConfigResult">
|
||||||
|
<include refid="selectDrawConfigVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="PRIZECODE != null and PRIZECODE != ''"> and PRIZECODE = #{PRIZECODE}</if>
|
||||||
|
<if test="DRAWCODE != null and DRAWCODE != ''"> and DRAWCODE = #{DRAWCODE}</if>
|
||||||
|
<if test="PRIZELEVEL != null and PRIZELEVEL != ''"> and PRIZELEVEL = #{PRIZELEVEL}</if>
|
||||||
|
<if test="AVAILABLENUMBER != null "> and AVAILABLENUMBER > #{AVAILABLENUMBER}</if>
|
||||||
|
<if test="STATUS != null and STATUS != ''"> and STATUS = #{STATUS}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertDrawConfig" parameterType="DrawConfig">
|
<insert id="insertDrawConfig" parameterType="DrawConfig">
|
||||||
insert into draw_config
|
insert into draw_config
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
@ -120,6 +131,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDrawConfigNumAndStatus" parameterType="DrawConfig">
|
||||||
|
update draw_config t
|
||||||
|
set
|
||||||
|
t.availablenumber=case when t.availablenumber>=1
|
||||||
|
then t.availablenumber-1 else t.availablenumber end,
|
||||||
|
t.status=case when t.availablenumber-1>0 then 1 else 0 end
|
||||||
|
where
|
||||||
|
t.drawcode=#{DRAWCODE} and t.prizecode=#{PRIZECODE}
|
||||||
|
and t.prizelevel=#{PRIZELEVEL}
|
||||||
|
</update>
|
||||||
|
<update id="updateDrawConfigRollback" parameterType="DrawConfig">
|
||||||
|
update draw_config t
|
||||||
|
set
|
||||||
|
t.availablenumber=t.availablenumber+1,t.status='1'
|
||||||
|
where
|
||||||
|
t.drawcode=#{DRAWCODE} and t.prizecode=#{PRIZECODE}
|
||||||
|
and t.prizelevel=#{PRIZELEVEL}
|
||||||
|
</update>
|
||||||
<update id="updateDrawConfig" parameterType="DrawConfig">
|
<update id="updateDrawConfig" parameterType="DrawConfig">
|
||||||
update draw_config
|
update draw_config
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDrawInfoFlag" parameterType="String">
|
||||||
|
update gt_draw_info set updateFlag='1' where drawCode=#{DRAWCODE}
|
||||||
|
</update>
|
||||||
<update id="updateDrawInfo" parameterType="DrawInfo">
|
<update id="updateDrawInfo" parameterType="DrawInfo">
|
||||||
update draw_info
|
update draw_info
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="PHONE != null and PHONE != ''"> and PHONE = #{PHONE}</if>
|
<if test="PHONE != null and PHONE != ''"> and PHONE = #{PHONE}</if>
|
||||||
<if test="EXTAREA != null and EXTAREA != ''"> and EXTAREA = #{EXTAREA}</if>
|
<if test="EXTAREA != null and EXTAREA != ''"> and EXTAREA = #{EXTAREA}</if>
|
||||||
</where>
|
</where>
|
||||||
|
<if test="params.start != null and params.start != ''"> limit #{params.start}, #{params.end}</if>
|
||||||
|
order by CREATETIMESTAMP desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDrawRecordCount" parameterType="DrawRecord" resultType="Long">
|
||||||
|
select count(*) from draw_record
|
||||||
|
<where>
|
||||||
|
<if test="DRAWCODE != null and DRAWCODE != ''"> and DRAWCODE = #{DRAWCODE}</if>
|
||||||
|
<if test="USERID != null and USERID != ''"> and USERID = #{USERID}</if>
|
||||||
|
<if test="DRAWRESULT != null and DRAWRESULT != ''"> and DRAWRESULT = #{DRAWRESULT}</if>
|
||||||
|
<if test="PRIZECODE != null and PRIZECODE != ''"> and PRIZECODE = #{PRIZECODE}</if>
|
||||||
|
<if test="PRIZETYPE != null and PRIZETYPE != ''"> and PRIZETYPE = #{PRIZETYPE}</if>
|
||||||
|
<if test="params.startTime != null "> and createTimeStamp >= to_date(#{params.startTime},'yyyy-MM-dd hh24:mi:ss')</if>
|
||||||
|
<if test="params.endTime != null "> and createTimeStamp <= to_date(#{params.endTime},'yyyy-MM-dd hh24:mi:ss')</if>
|
||||||
|
<if test="CHANNEL != null and CHANNEL != ''"> and CHANNEL = #{CHANNEL}</if>
|
||||||
|
<if test="USERNAME != null and USERNAME != ''"> and USERNAME like concat('%', #{USERNAME}, '%')</if>
|
||||||
|
<if test="PRIZELEVEL != null and PRIZELEVEL != ''"> and PRIZELEVEL = #{PRIZELEVEL}</if>
|
||||||
|
<if test="PROJECTCODE != null and PROJECTCODE != ''"> and PROJECTCODE = #{PROJECTCODE}</if>
|
||||||
|
<if test="SOURCE != null and SOURCE != ''"> and SOURCE = #{SOURCE}</if>
|
||||||
|
<if test="PHONE != null and PHONE != ''"> and PHONE = #{PHONE}</if>
|
||||||
|
<if test="EXTAREA != null and EXTAREA != ''"> and EXTAREA = #{EXTAREA}</if>
|
||||||
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDrawRecordById" parameterType="String" resultMap="DrawRecordResult">
|
<select id="selectDrawRecordById" parameterType="String" resultMap="DrawRecordResult">
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDrawTaskConsumeState" parameterType="DrawTaskConsume">
|
||||||
|
update draw_task_consume t set t.tranSeqNo=#{TRANSEQNO},t.tradeOrderId=#{TRADEORDERID},t.state='1' where t.taskConsumeId=#{TASKCONSUMEID}
|
||||||
|
</update>
|
||||||
<update id="updateDrawTaskConsume" parameterType="DrawTaskConsume">
|
<update id="updateDrawTaskConsume" parameterType="DrawTaskConsume">
|
||||||
update draw_task_consume
|
update draw_task_consume
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="SOURCE != null and SOURCE != ''"> and SOURCE = #{SOURCE}</if>
|
<if test="SOURCE != null and SOURCE != ''"> and SOURCE = #{SOURCE}</if>
|
||||||
<if test="ISSPECIALFLAG != null and ISSPECIALFLAG != ''"> and ISSPECIALFLAG = #{ISSPECIALFLAG}</if>
|
<if test="ISSPECIALFLAG != null and ISSPECIALFLAG != ''"> and ISSPECIALFLAG = #{ISSPECIALFLAG}</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by CREATETIMESTAMP desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDrawTaskNotifyById" parameterType="String" resultMap="DrawTaskNotifyResult">
|
<select id="selectDrawTaskNotifyById" parameterType="String" resultMap="DrawTaskNotifyResult">
|
||||||
|
|
@ -104,6 +105,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDrawTaskNotifyNum" parameterType="String">
|
||||||
|
UPDATE draw_task_notify t SET AVAILABLENUMBER=AVAILABLENUMBER-1, LASTUPDATETIMESTAMP=SYSDATE(),
|
||||||
|
t.state=case when t.availablenumber-1>0 then 1 else 0 end where t.tasknotifyid=#{TASKNOTIFYID}
|
||||||
|
</update>
|
||||||
<update id="updateDrawTaskNotify" parameterType="DrawTaskNotify">
|
<update id="updateDrawTaskNotify" parameterType="DrawTaskNotify">
|
||||||
update draw_task_notify
|
update draw_task_notify
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue