Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JeeSpringCloud
Commits
8b643e22
"vscode:/vscode.git/clone" did not exist on "07b489356b394414f7b28ca2a0472ab6539be7a8"
Commit
8b643e22
authored
Oct 12, 2018
by
HuangBingGui
Browse files
no commit message
parent
563ff060
Changes
1000
Show whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 1000+
files are displayed.
Plain diff
Email patch
JeeSpringCloud/src/main/java/cn/com/duiba/credits/sdk/result/VirtualResult.java
0 → 100644
View file @
8b643e22
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
;
}
}
JeeSpringCloud/src/main/java/com/JeeSpringDriver.java
0 → 100644
View file @
8b643e22
/**
* Copyright © 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.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
*/
@EnableCaching
@SpringBootApplication
@ServletComponentScan
(
value
=
{
"com.jeespring"
,
"com.company"
})
@ComponentScan
(
value
=
{
"com.jeespring"
,
"com.company"
})
//,lazyInit = true
@EnableScheduling
@ComponentScan
@EnableAutoConfiguration
@Configuration
//@EnableAutoConfiguration(exclude = {
// org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class,
// org.activiti.spring.boot.SecurityAutoConfiguration.class,
//})
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
();
}
@Bean
public
EmbeddedServletContainerFactory
servletContainer
()
{
TomcatEmbeddedServletContainerFactory
tomcat
=
new
TomcatEmbeddedServletContainerFactory
();
tomcat
.
addAdditionalTomcatConnectors
(
createStandardConnector
());
// 添加http
return
tomcat
;
}
// 配置http
private
Connector
createStandardConnector
()
{
Connector
connector
=
new
Connector
(
"org.apache.coyote.http11.Http11NioProtocol"
);
connector
.
setPort
(
port
);
return
connector
;
}
public
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"
+
""
);
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"
+
""
);
System
.
out
.
println
(
"\n"
+
" .::::. \n"
+
" .::::::::. \n"
+
" ::::::::::: \n"
+
" ..:::::::::::' \n"
+
" '::::::::::::' \n"
+
" .:::::::::: \n"
+
" '::::::::::::::.. 女神助攻,流量冲天 \n"
+
" ..::::::::::::. 永不宕机,代码无bug \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"
+
" 别人笑我太疯癫,我笑他人看不穿; \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"
+
""
);
}
}
JeeSpringCloud/src/main/java/com/JeeSpringServlet.java
0 → 100644
View file @
8b643e22
/**
* Copyright © 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
);
}
}
JeeSpringCloud/src/main/java/com/company/compnay.txt
0 → 100644
View file @
8b643e22
JeeSpringCloud/src/main/java/com/company/project/modules/activeMQ/CompanyConsumer.java
0 → 100644
View file @
8b643e22
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
JeeSpringCloud/src/main/java/com/company/project/modules/activeMQ/CompanyProducer.java
0 → 100644
View file @
8b643e22
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
JeeSpringCloud/src/main/java/com/company/project/modules/duiba/duibaRestController.java
0 → 100644
View file @
8b643e22
/**
* * Copyright © 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
JeeSpringCloud/src/main/java/com/company/project/modules/modules.txt
0 → 100644
View file @
8b643e22
JeeSpringCloud/src/main/java/com/company/project/modules/scheduling/CompanyScheduledTaskService.java
0 → 100644
View file @
8b643e22
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
JeeSpringCloud/src/main/java/com/company/project/modules/scheduling/CompanyTaskSchedulerConfig.java
0 → 100644
View file @
8b643e22
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
JeeSpringCloud/src/main/java/com/company/project/modules/ylttrip/dao/TfTicketDao.java
0 → 100644
View file @
8b643e22
/**
* * Copyright © 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-12
*/
@Mapper
public
interface
TfTicketDao
extends
InterfaceBaseDao
<
TfTicket
>
{
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/company/project/modules/ylttrip/entity/TfTicket.java
0 → 100644
View file @
8b643e22
/**
* * Copyright © 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-12
*/
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
JeeSpringCloud/src/main/java/com/company/project/modules/ylttrip/rest/TfTicketRestController.java
0 → 100644
View file @
8b643e22
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package
com.company.project.modules.ylttrip.rest
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.google.common.collect.Lists
;
import
com.jeespring.common.utils.DateUtils
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.utils.excel.ExportExcel
;
import
com.jeespring.common.utils.excel.ImportExcel
;
import
com.company.project.modules.ylttrip.entity.TfTicket
;
import
com.company.project.modules.ylttrip.service.ITfTicketService
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.jeespring.common.web.Result
;
import
com.jeespring.common.web.ResultFactory
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
/**
* 订单Controller
* @author JeeSpring
* @version 2018-10-12
*/
@RestController
@RequestMapping
(
value
=
"/rest/ylttrip/tfTicket"
)
@Api
(
value
=
"订单接口"
,
description
=
"订单接口"
)
public
class
TfTicketRestController
extends
AbstractBaseController
{
@Autowired
private
ITfTicketService
tfTicketService
;
/**
* 订单信息
*/
@RequestMapping
(
value
=
{
"get"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"订单信息(Content-Type为text/html)"
,
notes
=
"订单信息(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"订单id"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
Result
getRequestParam
(
@RequestParam
(
required
=
false
)
String
id
)
{
return
get
(
id
);
}
@RequestMapping
(
value
=
{
"get/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"订单信息(Content-Type为application/json)"
,
notes
=
"订单信息(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"订单id"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
public
Result
getRequestBody
(
@RequestBody
(
required
=
false
)
String
id
)
{
return
get
(
id
);
}
private
Result
get
(
String
id
)
{
TfTicket
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
tfTicketService
.
getCache
(
id
);
//entity = tfTicketService.get(id);
}
if
(
entity
==
null
){
entity
=
new
TfTicket
();
}
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
entity
);
return
result
;
}
/**
* 订单列表(不包含页信息)
*/
//RequiresPermissions("ylttrip:tfTicket:findList")
@RequestMapping
(
value
=
{
"findList"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"订单列表(不包含页信息)(Content-Type为text/html)"
,
notes
=
"订单列表(不包含页信息)(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"query"
)
public
Result
findListRequestParam
(
TfTicket
tfTicket
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
findList
(
tfTicket
,
model
);
}
@RequestMapping
(
value
=
{
"findList/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"订单列表(不包含页信息)(Content-Type为application/json)"
,
notes
=
"订单列表(不包含页信息)(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"body"
)
public
Result
findListRequestBody
(
@RequestBody
TfTicket
tfTicket
,
Model
model
)
{
return
findList
(
tfTicket
,
model
);
}
private
Result
findList
(
TfTicket
tfTicket
,
Model
model
)
{
List
<
TfTicket
>
list
=
tfTicketService
.
findListCache
(
tfTicket
);
//List<TfTicket> list = tfTicketService.findList(tfTicket);
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
list
);
return
result
;
}
/**
* 订单列表(包含页信息)
*/
//RequiresPermissions("ylttrip:tfTicket:list")
@RequestMapping
(
value
=
{
"list"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"订单列表(包含页信息)(Content-Type为text/html)"
,
notes
=
"订单列表(包含页信息)(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"query"
)
public
Result
listRequestParam
(
TfTicket
tfTicket
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
list
(
tfTicket
,
model
);
}
@RequestMapping
(
value
=
{
"list/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"订单列表(包含页信息)(Content-Type为application/json)"
,
notes
=
"订单列表(包含页信息)(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"body"
)
public
Result
listRequestBody
(
@RequestBody
TfTicket
tfTicket
,
Model
model
)
{
return
list
(
tfTicket
,
model
);
}
private
Result
list
(
TfTicket
tfTicket
,
Model
model
)
{
Page
<
TfTicket
>
page
=
tfTicketService
.
findPageCache
(
new
Page
<
TfTicket
>(
tfTicket
.
getPageNo
(),
tfTicket
.
getPageSize
(),
tfTicket
.
getOrderBy
()),
tfTicket
);
//Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(tfTicket.getPageNo(),tfTicket.getPageSize(),tfTicket.getOrderBy()), tfTicket);
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
page
);
return
result
;
}
/**
* 订单获取列表第一条记录
*/
//RequiresPermissions("ylttrip:tfTicket:listFrist")
@RequestMapping
(
value
=
{
"listFrist"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"订单获取列表第一条记录(Content-Type为text/html)"
,
notes
=
"订单获取列表第一条记录(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"query"
)
public
Result
listFristRequestParam
(
TfTicket
tfTicket
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
listFrist
(
tfTicket
,
model
);
}
@RequestMapping
(
value
=
{
"listFrist/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"订单获取列表第一条记录(Content-Type为application/json)"
,
notes
=
"订单获取列表第一条记录(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"body"
)
public
Result
listFristRequestBody
(
@RequestBody
TfTicket
tfTicket
,
Model
model
)
{
return
listFrist
(
tfTicket
,
model
);
}
private
Result
listFrist
(
TfTicket
tfTicket
,
Model
model
)
{
Page
<
TfTicket
>
page
=
tfTicketService
.
findPageCache
(
new
Page
<
TfTicket
>(
tfTicket
.
getPageNo
(),
tfTicket
.
getPageSize
(),
tfTicket
.
getOrderBy
()),
tfTicket
);
//Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(tfTicket.getPageNo(),tfTicket.getPageSize(),tfTicket.getOrderBy()), tfTicket);
Result
result
=
ResultFactory
.
getSuccessResult
();
if
(
page
.
getList
().
size
()>
0
){
result
.
setResultObject
(
page
.
getList
().
get
(
0
));
}
else
{
result
=
ResultFactory
.
getErrorResult
(
"没有记录!"
);
}
return
result
;
}
/**
* 保存订单
*/
//RequiresPermissions(value={"ylttrip:tfTicket:add","ylttrip:tfTicket:edit"},logical=Logical.OR)
@RequestMapping
(
value
=
"save"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"保存订单(Content-Type为text/html)"
,
notes
=
"保存订单(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"query"
)
public
Result
saveRequestParam
(
TfTicket
tfTicket
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
return
save
(
tfTicket
,
model
,
redirectAttributes
);
}
@RequestMapping
(
value
=
"save/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"保存订单(Content-Type为application/json)"
,
notes
=
"保存订单(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"body"
)
public
Result
saveRequestBody
(
@RequestBody
TfTicket
tfTicket
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
return
save
(
tfTicket
,
model
,
redirectAttributes
);
}
private
Result
save
(
TfTicket
tfTicket
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
tfTicket
)){
Result
result
=
ResultFactory
.
getErrorResult
(
"数据验证失败"
);
}
tfTicketService
.
save
(
tfTicket
);
Result
result
=
ResultFactory
.
getSuccessResult
(
"保存订单成功"
);
return
result
;
}
/**
* 删除订单
*/
//RequiresPermissions("ylttrip:tfTicket:del")
@RequestMapping
(
value
=
"delete"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"删除订单(Content-Type为text/html)"
,
notes
=
"删除订单(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"query"
)
public
Result
deleteRequestParam
(
TfTicket
tfTicket
,
RedirectAttributes
redirectAttributes
)
{
return
delete
(
tfTicket
,
redirectAttributes
);
}
@RequestMapping
(
value
=
"delete/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"删除订单(Content-Type为application/json)"
,
notes
=
"删除订单(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"body"
)
public
Result
deleteRequestBody
(
@RequestBody
TfTicket
tfTicket
,
RedirectAttributes
redirectAttributes
)
{
return
delete
(
tfTicket
,
redirectAttributes
);
}
private
Result
delete
(
TfTicket
tfTicket
,
RedirectAttributes
redirectAttributes
)
{
tfTicketService
.
delete
(
tfTicket
);
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除订单成功"
);
return
result
;
}
/**
* 删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteByLogic"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"逻辑删除订单(Content-Type为text/html)"
,
notes
=
"逻辑删除订单(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"query"
)
public
Result
deleteByLogicRequestParam
(
TfTicket
tfTicket
,
RedirectAttributes
redirectAttributes
)
{
return
deleteByLogic
(
tfTicket
,
redirectAttributes
);
}
/**
* 删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteByLogic/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"逻辑删除订单(Content-Type为application/json)"
,
notes
=
"逻辑删除订单(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"tfTicket"
,
value
=
"订单"
,
dataType
=
"TfTicket"
,
paramType
=
"body"
)
public
Result
deleteByLogicRequestBody
(
@RequestBody
TfTicket
tfTicket
,
RedirectAttributes
redirectAttributes
)
{
return
deleteByLogic
(
tfTicket
,
redirectAttributes
);
}
private
Result
deleteByLogic
(
TfTicket
tfTicket
,
RedirectAttributes
redirectAttributes
)
{
tfTicketService
.
deleteByLogic
(
tfTicket
);
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除订单成功"
);
return
result
;
}
/**
* 批量删除订单
*/
//RequiresPermissions("ylttrip:tfTicket:del")
@RequestMapping
(
value
=
"deleteAll"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"批量删除订单(Content-Type为text/html)"
,
notes
=
"批量删除订单(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"订单ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
Result
deleteAllRequestParam
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAll
(
ids
,
redirectAttributes
);
}
@RequestMapping
(
value
=
"deleteAll/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"批量删除订单(Content-Type为application/json)"
,
notes
=
"批量删除订单(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"订单ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
public
Result
deleteAllRequestBody
(
@RequestBody
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAll
(
ids
,
redirectAttributes
);
}
private
Result
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
tfTicketService
.
delete
(
tfTicketService
.
get
(
id
));
}
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除订单成功"
);
return
result
;
}
/**
* 批量删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteAllByLogic"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"逻辑批量删除订单(Content-Type为text/html)"
,
notes
=
"逻辑批量删除订单(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"订单ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
Result
deleteAllByLogicRequestParam
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAllByLogic
(
ids
,
redirectAttributes
);
}
/**
* 批量删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteAllByLogic/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"逻辑批量删除订单(Content-Type为application/json)"
,
notes
=
"逻辑批量删除订单(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"订单ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
public
Result
deleteAllByLogicRequestBody
(
@RequestBody
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAllByLogic
(
ids
,
redirectAttributes
);
}
private
Result
deleteAllByLogic
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
tfTicketService
.
deleteByLogic
(
tfTicketService
.
get
(
id
));
}
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除订单成功"
);
return
result
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/company/project/modules/ylttrip/service/ITfTicketService.java
0 → 100644
View file @
8b643e22
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package
com.company.project.modules.ylttrip.service
;
import
com.jeespring.common.persistence.InterfaceBaseService
;
import
com.jeespring.modules.server.entity.SysServer
;
import
com.company.project.modules.ylttrip.entity.TfTicket
;
/**
* I订单Service
* @author JeeSpring
* @version 2018-10-12
*/
public
interface
ITfTicketService
extends
InterfaceBaseService
<
TfTicket
>
{
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/company/project/modules/ylttrip/service/TfTicketService.java
0 → 100644
View file @
8b643e22
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package
com.company.project.modules.ylttrip.service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.service.AbstractBaseService
;
import
com.company.project.modules.ylttrip.entity.TfTicket
;
import
com.company.project.modules.ylttrip.dao.TfTicketDao
;
import
com.company.project.modules.ylttrip.service.ITfTicketService
;
import
com.alibaba.fastjson.JSON
;
import
com.jeespring.common.redis.RedisUtils
;
import
com.jeespring.common.security.MD5Tools
;
//import com.alibaba.dubbo.config.annotation.Service;
import
com.jeespring.common.config.Global
;
/**
* 订单Service
* @author JeeSpring
* @version 2018-10-12
*/
//启用dubbo服务器时,要去掉下面注解
//com.alibaba.dubbo.config.annotation.Service(interfaceClass = ISysServerService.class,version = "1.0.0", timeout = 60000)
@org
.
springframework
.
stereotype
.
Service
@Transactional
(
readOnly
=
true
)
public
class
TfTicketService
extends
AbstractBaseService
<
TfTicketDao
,
TfTicket
>
implements
ITfTicketService
{
/**
* redis caches
*/
@Autowired
private
RedisUtils
redisUtils
;
public
TfTicket
get
(
String
id
)
{
//获取数据库数据
TfTicket
tfTicket
=
super
.
get
(
id
);
return
tfTicket
;
}
public
TfTicket
getCache
(
String
id
)
{
//获取缓存数据
TfTicket
tfTicket
=(
TfTicket
)
redisUtils
.
get
(
RedisUtils
.
getIdKey
(
TfTicketService
.
class
.
getName
(),
id
));
if
(
tfTicket
!=
null
)
return
tfTicket
;
//获取数据库数据
tfTicket
=
super
.
get
(
id
);
//设置缓存数据
redisUtils
.
set
(
RedisUtils
.
getIdKey
(
TfTicketService
.
class
.
getName
(),
id
),
tfTicket
);
return
tfTicket
;
}
public
List
<
TfTicket
>
total
(
TfTicket
tfTicket
)
{
//获取数据库数据
List
<
TfTicket
>
tfTicketList
=
super
.
total
(
tfTicket
);
return
tfTicketList
;
}
public
List
<
TfTicket
>
totalCache
(
TfTicket
tfTicket
)
{
//获取缓存数据
String
totalKey
=
RedisUtils
.
getTotalKey
(
TfTicketService
.
class
.
getName
(),
JSON
.
toJSONString
(
tfTicket
));
List
<
TfTicket
>
tfTicketList
=(
List
<
TfTicket
>)
redisUtils
.
get
(
totalKey
);
if
(
tfTicketList
!=
null
)
return
tfTicketList
;
//获取数据库数据
tfTicketList
=
super
.
total
(
tfTicket
);
//设置缓存数据
redisUtils
.
set
(
totalKey
,
tfTicketList
);
return
tfTicketList
;
}
public
List
<
TfTicket
>
findList
(
TfTicket
tfTicket
)
{
//获取数据库数据
List
<
TfTicket
>
tfTicketList
=
super
.
findList
(
tfTicket
);
//设置缓存数据
return
tfTicketList
;
}
public
List
<
TfTicket
>
findListCache
(
TfTicket
tfTicket
)
{
//获取缓存数据
String
findListKey
=
RedisUtils
.
getFindListKey
(
TfTicketService
.
class
.
getName
(),
JSON
.
toJSONString
(
tfTicket
));
List
<
TfTicket
>
tfTicketList
=(
List
<
TfTicket
>)
redisUtils
.
get
(
findListKey
);
if
(
tfTicketList
!=
null
)
return
tfTicketList
;
//获取数据库数据
tfTicketList
=
super
.
findList
(
tfTicket
);
//设置缓存数据
redisUtils
.
set
(
findListKey
,
tfTicketList
);
return
tfTicketList
;
}
public
TfTicket
findListFirst
(
TfTicket
tfTicket
)
{;
//获取数据库数据
List
<
TfTicket
>
tfTicketList
=
super
.
findList
(
tfTicket
);
if
(
tfTicketList
.
size
()>
0
)
tfTicket
=
tfTicketList
.
get
(
0
);
return
tfTicket
;
}
public
TfTicket
findListFirstCache
(
TfTicket
tfTicket
)
{
//获取缓存数据
String
findListFirstKey
=
RedisUtils
.
getFindListFirstKey
(
TfTicketService
.
class
.
getName
(),
JSON
.
toJSONString
(
tfTicket
));
TfTicket
tfTicketRedis
=(
TfTicket
)
redisUtils
.
get
(
findListFirstKey
);
if
(
tfTicketRedis
!=
null
)
return
tfTicketRedis
;
//获取数据库数据
List
<
TfTicket
>
tfTicketList
=
super
.
findList
(
tfTicket
);
if
(
tfTicketList
.
size
()>
0
)
tfTicket
=
tfTicketList
.
get
(
0
);
else
tfTicket
=
new
TfTicket
();
//设置缓存数据
redisUtils
.
set
(
findListFirstKey
,
tfTicket
);
return
tfTicket
;
}
public
Page
<
TfTicket
>
findPage
(
Page
<
TfTicket
>
page
,
TfTicket
tfTicket
)
{
//获取数据库数据
Page
<
TfTicket
>
pageReuslt
=
super
.
findPage
(
page
,
tfTicket
);
return
pageReuslt
;
}
public
Page
<
TfTicket
>
findPageCache
(
Page
<
TfTicket
>
page
,
TfTicket
tfTicket
)
{
//获取缓存数据
String
findPageKey
=
RedisUtils
.
getFindPageKey
(
TfTicketService
.
class
.
getName
(),
JSON
.
toJSONString
(
page
)+
JSON
.
toJSONString
(
tfTicket
));
Page
<
TfTicket
>
pageReuslt
=(
Page
<
TfTicket
>)
redisUtils
.
get
(
findPageKey
);
if
(
pageReuslt
!=
null
)
return
pageReuslt
;
//获取数据库数据
pageReuslt
=
super
.
findPage
(
page
,
tfTicket
);
//设置缓存数据
redisUtils
.
set
(
findPageKey
,
pageReuslt
);
return
pageReuslt
;
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
TfTicket
tfTicket
)
{
//保存数据库记录
super
.
save
(
tfTicket
);
//设置清除缓存数据
redisUtils
.
remove
(
RedisUtils
.
getIdKey
(
TfTicketService
.
class
.
getName
(),
tfTicket
.
getId
()));
//清除列表和页面缓存数据
redisUtils
.
removePattern
(
RedisUtils
.
getFindListKeyPattern
(
TfTicketService
.
class
.
getName
()));
redisUtils
.
removePattern
(
RedisUtils
.
getFinPageKeyPattern
(
TfTicketService
.
class
.
getName
()));
}
@Transactional
(
readOnly
=
false
)
public
void
delete
(
TfTicket
tfTicket
)
{
//清除记录缓存数据
redisUtils
.
remove
(
RedisUtils
.
getIdKey
(
TfTicketService
.
class
.
getName
(),
tfTicket
.
getId
()));
//删除数据库记录
super
.
delete
(
tfTicket
);
//清除列表和页面缓存数据
redisUtils
.
removePattern
(
RedisUtils
.
getFindListKeyPattern
(
TfTicketService
.
class
.
getName
()));
redisUtils
.
removePattern
(
RedisUtils
.
getFinPageKeyPattern
(
TfTicketService
.
class
.
getName
()));
}
@Transactional
(
readOnly
=
false
)
public
void
deleteByLogic
(
TfTicket
tfTicket
)
{
//清除记录缓存数据
redisUtils
.
remove
(
RedisUtils
.
getIdKey
(
TfTicketService
.
class
.
getName
(),
tfTicket
.
getId
()));
//逻辑删除数据库记录
super
.
deleteByLogic
(
tfTicket
);
//清除列表和页面缓存数据
redisUtils
.
removePattern
(
RedisUtils
.
getFindListKeyPattern
(
TfTicketService
.
class
.
getName
()));
redisUtils
.
removePattern
(
RedisUtils
.
getFinPageKeyPattern
(
TfTicketService
.
class
.
getName
()));
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/company/project/modules/ylttrip/web/TfTicketController.java
0 → 100644
View file @
8b643e22
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpringCloud</a> All rights reserved..
*/
package
com.company.project.modules.ylttrip.web
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.google.common.collect.Lists
;
import
com.jeespring.common.utils.DateUtils
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.utils.excel.ExportExcel
;
import
com.jeespring.common.utils.excel.ImportExcel
;
import
com.company.project.modules.ylttrip.entity.TfTicket
;
import
com.company.project.modules.ylttrip.service.TfTicketService
;
import
com.company.project.modules.ylttrip.service.ITfTicketService
;
import
com.alibaba.dubbo.config.annotation.Reference
;
/**
* 订单Controller
* @author JeeSpring
* @version 2018-10-12
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/ylttrip/tfTicket"
)
public
class
TfTicketController
extends
AbstractBaseController
{
//调用dubbo服务器是,要去Reference注解,注解Autowired
//@Reference(version = "1.0.0")
@Autowired
private
ITfTicketService
tfTicketService
;
@ModelAttribute
public
TfTicket
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
TfTicket
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
tfTicketService
.
getCache
(
id
);
//entity = tfTicketService.get(id);
}
if
(
entity
==
null
){
entity
=
new
TfTicket
();
}
return
entity
;
}
/**
* 订单统计页面
*/
@RequiresPermissions
(
"ylttrip:tfTicket:total"
)
@RequestMapping
(
value
=
{
"total"
})
public
String
totalView
(
TfTicket
tfTicket
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
total
(
tfTicket
,
request
,
response
,
model
);
return
"modules/ylttrip/tfTicketTotal"
;
}
private
void
total
(
TfTicket
tfTicket
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
if
(
StringUtils
.
isEmpty
(
tfTicket
.
getTotalType
())){
tfTicket
.
setTotalType
(
"%Y-%m-%d"
);
}
//X轴的数据
List
<
String
>
xAxisData
=
new
ArrayList
<
String
>();
//Y轴的数据
Map
<
String
,
List
<
Double
>>
yAxisData
=
new
HashMap
<
String
,
List
<
Double
>>();
List
<
Double
>
countList
=
new
ArrayList
<
Double
>();
List
<
Double
>
sumList
=
new
ArrayList
<
Double
>();
List
<
Double
>
sumGoodsNumList
=
new
ArrayList
<
Double
>();
List
<
Double
>
sumPriceList
=
new
ArrayList
<
Double
>();
List
<
Double
>
sumSalePriceList
=
new
ArrayList
<
Double
>();
if
(
tfTicket
.
getOrderBy
()==
""
){
tfTicket
.
setOrderBy
(
"totalDate"
);
}
List
<
TfTicket
>
list
=
tfTicketService
.
totalCache
(
tfTicket
);
//List<TfTicket> list = tfTicketService.total(tfTicket);
model
.
addAttribute
(
"list"
,
list
);
for
(
TfTicket
tfTicketItem:
list
){
//x轴数据
xAxisData
.
add
(
tfTicketItem
.
getTotalDate
());
countList
.
add
(
Double
.
valueOf
(
tfTicketItem
.
getTotalCount
()));
if
(
tfTicketItem
.
getSumGoodsNum
()!=
null
)
sumGoodsNumList
.
add
(
Double
.
valueOf
(
tfTicketItem
.
getSumGoodsNum
()));
else
tfTicketItem
.
setSumGoodsNum
(
0
D
);
if
(
tfTicketItem
.
getSumPrice
()!=
null
)
sumPriceList
.
add
(
Double
.
valueOf
(
tfTicketItem
.
getSumPrice
()));
else
tfTicketItem
.
setSumPrice
(
0
D
);
if
(
tfTicketItem
.
getSumSalePrice
()!=
null
)
sumSalePriceList
.
add
(
Double
.
valueOf
(
tfTicketItem
.
getSumSalePrice
()));
else
tfTicketItem
.
setSumSalePrice
(
0
D
);
}
yAxisData
.
put
(
"数量"
,
countList
);
yAxisData
.
put
(
"商品数量"
,
sumGoodsNumList
);
yAxisData
.
put
(
"商品单价"
,
sumPriceList
);
yAxisData
.
put
(
"订单金额"
,
sumSalePriceList
);
request
.
setAttribute
(
"xAxisData"
,
xAxisData
);
request
.
setAttribute
(
"yAxisData"
,
yAxisData
);
model
.
addAttribute
(
"sumTotalCount"
,
list
.
stream
().
mapToInt
(
TfTicket:
:
getTotalCount
).
sum
());
model
.
addAttribute
(
"sumGoodsNum"
,
list
.
stream
().
mapToDouble
(
TfTicket:
:
getSumGoodsNum
).
sum
());
model
.
addAttribute
(
"sumPrice"
,
list
.
stream
().
mapToDouble
(
TfTicket:
:
getSumPrice
).
sum
());
model
.
addAttribute
(
"sumSalePrice"
,
list
.
stream
().
mapToDouble
(
TfTicket:
:
getSumSalePrice
).
sum
());
//饼图数据
Map
<
String
,
Object
>
orientData
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
orientDataSumGoodsNum
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
orientDataSumPrice
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
orientDataSumSalePrice
=
new
HashMap
<
String
,
Object
>();
for
(
TfTicket
tfTicketItem:
list
){
orientData
.
put
(
tfTicketItem
.
getTotalDate
(),
tfTicketItem
.
getTotalCount
());
orientDataSumGoodsNum
.
put
(
tfTicketItem
.
getTotalDate
(),
Double
.
valueOf
(
tfTicketItem
.
getSumGoodsNum
()));
orientDataSumPrice
.
put
(
tfTicketItem
.
getTotalDate
(),
Double
.
valueOf
(
tfTicketItem
.
getSumPrice
()));
orientDataSumSalePrice
.
put
(
tfTicketItem
.
getTotalDate
(),
Double
.
valueOf
(
tfTicketItem
.
getSumSalePrice
()));
}
model
.
addAttribute
(
"orientData"
,
orientData
);
model
.
addAttribute
(
"orientDataSumGoodsNum"
,
orientDataSumGoodsNum
);
model
.
addAttribute
(
"orientDataSumPrice"
,
orientDataSumPrice
);
model
.
addAttribute
(
"orientDataSumSalePrice"
,
orientDataSumSalePrice
);
}
@RequiresPermissions
(
"ylttrip:tfTicket:total"
)
@RequestMapping
(
value
=
{
"totalMap"
})
public
String
totalMap
(
TfTicket
tfTicket
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
if
(
StringUtils
.
isEmpty
(
tfTicket
.
getTotalType
())){
tfTicket
.
setTotalType
(
"%Y-%m-%d"
);
}
List
<
TfTicket
>
list
=
tfTicketService
.
totalCache
(
tfTicket
);
//List<TfTicket> list = tfTicketService.total(tfTicket);
model
.
addAttribute
(
"sumTotalCount"
,
list
.
stream
().
mapToInt
(
TfTicket:
:
getTotalCount
).
sum
());
model
.
addAttribute
(
"sumGoodsNum"
,
list
.
stream
().
mapToDouble
(
TfTicket:
:
getSumGoodsNum
).
sum
());
model
.
addAttribute
(
"sumPrice"
,
list
.
stream
().
mapToDouble
(
TfTicket:
:
getSumPrice
).
sum
());
model
.
addAttribute
(
"sumSalePrice"
,
list
.
stream
().
mapToDouble
(
TfTicket:
:
getSumSalePrice
).
sum
());
model
.
addAttribute
(
"list"
,
list
);
return
"modules/ylttrip/tfTicketTotalMap"
;
}
/**
* 订单列表页面
*/
@RequiresPermissions
(
"ylttrip:tfTicket:list"
)
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
TfTicket
tfTicket
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
<
TfTicket
>
page
=
tfTicketService
.
findPageCache
(
new
Page
<
TfTicket
>(
request
,
response
),
tfTicket
);
//Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(request, response), tfTicket);
model
.
addAttribute
(
"page"
,
page
);
tfTicket
.
setOrderBy
(
"totalDate"
);
total
(
tfTicket
,
request
,
response
,
model
);
return
"modules/ylttrip/tfTicketList"
;
}
/**
* 订单列表页面
*/
@RequiresPermissions
(
"ylttrip:tfTicket:list"
)
@RequestMapping
(
value
=
{
"listVue"
})
public
String
listVue
(
TfTicket
tfTicket
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
<
TfTicket
>
page
=
tfTicketService
.
findPageCache
(
new
Page
<
TfTicket
>(
request
,
response
),
tfTicket
);
//Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(request, response), tfTicket);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/ylttrip/tfTicketListVue"
;
}
/**
* 订单列表页面
*/
//RequiresPermissions("ylttrip:tfTicket:select")
@RequestMapping
(
value
=
{
"select"
})
public
String
select
(
TfTicket
tfTicket
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
<
TfTicket
>
page
=
tfTicketService
.
findPageCache
(
new
Page
<
TfTicket
>(
request
,
response
),
tfTicket
);
//Page<TfTicket> page = tfTicketService.findPage(new Page<TfTicket>(request, response), tfTicket);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/ylttrip/tfTicketSelect"
;
}
/**
* 查看,增加,编辑订单表单页面
*/
@RequiresPermissions
(
value
={
"ylttrip:tfTicket:view"
,
"ylttrip:tfTicket:add"
,
"ylttrip:tfTicket:edit"
},
logical
=
Logical
.
OR
)
@RequestMapping
(
value
=
"form"
)
public
String
form
(
TfTicket
tfTicket
,
Model
model
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
model
.
addAttribute
(
"action"
,
request
.
getParameter
(
"action"
));
model
.
addAttribute
(
"tfTicket"
,
tfTicket
);
if
(
request
.
getParameter
(
"ViewFormType"
)!=
null
&&
request
.
getParameter
(
"ViewFormType"
).
equals
(
"FormTwo"
))
return
"modules/ylttrip/tfTicketFormTwo"
;
return
"modules/ylttrip/tfTicketForm"
;
}
/**
* 保存订单
*/
@RequiresPermissions
(
value
={
"ylttrip:tfTicket:add"
,
"ylttrip:tfTicket:edit"
},
logical
=
Logical
.
OR
)
@RequestMapping
(
value
=
"save"
)
public
String
save
(
TfTicket
tfTicket
,
Model
model
,
RedirectAttributes
redirectAttributes
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
if
(!
beanValidator
(
model
,
tfTicket
)){
return
form
(
tfTicket
,
model
,
request
,
response
);
}
tfTicketService
.
save
(
tfTicket
);
addMessage
(
redirectAttributes
,
"保存订单成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/ylttrip/tfTicket/?repage"
;
}
/**
* 删除订单
*/
@RequiresPermissions
(
"ylttrip:tfTicket:del"
)
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
TfTicket
tfTicket
,
RedirectAttributes
redirectAttributes
)
{
tfTicketService
.
delete
(
tfTicket
);
addMessage
(
redirectAttributes
,
"删除订单成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/ylttrip/tfTicket/?repage"
;
}
/**
* 删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequiresPermissions
(
value
={
"ylttrip:tfTicket:del"
,
"ylttrip:tfTicket:delByLogic"
},
logical
=
Logical
.
OR
)
@RequestMapping
(
value
=
"deleteByLogic"
)
public
String
deleteByLogic
(
TfTicket
tfTicket
,
RedirectAttributes
redirectAttributes
)
{
tfTicketService
.
deleteByLogic
(
tfTicket
);
addMessage
(
redirectAttributes
,
"逻辑删除订单成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/ylttrip/tfTicket/?repage"
;
}
/**
* 批量删除订单
*/
@RequiresPermissions
(
"ylttrip:tfTicket:del"
)
@RequestMapping
(
value
=
"deleteAll"
)
public
String
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
tfTicketService
.
delete
(
tfTicketService
.
get
(
id
));
}
addMessage
(
redirectAttributes
,
"删除订单成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/ylttrip/tfTicket/?repage"
;
}
/**
* 批量删除订单(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequiresPermissions
(
value
={
"ylttrip:tfTicket:del"
,
"ylttrip:tfTicket:delByLogic"
},
logical
=
Logical
.
OR
)
@RequestMapping
(
value
=
"deleteAllByLogic"
)
public
String
deleteAllByLogic
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
tfTicketService
.
deleteByLogic
(
tfTicketService
.
get
(
id
));
}
addMessage
(
redirectAttributes
,
"删除订单成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/ylttrip/tfTicket/?repage"
;
}
/**
* 导出excel文件
*/
@RequiresPermissions
(
"ylttrip:tfTicket:export"
)
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
POST
)
public
String
exportFile
(
TfTicket
tfTicket
,
HttpServletRequest
request
,
HttpServletResponse
response
,
RedirectAttributes
redirectAttributes
)
{
try
{
String
fileName
=
"订单"
+
DateUtils
.
getDate
(
"yyyyMMddHHmmss"
)+
".xlsx"
;
Page
<
TfTicket
>
page
=
tfTicketService
.
findPage
(
new
Page
<
TfTicket
>(
request
,
response
,
-
1
),
tfTicket
);
new
ExportExcel
(
"订单"
,
TfTicket
.
class
).
setDataList
(
page
.
getList
()).
write
(
response
,
fileName
).
dispose
();
return
null
;
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导出订单记录失败!失败信息:"
+
e
.
getMessage
());
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/ylttrip/tfTicket/?repage"
;
}
/**
* 导入Excel数据
*/
@RequiresPermissions
(
"ylttrip:tfTicket:import"
)
@RequestMapping
(
value
=
"import"
,
method
=
RequestMethod
.
POST
)
public
String
importFile
(
MultipartFile
file
,
RedirectAttributes
redirectAttributes
)
{
try
{
int
successNum
=
0
;
ImportExcel
ei
=
new
ImportExcel
(
file
,
1
,
0
);
List
<
TfTicket
>
list
=
ei
.
getDataList
(
TfTicket
.
class
);
for
(
TfTicket
tfTicket
:
list
){
tfTicketService
.
save
(
tfTicket
);
}
addMessage
(
redirectAttributes
,
"已成功导入 "
+
successNum
+
" 条订单记录"
);
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导入订单失败!失败信息:"
+
e
.
getMessage
());
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/ylttrip/tfTicket/?repage"
;
}
/**
* 下载导入订单数据模板
*/
@RequiresPermissions
(
"ylttrip:tfTicket:import"
)
@RequestMapping
(
value
=
"import/template"
)
public
String
importFileTemplate
(
HttpServletResponse
response
,
RedirectAttributes
redirectAttributes
)
{
try
{
String
fileName
=
"订单数据导入模板.xlsx"
;
List
<
TfTicket
>
list
=
Lists
.
newArrayList
();
new
ExportExcel
(
"订单数据"
,
TfTicket
.
class
,
1
).
setDataList
(
list
).
write
(
response
,
fileName
).
dispose
();
return
null
;
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导入模板下载失败!失败信息:"
+
e
.
getMessage
());
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/ylttrip/tfTicket/?repage"
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/company/project/project.txt
0 → 100644
View file @
8b643e22
JeeSpringCloud/src/main/java/com/jeespring/common/annotation/FieldName.java
0 → 100644
View file @
8b643e22
package
com.jeespring.common.annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* bean中文名注解
*/
@Target
(
ElementType
.
METHOD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
FieldName
{
String
value
();
}
JeeSpringCloud/src/main/java/com/jeespring/common/beanvalidator/AddGroup.java
0 → 100644
View file @
8b643e22
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.common.beanvalidator
;
/**
* 添加Bean验证组
* @author 黄炳桂 516821420@qq.com
*
*/
public
interface
AddGroup
{
}
JeeSpringCloud/src/main/java/com/jeespring/common/beanvalidator/DefaultGroup.java
0 → 100644
View file @
8b643e22
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.common.beanvalidator
;
/**
* 默认Bean验证组
* @author 黄炳桂 516821420@qq.com
*/
public
interface
DefaultGroup
{
}
Prev
1
2
3
4
5
6
…
50
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment