generated from root/miduo_server
序列号
parent
ee0e4a7b58
commit
86ea515f78
|
@ -3,3 +3,5 @@
|
|||
|
||||
/target
|
||||
/logs
|
||||
gm_tw_admin.iml
|
||||
*.txt
|
||||
|
|
|
@ -3,9 +3,7 @@ package com;
|
|||
import com.jmfy.redisProperties.RedisAutoConfiguration;
|
||||
import com.jmfy.thrift.pool.ThriftPoolUtils;
|
||||
import com.jmfy.utils.RedisUtil;
|
||||
import com.jmfy.utils.STableManager;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
||||
|
@ -23,9 +21,6 @@ public class Application extends SpringBootServletInitializer {
|
|||
ConfigurableApplicationContext configurableApplicationContext = SpringApplication.run(Application.class, args);
|
||||
RedisAutoConfiguration redisAutoConfiguration = configurableApplicationContext.getBean(RedisAutoConfiguration.class);
|
||||
RedisUtil.getInstence().init(redisAutoConfiguration.getRedisProperties());
|
||||
//初始化表数据
|
||||
STableManager.getInstance().init(configurableApplicationContext);
|
||||
STableManager.getInstance().initSTable();
|
||||
//初使化连接池util类
|
||||
ThriftPoolUtils.getInstance().initContext(configurableApplicationContext);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,9 @@ public class WebSecurityConfig extends WebMvcConfigurerAdapter{
|
|||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,Object handler) throws IOException {
|
||||
HttpSession session = request.getSession();
|
||||
// 判断是否已有该用户登录的session
|
||||
if (request.getParameterMap().size() == 0){
|
||||
|
||||
}
|
||||
if(session.getAttribute(SESSION_KEY) != null){
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
package com.jmfy.controller;
|
||||
|
||||
import ch.qos.logback.core.util.TimeUtil;
|
||||
import com.jmfy.dao.CdkInfoDao;
|
||||
import com.jmfy.dao.NoticeDao;
|
||||
import com.jmfy.dao.UserInfoDao;
|
||||
import com.jmfy.model.*;
|
||||
import com.jmfy.model.vo.CDKInfoVo;
|
||||
import com.jmfy.model.vo.UseCDKInfoVo;
|
||||
import com.jmfy.utils.JsonUtil;
|
||||
import com.jmfy.utils.MD5Util;
|
||||
import com.jmfy.utils.STableManager;
|
||||
import com.jmfy.utils.TXTUtils;
|
||||
import com.jmfy.utils.*;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
@ -23,8 +18,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.*;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -36,41 +29,36 @@ public class CdkInfoController {
|
|||
private CdkInfoDao cdkInfoDao;
|
||||
@Resource
|
||||
private UserInfoDao userInfoDao;
|
||||
@Resource
|
||||
private SeqUtils seqUtils;
|
||||
|
||||
@RequestMapping(value = "/addCdkNumber", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody int SendMail(HttpSession session, ModelMap map , HttpServletRequest request) throws Exception {
|
||||
public @ResponseBody int addCdkNumber(HttpSession session, ModelMap map , HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||
int goodsId = Integer.parseInt(parameterMap.get("goodsId"));
|
||||
SCdkInfo scdkInfo = STableManager.getInstance().getScdkInfo(goodsId);
|
||||
SCdkInfo scdkInfo = cdkInfoDao.getScdkInfo(goodsId);
|
||||
if (scdkInfo == null){
|
||||
return 1;
|
||||
}
|
||||
long time = System.currentTimeMillis();
|
||||
if (scdkInfo.getStartTime() > time || scdkInfo.getEndTime() < time){
|
||||
if (scdkInfo.getIsAdd() ==1){
|
||||
return 3;
|
||||
}
|
||||
if (scdkInfo.getStartTime() > time || scdkInfo.getEndTime() < time) {
|
||||
return 2;
|
||||
}
|
||||
if (scdkInfo.getAddtype() == 1) { //策划生成
|
||||
CdkInfo cdkInfo = cdkInfoDao.findCdkInfoBuyId(scdkInfo.getCdk_num());
|
||||
if (cdkInfo ==null){
|
||||
cdkInfo = new CdkInfo();
|
||||
cdkInfo.setId(scdkInfo.getCdk_num());
|
||||
cdkInfo.setGoodsId(goodsId);
|
||||
cdkInfo.setStatus(0);
|
||||
cdkInfoDao.addCdkInfo(cdkInfo);
|
||||
}else{
|
||||
return 3;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < scdkInfo.getGoodsSum(); i++) {
|
||||
long nowTime = System.currentTimeMillis();
|
||||
String sdk = "YSJCDK" + goodsId + nowTime + UUID.randomUUID().toString();
|
||||
String id = MD5Util.encrypByMd5(sdk);
|
||||
CdkInfo cdkInfo = new CdkInfo();
|
||||
cdkInfo.setId(id);
|
||||
cdkInfo.setGoodsId(goodsId);
|
||||
cdkInfo.setStatus(0);
|
||||
cdkInfoDao.addCdkInfo(cdkInfo);
|
||||
}
|
||||
for (int i = 0; i < scdkInfo.getGoodsSum(); i++) {
|
||||
long nowTime = System.currentTimeMillis();
|
||||
String sdk = "YSJCDK" + goodsId + nowTime + UUID.randomUUID().toString();
|
||||
String id = MD5Util.encrypByMd5(sdk);
|
||||
CdkInfo cdkInfo = new CdkInfo();
|
||||
cdkInfo.setId(id);
|
||||
cdkInfo.setGoodsId(goodsId);
|
||||
cdkInfo.setStatus(0);
|
||||
cdkInfoDao.addCdkInfo(cdkInfo);
|
||||
}
|
||||
scdkInfo.setIsAdd(1);
|
||||
cdkInfoDao.updateCdkGoodsInfo(scdkInfo,goodsId);
|
||||
return 0;
|
||||
}
|
||||
@RequestMapping(value = "/findCdkInfo", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
|
@ -82,7 +70,7 @@ public class CdkInfoController {
|
|||
if (cdkInfo == null){
|
||||
return "404";
|
||||
}
|
||||
SCdkInfo scdkInfo = STableManager.getInstance().getScdkInfo(cdkInfo.getGoodsId());
|
||||
SCdkInfo scdkInfo = cdkInfoDao.getScdkInfo(Integer.parseInt(cdkNum));
|
||||
if (scdkInfo == null){
|
||||
return "404";
|
||||
}
|
||||
|
@ -105,25 +93,36 @@ public class CdkInfoController {
|
|||
}
|
||||
@RequestMapping(value = "/toCDKBuild", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String toCDKBuild (HttpSession session, ModelMap map , HttpServletRequest request) throws Exception {
|
||||
Map<Integer, SCdkInfo> scdkInfoMap = STableManager.getInstance().getScdkInfoMap();
|
||||
List<CDKInfoVo> sCdkInfoList = new ArrayList<>();
|
||||
for (Map.Entry<Integer,SCdkInfo> entry :scdkInfoMap.entrySet()){
|
||||
SCdkInfo sCdkInfo = entry.getValue();
|
||||
List<SCdkInfo> sCdkInfoList = cdkInfoDao.getScdkInfoList();
|
||||
List<CDKInfoVo> sCdkInfoListVo = new ArrayList<>();
|
||||
for (SCdkInfo sCdkInfo :sCdkInfoList){
|
||||
CDKInfoVo cdkInfoVo = new CDKInfoVo();
|
||||
cdkInfoVo.setId(sCdkInfo.getId());
|
||||
cdkInfoVo.setGoodsName(sCdkInfo.getGoodsName());
|
||||
cdkInfoVo.setGoodsInfo(sCdkInfo.getGoodsInfo());
|
||||
cdkInfoVo.setStartTime(JsonUtil.timeStamp2Date(String.valueOf(sCdkInfo.getStartTime())));
|
||||
cdkInfoVo.setEndTime(JsonUtil.timeStamp2Date(String.valueOf(sCdkInfo.getEndTime())));
|
||||
long goodsNum = cdkInfoDao.getCdkNumByGoodsId(sCdkInfo.getId());
|
||||
cdkInfoVo.setGoodsNum(goodsNum);
|
||||
// long goodsNum = cdkInfoDao.getCdkNumByGoodsId(sCdkInfo.getId());
|
||||
cdkInfoVo.setGoodsNum(sCdkInfo.getGoodsSum());
|
||||
long useNum = cdkInfoDao.getUseCdkNumByGoodsId(sCdkInfo.getId());
|
||||
cdkInfoVo.setUseNum(useNum);
|
||||
sCdkInfoList.add(cdkInfoVo);
|
||||
cdkInfoVo.setType(getUsetype(sCdkInfo));
|
||||
sCdkInfoListVo.add(cdkInfoVo);
|
||||
}
|
||||
map.put("sCdkInfoList",sCdkInfoList);
|
||||
map.put("sCdkInfoList",sCdkInfoListVo);
|
||||
return "CDKBuild";
|
||||
}
|
||||
|
||||
private String getUsetype(SCdkInfo sCdkInfo) {
|
||||
String type = "C";
|
||||
if (sCdkInfo.getUsetype() ==0){
|
||||
type = "A";
|
||||
}else if (sCdkInfo.getUsetype() ==1){
|
||||
type = "B";
|
||||
}
|
||||
return type ;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/downloadFile", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public ResponseEntity<byte[]> downloadFile (HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||
|
@ -146,6 +145,29 @@ public class CdkInfoController {
|
|||
File file = new File(path);
|
||||
return TXTUtils.buildResponseEntity(file);
|
||||
}
|
||||
@RequestMapping(value = "/addCdkGoodsInfo", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String addCdkGoodsInfo(HttpSession session, ModelMap map , HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||
String goodsName = parameterMap.get("goodsName");
|
||||
String addType = parameterMap.get("addType");
|
||||
String goodsNum = parameterMap.get("goodsNum");
|
||||
String startTime = JsonUtil.date3TimeStamp(parameterMap.get("startTime"));
|
||||
String endTime = JsonUtil.date3TimeStamp(parameterMap.get("endTime"));
|
||||
String goodsInfo = parameterMap.get("goodsInfo");
|
||||
String reward = parameterMap.get("reward");
|
||||
SCdkInfo sCdkInfo = new SCdkInfo();
|
||||
sCdkInfo.setId(seqUtils.getSequence("cdk_goods_id"));
|
||||
sCdkInfo.setGoodsInfo(goodsInfo);
|
||||
sCdkInfo.setGoodsName(goodsName);
|
||||
sCdkInfo.setUsetype(Integer.parseInt(addType));
|
||||
sCdkInfo.setGoodsSum(Integer.parseInt(goodsNum));
|
||||
sCdkInfo.setReward(reward);
|
||||
sCdkInfo.setStartTime(Long.parseLong(startTime));
|
||||
sCdkInfo.setEndTime(Long.parseLong(endTime));
|
||||
sCdkInfo.setIsAdd(0);
|
||||
cdkInfoDao.addCDKGoodsInfo(sCdkInfo);
|
||||
return "redirect:/toCDKBuild";
|
||||
}
|
||||
public static void main(String [] args) {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
String sdk = "YSJSDK" + 1001 + System.currentTimeMillis() + UUID.randomUUID().toString();
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.jmfy.model.CUser;
|
|||
import com.jmfy.model.vo.FamilyInfoVo;
|
||||
import com.jmfy.model.vo.FamilyLeaguerInfoVo;
|
||||
import com.jmfy.utils.JsonUtil;
|
||||
import com.jmfy.utils.STableManager;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.jmfy.dao;
|
|||
|
||||
import com.jmfy.model.CdkInfo;
|
||||
import com.jmfy.model.CdkUseInfo;
|
||||
import com.jmfy.model.SCdkInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -13,9 +14,17 @@ public interface CdkInfoDao {
|
|||
|
||||
List<CdkUseInfo> findCdkUseInfoById(int serverId, String cdkNum) throws Exception;
|
||||
|
||||
long getCdkNumByGoodsId(int id) throws Exception;
|
||||
// long getCdkNumByGoodsId(int id) throws Exception;
|
||||
|
||||
long getUseCdkNumByGoodsId(int id) throws Exception;
|
||||
|
||||
List<CdkInfo> findCdkUseInfoByGoodsId(int goodsId) throws Exception;
|
||||
|
||||
void addCDKGoodsInfo(SCdkInfo sCdkInfo) throws Exception;
|
||||
|
||||
List<SCdkInfo> getScdkInfoList() throws Exception;
|
||||
|
||||
SCdkInfo getScdkInfo(int goodsId) throws Exception;
|
||||
|
||||
void updateCdkGoodsInfo(SCdkInfo scdkInfo,int goodsId) throws Exception;
|
||||
}
|
||||
|
|
|
@ -3,11 +3,13 @@ package com.jmfy.dao.impl;
|
|||
import com.jmfy.dao.CdkInfoDao;
|
||||
import com.jmfy.model.CdkInfo;
|
||||
import com.jmfy.model.CdkUseInfo;
|
||||
import com.jmfy.model.SCdkInfo;
|
||||
import com.jmfy.model.ServerInfo;
|
||||
import com.jmfy.utils.Connect;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.core.query.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -40,23 +42,23 @@ public class CdkInfoDaoImpl implements CdkInfoDao {
|
|||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
Query query = new Query();
|
||||
Criteria cr = new Criteria();
|
||||
// cr.andOperator(Criteria.where("cdk_num").is(cdkNum), Criteria.where("serverId").is(serverId));
|
||||
cr.andOperator(Criteria.where("goodsId").is(cdkNum));
|
||||
cr.andOperator(Criteria.where("cdk_num").is(cdkNum), Criteria.where("serverId").is(serverId));
|
||||
// cr.andOperator(Criteria.where("goodsId").is(cdkNum));
|
||||
query.addCriteria(cr);
|
||||
return mongoTemplate.find(query, CdkUseInfo.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCdkNumByGoodsId(int id) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
Query query = new Query();
|
||||
Criteria cr = new Criteria();
|
||||
// cr.andOperator(Criteria.where("cdk_num").is(cdkNum), Criteria.where("serverId").is(serverId));
|
||||
cr.andOperator(Criteria.where("goodsId").is(id));
|
||||
query.addCriteria(cr);
|
||||
return mongoTemplate.count(query, CdkInfo.class);
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public long getCdkNumByGoodsId(int id) throws Exception {
|
||||
// MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
// Query query = new Query();
|
||||
// Criteria cr = new Criteria();
|
||||
//// cr.andOperator(Criteria.where("cdk_num").is(cdkNum), Criteria.where("serverId").is(serverId));
|
||||
// cr.andOperator(Criteria.where("goodsId").is(id));
|
||||
// query.addCriteria(cr);
|
||||
// return mongoTemplate.count(query, CdkInfo.class);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public long getUseCdkNumByGoodsId(int id) throws Exception {
|
||||
|
@ -73,8 +75,42 @@ public class CdkInfoDaoImpl implements CdkInfoDao {
|
|||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
Query query = new Query();
|
||||
Criteria cr = new Criteria();
|
||||
cr.andOperator(Criteria.where("goodsId").is(goodsId),Criteria.where("status").is(0));
|
||||
cr.andOperator(Criteria.where("goodsId").is(goodsId));
|
||||
// cr.andOperator(Criteria.where("goodsId").is(goodsId),Criteria.where("status").is(0));
|
||||
query.addCriteria(cr);
|
||||
return mongoTemplate.find(query,CdkInfo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCDKGoodsInfo(SCdkInfo sCdkInfo) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
mongoTemplate.insert(sCdkInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SCdkInfo> getScdkInfoList() throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
Query query = new Query();
|
||||
return mongoTemplate.find(query,SCdkInfo.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SCdkInfo getScdkInfo(int goodsId) throws Exception {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
Query query = new Query();
|
||||
Criteria cr = new Criteria();
|
||||
cr.andOperator(Criteria.where("_id").is(goodsId));
|
||||
query.addCriteria(cr);
|
||||
return mongoTemplate.findOne(query, SCdkInfo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCdkGoodsInfo(SCdkInfo scdkInfo,int goodsId) throws Exception {
|
||||
Update update = new Update();
|
||||
update.set("isAdd",1);
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
Query query = new Query(Criteria.where("_id").is(goodsId));
|
||||
mongoTemplate.updateMulti(query, update, SCdkInfo.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,19 +7,14 @@ import org.springframework.data.mongodb.core.mapping.Field;
|
|||
@Document(collection = "s_c_add_sdk_info")
|
||||
public class SCdkInfo {
|
||||
@Id
|
||||
private int id;
|
||||
|
||||
@Field(value = "goodsId")
|
||||
private int goodsId; //所属的商品id
|
||||
|
||||
@Field(value = "addtype")
|
||||
private int addtype; //添加ID : 0:自动生成1:策划配置
|
||||
|
||||
@Field(value = "cdk_num")
|
||||
private String cdk_num;
|
||||
|
||||
private int id; //所属的商品id
|
||||
/**
|
||||
* 0:同一批禮包序號,同角色不可重複兌換。每組序號限兌換一次。
|
||||
* 1:同一批禮包序號,同角色可重複兌換。每組序號限兌換一次。
|
||||
* 2: 萬用序號,只出一組序號,可重複使用,每一帳號(一個賬號可能有多個角色)僅限兌換一次。
|
||||
*/
|
||||
@Field(value = "usetype")
|
||||
private int usetype; // 0:单个CDK对应单个礼包 1:单个CDK对应多个礼包
|
||||
private int usetype;
|
||||
|
||||
@Field(value = "start_time")
|
||||
private long startTime;
|
||||
|
@ -39,48 +34,78 @@ public class SCdkInfo {
|
|||
@Field(value = "goods_sum")
|
||||
private int goodsSum;
|
||||
|
||||
@Field(value = "isAdd")
|
||||
private int isAdd; // 1: 已生成过 ,0: 未生成过
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getGoodsId() {
|
||||
return goodsId;
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getAddtype() {
|
||||
return addtype;
|
||||
}
|
||||
|
||||
public String getCdk_num() {
|
||||
return cdk_num;
|
||||
}
|
||||
|
||||
public int getUsetype() {
|
||||
return usetype;
|
||||
}
|
||||
|
||||
public String getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName;
|
||||
}
|
||||
|
||||
public String getGoodsInfo() {
|
||||
return goodsInfo;
|
||||
}
|
||||
|
||||
public int getGoodsSum() {
|
||||
return goodsSum;
|
||||
public void setUsetype(int usetype) {
|
||||
this.usetype = usetype;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(long startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public long getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(long endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public void setReward(String reward) {
|
||||
this.reward = reward;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName;
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public String getGoodsInfo() {
|
||||
return goodsInfo;
|
||||
}
|
||||
|
||||
public void setGoodsInfo(String goodsInfo) {
|
||||
this.goodsInfo = goodsInfo;
|
||||
}
|
||||
|
||||
public int getGoodsSum() {
|
||||
return goodsSum;
|
||||
}
|
||||
|
||||
public void setGoodsSum(int goodsSum) {
|
||||
this.goodsSum = goodsSum;
|
||||
}
|
||||
|
||||
public int getIsAdd() {
|
||||
return isAdd;
|
||||
}
|
||||
|
||||
public void setIsAdd(int isAdd) {
|
||||
this.isAdd = isAdd;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@ public class CDKInfoVo {
|
|||
|
||||
public long useNum ; // 被使用数量
|
||||
|
||||
public String type ; // 类型
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -44,4 +46,7 @@ public class CDKInfoVo {
|
|||
this.goodsInfo = goodsInfo;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,144 +0,0 @@
|
|||
package com.jmfy.utils;
|
||||
|
||||
import com.jmfy.model.SCdkInfo;
|
||||
import com.mongodb.DBObject;
|
||||
import com.mongodb.util.JSON;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
import org.springframework.data.mongodb.core.convert.MongoConverter;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author admin
|
||||
* @date 2016/5/6
|
||||
*/
|
||||
public class STableManager {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(STableManager.class);
|
||||
private MongoConverter mongoConverter;
|
||||
private MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext;
|
||||
|
||||
public static STableManager getInstance() {
|
||||
return Instance.instance;
|
||||
}
|
||||
|
||||
private static class Instance {
|
||||
final static STableManager instance = new STableManager();
|
||||
}
|
||||
private Map<String, String> tableToMethodMap = new HashMap<>();
|
||||
private Map<Integer, SCdkInfo> automaticCDKinfoMap;
|
||||
private List<SCdkInfo> configCDKInfoList;
|
||||
private String path;
|
||||
|
||||
public void init(ConfigurableApplicationContext applicationContext) {
|
||||
mongoConverter = applicationContext.getBean(MongoConverter.class);
|
||||
mappingContext = mongoConverter.getMappingContext();
|
||||
String osName = System.getProperty("os.name");
|
||||
if (osName.matches("^(?i)Windows.*$")) {// Window 系统
|
||||
path = "conf/jsonconf/";
|
||||
} else {// Linux 系统
|
||||
path = "./config/jsonconf/";
|
||||
}
|
||||
}
|
||||
public void initSTable() {
|
||||
try {
|
||||
initSCdkInfo();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("initSTable->msg={}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void initSCdkInfo() {
|
||||
LOGGER.info("----------initSCdkInfo---------------");
|
||||
tableToMethodMap.put("s_c_add_sdk_info","initSCdkInfo");
|
||||
List<SCdkInfo> sCdkInfoList = findAll(SCdkInfo.class);
|
||||
Map<Integer,SCdkInfo> automaticCDKinfoMap = new ConcurrentHashMap<>();
|
||||
List<SCdkInfo> cdkInfoList = new CopyOnWriteArrayList<>();
|
||||
for (SCdkInfo sCdkInfo :sCdkInfoList){
|
||||
if (sCdkInfo.getAddtype() ==0){
|
||||
automaticCDKinfoMap.put(sCdkInfo.getId(),sCdkInfo);
|
||||
}else{
|
||||
cdkInfoList.add(sCdkInfo);
|
||||
}
|
||||
}
|
||||
this.automaticCDKinfoMap = automaticCDKinfoMap;
|
||||
this.configCDKInfoList = cdkInfoList;
|
||||
}
|
||||
public SCdkInfo getScdkInfo(int id){
|
||||
return automaticCDKinfoMap .get(id);
|
||||
}
|
||||
public Map<Integer, SCdkInfo> getScdkInfoMap(){
|
||||
return automaticCDKinfoMap ;
|
||||
}
|
||||
//获取策划配置sdk
|
||||
public List<SCdkInfo> getConfigCDKInfoList(){
|
||||
return configCDKInfoList;
|
||||
}
|
||||
|
||||
private <T> List<T> findAll(Class<T> clazz) {
|
||||
List<T> result = new ArrayList<>();
|
||||
MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(clazz);
|
||||
String collection = entity.getCollection();
|
||||
String line;
|
||||
File file = new File(path + collection + ".json");
|
||||
if (!file.exists()) {
|
||||
LOGGER.error("the table->={} is not exist", collection);
|
||||
return result;
|
||||
}
|
||||
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(file));) {
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
DBObject parse = (DBObject) JSON.parse(line);
|
||||
T read = mongoConverter.read(clazz, parse);
|
||||
result.add(read);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public void initSTable(String tables) {
|
||||
String[] tableList = tables.split("\\|");
|
||||
Set<String> methods = new HashSet<>();
|
||||
for (int i = 0; i < tableList.length; i++) {
|
||||
if (tableList[i].isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (tableToMethodMap.get(tableList[i]) != null) {
|
||||
methods.add(tableToMethodMap.get(tableList[i]));
|
||||
LOGGER.info("tableList[i]->{}", tableList[i]);
|
||||
}
|
||||
}
|
||||
for (String methodName : methods) {
|
||||
try {
|
||||
LOGGER.info("methodName->{}", methodName);
|
||||
//TODO
|
||||
if (methodName.trim().equals("initSActivityFriendRecall")) {
|
||||
if (tableToMethodMap.get("s_c_activity").trim().equals("initSActivityFriendRecall")) {
|
||||
tableToMethodMap.put("s_c_activity", "initSActivity");
|
||||
tableToMethodMap.put("s_c_activity_friend_recall", "initSActivityFriendRecall");
|
||||
methodName = "initSActivity";
|
||||
LOGGER.info("fix methodName success");
|
||||
}
|
||||
}
|
||||
Method method = this.getClass().getMethod(methodName);
|
||||
method.invoke(getInstance());
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("initSTable->msg={}", e.getMessage(), e);
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,195 @@
|
|||
<!--_meta 作为公共模版分离出去-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="Bookmark" href="..//favicon.ico" />
|
||||
<link rel="Shortcut Icon" href="..//favicon.ico" />
|
||||
<!--[if lt IE 9]>
|
||||
<script type="text/javascript" src="../lib/html5shiv.js"></script>
|
||||
<script type="text/javascript" src="../lib/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" type="text/css" href="../h-ui/css/H-ui.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../h-ui.admin/css/H-ui.admin.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../h-ui.admin/skin/default/skin.css" id="skin" />
|
||||
<link rel="stylesheet" type="text/css" href="../h-ui.admin/css/style.css" />
|
||||
<!--[if IE 6]>
|
||||
<script type="text/javascript" src="../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
|
||||
<script>DD_belatedPNG.fix('*');</script>
|
||||
<![endif]-->
|
||||
|
||||
<title>基本设置</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="breadcrumb"><i class="Hui-iconfont"></i> 首页
|
||||
<span class="c-gray en">></span>
|
||||
序列號管理
|
||||
<span class="c-gray en">></span>
|
||||
序列号礼包生成
|
||||
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont"></i></a>
|
||||
</nav>
|
||||
<div class="page-container">
|
||||
<form class="form form-horizontal" id="form-article-add" action="/addCdkGoodsInfo" method="post" onsubmit="return toaddCDKInfo()">
|
||||
<div id="tab-system" class="HuiTab">
|
||||
<div class="tabBar cl">
|
||||
<span>序列号礼包生成</span>
|
||||
</div>
|
||||
<div class="tabCon">
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
礼包名称:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" name="goodsName" placeholder="" value="" class="input-text"/>
|
||||
<span class="GOODSNAME"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
生成类型:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select name="addType" class="input-text" id="contentType"><!--下拉列表-->
|
||||
<option value="0" selected = "selected">A(同一批禮包序號,同角色不可重複兌換。每組序號限兌換一次)</option>
|
||||
<option value="1" >B(同一批禮包序號,同角色可重複兌換。每組序號限兌換一次)</option>
|
||||
<option value="2" >C(萬用序號,只出一組序號,可重複使用,每一帳號(一個賬號可能有多個角色)僅限兌換一次)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
礼包数量:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" name="goodsNum" placeholder="" value="" class="input-text"/>
|
||||
<span class="GOODSNUM"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
开始时间:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'datemin\')}' })" id="datemin" class="input-text Wdate" style="width:180px;" name="startTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
结束时间:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'datemin\')}' })" id="datemax" class="input-text Wdate" style="width:180px;" name="endTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
礼包内容:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" name="goodsInfo" placeholder=""class="input-text"/>
|
||||
<span class="GOODSINFO"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
礼包奖励:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" name="reward" placeholder=""class="input-text"/>
|
||||
<span class="REWARD"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tabCon">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl" style="text-align: center" >
|
||||
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
|
||||
<button class="btn btn-primary radius" type="submit" ><i class="Hui-iconfont"></i> 生成礼包</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<iframe name='sendNotice' id="hidden_frame" style='display: none'></iframe>
|
||||
</div>
|
||||
|
||||
|
||||
<!--_footer 作为公共模版分离出去-->
|
||||
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
|
||||
<script type="text/javascript" src="../h-ui/js/H-ui.min.js"></script>
|
||||
<script type="text/javascript" src="../h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
|
||||
|
||||
<!--请在下方写此页面业务相关的脚本-->
|
||||
<script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/validate-methods.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/messages_zh.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('.skin-minimal input').iCheck({
|
||||
checkboxClass: 'icheckbox-blue',
|
||||
radioClass: 'iradio-blue',
|
||||
increaseArea: '20%'
|
||||
});
|
||||
$("#tab-system").Huitab({
|
||||
index:0
|
||||
});
|
||||
});
|
||||
$('#sendNotice').load(function () {
|
||||
// 根据后台返回值处理结果
|
||||
var j=$.parseJSON(text);
|
||||
if(j.status!=0) {
|
||||
alert(j.msg);
|
||||
} else {
|
||||
alert('导入成功');
|
||||
//location.href='BookResourceList.jsp'
|
||||
}
|
||||
})
|
||||
function toaddCDKInfo() {
|
||||
var erroCode = $('.GOODSNAME');
|
||||
var goodsName = $("input[name='goodsName']").val();
|
||||
var goodsNum = $("input[name='goodsNum']").val();
|
||||
var startTime = $("input[name='startTime']").val();
|
||||
var endTime = $("input[name='endTime']").val();
|
||||
var goodsInfo = $("input[name='goodsInfo']").val();
|
||||
var reward = $("input[name='reward']").val();
|
||||
alert(goodsName)
|
||||
if (goodsName === '' || goodsName == null) {
|
||||
erroCode.html('<span style="color: red; ">商品名称不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
if (goodsNum === '' || goodsNum == null) {
|
||||
erroCode.html('<span style="color: red; ">商品数量不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
if (startTime === '' || startTime == null) {
|
||||
erroCode = $('.GOODSNUM');
|
||||
erroCode.html('<span style="color: red; ">开始时间不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
if (endTime === '' || endTime == null) {
|
||||
erroCode = $('.ENDTIME');
|
||||
erroCode.html('<span style="color: red; ">结束时间不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
if (goodsInfo === '' || goodsInfo == null) {
|
||||
erroCode = $('.GOODSINFO');
|
||||
erroCode.html('<span style="color: red; ">商品信息不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
if (reward === '' || reward == null) {
|
||||
erroCode = $('.REWARD');
|
||||
erroCode.html('<span style="color: red; ">商品奖励不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
<!--/请在上方写此页面业务相关的脚本-->
|
||||
</body>
|
||||
</html>
|
|
@ -1,72 +1,86 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp"/>
|
||||
<script type="text/javascript" src="lib/html5shiv.js"></script>
|
||||
<script type="text/javascript" src="lib/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" type="text/css" href="h-ui/css/H-ui.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/H-ui.admin.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/skin/default/skin.css" id="skin"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/style.css"/>
|
||||
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
|
||||
<script>DD_belatedPNG.fix('*');</script>
|
||||
<title>序列號列表</title>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp"/>
|
||||
<script type="text/javascript" src="lib/html5shiv.js"></script>
|
||||
<script type="text/javascript" src="lib/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" type="text/css" href="h-ui/css/H-ui.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/H-ui.admin.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/skin/default/skin.css" id="skin"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/style.css"/>
|
||||
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
|
||||
<script>DD_belatedPNG.fix('*');</script>
|
||||
<title>服务器列表信息</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="breadcrumb"><i class="Hui-iconfont"></i> 首页 <span class="c-gray en">></span> 序列號管理 <span class="c-gray en">></span> 序列號生成 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont"></i></a></nav>
|
||||
<nav class="breadcrumb">
|
||||
<i class="Hui-iconfont"></i> 首页
|
||||
<span class="c-gray en">></span> 序列號管理 <span class="c-gray en">></span> 序列號生成 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/toCDKBuild');" title="刷新" ><i class="Hui-iconfont"></i></a></nav>
|
||||
<div class="page-container" style="text-align: center">
|
||||
<h2><span style="color:red;">序列號列表</span></h2>
|
||||
<div class="text-c">
|
||||
<div class="mt-20">
|
||||
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
|
||||
<thead>
|
||||
<tr class="text-c">
|
||||
<!--<th width="25"><input type="checkbox" name="" value=""/></th>-->
|
||||
<th width="200">id</th>
|
||||
<th width="200">礼包名称</th>
|
||||
<th width="200">礼包数量</th>
|
||||
<th width="200">开始时间</th>
|
||||
<th width="200">结束时间</th>
|
||||
<th width="200">礼包内容</th>
|
||||
<th width="200">被使用次数</th>
|
||||
<th width="200">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="obj:${sCdkInfoList}">
|
||||
<td th:text="${obj.id}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.goodsName}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.goodsNum}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.startTime}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.endTime}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.goodsInfo}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.useNum}" style="text-align: center;"></td>
|
||||
<td style="text-align: center;">
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-success" onclick="return cdkAdd(this)"><i class="Hui-iconfont"></i> 序列號生成</button>
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-success" onclick="return download(this)"><i class="Hui-iconfont"></i> 序列號导出</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!--_footer 作为公共模版分离出去-->
|
||||
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
|
||||
<script type="text/javascript" src="h-ui/js/H-ui.min.js"></script>
|
||||
<script type="text/javascript" src="h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
|
||||
<h2><span style="color:red;">序列號生成</span></h2>
|
||||
<div class="text-c">
|
||||
<div class="mt-20">
|
||||
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
|
||||
<thead>
|
||||
<tr class="text-c">
|
||||
<!--<th width="25"><input type="checkbox" name="" value=""/></th>-->
|
||||
<th width="200">礼包名称</th>
|
||||
<th width="200">礼包id</th>
|
||||
<th width="200">礼包数量</th>
|
||||
<th width="200">开始时间</th>
|
||||
<th width="200">结束时间</th>
|
||||
<th width="200">礼包内容</th>
|
||||
<th width="200">礼包类型</th>
|
||||
<th width="200">被使用数量</th>
|
||||
<th width="200">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="obj:${sCdkInfoList}">
|
||||
<!--<td><input type="checkbox" value="" name=""/></td>-->
|
||||
<td th:text="${obj.goodsName}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.id}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.goodsNum}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.startTime}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.endTime}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.goodsInfo}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.type}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.useNum}" style="text-align: center;"></td>
|
||||
<td style="text-align: center; width: 300px">
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-primary" onclick="return cdkAdd(this)"><i class="Hui-iconfont"></i> 序列號生成</button>
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-success" onclick="return download(this)"><i class="Hui-iconfont"></i> 序列號导出</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!--_footer 作为公共模版分离出去-->
|
||||
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
|
||||
<script type="text/javascript" src="h-ui/js/H-ui.min.js"></script>
|
||||
<script type="text/javascript" src="h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
|
||||
|
||||
<!--请在下方写此页面业务相关的脚本-->
|
||||
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
|
||||
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--请在下方写此页面业务相关的脚本-->
|
||||
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
|
||||
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
|
||||
<script type="text/javascript">
|
||||
$('.table-sort').dataTable({
|
||||
"aaSorting": [[ 1, "desc" ]],//默认第几个排序
|
||||
"bStateSave": true,//状态保存
|
||||
"pading":false,
|
||||
"aoColumnDefs": [
|
||||
//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
|
||||
{"orderable":false,"aTargets":[0,5]}// 不参与排序的列
|
||||
]
|
||||
});
|
||||
function cdkAdd(obj, goodsId) {
|
||||
goodsId = $(obj).attr("id");
|
||||
$.ajax({
|
||||
|
@ -104,7 +118,7 @@
|
|||
layer.msg('输入的力礼包id已过期!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data == 3) {
|
||||
layer.msg('此类礼包只能生成一次!', {icon: 6, time: 1000});
|
||||
layer.msg('礼包只能生成一次!', {icon: 6, time: 1000});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,10 +131,9 @@
|
|||
form.attr("target","");
|
||||
form.attr("method","post");//提交方式为post
|
||||
form.attr("action","/downloadFile?goodsId="+goodsId);//定义action
|
||||
|
||||
$("body").append(form);
|
||||
form.submit();
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -71,6 +71,7 @@
|
|||
<dt><i class="Hui-iconfont"></i>序列號管理<i class="Hui-iconfont menu_dropdown-arrow"></i></dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a data-href="/html/toAddCDKGoods.html" data-title="序列号礼包生成" href="javascript:void(0)">序列号礼包生成</a></li>
|
||||
<li><a data-href="toCDKBuild" data-title="序列號生成" href="javascript:void(0)">序列號生成</a></li>
|
||||
<li><a data-href="/html/findCDKInfo.html" data-title="序列號使用者查询" href="javascript:void(0)">序列號查询</a></li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue