Authored by wangshusheng

手动执行脚本

  1 +package com.yoho.unions.shoudong;
  2 +
  3 +import com.yoho.unions.shoudong.model.*;
  4 +
  5 +import java.io.*;
  6 +import java.math.BigDecimal;
  7 +import java.text.ParseException;
  8 +import java.text.SimpleDateFormat;
  9 +import java.util.*;
  10 +
  11 +/**
  12 + * Created by mingdan.ge on 2019/5/8.
  13 + */
  14 +public class ActivityCreateSqlUtils {
  15 +
  16 +
  17 + public static void main(String[] args) {
  18 + BufferedWriter writer = null;
  19 +
  20 + /**
  21 + * start配置参数
  22 + * */
  23 + String dateint="20191031";//TODO
  24 + String unionDir = "E:\\union\\";
  25 + String writerFile = unionDir + "activity"+dateint+".txt";
  26 + String activityName = "双十一潮品高佣活动";//TODO
  27 + int type = 2;//活动类型:1-特殊返,2-订单返利翻x倍,3-额外返,4-cps新人额外返//TODO
  28 + int collage=2;//拼团订单处理:0-不做处理,1-剔除拼团订单,2-拼团参与//TODO
  29 +
  30 + //活动类型:2-订单返利翻x倍 ----字段
  31 + BigDecimal amount=new BigDecimal(99999);//类型1、2-每单奖励xx元封顶--加倍返活动字段//TODO
  32 + int percent=15;//类型1-返利比例万分点,类型2-倍数十分点,常用在加倍返回活动,例如活动配置加倍返1.3倍佣金,此次 配3(十分点)//TODO
  33 + int priority=12;//优先级,越大越优先,只用于加倍返活动,同时间段多个加倍返可以参加,取此字段最大值的活动//TODO
  34 +
  35 + //活动类型:3-额外返---专用
  36 + Map<Integer, BigDecimal> itemM = new HashMap<>();//TODO
  37 +// itemM.put( 6,new BigDecimal(10));//满6单返10元
  38 +// itemM.put( 10,new BigDecimal(15));
  39 +// itemM.put( 15,new BigDecimal(30));
  40 +// itemM.put( 30,new BigDecimal(40));
  41 +// itemM.put( 1,new BigDecimal(5));
  42 +// itemM.put( 2,new BigDecimal(12));
  43 +// itemM.put( 3,new BigDecimal(21));
  44 +
  45 + int isNew=0;//是否首单专享:1-是,0-否//TODO
  46 +
  47 + int uidsType=2;//这组uid作用:0-不筛选uid 1-指定可参与活动的uid 2-剔除不可参与活动的uid//TODO
  48 + String uidFile = unionDir + "uid" + dateint + ".txt";//文件内一行一个uid
  49 +
  50 + int needSkn=1;//这组skn作用:0-不筛选skn,1-指定可参与活动的skn,2-剔除不可参与活动的skn,3-订单只包含指定skn//TODO
  51 + String sknFile = unionDir + "skn" + dateint + ".txt";//文件内一行一个skn
  52 +
  53 + int extraUidType=2;//满单返过滤维度:1-下单人满单,2-分享满单,一般配置的活动都是2//TODO
  54 + int newDays=0;//注册有赚几天内可参与,这个字段一般不用,默认0就好//TODO
  55 + BigDecimal orderAmount=new BigDecimal(99);//订单金额门槛,订单实付金额满多少可以参与活动//TODO
  56 +
  57 + String startTimeStr="2019-11-1 00:00:00";//活动开始时间//TODO
  58 + String endTimeStr="2019-11-6 23:59:59";//活动结束时间2019/6/10 23:59:59//TODO
  59 +// int startTime=1559959200;//活动开始时间戳,秒//TODO
  60 +// int endTime=1560182399;//活动结束时间戳,秒//TODO
  61 + int startTime= stringToDateInt(startTimeStr);
  62 + int endTime= stringToDateInt(endTimeStr);
  63 +
  64 + //是否需要配置活动页面
  65 + boolean needPage = true;//TODO
  66 + //活动参与页面显示的banner图片
  67 + String image = "http://img11.static.yhbimg.com/unionimg/2019/10/31/14/01dd3c21eff74f38e5c89ece2d26ff4eae.jpg";//TODO
  68 + //活动参与页面显示的内容
  69 + String contentFile = unionDir + "content" + dateint + ".txt";//需要把文件编码改成utf-8 无bom格式
  70 +// String content = "奖励时间:5月9日-5月31日(共计22天)<br>奖励对象:首次带单有赚用户<br>奖励规则:活动期间,有赚新达人成功带新客订单,即可领取原本佣金之外的5元现金奖励!<br><br>注意事项:<br>特别说明:<br>1.以结算订单为准,出现取消或退货,不参与返现。<br>2.分享下单实付金额不低于50元,仅享受一次。<br>3. 拼团订单不计入活动<br>4.如出现批量注册,买号在同一个设备下单等违规行为,不进行奖励且取消其奖励资格。<br>奖励在活动结束后统一发放<br><br><br><br><br>";
  71 + //报名成功跳转页面
  72 + String url = "https://activity.yoho.cn/feature/6943.html?share_id=9649&title=高佣潮品汇集";//TODO
  73 + /**
  74 + * 配置参数end
  75 + * */
  76 +
  77 + try {
  78 +
  79 + //创建活动
  80 + ActivityBo activityBo = new ActivityBo();
  81 + activityBo.setActivityName(activityName);
  82 + activityBo.setAmount(amount);//类型1、2-每单奖励xx元封顶
  83 + activityBo.setCollage(collage);//拼团订单处理:0-不做处理,1-剔除拼团订单,2-拼团参与
  84 + activityBo.setType(type);//活动类型:1-特殊返,2-订单返利翻x倍,3-额外返,4-cps新人额外返
  85 + activityBo.setStartTime(startTime);
  86 + activityBo.setEndTime(endTime);
  87 + activityBo.setIsNew((byte) isNew);//是否首单专享:1-是,0-否
  88 + activityBo.setUidsType(uidsType);//这组uid作用:0-不筛选uid 1-指定可参与活动的uid 2-剔除可参与活动的uid
  89 + activityBo.setNeedSkn(needSkn);//这组skn作用:0-不筛选skn,1-指定可参与活动的skn,2-剔除可参与活动的skn
  90 + activityBo.setExtraUidType(extraUidType);//满单返过滤维度:1-下单人满单,2-分享满单
  91 + activityBo.setNewDays(newDays);//注册有赚几天内可参与
  92 + activityBo.setOrderAmount(orderAmount);//订单金额门槛
  93 + activityBo.setPercent(percent);//类型1-返利比例万分点,类型2-倍数十分点
  94 + activityBo.setPriority(priority);//优先级,越大越优先
  95 + activityBo.setCreateTime((int)(System.currentTimeMillis()/1000));
  96 + writer = new BufferedWriter(new FileWriter(writerFile));
  97 + writer.write(createActivity(activityBo));//创建活动
  98 + writer.newLine();//换行
  99 + writer.newLine();//换行
  100 + writer.write("#下面insert语句中的activityId 使用上面insert生成的id:");//创建活动
  101 + writer.newLine();//换行
  102 +
  103 + //活动类型3-额外返,需要配置阶梯返额
  104 + if (activityBo.getType() == 3) {
  105 + activityBo.setAmount(new BigDecimal(0));
  106 +
  107 + ActivityItem item=getStartItem(itemM);
  108 + if (item != null) {
  109 + do {
  110 + writer.write(createActivityItem(item));//创建活动阶梯
  111 + writer.newLine();//换行
  112 + item = item.getNext();
  113 + } while (item != null);
  114 + }
  115 + writer.newLine();//换行
  116 + }
  117 +
  118 + //page
  119 + if (needPage) {
  120 + ActivityPageBo activityPageBo = new ActivityPageBo();
  121 + String content = readFileForContent(contentFile);
  122 + activityPageBo.setContent(content);
  123 + activityPageBo.setTitle(activityBo.getActivityName());
  124 + activityPageBo.setImage(image);
  125 + activityPageBo.setCreateTime(activityBo.getCreateTime());
  126 + activityPageBo.setUrl(url);
  127 + writer.write(createActivityPage(activityPageBo));//创建活动
  128 + writer.newLine();//换行
  129 + writer.newLine();//换行
  130 + }
  131 +
  132 + //skn
  133 + if (activityBo.getNeedSkn() > 0) {
  134 + Set<Integer> skns= readFileForNumSet (sknFile);
  135 + writer.write("INSERT INTO yh_unions.union_share_activity_skn (`activity_id`, `skn`, `type`, `create_time`) VALUES");
  136 + writer.newLine();//换行
  137 + //IINSERT INTO `yh_unions`.`union_share_activity_skn`
  138 + // (`activity_id`, `skn`, `type`, `create_time`) VALUES ('148', '51827678', '2', '1549004949');
  139 +
  140 + int j = 0;
  141 + for (Integer skn : skns) {
  142 + writer.write(createActivitySkn(skn,activityBo.getNeedSkn(),activityBo.getCreateTime()));//创建活动
  143 + j++;
  144 + if (j < skns.size()) {
  145 + writer.write(",");
  146 + } else {
  147 + writer.write(";");
  148 + }
  149 +
  150 + }
  151 + writer.newLine();//换行
  152 + writer.newLine();//换行
  153 + }
  154 +
  155 + //uid
  156 + if (activityBo.getUidsType() > 0) {
  157 + Set<Integer> uids= readFileForNumSet(uidFile);
  158 + writer.write("INSERT INTO yh_unions.union_share_activity_uid (`activity_id`, `uid`, `type`, `create_time`) VALUES");
  159 + writer.newLine();//换行
  160 + //INSERT INTO `yh_unions`.`union_share_activity_uid`
  161 + // (`activity_id`, `uid`, `type`, `create_time`) VALUES ('154', '9513433', '1', '1554967566');
  162 + int i=0;
  163 + for (Integer uid : uids) {
  164 + writer.write(createActivityUid(uid,activityBo.getUidsType(),activityBo.getCreateTime()));
  165 + i++;
  166 + if (i < uids.size()) {
  167 + writer.write(",");
  168 + } else {
  169 + writer.write(";");
  170 + }
  171 + }
  172 + writer.newLine();//换行
  173 + writer.newLine();//换行
  174 + }
  175 + writer.flush();
  176 + } catch (IOException e) {
  177 + e.printStackTrace();
  178 + }
  179 + }
  180 +
  181 +
  182 + public static int stringToDateInt(String dateStr) {
  183 + return stringToDateInt(dateStr,"yyyy-MM-dd HH:mm:ss");
  184 + }
  185 + public static int stringToDateInt(String dateStr, String simpleDateFormat) {
  186 + return (int)(stringToDate(dateStr, simpleDateFormat).getTime() / 1000);
  187 + }
  188 +
  189 + public static Date stringToDate(String dateStr, String simpleDateFormat) {
  190 + SimpleDateFormat format = new SimpleDateFormat(simpleDateFormat);
  191 + Date d = null;
  192 + if (dateStr==null||dateStr.trim().length()==0) {
  193 + return null;
  194 + } else {
  195 + try {
  196 + d = format.parse(dateStr);
  197 + } catch (ParseException e) {
  198 + }
  199 + return d;
  200 + }
  201 + }
  202 +
  203 + public static ActivityItem getStartItem(Map<Integer, BigDecimal> itemM) {
  204 + if (itemM.isEmpty()) {
  205 + return null;
  206 + }
  207 + ActivityItem startItem = null;
  208 + //排序
  209 + for (Integer key : itemM.keySet()) {
  210 + if (startItem == null) {
  211 + startItem = new ActivityItem(itemM.get(key), key,1);
  212 + startItem.setOrderMaxNum(100000);
  213 + } else {
  214 + ActivityItem nowItem = startItem;
  215 + while (nowItem.hasNext()&&nowItem.getOrderMinNum() < key){
  216 + nowItem = nowItem.getNext();
  217 + }
  218 +
  219 + ActivityItem newItem = new ActivityItem(itemM.get(key), key);
  220 + if (nowItem.getOrderMinNum() > key) {
  221 + newItem.setOrderMaxNum(nowItem.getOrderMinNum() - 1);
  222 + newItem.setNext(nowItem);
  223 + newItem.setPre(nowItem.getPre());
  224 + newItem.setPriority(nowItem.getPriority());
  225 + if (newItem.getPre() != null) {
  226 + newItem.getPre().setNext(newItem);
  227 + newItem.getPre().setOrderMaxNum(newItem.getOrderMinNum() - 1);
  228 + }
  229 + nowItem.setPre(newItem);
  230 +
  231 + while (nowItem != null) {
  232 + nowItem.setPriority(nowItem.getPriority() + 1);
  233 + nowItem = nowItem.getNext();
  234 + }
  235 + } else {
  236 + newItem.setPre(nowItem);
  237 + newItem.setOrderMaxNum(100000);
  238 + newItem.setPriority(nowItem.getPriority()+1);
  239 + nowItem.setNext(newItem);
  240 + nowItem.setOrderMaxNum(key-1);
  241 + }
  242 + if (newItem.getPre() == null) {
  243 + startItem = newItem;
  244 + }
  245 + }
  246 + }
  247 +
  248 + return startItem;
  249 + }
  250 +
  251 +
  252 +
  253 +
  254 + /**
  255 + * 以行为单位读取文件
  256 + */
  257 + public static Set<Integer> readFileForNumSet(String readFile) {
  258 + BufferedReader reader = null;
  259 + Set<Integer> numSet = new HashSet<>();
  260 + int line=0;
  261 + try {
  262 + reader = new BufferedReader(new FileReader(readFile));
  263 +
  264 + String tempString = null;
  265 + // 一次读入一行,直到读入null为文件结束
  266 + while ((tempString = reader.readLine()) != null) {
  267 + if (tempString.trim().length()==0) {
  268 + System.out.println("此行为空:"+line+1);
  269 + continue;
  270 + }
  271 + line++;
  272 + numSet.add(Integer.valueOf(tempString.trim()));//如果报错可能是文件里面含有非法字符,把文件编码改成“UTF-8无BOM格式”编码即可
  273 + }
  274 + reader.close();
  275 + } catch (IOException e) {
  276 + // 显示行号
  277 + e.printStackTrace();
  278 + } finally {
  279 + if (reader != null) {
  280 + try {
  281 + reader.close();
  282 + } catch (IOException e1) {
  283 + }
  284 + }
  285 + }
  286 + System.out.println("line " + line );
  287 + return numSet;
  288 + }/**
  289 + * 以行为单位读取文件,常用于读面向行的格式化文件
  290 + */
  291 + public static String readFileForContent(String readFile) {
  292 + BufferedReader reader = null;
  293 + StringBuilder content = new StringBuilder();
  294 + try {
  295 + FileInputStream in = new FileInputStream(readFile);
  296 + reader = new BufferedReader(new InputStreamReader(in,"UTF-8"));
  297 +// reader = new BufferedReader(new FileReader(readFile));
  298 +
  299 + String tempString = null;
  300 + // 一次读入一行,直到读入null为文件结束
  301 + while ((tempString = reader.readLine()) != null) {
  302 + if (tempString.trim().length() == 0) {
  303 + content.append("<br>");
  304 + } else {
  305 + content.append(tempString.trim()).append("<br>");
  306 + }
  307 + }
  308 + content.append("<br><br><br><br>");
  309 + reader.close();
  310 + } catch (IOException e) {
  311 + // 显示行号
  312 + e.printStackTrace();
  313 + } finally {
  314 + if (reader != null) {
  315 + try {
  316 + reader.close();
  317 + } catch (IOException e1) {
  318 + }
  319 + }
  320 + }
  321 + return content.toString();
  322 + }
  323 +
  324 + public static String createActivity(ActivityBo bo) {
  325 + StringBuilder sql = new StringBuilder();
  326 + sql.append("INSERT INTO yh_unions.union_share_orders_activity ");
  327 + //INSERT INTO yh_unions.union_share_orders_activity
  328 + // (`activity_name`, `type`, `extra_uid_type`, `need_skn`, `collage`, `is_new`, `uids_type`, `uids`, `amount`, `order_amount`, `percent`, `start_time`, `end_time`, `create_time`)
  329 + // VALUES ('潮流T恤节', '2', '2', '1', '1', '1', '2', NULL, '10000.00', '99.00', '3', '1557021600', '1557676799', '1556526247');
  330 +
  331 + sql.append("(`activity_name`, `type`, `extra_uid_type`, `need_skn`, `collage`, `is_new`, `uids_type`, `amount`, `order_amount`, `percent`, `start_time`, `end_time`, `create_time`, `priority`)");
  332 + sql.append(" VALUES (");
  333 + sql.append("'"+bo.getActivityName()+"'").append(",").append(bo.getType()).append(",").append(bo.getExtraUidType()).append(",")
  334 + .append(bo.getNeedSkn()).append(",").append(bo.getCollage()).append(",").append(bo.getIsNew()).append(",")
  335 + .append(bo.getUidsType()).append(",").append(bo.getAmount()).append(",").append(bo.getOrderAmount()).append(",")
  336 + .append(bo.getPercent()).append(",").append(bo.getStartTime()).append(",").append(bo.getEndTime()).append(",")
  337 + .append(bo.getCreateTime()).append(",").append(bo.getPriority()).append(");");
  338 + return sql.toString();
  339 + }
  340 + public static String createActivityItem(ActivityItem bo) {
  341 + StringBuilder sql = new StringBuilder();
  342 + sql.append("INSERT INTO yh_unions.union_share_orders_activity_item ");
  343 + //INSERT INTO `yh_unions`.`union_share_orders_activity_item`
  344 + // (`activity_id`, `amount`, `order_min_num`, `order_max_num`, `priority`)
  345 + // VALUES ('150', '200.00', '100', '1000000', '5');
  346 + sql.append("(`activity_id`, `amount`, `order_min_num`, `order_max_num`, `priority`)");
  347 + sql.append(" VALUES ");
  348 + sql.append("(activityId").append(",").append(bo.getAmount()).append(",")
  349 + .append(bo.getOrderMinNum()).append(",").append(bo.getOrderMaxNum())
  350 + .append(",").append(bo.getPriority()).append(");");
  351 + return sql.toString();
  352 + }
  353 + public static String createActivityPage(ActivityPageBo bo) {
  354 + StringBuilder sql = new StringBuilder();
  355 + sql.append("INSERT INTO yh_unions.union_share_orders_activity_page ");
  356 + //INSERT INTO `yh_unions`.`union_share_orders_activity_page`
  357 + // (`activity_id`, `title`, `content`, `image`, `create_time`)
  358 + // VALUES ('163', '匡威品牌日', '1.奖励活设备【有货有赚】公众号', 'http://img11.stat7.jpg', '1556173698');
  359 + sql.append("(`activity_id`, `title`, `content`, `image`,`url`, `create_time`)");
  360 + sql.append(" VALUES ");
  361 + sql.append("(activityId").append(",'").append(bo.getTitle()).append("','")
  362 + .append(bo.getContent()).append("','").append(bo.getImage()).append("','")
  363 + .append(bo.getUrl()).append("',").append(bo.getCreateTime()).append(");");
  364 +
  365 + return sql.toString();
  366 + }
  367 + public static String createActivitySkn(Integer skn,int type,int createTime) {
  368 + StringBuilder sql = new StringBuilder();
  369 +// sql.append("INSERT INTO yh_unions.union_share_activity_skn ");
  370 + //IINSERT INTO `yh_unions`.`union_share_activity_skn`
  371 + // (`activity_id`, `skn`, `type`, `create_time`) VALUES ('148', '51827678', '2', '1549004949');
  372 +
  373 +// sql.append("(`activity_id`, `skn`, `type`, `create_time`)");
  374 +// sql.append(" VALUES ");
  375 + sql.append("(activityId").append(",").append(skn).append(",").append(type).append(",").append(createTime).append(")");
  376 + return sql.toString();
  377 + }
  378 + public static String createActivityUid(Integer uid,int type,int createTime) {
  379 +// ActivityUid bo=
  380 + StringBuilder sql = new StringBuilder();
  381 +// sql.append("INSERT INTO yh_unions.union_share_activity_uid ");
  382 + //INSERT INTO `yh_unions`.`union_share_activity_uid`
  383 + // (`activity_id`, `uid`, `type`, `create_time`) VALUES ('154', '9513433', '1', '1554967566');
  384 +// sql.append("(`activity_id`, `uid`, `type`, `create_time`)");
  385 +// sql.append(" VALUES ");
  386 + sql.append("(activityId").append(",").append(uid).append(",").append(type).append(",").append(createTime).append(")");
  387 + return sql.toString();
  388 + }
  389 +}
  1 +package com.yoho.unions.shoudong;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import org.apache.http.HttpEntity;
  5 +import org.apache.http.HttpResponse;
  6 +import org.apache.http.client.methods.HttpPost;
  7 +import org.apache.http.entity.StringEntity;
  8 +import org.apache.http.impl.client.CloseableHttpClient;
  9 +import org.apache.http.impl.client.HttpClientBuilder;
  10 +import org.apache.http.message.BasicHeader;
  11 +import org.apache.http.protocol.HTTP;
  12 +import org.apache.http.util.EntityUtils;
  13 +
  14 +import java.io.BufferedReader;
  15 +import java.io.FileReader;
  16 +import java.io.IOException;
  17 +
  18 +/**
  19 + * 批量创建cps有赚用户
  20 + * Created by mingdan.ge on 2019/10/21.
  21 + */
  22 +public class CpsNewCreate {
  23 + private static final String CONTENT_TYPE_TEXT_JSON = "text/json";
  24 + private static final String APPLICATION_JSON = "application/json;charset=utf-8";
  25 +
  26 + public static void main(String[] ags) {
  27 + String readFile="E:\\union\\20191021newcps.txt";
  28 + String url="http://union.yoho.cn/union/UnionShareRest/userApply";
  29 +// String url="http://java-yoho-union.test3.ingress.dev.yohocorp.com/union/UnionShareRest/userApply";
  30 +// String url="http://localhost/union/UnionShareRest/userApply";
  31 + int max=600000;
  32 + long start = System.currentTimeMillis();
  33 + CpsNewCreate.readFileByLinesToHttp(readFile,url,max);
  34 + long end = System.currentTimeMillis();
  35 + System.out.println("total time is "+(end-start)/1000);
  36 + }
  37 +
  38 + /**
  39 + * 以行为单位读取文件,常用于读面向行的格式化文件
  40 + */
  41 + public static int readFileByLinesToHttp(String readFile,String url,int max) {
  42 + BufferedReader reader = null;
  43 + int line = 1;
  44 + try {
  45 +// System.out.println("以行为单位读取文件内容,一次读一整行:");
  46 + reader = new BufferedReader(new FileReader(readFile));
  47 + String tempString = null;
  48 + // 一次读入一行,直到读入null为文件结束
  49 + while ((tempString = reader.readLine()) != null&&line<max) {
  50 +
  51 + if (tempString.trim().length() > 0) {
  52 + JSONObject u = new JSONObject();
  53 + String[] strings = tempString.trim().split(",");
  54 + u.put("uid", strings[0]);
  55 +// u.put("name", "有赚达人");
  56 +// u.put("mobile", strings[0]);
  57 + String result = httpPostWithJSON(url, u);
  58 + JSONObject r = JSONObject.parseObject(result);
  59 + if (r.getInteger("code") !=800010011) {
  60 + try {
  61 + System.out.println("sleep..");
  62 + Thread.sleep(100);
  63 + } catch (InterruptedException e) {
  64 + e.printStackTrace();
  65 + }
  66 + }
  67 + System.out.println("line " + line+",result=" +result );
  68 + }
  69 + line++;
  70 +
  71 + }
  72 + reader.close();
  73 + } catch (IOException e) {
  74 + // 显示行号
  75 + System.out.println("line " + line + ": " +e.getMessage() );
  76 + e.printStackTrace();
  77 + } finally {
  78 + if (reader != null) {
  79 + try {
  80 + reader.close();
  81 + } catch (IOException e1) {
  82 + }
  83 + }
  84 + }
  85 +
  86 + return line;
  87 + }
  88 + public static String httpPostWithJSON(String url, JSONObject params) {
  89 + // 创建HttpClientBuilder
  90 + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
  91 + // HttpClient
  92 + CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
  93 + HttpPost httpPost = new HttpPost(url);
  94 + try {
  95 + if (params != null) {
  96 + httpPost.addHeader(HTTP.CONTENT_TYPE, "application/json");
  97 + StringEntity se = new StringEntity(params.toJSONString(),"UTF-8");
  98 + se.setContentType(CONTENT_TYPE_TEXT_JSON);
  99 + se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON));
  100 + httpPost.setEntity(se);
  101 + }
  102 + HttpResponse httpResponse = closeableHttpClient.execute(httpPost);
  103 + if (httpResponse.getStatusLine().getStatusCode() == 200) {
  104 + // 获取响应消息实体
  105 + HttpEntity entity = httpResponse.getEntity();
  106 + // 判断响应实体是否为空
  107 + if (entity != null) {
  108 + return EntityUtils.toString(entity, "UTF-8");
  109 + }
  110 + }
  111 + } catch (IOException e) {
  112 + e.printStackTrace();
  113 + } finally {
  114 + try {
  115 + // 关闭流并释放资源
  116 + closeableHttpClient.close();
  117 + } catch (IOException e) {
  118 + e.printStackTrace();
  119 + }
  120 + }
  121 + return null;
  122 + }
  123 +}
  1 +package com.yoho.unions.shoudong.model;
  2 +
  3 +import java.math.BigDecimal;
  4 +
  5 +/**
  6 + * Created by mingdan.ge on 2019/5/8.
  7 + */
  8 +public class ActivityBo {
  9 + private String activityName;
  10 +
  11 + private Integer type;
  12 + private Integer extraUidType;
  13 +
  14 + private Integer needSkn;
  15 + private Integer collage;
  16 +
  17 + private Byte isNew;
  18 +
  19 + private Integer newDays;
  20 + private Integer uidsType;
  21 +
  22 + private BigDecimal amount;
  23 + private BigDecimal orderAmount;
  24 +
  25 + private Integer percent;
  26 +
  27 + private Integer progress;
  28 +
  29 + private Integer startTime;
  30 +
  31 + private Integer endTime;
  32 +
  33 + private Integer createTime;
  34 +
  35 + private Integer status;
  36 +
  37 + private Integer priority;
  38 +
  39 + public String getActivityName() {
  40 + return activityName;
  41 + }
  42 +
  43 + public void setActivityName(String activityName) {
  44 + this.activityName = activityName;
  45 + }
  46 +
  47 + public Integer getType() {
  48 + return type;
  49 + }
  50 +
  51 + public void setType(Integer type) {
  52 + this.type = type;
  53 + }
  54 +
  55 + public Integer getExtraUidType() {
  56 + return extraUidType;
  57 + }
  58 +
  59 + public void setExtraUidType(Integer extraUidType) {
  60 + this.extraUidType = extraUidType;
  61 + }
  62 +
  63 + public Integer getNeedSkn() {
  64 + return needSkn;
  65 + }
  66 +
  67 + public void setNeedSkn(Integer needSkn) {
  68 + this.needSkn = needSkn;
  69 + }
  70 +
  71 + public Integer getCollage() {
  72 + return collage;
  73 + }
  74 +
  75 + public void setCollage(Integer collage) {
  76 + this.collage = collage;
  77 + }
  78 +
  79 + public Byte getIsNew() {
  80 + return isNew;
  81 + }
  82 +
  83 + public void setIsNew(Byte isNew) {
  84 + this.isNew = isNew;
  85 + }
  86 +
  87 + public Integer getNewDays() {
  88 + return newDays;
  89 + }
  90 +
  91 + public void setNewDays(Integer newDays) {
  92 + this.newDays = newDays;
  93 + }
  94 +
  95 + public Integer getUidsType() {
  96 + return uidsType;
  97 + }
  98 +
  99 + public void setUidsType(Integer uidsType) {
  100 + this.uidsType = uidsType;
  101 + }
  102 +
  103 + public BigDecimal getAmount() {
  104 + return amount;
  105 + }
  106 +
  107 + public void setAmount(BigDecimal amount) {
  108 + this.amount = amount;
  109 + }
  110 +
  111 + public BigDecimal getOrderAmount() {
  112 + return orderAmount;
  113 + }
  114 +
  115 + public void setOrderAmount(BigDecimal orderAmount) {
  116 + this.orderAmount = orderAmount;
  117 + }
  118 +
  119 + public Integer getPercent() {
  120 + return percent;
  121 + }
  122 +
  123 + public void setPercent(Integer percent) {
  124 + this.percent = percent;
  125 + }
  126 +
  127 + public Integer getProgress() {
  128 + return progress;
  129 + }
  130 +
  131 + public void setProgress(Integer progress) {
  132 + this.progress = progress;
  133 + }
  134 +
  135 + public Integer getStartTime() {
  136 + return startTime;
  137 + }
  138 +
  139 + public void setStartTime(Integer startTime) {
  140 + this.startTime = startTime;
  141 + }
  142 +
  143 + public Integer getEndTime() {
  144 + return endTime;
  145 + }
  146 +
  147 + public void setEndTime(Integer endTime) {
  148 + this.endTime = endTime;
  149 + }
  150 +
  151 + public Integer getCreateTime() {
  152 + return createTime;
  153 + }
  154 +
  155 + public void setCreateTime(Integer createTime) {
  156 + this.createTime = createTime;
  157 + }
  158 +
  159 + public Integer getStatus() {
  160 + return status;
  161 + }
  162 +
  163 + public void setStatus(Integer status) {
  164 + this.status = status;
  165 + }
  166 +
  167 + public Integer getPriority() {
  168 + return priority;
  169 + }
  170 +
  171 + public void setPriority(Integer priority) {
  172 + this.priority = priority;
  173 + }
  174 +}
  1 +package com.yoho.unions.shoudong.model;
  2 +
  3 +import java.math.BigDecimal;
  4 +
  5 +/**
  6 + * Created by mingdan.ge on 2019/5/8.
  7 + */
  8 +public class ActivityItem {
  9 + private Integer id;
  10 +
  11 + private Integer activityId;
  12 +
  13 + private BigDecimal amount;
  14 +
  15 + private Integer orderMinNum;
  16 +
  17 + private Integer orderMaxNum;
  18 +
  19 + private Integer priority;
  20 +
  21 + private Integer status;
  22 +
  23 + private Integer num;
  24 +
  25 + private ActivityItem next;
  26 + private ActivityItem pre;
  27 +
  28 + public ActivityItem() {
  29 + }
  30 + public ActivityItem(BigDecimal amount,Integer orderMinNum) {
  31 + this.amount = amount;
  32 + this.orderMinNum = orderMinNum;
  33 + }
  34 + public ActivityItem(BigDecimal amount,Integer orderMinNum,int priority) {
  35 + this.amount = amount;
  36 + this.orderMinNum = orderMinNum;
  37 + this.priority = priority;
  38 + }
  39 + public ActivityItem(BigDecimal amount) {
  40 + this.amount = amount;
  41 + }
  42 +
  43 + public boolean hasNext() {
  44 + if (next != null) {
  45 + return true;
  46 + }
  47 + return false;
  48 + }
  49 + public ActivityItem getNext() {
  50 + return next;
  51 + }
  52 +
  53 + public void setNext(ActivityItem next) {
  54 + this.next = next;
  55 + }
  56 +
  57 + public ActivityItem getPre() {
  58 + return pre;
  59 + }
  60 +
  61 + public void setPre(ActivityItem pre) {
  62 + this.pre = pre;
  63 + }
  64 +
  65 + public Integer getId() {
  66 + return id;
  67 + }
  68 +
  69 + public void setId(Integer id) {
  70 + this.id = id;
  71 + }
  72 +
  73 + public Integer getActivityId() {
  74 + return activityId;
  75 + }
  76 +
  77 + public void setActivityId(Integer activityId) {
  78 + this.activityId = activityId;
  79 + }
  80 +
  81 + public BigDecimal getAmount() {
  82 + return amount;
  83 + }
  84 +
  85 + public void setAmount(BigDecimal amount) {
  86 + this.amount = amount;
  87 + }
  88 +
  89 + public Integer getOrderMinNum() {
  90 + return orderMinNum;
  91 + }
  92 +
  93 + public void setOrderMinNum(Integer orderMinNum) {
  94 + this.orderMinNum = orderMinNum;
  95 + }
  96 +
  97 + public Integer getOrderMaxNum() {
  98 + return orderMaxNum;
  99 + }
  100 +
  101 + public void setOrderMaxNum(Integer orderMaxNum) {
  102 + this.orderMaxNum = orderMaxNum;
  103 + }
  104 +
  105 + public Integer getPriority() {
  106 + return priority;
  107 + }
  108 +
  109 + public void setPriority(Integer priority) {
  110 + this.priority = priority;
  111 + }
  112 +
  113 + public Integer getStatus() {
  114 + return status;
  115 + }
  116 +
  117 + public void setStatus(Integer status) {
  118 + this.status = status;
  119 + }
  120 +
  121 + public Integer getNum() {
  122 + return num;
  123 + }
  124 +
  125 + public void setNum(Integer num) {
  126 + this.num = num;
  127 + }
  128 +}
  1 +package com.yoho.unions.shoudong.model;
  2 +
  3 +/**
  4 + * Created by mingdan.ge on 2019/5/8.
  5 + */
  6 +public class ActivityPageBo {
  7 + private Integer id;
  8 + private Integer activityId;
  9 + private String title;
  10 + private String content;
  11 + private String image;
  12 + private String url;
  13 + private Integer status;
  14 + private int startTime;
  15 + private int endTime;
  16 + private int createTime;
  17 +
  18 + public int getCreateTime() {
  19 + return createTime;
  20 + }
  21 +
  22 + public void setCreateTime(int createTime) {
  23 + this.createTime = createTime;
  24 + }
  25 +
  26 + public Integer getId() {
  27 + return id;
  28 + }
  29 +
  30 + public void setId(Integer id) {
  31 + this.id = id;
  32 + }
  33 +
  34 + public Integer getActivityId() {
  35 + return activityId;
  36 + }
  37 +
  38 + public void setActivityId(Integer activityId) {
  39 + this.activityId = activityId;
  40 + }
  41 +
  42 + public String getTitle() {
  43 + return title;
  44 + }
  45 +
  46 + public void setTitle(String title) {
  47 + this.title = title;
  48 + }
  49 +
  50 + public String getContent() {
  51 + return content;
  52 + }
  53 +
  54 + public void setContent(String content) {
  55 + this.content = content;
  56 + }
  57 +
  58 + public String getImage() {
  59 + return image;
  60 + }
  61 +
  62 + public void setImage(String image) {
  63 + this.image = image;
  64 + }
  65 +
  66 + public String getUrl() {
  67 + return url;
  68 + }
  69 +
  70 + public void setUrl(String url) {
  71 + this.url = url;
  72 + }
  73 +
  74 + public Integer getStatus() {
  75 + return status;
  76 + }
  77 +
  78 + public void setStatus(Integer status) {
  79 + this.status = status;
  80 + }
  81 +
  82 + public int getStartTime() {
  83 + return startTime;
  84 + }
  85 +
  86 + public void setStartTime(int startTime) {
  87 + this.startTime = startTime;
  88 + }
  89 +
  90 + public int getEndTime() {
  91 + return endTime;
  92 + }
  93 +
  94 + public void setEndTime(int endTime) {
  95 + this.endTime = endTime;
  96 + }
  97 +}
  1 +package com.yoho.unions.shoudong.model;
  2 +
  3 +/**
  4 + * Created by mingdan.ge on 2019/5/8.
  5 + */
  6 +public class ActivitySkn {
  7 + private Long id;
  8 +
  9 + private Integer activityId;
  10 +
  11 + private Integer skn;
  12 +
  13 + private Integer type;
  14 +
  15 + private Integer createTime;
  16 +
  17 + public Long getId() {
  18 + return id;
  19 + }
  20 +
  21 + public void setId(Long id) {
  22 + this.id = id;
  23 + }
  24 +
  25 + public Integer getActivityId() {
  26 + return activityId;
  27 + }
  28 +
  29 + public void setActivityId(Integer activityId) {
  30 + this.activityId = activityId;
  31 + }
  32 +
  33 + public Integer getSkn() {
  34 + return skn;
  35 + }
  36 +
  37 + public void setSkn(Integer skn) {
  38 + this.skn = skn;
  39 + }
  40 +
  41 + public Integer getType() {
  42 + return type;
  43 + }
  44 +
  45 + public void setType(Integer type) {
  46 + this.type = type;
  47 + }
  48 +
  49 + public Integer getCreateTime() {
  50 + return createTime;
  51 + }
  52 +
  53 + public void setCreateTime(Integer createTime) {
  54 + this.createTime = createTime;
  55 + }
  56 +}
  1 +package com.yoho.unions.shoudong.model;
  2 +
  3 +/**
  4 + * Created by mingdan.ge on 2019/5/8.
  5 + */
  6 +public class ActivityUid {
  7 + private Long id;
  8 +
  9 + private Integer activityId;
  10 +
  11 + private Integer uid;
  12 +
  13 + private Integer type;
  14 +
  15 + private Integer createTime;
  16 +
  17 + public Long getId() {
  18 + return id;
  19 + }
  20 +
  21 + public void setId(Long id) {
  22 + this.id = id;
  23 + }
  24 +
  25 + public Integer getActivityId() {
  26 + return activityId;
  27 + }
  28 +
  29 + public void setActivityId(Integer activityId) {
  30 + this.activityId = activityId;
  31 + }
  32 +
  33 + public Integer getUid() {
  34 + return uid;
  35 + }
  36 +
  37 + public void setUid(Integer uid) {
  38 + this.uid = uid;
  39 + }
  40 +
  41 + public Integer getType() {
  42 + return type;
  43 + }
  44 +
  45 + public void setType(Integer type) {
  46 + this.type = type;
  47 + }
  48 +
  49 + public Integer getCreateTime() {
  50 + return createTime;
  51 + }
  52 +
  53 + public void setCreateTime(Integer createTime) {
  54 + this.createTime = createTime;
  55 + }
  56 +}