Commit d5ba54ba authored by Huang's avatar Huang
Browse files

no commit message

parent da9d3b1b
package cn.com.duiba.credits.sdk.entity;
import java.util.Date;
/**
* 开发者向兑吧发起请求,确认兑换成功失败的参数
*
* 目前仅限于虚拟商品,需要使用
* @author xuhengfei
*
*/
public class CreditConfirmParams {
private boolean success=true;
private String errorMessage="";
private String orderNum="";
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
}
package cn.com.duiba.credits.sdk.entity;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import cn.com.duiba.credits.sdk.SignTool;
public class CreditConsumeParams {
private String appKey;
private Date timestamp;//时间戳
private Long credits;//消耗积分数
private String orderNum="";//兑吧订单号
private String description="";
private String itemCode="";//商品编码,非必须参数
private String type="";//类型:QB,Phonebill,Alipay,Coupon 所有类型不区分大小写
private Integer facePrice=0;//面值,分为单位
private Integer actualPrice=0;//实际扣款,分为单位
private String alipay="";//已废弃,请使用params
private String phone="";//已废弃,请使用params
private String qq="";//已废弃,请使用params
private String uid="";
private boolean waitAudit=false;//是否等待审核, 如果返回true,表示此订单需要审核,审核通过后才会继续下去。 如果返回false表示此订单无须审核,会直接继续兑换流程
private String ip="";//用户兑换时使用的ip地址,有可能为空
private String params="";//参数,根据不同的type,有不同的含义,参见在线文档
private String transfer="";
public Map<String, String> toRequestMap(String appSecret){
Map<String, String> map=new HashMap<String, String>();
map.put("credits", credits+"");
map.put("description", description);
map.put("uid", uid);
map.put("appKey", appKey);
map.put("waitAudit", waitAudit+"");
map.put("appSecret", appSecret);
map.put("timestamp", timestamp.getTime()+"");
map.put("orderNum", orderNum);
map.put("type", type);
map.put("facePrice", facePrice+"");
map.put("actualPrice", actualPrice+"");
map.put("ip", ip);
map.put("params", params);
putIfNotEmpty(map, "itemCode", itemCode);
putIfNotEmpty(map, "transfer", transfer);
putIfNotEmpty(map, "qq", qq);
putIfNotEmpty(map, "alipay", alipay);
putIfNotEmpty(map, "phone", phone);
String sign=SignTool.sign(map);
map.remove("appSecret");
map.put("sign", sign);
return map;
}
private void putIfNotEmpty(Map<String, String> map,String key,String value){
if(value==null || value.length()==0){
return;
}
map.put(key, value);
}
public Long getCredits() {
return credits;
}
public void setCredits(Long credits) {
this.credits = credits;
}
public String getItemCode() {
return itemCode;
}
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
public boolean isWaitAudit() {
return waitAudit;
}
public void setWaitAudit(boolean waitAudit) {
this.waitAudit = waitAudit;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getFacePrice() {
return facePrice;
}
public void setFacePrice(Integer facePrice) {
this.facePrice = facePrice;
}
public Integer getActualPrice() {
return actualPrice;
}
public void setActualPrice(Integer actualPrice) {
this.actualPrice = actualPrice;
}
public String getAlipay() {
return alipay;
}
public void setAlipay(String alipay) {
this.alipay = alipay;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
public String getTransfer() {
return transfer;
}
public void setTransfer(String transfer) {
this.transfer = transfer;
}
}
package cn.com.duiba.credits.sdk.entity;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import cn.com.duiba.credits.sdk.SignTool;
public class CreditNeedAuditParams {
private String appKey;
private String bizId="";
private Date timestamp;
public CreditNeedAuditParams(){
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public Map<String, String> toRequestMap(String appSecret){
Map<String, String> map=new HashMap<String, String>();
map.put("bizId", bizId+"");
map.put("appKey", appKey+"");
map.put("appSecret", appSecret+"");
map.put("timestamp", timestamp.getTime()+"");
String sign=SignTool.sign(map);
map.remove("appSecret");
map.put("sign", sign);
return map;
}
}
package cn.com.duiba.credits.sdk.entity;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import cn.com.duiba.credits.sdk.SignTool;
public class CreditNotifyParams {
private boolean success;
private String bizId="";
private String errorMessage="";
private String orderNum="";
private Date timestamp=new Date();
private String appKey;
private String uid="";
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public Map<String, String> toRequestMap(String appSecret){
Map<String, String> map=new HashMap<String, String>();
map.put("success", success+"");
map.put("errorMessage", getString(errorMessage));
map.put("bizId", getString(bizId));
map.put("appKey", getString(appKey));
map.put("appSecret", getString(appSecret));
map.put("timestamp",getString( timestamp.getTime()));
map.put("uid", getString(uid));
map.put("orderNum", getString(orderNum));
String sign=SignTool.sign(map);
map.remove("appSecret");
map.put("sign", sign);
return map;
}
private String getString(Object o){
if(o==null){
return "";
}
return o.toString();
}
public void setUid(String uid) {
this.uid = uid;
}
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
}
package cn.com.duiba.credits.sdk.entity;
/**
* 构建开发者批量发货的发货信息
* @author Yang-yudong
*
*/
public class ExpressInfo {
private String orderNum;//兑吧订单号
private String expressNum;//快递单号
private String expressType;//快递类型
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
public String getExpressNum() {
return expressNum;
}
public void setExpressNum(String expressNum) {
this.expressNum = expressNum;
}
public String getExpressType() {
return expressType;
}
public void setExpressType(String expressType) {
this.expressType = expressType;
}
/**
* 构建发货信息的toString方法
*/
@Override
public String toString() {
return orderNum + "|"+ expressType + "|" + expressNum + ",";
}
}
package cn.com.duiba.credits.sdk.entity;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import cn.com.duiba.credits.sdk.SignTool;
/**
*
* @author yangyudong
*
*/
public class VirtualParams {
private String appKey;//应用标示appKey
private Date timestamp;//时间戳,当前时间毫秒值
private Long credits;//积分
private String supplierBizId="";//充值流水号
private String uid="";//用户id
private String description="";//虚拟商品标示符
private String orderNum="";//兑吧订单号
private String account="";//虚拟商品充值账号,非必须参数
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
private String params="";
public Long getCredits() {
return credits;
}
public void setCredits(Long credits) {
this.credits = credits;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public Map<String, String> toRequestMap(String appSecret){
Map<String, String> map=new HashMap<String, String>();
map.put("description", description);
map.put("uid", uid);
map.put("appKey", appKey);
map.put("supplierBizId", supplierBizId);
map.put("appSecret", appSecret);
map.put("timestamp", timestamp.getTime()+"");
map.put("orderNum", orderNum);
map.put("params", params);
String sign=SignTool.sign(map);
map.remove("appSecret");
map.put("sign", sign);
return map;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
public String getSupplierBizId() {
return supplierBizId;
}
public void setSupplierBizId(String supplierBizId) {
this.supplierBizId = supplierBizId;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
}
package cn.com.duiba.credits.sdk.result;
public class AddCreditResult {
private boolean success;
private String errorMessage="";
private String bizId="";
private Long credits=-1L;//用户积分余额
public AddCreditResult(boolean success){
this.success=success;
}
public String toString(){
if(success){
return "{'status':'ok','errorMessage':'','bizId':'"+bizId+"','credits':'"+credits+"'}";
}else{
return "{'status':'fail','errorMessage':'"+errorMessage+"','credits':'"+credits+"'}";
}
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public Long getCredits() {
return credits;
}
public void setCredits(Long credits) {
this.credits = credits;
}
}
package cn.com.duiba.credits.sdk.result;
public class CreditConsumeResult {
private boolean success;
private String errorMessage="";
private String bizId="";
private Long credits=-1L;//用户积分余额
public CreditConsumeResult(boolean success){
this.success=success;
}
public String toString(){
if(success){
return "{'status':'ok','errorMessage':'','bizId':'"+bizId+"','credits':'"+credits+"'}";
}else{
return "{'status':'fail','errorMessage':'"+errorMessage+"','credits':'"+credits+"'}";
}
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public Long getCredits() {
return credits;
}
public void setCredits(Long credits) {
this.credits = credits;
}
}
package cn.com.duiba.credits.sdk.result;
public class VirtualResult {
private String status; //充值是否成功的状态
private String errorMessage="";//失败信息
private String supplierBizId="";//虚拟商品充值流水号
private Long credits=-1L;
public VirtualResult(String status){
this.status=status;
}
public String toString(){
if(status=="success"){
return "{'status':'success','credits':'"+credits+"','supplierBizId':'"+supplierBizId+"'}";
}else if(status=="process"){
return "{'status':'success','credits':'"+credits+"','supplierBizId':'"+supplierBizId+"'}";
}else
return "{'status':'fail','errorMessage':'"+errorMessage+"','supplierBizId':'"+supplierBizId+"'}";
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getSupplierBizId() {
return supplierBizId;
}
public void setSupplierBizId(String supplierBizId) {
this.supplierBizId = supplierBizId;
}
public Long getCredits() {
return credits;
}
public void setCredits(Long credits) {
this.credits = credits;
}
}
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved.
*/
package com;
import com.jeespring.common.redis.RedisUtils;
import com.jeespring.common.websocket.WebSockertFilter;
import com.jeespring.modules.scheduling.JeeSpringTaskSchedulerConfig;
import com.jeespring.modules.sys.service.SystemService;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.catalina.connector.Connector;
import org.apache.coyote.http11.Http11NioProtocol;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.scheduling.annotation.EnableScheduling;
import javax.jms.Queue;
import java.io.File;
import java.io.IOException;
/**
* jeespring
* springboot的启动类
* * * @author 黄炳桂 516821420@qq.com
* Created on 2017/1/8 16:20
*
* @EnableAutoConfiguration(exclude = {
* org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class,
* org.activiti.spring.boot.SecurityAutoConfiguration.class,
* })
* 使用lazyInit缩短Spring Boot启动时间//, lazyInit = true
*/
@EnableCaching
@SpringBootApplication
@ServletComponentScan(basePackages = {"com.jeespring", "com.company","cn.xxx"})
@ComponentScan(basePackages = {"com.jeespring", "com.company","cn.xxx"})
@MapperScan(basePackages={"com.jeespring.modules.**.dao","com.company.project.modules.*.dao","cn.xxx.xxx.modules.*.dao"})
@EnableScheduling
@ComponentScan
@EnableAutoConfiguration
@Configuration
public class JeeSpringDriver {
@Value("${http.port}")
private Integer port;
public static void main(String[] args) {
//Spring boot run
new SpringApplicationBuilder(JeeSpringDriver.class).web(true).run(args);
SystemService.printKeyLoadMessage();
//IM WebSocker
WebSockertFilter w = new WebSockertFilter();
w.startWebsocketChatServer();
printGods();
printAnimalsGods();
printLadyGods();
printPoetries();
}
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
// 添加http
tomcat.addAdditionalTomcatConnectors(createStandardConnector());
return tomcat;
}
/**
* 配置http
* @return Connector
*/
private Connector createStandardConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setPort(port);
return connector;
}
private static void printGods() {
System.out.println(
"--------------- 佛祖保佑 神兽护体 女神助攻 流量冲天 ---------------\n" +
" _ooOoo_ \n" +
" o8888888o \n" +
" 88\" . \"88 \n" +
" (| ^_^ |) \n" +
" O\\ = /O \n" +
" ____/`---'\\____ \n" +
" .' \\\\| |// `. \n" +
" / \\||| : |||// \\ \n" +
" / _||||| -:- |||||- \\ \n" +
" | | \\\\\\ - /// | | \n" +
" | \\_| ''\\---/'' | | \n" +
" \\ .-\\__ `-` ___/-. / \n" +
" ___`. .' /--.--\\ `. . ___ \n" +
" .\"\" '< `.___\\_<|>_/___.' >'\"\". \n" +
" | | : `- \\`.;`\\ _ /`;.`/ - ` : | | \n" +
" \\ \\ `-. \\_ __\\ /__ _/ .-` / / \n" +
" ========`-.____`-.___\\_____/___.-`____.-'======== \n" +
" `=---=' \n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n" +
" 佛祖保佑 永不宕机 永无BUG 流量冲天 \n" +
"");
}
private static void printAnimalsGods(){
System.out.println(
"\n" +
"        ┏┓ ┏┓+ + \n" +
"       ┏┛┻━━━━━━━┛┻┓ + + \n" +
"       ┃       ┃ \n" +
"       ┃   ━    ┃ ++ + + + \n" +
"       █████━█████ ┃+ \n" +
"       ┃       ┃ + \n" +
"       ┃   ┻    ┃ \n" +
"       ┃       ┃ + + \n" +
"       ┗━━┓  ┏━━━━┛ \n" +
" ┃   ┃ \n" +
"          ┃   ┃ + + + + \n" +
"          ┃   ┃  \n" +
"          ┃   ┃ +     神兽护体,流量冲天 \n" +
"          ┃   ┃ 永不宕机,代码无bug \n" +
"          ┃   ┃  + \n" +
"          ┃    ┗━━━━━┓ + + \n" +
"          ┃       ┣┓ \n" +
"          ┃       ┏┛ \n" +
"          ┗┓┓┏━━━┳┓┏┛ + + + + \n" +
"           ┃┫┫  ┃┫┫ \n" +
"           ┗┻┛  ┗┻┛+ + + + \n" +
"");
System.out.println(
"\n" +
"       ┏┓ ┏┓ \n" +
" ┏┛┻━━━━━━┛┻┓ \n" +
" ┃       ┃ \n" +
" ┃   ━    ┃ \n" +
" ┃ ┳┛  ┗┳  ┃ \n" +
" ┃       ┃ \n" +
" ┃   ┻    ┃ \n" +
" ┃       ┃ \n" +
" ┗━┓   ┏━━━┛ \n" +
" ┃   ┃ 神兽护体 流量冲天 \n" +
" ┃   ┃ 永不宕机 代码无BUG! \n" +
" ┃   ┗━━━━━━━━━┓ \n" +
" ┃        ┣┓ \n" +
" ┃     ┏┛ \n" +
" ┗━┓ ┓ ┏━━━┳ ┓ ┏━┛ \n" +
" ┃ ┫ ┫ ┃ ┫ ┫ \n" +
" ┗━┻━┛ ┗━┻━┛ \n" +
"");
}
private static void printLadyGods(){
System.out.println(
"\n" +
" .::::. \n" +
" .::::::::. \n" +
" ::::::::::: \n" +
" ..:::::::::::' \n" +
" '::::::::::::' \n" +
" .:::::::::: \n" +
" '::::::::::::::.. 女神助攻,流量冲天 \n" +
" ..::::::::::::. 永不宕机,代码无bug \n" +
" ``:::::::::::::::: \n" +
" ::::``:::::::::' .:::. \n" +
" ::::' ':::::' .::::::::. \n" +
" .::::' :::: .:::::::'::::. \n" +
" .:::' ::::: .:::::::::' ':::::. \n" +
" .::' :::::.:::::::::' ':::::. \n" +
" .::' ::::::::::::::' ``::::. \n" +
" ...::: ::::::::::::' ``::. \n" +
" ```` ':. ':::::::::' ::::.. \n" +
" '.:::::' ':'````.. \n" +
"");
}
private static void printPoetries() {
System.out.println(
"\n" +
" 唐伯虎:\n" +
" 桃花庵歌 \n" +
" 桃花坞里桃花庵,桃花庵下桃花仙; \n" +
" 桃花仙人种桃树,又摘桃花卖酒钱。 \n" +
" 酒醒只在花前坐,酒醉还来花下眠; \n" +
" 半醒半醉日复日,花落花开年复年。 \n" +
" 但愿老死花酒间,不愿鞠躬车马前; \n" +
" 车尘马足富者趣,酒盏花枝贫者缘。 \n" +
" 若将富贵比贫贱,一在平地一在天; \n" +
" 若将贫贱比车马,他得驱驰我得闲。 \n" +
" 别人笑我太疯癫,我笑他人看不穿; \n" +
" 不见五陵豪杰墓,无花无酒锄作田。 \n" +
"");
System.out.println(
"\n" +
" 曹操:\n" +
" 短歌行 \n" +
" 对酒当歌,人生几何?譬如朝露,去日苦多。 \n" +
" 概当以慷,忧思难忘。何以解忧?唯有杜康。 \n" +
" 青青子衿,悠悠我心。但为君故,沈吟至今。 \n" +
" 呦呦鹿鸣,食野之苹。我有嘉宾,鼓瑟吹笙。 \n" +
" 明明如月,何时可掇?忧从中来,不可断绝。 \n" +
" 越陌度阡,枉用相存。契阔谈咽,心念旧恩。 \n" +
" 月明星稀,乌鹊南飞。绕树三匝,何枝可依。 \n" +
" 山不厌高,海不厌深,周公吐哺,天下归心。 \n" +
"");
System.out.println(
"\n" +
" 关羽: \n" +
" 咏关公 \n" +
" 桃园结义薄云天,偃月青龙刀刃寒。 \n" +
" 一骑绝尘走千里,五关斩将震坤乾。 \n" +
" 忠心报国为梁栋,肝胆护兄铸铁肩。 \n" +
" 一去麦城无复返,英魂庙里化青烟。 \n" +
"");
System.out.println(
"\n" +
" 程序员: \n" +
" 程序开发行 \n" +
" 写字楼里写字间,写字间里程序员; \n" +
" 程序人员做开发,又拿程序换活钱。 \n" +
" 上班只在网上坐,下班还来网下眠; \n" +
" 奔驰宝马贵者趣,公交自行程序员。 \n" +
" 不见满街漂亮妹,哪个归得程序员; \n" +
" 别人笑我忒疯癫,我笑他人看不穿。 \n" +
" 年复一年代码圈,精益求精产品圈; \n" +
" 至情之人同成长,缔造和谐至情间。 \n" +
" 千锤百炼飞冲天,辉煌有为戏人间; \n" +
" 谈笑风生社会圈,享天福天下归心。 \n" +
"\n" +
" 产品专员:征集中 \n" +
" 美工专员:征集中 \n" +
" UI专员:征集中 \n" +
" 测试专员:征集中 \n" +
" 老董:征集中 \n" +
" JeeSpring官方QQ群:328910546 \n" +
" JeeSpring官方QQ群(VIP):558699173 \n" +
" JeeSpring官方架构群:464865153 \n" +
" JeeSpring是官方分布式微服务集群开源框架,使用前端HTML或后端模板引擎+mvvm+spring mvc+spring boot+spring cloud、mybatis、alibaba dubbo 分布式、\n" +
" 微服务、集群、代码生成(前端界面、底层代码、dubbo、微服务的生成)等核心技术。\n" +
" 开源中国 https://git.oschina.net/JeeHuangBingGui/JeeSpring\n" +
"");
}
}
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved.
*/
package com;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
/**
* Web程序启动类
*
* @author 黄炳桂 516821420@qq.com
* @date 2017-05-21 9:43
*/
public class JeeSpringServlet extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(JeeSpringDriver.class);
}
}
package com.company.project.modules.activeMQ;
import com.jeespring.common.utils.SendMailUtil;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 消息消费者.
* @author 黄炳桂 516821420@qq.com
* @version v.0.1
* @date 2016年8月23日
*/
@Component
public class CompanyConsumer {
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 使用JmsListener配置消费者监听的队列,其中text是接收到的消息
@JmsListener(destination = CompanyProducer.ActiveMQQueueKey)
public void receiveQueue(String text) {
System.out.println(dateFormat.format(new Date()) + " | " +"ActiveMQ Consumer :"+ CompanyProducer.ActiveMQQueueKey+":收到的报文为:"+text);
}
// 使用JmsListener配置消费者监听的队列,其中text是接收到的消息
@JmsListener(destination = CompanyProducer.ActiveMQQueueKeyA)
public void receiveQueueA(String text) {
System.out.println(dateFormat.format(new Date()) + " | " +"ActiveMQ Consumer :"+ CompanyProducer.ActiveMQQueueKeyA+":收到的报文为:"+text);
}
// 使用JmsListener配置消费者监听的队列,其中text是接收到的消息
@JmsListener(destination = CompanyProducer.ActiveMQQueueKeyB)
@SendTo("company.out.queue")
public String receiveQueueB(String text) {
System.out.println(dateFormat.format(new Date()) + " | " +"ActiveMQ Consumer :"+ CompanyProducer.ActiveMQQueueKeyA+"收到的报文为:"+text);
return "return message:"+text;
}
}
\ No newline at end of file
package com.company.project.modules.activeMQ;
import com.jeespring.common.redis.RedisUtils;
import org.apache.activemq.command.ActiveMQQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;
import javax.jms.Destination;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 消息生产者.
* @author 黄炳桂 516821420@qq.com
* @version v.0.1
* @date 2016年8月23日
*/
@Service("companyProducer")
public class CompanyProducer {
private static Logger logger = LoggerFactory.getLogger(RedisUtils.class);
public static final String ActiveMQQueueKey="Company.ActiveMQ.queue";
public static final String ActiveMQQueueKeyA="Company.ActiveMQ.queueA";
public static final String ActiveMQQueueKeyB="Company.ActiveMQ.queueB";
public static String RUN_MESSAGE="ActvieMQ连接异常,请开启ActvieMQ服务.";
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 也可以注入JmsTemplate,JmsMessagingTemplate对JmsTemplate进行了封装
@Autowired
private JmsMessagingTemplate jmsTemplate;
// 发送消息,destination是发送到的队列,message是待发送的消息
public void sendMessage( final String message){
try{
Destination destination = new ActiveMQQueue(CompanyProducer.ActiveMQQueueKey);
jmsTemplate.convertAndSend(destination, message);
}catch (Exception e){
logger.error(dateFormat.format(new Date()) + " | " +"ActvieMQ:"+RUN_MESSAGE+e.getMessage(), RUN_MESSAGE+e.getMessage());
}
}
public void sendMessageA( final String message){
try{
Destination destinationA = new ActiveMQQueue(CompanyProducer.ActiveMQQueueKeyA);
jmsTemplate.convertAndSend(destinationA, message);
}catch (Exception e){
logger.error(dateFormat.format(new Date()) + " | " +"ActvieMQ:"+RUN_MESSAGE+e.getMessage(), RUN_MESSAGE+e.getMessage());
}
}
public void sendMessageB(final String message){
try{
Destination destinationB = new ActiveMQQueue(CompanyProducer.ActiveMQQueueKeyA);
jmsTemplate.convertAndSend(destinationB, message);
}catch (Exception e){
logger.error(dateFormat.format(new Date()) + " | " +"ActvieMQ:"+RUN_MESSAGE+e.getMessage(), RUN_MESSAGE+e.getMessage());
}
}
@JmsListener(destination="company.out.queue")
public void consumerMessage(String text){
System.out.println(dateFormat.format(new Date()) + " | " +"ActvieMQ:从out.queue队列收到的回复报文为:"+text);
}
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package com.company.project.modules.duiba;
import cn.com.duiba.credits.sdk.BulidUrl;
import cn.com.duiba.credits.sdk.CreditTool;
import cn.com.duiba.credits.sdk.entity.CreditConsumeParams;
import cn.com.duiba.credits.sdk.result.CreditConsumeResult;
import com.jeespring.common.web.AbstractBaseController;
import com.jeespring.common.web.Result;
import com.jeespring.common.web.ResultFactory;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 订单Controller
* @author 黄炳桂
* @version 2017-11-13
*/
@RestController
@RequestMapping(value = "/duiba")
@Api(value="duiba", description="积分兑换")
public class duibaRestController extends AbstractBaseController {
@RequestMapping(value = {"index"},method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="积分兑换首页(Content-Type为text/html)", notes="积分兑换首页(Content-Type为text/html)")
public Result index(HttpServletRequest request, HttpServletResponse response) {
Long credits=Long.valueOf(0);
String redirect=null;
if(request.getParameter("credits")!=null){
credits=Long.valueOf(request.getParameter("credits"));
}
if(request.getParameter("redirect")!=null){
redirect=request.getParameter("redirect");
}
if(request.getParameter("dbredirect")!=null){
redirect=request.getParameter("dbredirect");
}
Result result = ResultFactory.getSuccessResult();
result.setResultObject(BulidUrl.buildAutoLoginRequest(request.getParameter("uid"),credits ,redirect));
return result;
}
@RequestMapping(value = {"signIn"},method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="签到(Content-Type为text/html)", notes="签到(Content-Type为text/html)")
public Result signIn(HttpServletRequest request, HttpServletResponse response) {
Long credits=Long.valueOf(0);
String redirect=null;
if(request.getParameter("credits")!=null){
credits=Long.valueOf(request.getParameter("credits"));
}
if(request.getParameter("redirect")!=null){
redirect=request.getParameter("redirect");
}else{
//redirect="http://activity.m.duiba.com.cn/activity/acShareIndex?url=https%3A%2F%2Factivity-1.m.duiba.com.cn%2Fnewtools%2Findex%3Fid%3D2685169&apk=3dqRcUoEnKDLAj5ziF63DgkZBT3z";
redirect="https://activity.m.duiba.com.cn/signactivity/index?id=90&dpm=43346.41.1.0&dcm=216.90.51.0&appKey=7HWwRiKJXPiyh7pF4QnYAieVPQL&open4share=tongdun";
}
Result result = ResultFactory.getSuccessResult();
result.setResultObject(BulidUrl.buildAutoLoginRequest(request.getParameter("uid"),credits ,redirect));
return result;
}
@RequestMapping(value = {"cancle"},method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="扣积分(Content-Type为text/html)", notes="扣积分(Content-Type为text/html)")
public void cancle(HttpServletRequest request, HttpServletResponse response) {
CreditTool tool=new CreditTool(BulidUrl.AppKey, BulidUrl.AppSecret);
try {
CreditConsumeParams params= tool.parseCreditConsume(request);//利用tool来解析这个请求
String uid=params.getUid();//用户id
Long credits=params.getCredits();
String type=params.getType();//获取兑换类型
String alipay=params.getAlipay();//获取支付宝账号
//其他参数参见 params的属性字段
//TODO 开发者系统对uid用户扣除credits个积分
String bizId="001";//返回开发者系统中的业务订单id
CreditConsumeResult result=new CreditConsumeResult(true);
result.setBizId(bizId);
response.getWriter().write(result.toString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@RequestMapping(value = {"add"},method ={RequestMethod.POST,RequestMethod.GET})
@ApiOperation(value="加积分(Content-Type为text/html)", notes="加积分(Content-Type为text/html)")
public String add(HttpServletRequest request, HttpServletResponse response) {
return "{'status': 'ok','errorMessage': '失败原因''credits': '100'}";
}
}
\ No newline at end of file
package com.company.project.modules.scheduling;
import com.company.project.modules.activeMQ.CompanyProducer;
import com.jeespring.common.config.Global;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Component
public class CompanyScheduledTaskService {
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//@Autowired
//private XXXService xxxxService;
@Autowired
private CompanyProducer companyProducer;
//每个2s执行一次任务
@Scheduled(fixedRate = 2000)
public void run(){
//xxxxService.method();
//System.out.println(dateFormat.format(new Date()) + " | " + "com.company.project.modules.scheduling:每隔2s执行一次任务");
}
//每个2s执行一次任务#朝九晚七工作时间内每五分钟
@Scheduled(cron = "0 0/3 9-19 * * ?")
public void run2(){
//xxxxService.method();
//System.out.println(dateFormat.format(new Date()) + " | " + "com.company.project.modules.scheduling:朝九晚七工作时间内每五分钟执行一次任务");
//companyProducer.sendMessageA( "ActiveMQ CompanyProducer queueA。");
//companyProducer.sendMessageB("ActiveMQ CompanyProducer queueB。");
}
//每天15点29分执行该任务
@Scheduled(cron = "0 29 15 ? * *")
public void run3()
{
//System.out.println(dateFormat.format(new Date()) + " | " + "com.company.project.modules.scheduling:每天在指定时间执行任务");
}
}
\ No newline at end of file
package com.company.project.modules.scheduling;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
@Configuration
@ComponentScan("com.company.project.modules.scheduling")
@EnableScheduling
public class CompanyTaskSchedulerConfig {
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.company.project.modules.ylttrip.dao;
import com.jeespring.common.persistence.InterfaceBaseDao;
import org.apache.ibatis.annotations.Mapper;
import com.company.project.modules.ylttrip.entity.TfTicket;
/**
* 订单DAO接口
* @author JeeSpring
* @version 2018-10-15
*/
@Mapper
public interface TfTicketDao extends InterfaceBaseDao<TfTicket> {
}
\ No newline at end of file
/**
* * Copyright &copy; 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package com.company.project.modules.ylttrip.entity;
import org.hibernate.validator.constraints.Length;
import com.jeespring.modules.sys.entity.User;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeespring.common.persistence.AbstractBaseEntity;
import com.jeespring.common.utils.excel.annotation.ExcelField;
import com.jeespring.modules.sys.utils.DictUtils;
/**
* 订单Entity
* @author JeeSpring
* @version 2018-10-15
*/
public class TfTicket extends AbstractBaseEntity<TfTicket> {
private static final long serialVersionUID = 1L;
private String ticketNo; // 订单编号
private String goodsNo; // 商品编号
private String goodsItemId; // 种类编号
private String goodsItemName; // 种类名称
private Long goodsNum; // 商品数量
private Double sumGoodsNum; // sum商品数量
private Double price; // 商品单价
private Double sumPrice; // sum商品单价
private Double salePrice; // 订单金额
private Double sumSalePrice; // sum订单金额
private com.jeespring.modules.sys.entity.User user; // 下单人
private java.util.Date orderDate; // 下单时间
private String state; // 订单状态
private String stateLabel; // 订单状态Label
private String statePicture; // 订单状态Picture
private java.util.Date stateDate; // 状态时间
private String custName; // 客户姓名
private String linkPhone; // 联系电话
private String address; // 收货地址
private Long payType; // 付款方式
private String payTypeLabel; // 付款方式Label
private String payTypePicture; // 付款方式Picture
private String logistId; // 物流编号
private String logistComp; // 物流公司
private String checkinCode; // 入园号
private String reserveId; // 票务系统订单号
private String remark; // 订单备注
private java.util.Date beginOrderDate; // 开始 下单时间
private java.util.Date endOrderDate; // 结束 下单时间
private java.util.Date beginStateDate; // 开始 状态时间
private java.util.Date endStateDate; // 结束 状态时间
public TfTicket() {
super();
}
public TfTicket(String id){
super(id);
}
@Length(min=1, max=25, message="订单编号长度必须介于 1 和 25 之间")
@ExcelField(title="订单编号", align=2, sort=1)
public String getTicketNo() {
return ticketNo;
}
public void setTicketNo(String ticketNo) {
this.ticketNo = ticketNo;
}
@Length(min=0, max=25, message="商品编号长度必须介于 0 和 25 之间")
@ExcelField(title="商品编号", align=2, sort=2)
public String getGoodsNo() {
return goodsNo;
}
public void setGoodsNo(String goodsNo) {
this.goodsNo = goodsNo;
}
@Length(min=0, max=255, message="种类编号长度必须介于 0 和 255 之间")
@ExcelField(title="种类编号", align=2, sort=3)
public String getGoodsItemId() {
return goodsItemId;
}
public void setGoodsItemId(String goodsItemId) {
this.goodsItemId = goodsItemId;
}
@Length(min=0, max=255, message="种类名称长度必须介于 0 和 255 之间")
@ExcelField(title="种类名称", align=2, sort=4)
public String getGoodsItemName() {
return goodsItemName;
}
public void setGoodsItemName(String goodsItemName) {
this.goodsItemName = goodsItemName;
}
@ExcelField(title="商品数量", align=2, sort=5)
public Long getGoodsNum() {
return goodsNum;
}
public void setGoodsNum(Long goodsNum) {
this.goodsNum = goodsNum;
}
public Double getSumGoodsNum() {
return sumGoodsNum;
}
public void setSumGoodsNum(Double goodsNum) {
this.sumGoodsNum = goodsNum;
}
@ExcelField(title="商品单价", align=2, sort=6)
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Double getSumPrice() {
return sumPrice;
}
public void setSumPrice(Double price) {
this.sumPrice = price;
}
@ExcelField(title="订单金额", align=2, sort=7)
public Double getSalePrice() {
return salePrice;
}
public void setSalePrice(Double salePrice) {
this.salePrice = salePrice;
}
public Double getSumSalePrice() {
return sumSalePrice;
}
public void setSumSalePrice(Double salePrice) {
this.sumSalePrice = salePrice;
}
@ExcelField(title="下单人", fieldType=User.class, value="user.name", align=2, sort=8)
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ExcelField(title="下单时间", align=2, sort=9)
public Date getOrderDate() {
return orderDate;
}
public void setOrderDate(Date orderDate) {
this.orderDate = orderDate;
}
@Length(min=0, max=2, message="订单状态长度必须介于 0 和 2 之间")
@ExcelField(title="订单状态", dictType="STATE", align=2, sort=10)
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getStateLabel() {
return DictUtils.getDictLabel(state,"STATE","");
}
public String getStatePicture() {
return DictUtils.getDictPicture(state,"STATE","");
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ExcelField(title="状态时间", align=2, sort=11)
public Date getStateDate() {
return stateDate;
}
public void setStateDate(Date stateDate) {
this.stateDate = stateDate;
}
@Length(min=0, max=50, message="客户姓名长度必须介于 0 和 50 之间")
@ExcelField(title="客户姓名", align=2, sort=12)
public String getCustName() {
return custName;
}
public void setCustName(String custName) {
this.custName = custName;
}
@Length(min=0, max=50, message="联系电话长度必须介于 0 和 50 之间")
@ExcelField(title="联系电话", align=2, sort=13)
public String getLinkPhone() {
return linkPhone;
}
public void setLinkPhone(String linkPhone) {
this.linkPhone = linkPhone;
}
@Length(min=0, max=500, message="收货地址长度必须介于 0 和 500 之间")
@ExcelField(title="收货地址", align=2, sort=14)
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@ExcelField(title="付款方式", dictType="PAY_TYPE", align=2, sort=15)
public Long getPayType() {
return payType;
}
public void setPayType(Long payType) {
this.payType = payType;
}
public String getPayTypeLabel() {
return DictUtils.getDictLabel(payType,"PAY_TYPE","");
}
public String getPayTypePicture() {
return DictUtils.getDictPicture(payType,"PAY_TYPE","");
}
@Length(min=0, max=25, message="物流编号长度必须介于 0 和 25 之间")
@ExcelField(title="物流编号", align=2, sort=16)
public String getLogistId() {
return logistId;
}
public void setLogistId(String logistId) {
this.logistId = logistId;
}
@Length(min=0, max=200, message="物流公司长度必须介于 0 和 200 之间")
@ExcelField(title="物流公司", align=2, sort=17)
public String getLogistComp() {
return logistComp;
}
public void setLogistComp(String logistComp) {
this.logistComp = logistComp;
}
@Length(min=0, max=255, message="入园号长度必须介于 0 和 255 之间")
@ExcelField(title="入园号", align=2, sort=18)
public String getCheckinCode() {
return checkinCode;
}
public void setCheckinCode(String checkinCode) {
this.checkinCode = checkinCode;
}
@Length(min=0, max=30, message="票务系统订单号长度必须介于 0 和 30 之间")
@ExcelField(title="票务系统订单号", align=2, sort=20)
public String getReserveId() {
return reserveId;
}
public void setReserveId(String reserveId) {
this.reserveId = reserveId;
}
@Length(min=0, max=500, message="订单备注长度必须介于 0 和 500 之间")
@ExcelField(title="订单备注", align=2, sort=21)
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getBeginOrderDate() {
return beginOrderDate;
}
public void setBeginOrderDate(Date beginOrderDate) {
this.beginOrderDate = beginOrderDate;
}
public Date getEndOrderDate() {
return endOrderDate;
}
public void setEndOrderDate(Date endOrderDate) {
this.endOrderDate = endOrderDate;
}
public Date getBeginStateDate() {
return beginStateDate;
}
public void setBeginStateDate(Date beginStateDate) {
this.beginStateDate = beginStateDate;
}
public Date getEndStateDate() {
return endStateDate;
}
public void setEndStateDate(Date endStateDate) {
this.endStateDate = endStateDate;
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment