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
JeeSpringCloudV3.0
Commits
e344509c
"jetbrains:/idea/checkout/git" did not exist on "09c169c1ed4c3c309d83ac17643ba85cc8000508"
Commit
e344509c
authored
Oct 22, 2018
by
HuangBingGui
Browse files
删除目录JeeSpringCloud
parent
51016ad9
Changes
393
Show whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 393+
files are displayed.
Plain diff
Email patch
JeeSpringCloud/src/main/java/com/jeespring/modules/act/utils/DateConverter.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package
com.jeespring.modules.act.utils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
org.apache.commons.beanutils.Converter
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* 日期转换类
* @author ThinkGem
* @version 2013-11-03
*/
public
class
DateConverter
implements
Converter
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DateConverter
.
class
);
private
static
final
String
DATETIME_PATTERN
=
"yyyy-MM-dd HH:mm:ss"
;
private
static
final
String
DATETIME_PATTERN_NO_SECOND
=
"yyyy-MM-dd HH:mm"
;
private
static
final
String
DATE_PATTERN
=
"yyyy-MM-dd"
;
private
static
final
String
MONTH_PATTERN
=
"yyyy-MM"
;
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
Object
convert
(
Class
type
,
Object
value
)
{
Object
result
=
null
;
if
(
type
==
Date
.
class
)
{
try
{
result
=
doConvertToDate
(
value
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
}
else
if
(
type
==
String
.
class
)
{
result
=
doConvertToString
(
value
);
}
return
result
;
}
/**
* Convert String to Date
*
* @param value
* @return
* @throws ParseException
*/
private
Date
doConvertToDate
(
Object
value
)
throws
ParseException
{
Date
result
=
null
;
if
(
value
instanceof
String
)
{
result
=
DateUtils
.
parseDate
((
String
)
value
,
new
String
[]
{
DATE_PATTERN
,
DATETIME_PATTERN
,
DATETIME_PATTERN_NO_SECOND
,
MONTH_PATTERN
});
// all patterns failed, try a milliseconds constructor
if
(
result
==
null
&&
StringUtils
.
isNotEmpty
((
String
)
value
))
{
try
{
result
=
new
Date
(
new
Long
((
String
)
value
).
longValue
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"Converting from milliseconds to Date fails!"
);
e
.
printStackTrace
();
}
}
}
else
if
(
value
instanceof
Object
[])
{
// let's try to convert the first element only
Object
[]
array
=
(
Object
[])
value
;
if
(
array
.
length
>=
1
)
{
value
=
array
[
0
];
result
=
doConvertToDate
(
value
);
}
}
else
if
(
Date
.
class
.
isAssignableFrom
(
value
.
getClass
()))
{
result
=
(
Date
)
value
;
}
return
result
;
}
/**
* Convert Date to String
*
* @param value
* @return
*/
private
String
doConvertToString
(
Object
value
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
DATETIME_PATTERN
);
String
result
=
null
;
if
(
value
instanceof
Date
)
{
result
=
simpleDateFormat
.
format
(
value
);
}
return
result
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/act/utils/ProcessDefCache.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package
com.jeespring.modules.act.utils
;
import
java.util.List
;
import
org.activiti.engine.RepositoryService
;
import
org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity
;
import
org.activiti.engine.impl.pvm.process.ActivityImpl
;
import
org.activiti.engine.repository.ProcessDefinition
;
import
org.apache.commons.lang3.ObjectUtils
;
import
com.jeespring.common.utils.CacheUtils
;
import
com.jeespring.common.utils.SpringContextHolder
;
/**
* 流程定义缓存
* @author ThinkGem
* @version 2013-12-05
*/
public
class
ProcessDefCache
{
private
static
final
String
ACT_CACHE
=
"actCache"
;
private
static
final
String
ACT_CACHE_PD_ID_
=
"pd_id_"
;
/**
* 获得流程定义对象
* @param procDefId
* @return
*/
public
static
ProcessDefinition
get
(
String
procDefId
)
{
ProcessDefinition
pd
=
(
ProcessDefinition
)
CacheUtils
.
get
(
ACT_CACHE
,
ACT_CACHE_PD_ID_
+
procDefId
);
if
(
pd
==
null
)
{
RepositoryService
repositoryService
=
SpringContextHolder
.
getBean
(
RepositoryService
.
class
);
// pd = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(pd);
pd
=
repositoryService
.
createProcessDefinitionQuery
().
processDefinitionId
(
procDefId
).
singleResult
();
if
(
pd
!=
null
)
{
CacheUtils
.
put
(
ACT_CACHE
,
ACT_CACHE_PD_ID_
+
procDefId
,
pd
);
}
}
return
pd
;
}
/**
* 获得流程定义的所有活动节点
* @param procDefId
* @return
*/
public
static
List
<
ActivityImpl
>
getActivitys
(
String
procDefId
)
{
ProcessDefinition
pd
=
get
(
procDefId
);
if
(
pd
!=
null
)
{
return
((
ProcessDefinitionEntity
)
pd
).
getActivities
();
}
return
null
;
}
/**
* 获得流程定义活动节点
* @param procDefId
* @param activityId
* @return
*/
public
static
ActivityImpl
getActivity
(
String
procDefId
,
String
activityId
)
{
ProcessDefinition
pd
=
get
(
procDefId
);
if
(
pd
!=
null
)
{
List
<
ActivityImpl
>
list
=
getActivitys
(
procDefId
);
if
(
list
!=
null
){
for
(
ActivityImpl
activityImpl
:
list
)
{
if
(
activityId
.
equals
(
activityImpl
.
getId
())){
return
activityImpl
;
}
}
}
}
return
null
;
}
/**
* 获取流程定义活动节点名称
* @param procDefId
* @param activityId
* @return
*/
@SuppressWarnings
(
"deprecation"
)
public
static
String
getActivityName
(
String
procDefId
,
String
activityId
)
{
ActivityImpl
activity
=
getActivity
(
procDefId
,
activityId
);
if
(
activity
!=
null
)
{
return
ObjectUtils
.
toString
(
activity
.
getProperty
(
"name"
));
}
return
null
;
}
}
JeeSpringCloud/src/main/java/com/jeespring/modules/act/utils/ProcessDefUtils.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.modules.act.utils
;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
import
org.activiti.engine.ProcessEngine
;
import
org.activiti.engine.delegate.Expression
;
import
org.activiti.engine.impl.RepositoryServiceImpl
;
import
org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior
;
import
org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl
;
import
org.activiti.engine.impl.el.FixedValue
;
import
org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity
;
import
org.activiti.engine.impl.pvm.process.ActivityImpl
;
import
org.activiti.engine.impl.task.TaskDefinition
;
import
org.apache.commons.lang3.reflect.FieldUtils
;
import
org.apache.log4j.Logger
;
/**
* 流程定义相关操作的封装
* @author bluejoe2008@gmail.com
*/
public
abstract
class
ProcessDefUtils
{
public
static
ActivityImpl
getActivity
(
ProcessEngine
processEngine
,
String
processDefId
,
String
activityId
)
{
ProcessDefinitionEntity
pde
=
getProcessDefinition
(
processEngine
,
processDefId
);
return
(
ActivityImpl
)
pde
.
findActivity
(
activityId
);
}
public
static
ProcessDefinitionEntity
getProcessDefinition
(
ProcessEngine
processEngine
,
String
processDefId
)
{
return
(
ProcessDefinitionEntity
)
((
RepositoryServiceImpl
)
processEngine
.
getRepositoryService
()).
getDeployedProcessDefinition
(
processDefId
);
}
public
static
void
grantPermission
(
ActivityImpl
activity
,
String
assigneeExpression
,
String
candidateGroupIdExpressions
,
String
candidateUserIdExpressions
)
throws
Exception
{
TaskDefinition
taskDefinition
=
((
UserTaskActivityBehavior
)
activity
.
getActivityBehavior
()).
getTaskDefinition
();
taskDefinition
.
setAssigneeExpression
(
assigneeExpression
==
null
?
null
:
new
FixedValue
(
assigneeExpression
));
FieldUtils
.
writeField
(
taskDefinition
,
"candidateUserIdExpressions"
,
ExpressionUtils
.
stringToExpressionSet
(
candidateUserIdExpressions
),
true
);
FieldUtils
.
writeField
(
taskDefinition
,
"candidateGroupIdExpressions"
,
ExpressionUtils
.
stringToExpressionSet
(
candidateGroupIdExpressions
),
true
);
Logger
.
getLogger
(
ProcessDefUtils
.
class
).
info
(
String
.
format
(
"granting previledges for [%s, %s, %s] on [%s, %s]"
,
assigneeExpression
,
candidateGroupIdExpressions
,
candidateUserIdExpressions
,
activity
.
getProcessDefinition
().
getKey
(),
activity
.
getProperty
(
"name"
)));
}
/**
* 实现常见类型的expression的包装和转换
*
* @author bluejoe2008@gmail.com
*
*/
public
static
class
ExpressionUtils
{
public
static
Expression
stringToExpression
(
ProcessEngineConfigurationImpl
conf
,
String
expr
)
{
return
conf
.
getExpressionManager
().
createExpression
(
expr
);
}
public
static
Expression
stringToExpression
(
String
expr
)
{
return
new
FixedValue
(
expr
);
}
public
static
Set
<
Expression
>
stringToExpressionSet
(
String
exprs
)
{
Set
<
Expression
>
set
=
new
LinkedHashSet
<
Expression
>();
for
(
String
expr
:
exprs
.
split
(
";"
))
{
set
.
add
(
stringToExpression
(
expr
));
}
return
set
;
}
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/act/utils/PropertyType.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package
com.jeespring.modules.act.utils
;
import
java.util.Date
;
/**
* 属性数据类型
* @author ThinkGem
* @version 2013-11-03
*/
public
enum
PropertyType
{
S
(
String
.
class
),
I
(
Integer
.
class
),
L
(
Long
.
class
),
F
(
Float
.
class
),
N
(
Double
.
class
),
D
(
Date
.
class
),
SD
(
java
.
sql
.
Date
.
class
),
B
(
Boolean
.
class
);
private
Class
<?>
clazz
;
private
PropertyType
(
Class
<?>
clazz
)
{
this
.
clazz
=
clazz
;
}
public
Class
<?>
getValue
()
{
return
clazz
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/act/utils/Variable.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package
com.jeespring.modules.act.utils
;
import
java.util.Map
;
import
org.apache.commons.beanutils.ConvertUtils
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.google.common.collect.Maps
;
import
com.jeespring.common.utils.StringUtils
;
/**
* 流程变量对象
* @author ThinkGem
* @version 2013-11-03
*/
public
class
Variable
{
private
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
private
String
keys
;
private
String
values
;
private
String
types
;
public
Variable
(){
}
public
Variable
(
Map
<
String
,
Object
>
map
){
this
.
map
=
map
;
}
public
String
getKeys
()
{
return
keys
;
}
public
void
setKeys
(
String
keys
)
{
this
.
keys
=
keys
;
}
public
String
getValues
()
{
return
values
;
}
public
void
setValues
(
String
values
)
{
this
.
values
=
values
;
}
public
String
getTypes
()
{
return
types
;
}
public
void
setTypes
(
String
types
)
{
this
.
types
=
types
;
}
@JsonIgnore
public
Map
<
String
,
Object
>
getVariableMap
()
{
ConvertUtils
.
register
(
new
DateConverter
(),
java
.
util
.
Date
.
class
);
if
(
StringUtils
.
isBlank
(
keys
))
{
return
map
;
}
String
[]
arrayKey
=
keys
.
split
(
","
);
String
[]
arrayValue
=
values
.
split
(
","
);
String
[]
arrayType
=
types
.
split
(
","
);
for
(
int
i
=
0
;
i
<
arrayKey
.
length
;
i
++)
{
String
key
=
arrayKey
[
i
];
String
value
=
arrayValue
[
i
];
String
type
=
arrayType
[
i
];
Class
<?>
targetType
=
Enum
.
valueOf
(
PropertyType
.
class
,
type
).
getValue
();
Object
objectValue
=
ConvertUtils
.
convert
(
value
,
targetType
);
map
.
put
(
key
,
objectValue
);
}
return
map
;
}
public
Map
<
String
,
Object
>
getMap
()
{
return
map
;
}
}
JeeSpringCloud/src/main/java/com/jeespring/modules/activeMQ/Email.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.modules.activeMQ
;
import
com.jeespring.common.persistence.AbstractBaseEntity
;
/**
* 消息生产者.
* @author 黄炳桂 516821420@qq.com
* @version v.0.1
* @date 2016年8月23日
*/
public
class
Email
extends
AbstractBaseEntity
<
Email
>
{
private
String
toMailAddr
;
private
String
subject
;
private
String
message
;
public
String
getToMailAddr
()
{
return
toMailAddr
;
}
public
void
setToMailAddr
(
String
toMailAddr
)
{
this
.
toMailAddr
=
toMailAddr
;
}
public
String
getSubject
()
{
return
subject
;
}
public
void
setSubject
(
String
subject
)
{
this
.
subject
=
subject
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
}
JeeSpringCloud/src/main/java/com/jeespring/modules/activeMQ/JeeSpringConsumer.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.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
;
import
java.util.List
;
import
java.util.Map
;
/**
* 消息消费者.
* @author 黄炳桂 516821420@qq.com
* @version v.0.1
* @date 2016年8月23日
*/
@Component
public
class
JeeSpringConsumer
{
private
static
final
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
// 使用JmsListener配置消费者监听的队列,其中text是接收到的消息
@JmsListener
(
destination
=
JeeSpringProducer
.
ActiveMQQueueKeySendMailList
)
public
void
receiveQueue
(
List
<
String
>
list
)
{
String
toMailAddr
=
list
.
get
(
0
);
String
subject
=
list
.
get
(
1
);
String
message
=
list
.
get
(
2
);
SendMailUtil
.
sendCommonMail
(
toMailAddr
,
subject
,
message
);
}
@JmsListener
(
destination
=
JeeSpringProducer
.
ActiveMQQueueKeySendMailObject
)
public
void
receiveQueue
(
Email
email
)
{
SendMailUtil
.
sendCommonMail
(
email
.
getToMailAddr
(),
email
.
getSubject
(),
email
.
getMessage
());
}
// 使用JmsListener配置消费者监听的队列,其中text是接收到的消息
@JmsListener
(
destination
=
JeeSpringProducer
.
ActiveMQQueueKey
)
public
void
receiveQueue
(
String
text
)
{
System
.
out
.
println
(
dateFormat
.
format
(
new
Date
())
+
" | "
+
"ActiveMQ Consumer :"
+
JeeSpringProducer
.
ActiveMQQueueKey
+
":收到的报文为:"
+
text
);
}
// 使用JmsListener配置消费者监听的队列,其中text是接收到的消息
@JmsListener
(
destination
=
JeeSpringProducer
.
ActiveMQQueueKeyA
)
public
void
receiveQueueA
(
String
text
)
{
System
.
out
.
println
(
dateFormat
.
format
(
new
Date
())
+
" | "
+
"ActiveMQ Consumer :"
+
JeeSpringProducer
.
ActiveMQQueueKeyA
+
":收到的报文为:"
+
text
);
}
// 使用JmsListener配置消费者监听的队列,其中text是接收到的消息
@JmsListener
(
destination
=
JeeSpringProducer
.
ActiveMQQueueKeyB
)
@SendTo
(
"jeespring.out.queue"
)
public
String
receiveQueueB
(
String
text
)
{
System
.
out
.
println
(
dateFormat
.
format
(
new
Date
())
+
" | "
+
"ActiveMQ Consumer :"
+
JeeSpringProducer
.
ActiveMQQueueKeyA
+
"收到的报文为:"
+
text
);
return
"return message:"
+
text
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/activeMQ/JeeSpringProducer.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.modules.activeMQ
;
import
com.jeespring.common.redis.RedisUtils
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.apache.xmlbeans.impl.xb.xsdschema.Public
;
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
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 消息生产者.
* @author 黄炳桂 516821420@qq.com
* @version v.0.1
* @date 2016年8月23日
*/
@Service
public
class
JeeSpringProducer
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
RedisUtils
.
class
);
public
static
final
String
ActiveMQQueueKeySendMailList
=
"JeeSpring.ActiveMQ.queue.sendmaillist"
;
public
static
final
String
ActiveMQQueueKeySendMailObject
=
"JeeSpring.ActiveMQ.queue.sendmailobject"
;
public
static
final
String
ActiveMQQueueKey
=
"JeeSpring.ActiveMQ.queue"
;
public
static
final
String
ActiveMQQueueKeyA
=
"JeeSpring.ActiveMQ.queueA"
;
public
static
final
String
ActiveMQQueueKeyB
=
"JeeSpring.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
(
Destination
destination
,
List
<
String
>
list
){
try
{
jmsTemplate
.
convertAndSend
(
destination
,
list
);
}
catch
(
Exception
e
){
logger
.
error
(
dateFormat
.
format
(
new
Date
())
+
" | "
+
"ActvieMQ:"
+
RUN_MESSAGE
+
e
.
getMessage
(),
RUN_MESSAGE
+
e
.
getMessage
());
}
}
public
void
sendMessage
(
Destination
destination
,
Email
email
){
try
{
jmsTemplate
.
convertAndSend
(
destination
,
email
);
}
catch
(
Exception
e
){
logger
.
error
(
dateFormat
.
format
(
new
Date
())
+
" | "
+
"ActvieMQ:"
+
RUN_MESSAGE
+
e
.
getMessage
(),
RUN_MESSAGE
+
e
.
getMessage
());
}
}
public
void
sendMessage
(
Destination
destination
,
String
message
){
try
{
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
(
JeeSpringProducer
.
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
(
JeeSpringProducer
.
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
=
"jeespring.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/jeespring/modules/activeMQ/JeeSpringProducerRestController.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.modules.activeMQ
;
import
com.jeespring.common.utils.SendMailUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.bind.annotation.RestController
;
import
javax.jms.Destination
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* ActiveMQController
* @author 黄炳桂 516821420@qq.com
* @version 2014-05-16
*/
@RestController
@RequestMapping
(
value
=
"rest/mq/producer"
)
@Api
(
value
=
"ActiveMQ队列任务云接口"
,
description
=
"ActiveMQ队列任务云接口"
)
public
class
JeeSpringProducerRestController
{
@Autowired
private
JeeSpringProducer
jeeSpringProducer
;
@RequestMapping
(
value
=
{
"sendMessage"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"ActiveMQ队列云发送信息(Content-Type为text/html)"
,
notes
=
"ActiveMQ队列云发送信息(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"message"
,
value
=
"信息"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
void
sendMessage
(
@RequestParam
(
required
=
false
)
String
message
){
Destination
destination
=
new
ActiveMQQueue
(
JeeSpringProducer
.
ActiveMQQueueKey
);
jeeSpringProducer
.
sendMessage
(
destination
,
message
);
}
@RequestMapping
(
value
=
{
"sendMail"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"ActiveMQ队列云发送邮件(Content-Type为text/html)"
,
notes
=
"ActiveMQ队列云发送邮件(Content-Type为text/html)"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"toMailAddr"
,
value
=
"接收邮件"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"subject"
,
value
=
"邮件主题"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"message"
,
value
=
"邮件内容"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
})
public
void
sendMail
(
@RequestParam
(
required
=
false
)
String
toMailAddr
,
@RequestParam
(
required
=
false
)
String
subject
,
@RequestParam
(
required
=
false
)
String
message
)
{
List
<
String
>
list
=
new
ArrayList
();
list
.
add
(
toMailAddr
);
list
.
add
(
subject
);
list
.
add
(
message
);
Destination
destination
=
new
ActiveMQQueue
(
JeeSpringProducer
.
ActiveMQQueueKeySendMailList
);
jeeSpringProducer
.
sendMessage
(
destination
,
list
);
}
@RequestMapping
(
value
=
{
"sendMailObject"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"ActiveMQ队列云发送邮件(Content-Type为text/html)"
,
notes
=
"ActiveMQ队列云发送邮件(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"email"
,
value
=
"email信息{toMailAddr,subject,message}"
,
required
=
false
,
dataType
=
"Email"
,
paramType
=
"query"
)
public
void
sendMailObject
(
Email
email
)
{
Destination
destination
=
new
ActiveMQQueue
(
JeeSpringProducer
.
ActiveMQQueueKeySendMailObject
);
jeeSpringProducer
.
sendMessage
(
destination
,
email
);
}
}
JeeSpringCloud/src/main/java/com/jeespring/modules/aop/AOPService.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.modules.aop
;
import
com.jeespring.common.utils.SendMailUtil
;
import
com.jeespring.modules.activeMQ.Email
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* JeeSpring AOP
* @author 黄炳桂 516821420@qq.com
* @version v.0.1
* @date 2016年8月23日
*/
@Aspect
@Component
public
class
AOPService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
AOPService
.
class
);
private
static
final
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
// defined aop pointcut
//@Pointcut("execution(* com.company.project.modules.*.*(..))")
//@Pointcut("execution(* com.company.project.modules..*.*(..))")
/*任意公共方法的执行:
execution(public * *(..))
任何一个以“set”开始的方法的执行:
execution(* set*(..))
AccountService 接口的任意方法的执行:
execution(* com.xyz.service.AccountService.*(..))
定义在service包里的任意方法的执行:
execution(* com.xyz.service.*.*(..))
定义在service包和所有子包里的任意类的任意方法的执行:
execution(* com.xyz.service..*.*(..))
定义在pointcutexp包和所有子包里的JoinPointObjP2类的任意方法的执行:
execution(* com.test.spring.aop.pointcutexp..JoinPointObjP2.*(..))
最靠近(..)的为方法名,靠近.*(..))的为类名或者接口名,如上例的JoinPointObjP2.*(..))*/
@Pointcut
(
"execution(* com.company.project.modules.*.*.*.*(..))"
)
public
void
controllerLog
()
{
}
// log all of controller
@Before
(
"controllerLog()"
)
public
void
before
(
JoinPoint
joinPoint
)
{
//System.out.println("AOP Before:"+joinPoint.getSignature().getDeclaringType() + ",method:" + joinPoint.getSignature().getName()
//+ ",params:" + Arrays.asList(joinPoint.getArgs()));
logger
.
debug
(
dateFormat
.
format
(
new
Date
())
+
" | "
+
"AOP Before:"
+
joinPoint
.
getSignature
().
getDeclaringType
()
+
",method:"
+
joinPoint
.
getSignature
().
getName
());
/*Email email=new Email();
email.setToMailAddr("516821420@qq.com");
email.setSubject("JeeSpring");
email.setMessage("JeeSpring AOP!");
SendMailUtil.sendCommonMail(email.getToMailAddr(),email.getSubject(),email.getMessage());*/
}
/*@Around("controllerLog()")
public void around(ProceedingJoinPoint pjp) throws Throwable{
pjp.proceed();
}*/
// result of return
@AfterReturning
(
pointcut
=
"controllerLog()"
,
returning
=
"retVal"
)
public
void
after
(
JoinPoint
joinPoint
,
Object
retVal
)
{
//System.out.println("AOP AfterReturning:"+retVal);
logger
.
debug
(
dateFormat
.
format
(
new
Date
())
+
" | "
+
"AOP AfterReturning:Object"
);
}
}
JeeSpringCloud/src/main/java/com/jeespring/modules/baiduface/rest/FaceRecognitionRestController.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.modules.baiduface.rest
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeespring.common.utils.GsonUtils
;
import
com.jeespring.common.utils.HttpUtil
;
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.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 人脸识别Controller
* @author 唐继涛
* @version 2018-7-13
*/
@RestController
@RequestMapping
(
value
=
"/rest/face"
)
@Api
(
value
=
"face百度人脸识别API接口"
,
description
=
"face百度人脸识别API接口"
)
public
class
FaceRecognitionRestController
extends
AbstractBaseController
{
//设置APPID/AK/SK
public
static
final
String
APP_ID
=
"11483847"
;
public
static
final
String
API_KEY
=
"Hn5zrGgRe5WWiXV1GcWYirFT"
;
public
static
final
String
SECRET_KEY
=
"vlzV3XEvuc1zGa9cfi5PpdRuFlfz08gu"
;
public
String
id
=
null
;
@RequestMapping
(
value
=
{
"match"
},
method
=
{
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"人脸对比(Content-Type为application/json)"
,
notes
=
"人脸对比(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"String"
,
value
=
"人脸对比"
,
dataType
=
"String"
)
public
String
match
(
@RequestBody
String
imgStr
)
{
// 请求url
String
url
=
"https://aip.baidubce.com/rest/2.0/face/v3/match"
;
//百度人脸对比的API
try
{
// String str = this.getUser(userId);
List
<
Map
<
String
,
Object
>>
images
=
new
ArrayList
<>();
Map
<
String
,
Object
>
map1
=
new
HashMap
<>();
map1
.
put
(
"image"
,
imgStr
);
map1
.
put
(
"image_type"
,
"BASE64"
);
map1
.
put
(
"face_type"
,
"LIVE"
);
map1
.
put
(
"quality_control"
,
"LOW"
);
map1
.
put
(
"liveness_control"
,
"NORMAL"
);
Map
<
String
,
Object
>
map2
=
new
HashMap
<>();
map2
.
put
(
"image"
,
imgStr
);
map2
.
put
(
"image_type"
,
"BASE64"
);
map2
.
put
(
"face_type"
,
"LIVE"
);
map2
.
put
(
"quality_control"
,
"LOW"
);
map2
.
put
(
"liveness_control"
,
"NORMAL"
);
images
.
add
(
map1
);
images
.
add
(
map2
);
String
param
=
GsonUtils
.
toJson
(
images
);
String
token
=
FaceRecognitionRestController
.
getAuth
();
String
result
=
HttpUtil
.
post
(
url
,
token
,
"application/json"
,
param
);
System
.
out
.
println
(
result
);
return
result
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
@RequestMapping
(
value
=
{
"search"
},
method
=
{
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"人脸搜索(Content-Type为application/json)"
,
notes
=
"人脸搜索(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"String"
,
value
=
"人脸搜索"
,
dataType
=
"String"
)
public
Result
search
(
@RequestBody
String
imgStr
)
{
// 请求url
String
url
=
"https://aip.baidubce.com/rest/2.0/face/v3/search"
;
//百度人脸搜索的API
Result
result
=
ResultFactory
.
getSuccessResult
();
try
{
String
Str
=
this
.
GroupGetlist
();
//调用百度查询用户组的API接口,将查询返回的数据接收。
JSONObject
baiJsonObject
=
JSONObject
.
parseObject
(
Str
);
//将数据转换为json对象类型的数据。
String
str
=
baiJsonObject
.
getJSONObject
(
"result"
).
getString
(
"group_id_list"
).
replace
(
"\""
,
""
).
replace
(
"["
,
""
).
replace
(
"]"
,
""
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"image"
,
imgStr
);
map
.
put
(
"liveness_control"
,
"NORMAL"
);
map
.
put
(
"group_id_list"
,
str
);
map
.
put
(
"image_type"
,
"BASE64"
);
map
.
put
(
"quality_control"
,
"LOW"
);
String
param
=
GsonUtils
.
toJson
(
map
);
//调用百度的人脸检测API获取百度API返回的数据。
String
token
=
FaceRecognitionRestController
.
getAuth
();
String
baiDuResult
=
HttpUtil
.
post
(
url
,
token
,
"application/json"
,
param
);
JSONObject
returnResult
=
JSONObject
.
parseObject
(
baiDuResult
);
//将百度返回的数据转为json对象类型的数据。
String
user
=
returnResult
.
getJSONObject
(
"result"
).
getString
(
"user_list"
).
replace
(
"\""
,
""
).
replace
(
"["
,
""
)
.
replace
(
"]"
,
""
).
replace
(
"{"
,
""
).
replace
(
"}"
,
""
);
String
[]
userList
=
user
.
split
(
","
);
//根据逗号分隔用户信息。
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
toJSON
(
userList
);
//将字符串数组转为json 数组类型的。
String
[]
scoreList
=
((
String
)
jsonArray
.
get
(
0
)).
split
(
":"
);
//获取json数组第一条数据然后根据:分隔。
JSONArray
json
=
(
JSONArray
)
JSONArray
.
toJSON
(
scoreList
);
//获取百度返回user_list数据的score评分。
String
scoreString
=
String
.
valueOf
(
json
.
get
(
1
));
//将分数值转成string类型的。
Double
score
=
Double
.
parseDouble
(
scoreString
);
//将string类型的转换成double。
//判断分数值
if
(
score
>=
80
){
result
=
ResultFactory
.
getSuccessResult
(
"检测成功!"
);
}
else
result
=
ResultFactory
.
getErrorResult
(
"检测失败,请重新扫描!!"
);
return
result
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
@RequestMapping
(
value
=
{
"add"
},
method
=
{
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"人脸注册(Content-Type为application/json)"
,
notes
=
"人脸注册(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"String"
,
value
=
"人脸注册"
,
dataType
=
"String"
)
public
Result
add
(
@RequestBody
String
imgStr
,
String
userId
)
{
// 请求url
String
url
=
"https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/add"
;
//百度添加到人脸库的API
Result
result
=
ResultFactory
.
getSuccessResult
();
try
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"image"
,
imgStr
);
map
.
put
(
"group_id"
,
"测试人脸库"
);
map
.
put
(
"user_id"
,
11
);
map
.
put
(
"user_info"
,
"测试"
);
map
.
put
(
"liveness_control"
,
"NORMAL"
);
map
.
put
(
"image_type"
,
"BASE64"
);
map
.
put
(
"quality_control"
,
"NORMAL"
);
String
param
=
GsonUtils
.
toJson
(
map
);
String
token
=
FaceRecognitionRestController
.
getAuth
();
String
baiDuResult
=
HttpUtil
.
post
(
url
,
token
,
"application/json"
,
param
);
if
(
baiDuResult
.
contains
(
"SUCCESS"
))
{
result
=
ResultFactory
.
getSuccessResult
(
"注册成功!"
);
}
else
result
=
ResultFactory
.
getErrorResult
(
"注册失败!"
);
return
result
;
}
catch
(
Exception
e
)
{
logger
.
info
(
e
.
toString
());
}
return
null
;
}
/**
* 组列表查询
*/
private
String
GroupGetlist
()
{
// 请求url
String
url
=
"https://aip.baidubce.com/rest/2.0/face/v3/faceset/group/getlist"
;
try
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"start"
,
0
);
map
.
put
(
"length"
,
100
);
String
param
=
GsonUtils
.
toJson
(
map
);
String
token
=
FaceRecognitionRestController
.
getAuth
();
String
result
=
HttpUtil
.
post
(
url
,
token
,
"application/json"
,
param
);
return
result
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* 获取API访问token
* 该token有一定的有效期,需要自行管理,当失效时需重新获取.
* @return assess_token 示例:
* "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567"
*/
public
static
String
getAuth
()
{
// 获取token地址
String
authHost
=
"https://aip.baidubce.com/oauth/2.0/token?"
;
String
getAccessTokenUrl
=
authHost
// 1. grant_type为固定参数
+
"grant_type=client_credentials"
// 2. 官网获取的 API Key
+
"&client_id="
+
API_KEY
// 3. 官网获取的 Secret Key
+
"&client_secret="
+
SECRET_KEY
;
try
{
URL
realUrl
=
new
URL
(
getAccessTokenUrl
);
// 打开和URL之间的连接
HttpURLConnection
connection
=
(
HttpURLConnection
)
realUrl
.
openConnection
();
connection
.
setRequestMethod
(
"GET"
);
connection
.
connect
();
// 获取所有响应头字段
Map
<
String
,
List
<
String
>>
map
=
connection
.
getHeaderFields
();
// 遍历所有的响应头字段
for
(
String
key
:
map
.
keySet
())
{
System
.
err
.
println
(
key
+
"--->"
+
map
.
get
(
key
));
}
// 定义 BufferedReader输入流来读取URL的响应
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
String
result
=
""
;
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
+=
line
;
}
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
String
access_token
=
jsonObject
.
getString
(
"access_token"
);
System
.
out
.
print
(
access_token
);
return
access_token
;
}
catch
(
Exception
e
)
{
System
.
err
.
printf
(
"获取token失败!"
);
e
.
printStackTrace
(
System
.
err
);
}
return
null
;
}
public
static
void
main
(
String
[]
args
)
{
// new FaceSpot().getAuth();
getAuth
();
}
}
JeeSpringCloud/src/main/java/com/jeespring/modules/echarts/dao/ChinaWeatherDataBeanDao.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2015-2020 <a href="http://www.jeespring.org/">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.echarts.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
com.jeespring.modules.echarts.entity.ChinaWeatherDataBean
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 城市气温DAO接口
* @author lgf
* @version 2016-06-02
*/
@Mapper
public
interface
ChinaWeatherDataBeanDao
extends
InterfaceBaseDao
<
ChinaWeatherDataBean
>
{
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/echarts/dao/PieClassDao.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2015-2020 <a href="http://www.jeespring.org/">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.echarts.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
com.jeespring.modules.echarts.entity.PieClass
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 班级DAO接口
* @author lgf
* @version 2016-05-26
*/
@Mapper
public
interface
PieClassDao
extends
InterfaceBaseDao
<
PieClass
>
{
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/echarts/entity/ChinaWeatherDataBean.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2015-2020 <a href="http://www.jeespring.org/">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.echarts.entity
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.jeespring.common.persistence.AbstractBaseEntity
;
import
com.jeespring.common.utils.excel.annotation.ExcelField
;
/**
* 城市气温Entity
* @author lgf
* @version 2016-06-02
*/
public
class
ChinaWeatherDataBean
extends
AbstractBaseEntity
<
ChinaWeatherDataBean
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
Date
datestr
;
// 日期
private
Double
beijingMaxTemp
;
// 北京最高气温
private
Double
beijingMinTemp
;
// 北京最低气温
private
Double
changchunMaxTemp
;
// 长春最高气温
private
Double
changchunMinTemp
;
// 长春最低气温
private
Double
shenyangMaxTemp
;
// 沈阳最高气温
private
Double
shenyangMinTemp
;
// 沈阳最低气温
private
Double
haerbinMaxTemp
;
// 哈尔滨最高气温
private
Double
haerbinMinTemp
;
// 哈尔滨最低气温
public
ChinaWeatherDataBean
()
{
super
();
}
public
ChinaWeatherDataBean
(
String
id
){
super
(
id
);
}
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ExcelField
(
title
=
"日期"
,
align
=
2
,
sort
=
7
)
public
Date
getDatestr
()
{
return
datestr
;
}
public
void
setDatestr
(
Date
datestr
)
{
this
.
datestr
=
datestr
;
}
@ExcelField
(
title
=
"北京最高气温"
,
align
=
2
,
sort
=
8
)
public
Double
getBeijingMaxTemp
()
{
return
beijingMaxTemp
;
}
public
void
setBeijingMaxTemp
(
Double
beijingMaxTemp
)
{
this
.
beijingMaxTemp
=
beijingMaxTemp
;
}
@ExcelField
(
title
=
"北京最低气温"
,
align
=
2
,
sort
=
9
)
public
Double
getBeijingMinTemp
()
{
return
beijingMinTemp
;
}
public
void
setBeijingMinTemp
(
Double
beijingMinTemp
)
{
this
.
beijingMinTemp
=
beijingMinTemp
;
}
@ExcelField
(
title
=
"长春最高气温"
,
align
=
2
,
sort
=
10
)
public
Double
getChangchunMaxTemp
()
{
return
changchunMaxTemp
;
}
public
void
setChangchunMaxTemp
(
Double
changchunMaxTemp
)
{
this
.
changchunMaxTemp
=
changchunMaxTemp
;
}
@ExcelField
(
title
=
"长春最低气温"
,
align
=
2
,
sort
=
11
)
public
Double
getChangchunMinTemp
()
{
return
changchunMinTemp
;
}
public
void
setChangchunMinTemp
(
Double
changchunMinTemp
)
{
this
.
changchunMinTemp
=
changchunMinTemp
;
}
@ExcelField
(
title
=
"沈阳最高气温"
,
align
=
2
,
sort
=
12
)
public
Double
getShenyangMaxTemp
()
{
return
shenyangMaxTemp
;
}
public
void
setShenyangMaxTemp
(
Double
shenyangMaxTemp
)
{
this
.
shenyangMaxTemp
=
shenyangMaxTemp
;
}
@ExcelField
(
title
=
"沈阳最低气温"
,
align
=
2
,
sort
=
13
)
public
Double
getShenyangMinTemp
()
{
return
shenyangMinTemp
;
}
public
void
setShenyangMinTemp
(
Double
shenyangMinTemp
)
{
this
.
shenyangMinTemp
=
shenyangMinTemp
;
}
@ExcelField
(
title
=
"哈尔滨最高气温"
,
align
=
2
,
sort
=
14
)
public
Double
getHaerbinMaxTemp
()
{
return
haerbinMaxTemp
;
}
public
void
setHaerbinMaxTemp
(
Double
haerbinMaxTemp
)
{
this
.
haerbinMaxTemp
=
haerbinMaxTemp
;
}
@ExcelField
(
title
=
"哈尔滨最低气温"
,
align
=
2
,
sort
=
15
)
public
Double
getHaerbinMinTemp
()
{
return
haerbinMinTemp
;
}
public
void
setHaerbinMinTemp
(
Double
haerbinMinTemp
)
{
this
.
haerbinMinTemp
=
haerbinMinTemp
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/echarts/entity/PieClass.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2015-2020 <a href="http://www.jeespring.org/">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.echarts.entity
;
import
org.hibernate.validator.constraints.Length
;
import
com.jeespring.common.persistence.AbstractBaseEntity
;
import
com.jeespring.common.utils.excel.annotation.ExcelField
;
/**
* 班级Entity
* @author lgf
* @version 2016-05-26
*/
public
class
PieClass
extends
AbstractBaseEntity
<
PieClass
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
className
;
// 班级
private
Integer
num
;
// 人数
public
PieClass
()
{
super
();
}
public
PieClass
(
String
id
){
super
(
id
);
}
@Length
(
min
=
0
,
max
=
64
,
message
=
"班级长度必须介于 0 和 64 之间"
)
@ExcelField
(
title
=
"班级"
,
align
=
2
,
sort
=
7
)
public
String
getClassName
()
{
return
className
;
}
public
void
setClassName
(
String
className
)
{
this
.
className
=
className
;
}
@ExcelField
(
title
=
"人数"
,
align
=
2
,
sort
=
8
)
public
Integer
getNum
()
{
return
num
;
}
public
void
setNum
(
Integer
num
)
{
this
.
num
=
num
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/echarts/service/ChinaWeatherDataBeanService.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2015-2020 <a href="http://www.jeespring.org/">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.echarts.service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.service.AbstractBaseService
;
import
com.jeespring.modules.echarts.entity.ChinaWeatherDataBean
;
import
com.jeespring.modules.echarts.dao.ChinaWeatherDataBeanDao
;
/**
* 城市气温Service
* @author lgf
* @version 2016-06-02
*/
@Service
@Transactional
(
readOnly
=
true
)
public
class
ChinaWeatherDataBeanService
extends
AbstractBaseService
<
ChinaWeatherDataBeanDao
,
ChinaWeatherDataBean
>
{
public
ChinaWeatherDataBean
get
(
String
id
)
{
return
super
.
get
(
id
);
}
public
List
<
ChinaWeatherDataBean
>
findList
(
ChinaWeatherDataBean
chinaWeatherDataBean
)
{
return
super
.
findList
(
chinaWeatherDataBean
);
}
public
Page
<
ChinaWeatherDataBean
>
findPage
(
Page
<
ChinaWeatherDataBean
>
page
,
ChinaWeatherDataBean
chinaWeatherDataBean
)
{
return
super
.
findPage
(
page
,
chinaWeatherDataBean
);
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
ChinaWeatherDataBean
chinaWeatherDataBean
)
{
super
.
save
(
chinaWeatherDataBean
);
}
@Transactional
(
readOnly
=
false
)
public
void
delete
(
ChinaWeatherDataBean
chinaWeatherDataBean
)
{
super
.
delete
(
chinaWeatherDataBean
);
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/echarts/service/PieClassService.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2015-2020 <a href="http://www.jeespring.org/">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.echarts.service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.service.AbstractBaseService
;
import
com.jeespring.modules.echarts.entity.PieClass
;
import
com.jeespring.modules.echarts.dao.PieClassDao
;
/**
* 班级Service
* @author JeeSpring
* @version 2016-05-26
*/
@Service
@Transactional
(
readOnly
=
true
)
public
class
PieClassService
extends
AbstractBaseService
<
PieClassDao
,
PieClass
>
{
public
PieClass
get
(
String
id
)
{
return
super
.
get
(
id
);
}
public
List
<
PieClass
>
findList
(
PieClass
pieClass
)
{
return
super
.
findList
(
pieClass
);
}
public
Page
<
PieClass
>
findPage
(
Page
<
PieClass
>
page
,
PieClass
pieClass
)
{
return
super
.
findPage
(
page
,
pieClass
);
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
PieClass
pieClass
)
{
super
.
save
(
pieClass
);
}
@Transactional
(
readOnly
=
false
)
public
void
delete
(
PieClass
pieClass
)
{
super
.
delete
(
pieClass
);
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/echarts/web/BarController.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.modules.echarts.web
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
com.jeespring.common.web.AbstractBaseController
;
@Controller
@RequestMapping
(
value
=
"${adminPath}/echarts/bar"
)
public
class
BarController
extends
AbstractBaseController
{
private
static
final
long
serialVersionUID
=
-
6886697421555222670L
;
private
List
<
String
>
xAxisData
;
private
Map
<
String
,
List
<
Double
>>
yAxisData
;
private
Map
<
String
,
Integer
>
yAxisIndex
;
@RequestMapping
(
value
=
{
"index"
,
""
})
public
String
index
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
//x轴数据
request
.
setAttribute
(
"xAxisData"
,
getxAxisData
());
//y轴数据
request
.
setAttribute
(
"yAxisData"
,
getyAxisData
());
//Y轴双轴情况下的位置定位
request
.
setAttribute
(
"yAxisIndex"
,
getyAxisIndex
());
return
"modules/echarts/bar"
;
}
public
List
<
String
>
getxAxisData
(){
xAxisData
=
new
ArrayList
<
String
>();
xAxisData
.
add
(
"2015-10-10"
);
xAxisData
.
add
(
"2015-10-11"
);
xAxisData
.
add
(
"2015-10-12"
);
xAxisData
.
add
(
"2015-10-13"
);
xAxisData
.
add
(
"2015-10-14"
);
return
xAxisData
;
}
public
Map
<
String
,
List
<
Double
>>
getyAxisData
(){
Random
random
=
new
Random
();
yAxisData
=
new
HashMap
<
String
,
List
<
Double
>>();
List
<
Double
>
data1
=
new
ArrayList
<
Double
>();
data1
.
add
(
random
.
nextDouble
());
data1
.
add
(
random
.
nextDouble
());
data1
.
add
(
random
.
nextDouble
());
data1
.
add
(
random
.
nextDouble
());
data1
.
add
(
random
.
nextDouble
());
yAxisData
.
put
(
"柱状一"
,
data1
);
List
<
Double
>
data2
=
new
ArrayList
<
Double
>();
data2
.
add
(
random
.
nextDouble
());
data2
.
add
(
random
.
nextDouble
());
data2
.
add
(
random
.
nextDouble
());
data2
.
add
(
random
.
nextDouble
());
data2
.
add
(
random
.
nextDouble
());
yAxisData
.
put
(
"柱状二"
,
data2
);
return
yAxisData
;
}
public
Map
<
String
,
Integer
>
getyAxisIndex
(){
yAxisIndex
=
new
HashMap
<
String
,
Integer
>();
yAxisIndex
.
put
(
"柱状一"
,
0
);
yAxisIndex
.
put
(
"柱状二"
,
1
);
return
yAxisIndex
;
}
}
JeeSpringCloud/src/main/java/com/jeespring/modules/echarts/web/ChinaWeatherDataBeanController.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2015-2020 <a href="http://www.jeespring.org/">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.echarts.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
javax.validation.ConstraintViolationException
;
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.config.Global
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.utils.DateUtils
;
import
com.jeespring.common.utils.MyBeanUtils
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.utils.excel.ExportExcel
;
import
com.jeespring.common.utils.excel.ImportExcel
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.echarts.entity.ChinaWeatherDataBean
;
import
com.jeespring.modules.echarts.service.ChinaWeatherDataBeanService
;
/**
* 城市气温Controller
* @author JeeSpring
* @version 2016-05-26
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/echarts/chinaWeatherDataBean"
)
public
class
ChinaWeatherDataBeanController
extends
AbstractBaseController
{
@Autowired
private
ChinaWeatherDataBeanService
chinaWeatherDataBeanService
;
@ModelAttribute
public
ChinaWeatherDataBean
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
ChinaWeatherDataBean
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
chinaWeatherDataBeanService
.
get
(
id
);
}
if
(
entity
==
null
){
entity
=
new
ChinaWeatherDataBean
();
}
return
entity
;
}
/**
* 城市气温列表页面
*/
@RequiresPermissions
(
"echarts:chinaWeatherDataBean:list"
)
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
ChinaWeatherDataBean
chinaWeatherDataBean
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
<
ChinaWeatherDataBean
>
page
=
chinaWeatherDataBeanService
.
findPage
(
new
Page
<
ChinaWeatherDataBean
>(
request
,
response
),
chinaWeatherDataBean
);
model
.
addAttribute
(
"page"
,
page
);
//折线图列表数据
//X轴的数据
List
<
String
>
xAxisData
=
new
ArrayList
<
String
>();
//Y轴的数据
Map
<
String
,
List
<
Double
>>
yAxisData
=
new
HashMap
<
String
,
List
<
Double
>>();
//Y轴双轴情况下的位置定位
Map
<
String
,
Integer
>
yAxisIndex
=
new
HashMap
<
String
,
Integer
>();
List
<
ChinaWeatherDataBean
>
weatherDataList
=
chinaWeatherDataBeanService
.
findList
(
chinaWeatherDataBean
);
List
<
Double
>
beijingMaxTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
beijingMinTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
changchunMaxTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
changchunMinTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
shenyangMaxTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
shenyangMinTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
haerbinMaxTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
haerbinMinTemp
=
new
ArrayList
<
Double
>();
for
(
ChinaWeatherDataBean
chinaWeatherDataBeanTemp:
weatherDataList
){
//x轴数据
xAxisData
.
add
(
chinaWeatherDataBeanTemp
.
getDatestr
().
toLocaleString
());
//北京最高温度
beijingMaxTemp
.
add
(
chinaWeatherDataBeanTemp
.
getBeijingMaxTemp
());
//北京最低温度
beijingMinTemp
.
add
(
chinaWeatherDataBeanTemp
.
getBeijingMinTemp
());
//长春最高温度
changchunMaxTemp
.
add
(
chinaWeatherDataBeanTemp
.
getChangchunMaxTemp
());
//长春最高温度
changchunMinTemp
.
add
(
chinaWeatherDataBeanTemp
.
getChangchunMinTemp
());
//沈阳最高温度
shenyangMaxTemp
.
add
(
chinaWeatherDataBeanTemp
.
getShenyangMaxTemp
());
//沈阳最高温度
shenyangMinTemp
.
add
(
chinaWeatherDataBeanTemp
.
getShenyangMinTemp
());
//哈尔滨最高温度
haerbinMaxTemp
.
add
(
chinaWeatherDataBeanTemp
.
getHaerbinMaxTemp
());
//哈尔滨最高温度
haerbinMinTemp
.
add
(
chinaWeatherDataBeanTemp
.
getHaerbinMinTemp
());
}
//y轴数据
yAxisData
.
put
(
"北京 最高温度"
,
beijingMaxTemp
);
yAxisData
.
put
(
"北京 最低温度"
,
beijingMinTemp
);
yAxisData
.
put
(
"长春 最高温度"
,
changchunMaxTemp
);
yAxisData
.
put
(
"长春 最低温度"
,
changchunMinTemp
);
yAxisData
.
put
(
"沈阳 最高温度"
,
shenyangMaxTemp
);
yAxisData
.
put
(
"沈阳 最低温度"
,
shenyangMinTemp
);
yAxisData
.
put
(
"哈尔滨 最高温度"
,
haerbinMinTemp
);
yAxisData
.
put
(
"哈尔滨 最低温度"
,
haerbinMinTemp
);
//Y轴双轴情况下的位置定位
yAxisIndex
.
put
(
"北京 最高温度"
,
0
);
//0表示Y轴左轴
yAxisIndex
.
put
(
"长春 最高温度"
,
0
);
//0表示Y轴左轴
yAxisIndex
.
put
(
"沈阳 最高温度"
,
0
);
//0表示Y轴左轴
yAxisIndex
.
put
(
"哈尔滨 最高温度"
,
0
);
//0表示Y轴左轴
yAxisIndex
.
put
(
"北京 最低温度"
,
1
);
//1表示Y轴右轴
yAxisIndex
.
put
(
"长春 最低温度"
,
1
);
//1表示Y轴右轴
yAxisIndex
.
put
(
"沈阳 最低温度"
,
1
);
//1表示Y轴右轴
yAxisIndex
.
put
(
"哈尔滨 最低温度"
,
1
);
//1表示Y轴右轴
request
.
setAttribute
(
"yAxisIndex"
,
yAxisIndex
);
request
.
setAttribute
(
"xAxisData"
,
xAxisData
);
request
.
setAttribute
(
"yAxisData"
,
yAxisData
);
return
"modules/echarts/chinaWeatherDataBeanList"
;
}
/**
* 查看,增加,编辑城市气温表单页面
*/
@RequiresPermissions
(
value
={
"echarts:chinaWeatherDataBean:view"
,
"echarts:chinaWeatherDataBean:add"
,
"echarts:chinaWeatherDataBean:edit"
},
logical
=
Logical
.
OR
)
@RequestMapping
(
value
=
"form"
)
public
String
form
(
ChinaWeatherDataBean
chinaWeatherDataBean
,
Model
model
)
{
model
.
addAttribute
(
"chinaWeatherDataBean"
,
chinaWeatherDataBean
);
return
"modules/echarts/chinaWeatherDataBeanForm"
;
}
/**
* 保存城市气温
*/
@RequiresPermissions
(
value
={
"echarts:chinaWeatherDataBean:add"
,
"echarts:chinaWeatherDataBean:edit"
},
logical
=
Logical
.
OR
)
@RequestMapping
(
value
=
"save"
)
public
String
save
(
ChinaWeatherDataBean
chinaWeatherDataBean
,
Model
model
,
RedirectAttributes
redirectAttributes
)
throws
Exception
{
if
(!
beanValidator
(
model
,
chinaWeatherDataBean
)){
return
form
(
chinaWeatherDataBean
,
model
);
}
if
(!
chinaWeatherDataBean
.
getIsNewRecord
()){
//编辑表单保存
ChinaWeatherDataBean
t
=
chinaWeatherDataBeanService
.
get
(
chinaWeatherDataBean
.
getId
());
//从数据库取出记录的值
MyBeanUtils
.
copyBeanNotNull2Bean
(
chinaWeatherDataBean
,
t
);
//将编辑表单中的非NULL值覆盖数据库记录中的值
chinaWeatherDataBeanService
.
save
(
t
);
//保存
}
else
{
//新增表单保存
chinaWeatherDataBeanService
.
save
(
chinaWeatherDataBean
);
//保存
}
addMessage
(
redirectAttributes
,
"保存城市气温成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/echarts/chinaWeatherDataBean/?repage"
;
}
/**
* 删除城市气温
*/
@RequiresPermissions
(
"echarts:chinaWeatherDataBean:del"
)
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
ChinaWeatherDataBean
chinaWeatherDataBean
,
RedirectAttributes
redirectAttributes
)
{
chinaWeatherDataBeanService
.
delete
(
chinaWeatherDataBean
);
addMessage
(
redirectAttributes
,
"删除城市气温成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/echarts/chinaWeatherDataBean/?repage"
;
}
/**
* 批量删除城市气温
*/
@RequiresPermissions
(
"echarts:chinaWeatherDataBean:del"
)
@RequestMapping
(
value
=
"deleteAll"
)
public
String
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
chinaWeatherDataBeanService
.
delete
(
chinaWeatherDataBeanService
.
get
(
id
));
}
addMessage
(
redirectAttributes
,
"删除城市气温成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/echarts/chinaWeatherDataBean/?repage"
;
}
/**
* 导出excel文件
*/
@RequiresPermissions
(
"echarts:chinaWeatherDataBean:export"
)
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
POST
)
public
String
exportFile
(
ChinaWeatherDataBean
chinaWeatherDataBean
,
HttpServletRequest
request
,
HttpServletResponse
response
,
RedirectAttributes
redirectAttributes
)
{
try
{
String
fileName
=
"城市气温"
+
DateUtils
.
getDate
(
"yyyyMMddHHmmss"
)+
".xlsx"
;
Page
<
ChinaWeatherDataBean
>
page
=
chinaWeatherDataBeanService
.
findPage
(
new
Page
<
ChinaWeatherDataBean
>(
request
,
response
,
-
1
),
chinaWeatherDataBean
);
new
ExportExcel
(
"城市气温"
,
ChinaWeatherDataBean
.
class
).
setDataList
(
page
.
getList
()).
write
(
response
,
fileName
).
dispose
();
return
null
;
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导出城市气温记录失败!失败信息:"
+
e
.
getMessage
());
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/echarts/chinaWeatherDataBean/?repage"
;
}
/**
* 导入Excel数据
*/
@RequiresPermissions
(
"echarts:chinaWeatherDataBean:import"
)
@RequestMapping
(
value
=
"import"
,
method
=
RequestMethod
.
POST
)
public
String
importFile
(
MultipartFile
file
,
RedirectAttributes
redirectAttributes
)
{
try
{
int
successNum
=
0
;
int
failureNum
=
0
;
StringBuilder
failureMsg
=
new
StringBuilder
();
ImportExcel
ei
=
new
ImportExcel
(
file
,
1
,
0
);
List
<
ChinaWeatherDataBean
>
list
=
ei
.
getDataList
(
ChinaWeatherDataBean
.
class
);
for
(
ChinaWeatherDataBean
chinaWeatherDataBean
:
list
){
try
{
chinaWeatherDataBeanService
.
save
(
chinaWeatherDataBean
);
successNum
++;
}
catch
(
ConstraintViolationException
ex
){
failureNum
++;
}
catch
(
Exception
ex
)
{
failureNum
++;
}
}
if
(
failureNum
>
0
){
failureMsg
.
insert
(
0
,
",失败 "
+
failureNum
+
" 条城市气温记录。"
);
}
addMessage
(
redirectAttributes
,
"已成功导入 "
+
successNum
+
" 条城市气温记录"
+
failureMsg
);
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导入城市气温失败!失败信息:"
+
e
.
getMessage
());
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/echarts/chinaWeatherDataBean/?repage"
;
}
/**
* 下载导入城市气温数据模板
*/
@RequiresPermissions
(
"echarts:chinaWeatherDataBean:import"
)
@RequestMapping
(
value
=
"import/template"
)
public
String
importFileTemplate
(
HttpServletResponse
response
,
RedirectAttributes
redirectAttributes
)
{
try
{
String
fileName
=
"城市气温数据导入模板.xlsx"
;
List
<
ChinaWeatherDataBean
>
list
=
Lists
.
newArrayList
();
new
ExportExcel
(
"城市气温数据"
,
ChinaWeatherDataBean
.
class
,
1
).
setDataList
(
list
).
write
(
response
,
fileName
).
dispose
();
return
null
;
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导入模板下载失败!失败信息:"
+
e
.
getMessage
());
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/echarts/chinaWeatherDataBean/?repage"
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/echarts/web/LineController.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.modules.echarts.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.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.echarts.entity.ChinaWeatherDataBean
;
import
com.jeespring.modules.echarts.service.ChinaWeatherDataBeanService
;
@Controller
@RequestMapping
(
value
=
"${adminPath}/echarts/line"
)
public
class
LineController
extends
AbstractBaseController
{
private
static
final
long
serialVersionUID
=
-
6886697421555222670L
;
@Autowired
private
ChinaWeatherDataBeanService
chinaWeatherDataBeanService
;
@RequestMapping
(
value
=
{
"index"
,
""
})
public
String
index
(
ChinaWeatherDataBean
chinaWeatherDataBean
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
//X轴的数据
List
<
String
>
xAxisData
=
new
ArrayList
<
String
>();
//Y轴的数据
Map
<
String
,
List
<
Double
>>
yAxisData
=
new
HashMap
<
String
,
List
<
Double
>>();
//Y轴双轴情况下的位置定位
Map
<
String
,
Integer
>
yAxisIndex
=
new
HashMap
<
String
,
Integer
>();
List
<
ChinaWeatherDataBean
>
weatherDataList
=
chinaWeatherDataBeanService
.
findList
(
chinaWeatherDataBean
);
List
<
Double
>
beijingMaxTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
beijingMinTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
changchunMaxTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
changchunMinTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
shenyangMaxTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
shenyangMinTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
haerbinMaxTemp
=
new
ArrayList
<
Double
>();
List
<
Double
>
haerbinMinTemp
=
new
ArrayList
<
Double
>();
for
(
ChinaWeatherDataBean
chinaWeatherDataBeanTemp:
weatherDataList
){
//x轴数据
xAxisData
.
add
(
chinaWeatherDataBeanTemp
.
getDatestr
().
toLocaleString
());
//北京最高温度
beijingMaxTemp
.
add
(
chinaWeatherDataBeanTemp
.
getBeijingMaxTemp
());
//北京最低温度
beijingMinTemp
.
add
(
chinaWeatherDataBeanTemp
.
getBeijingMinTemp
());
//长春最高温度
changchunMaxTemp
.
add
(
chinaWeatherDataBeanTemp
.
getChangchunMaxTemp
());
//长春最高温度
changchunMinTemp
.
add
(
chinaWeatherDataBeanTemp
.
getChangchunMinTemp
());
//沈阳最高温度
shenyangMaxTemp
.
add
(
chinaWeatherDataBeanTemp
.
getShenyangMaxTemp
());
//沈阳最高温度
shenyangMinTemp
.
add
(
chinaWeatherDataBeanTemp
.
getShenyangMinTemp
());
//哈尔滨最高温度
haerbinMaxTemp
.
add
(
chinaWeatherDataBeanTemp
.
getHaerbinMaxTemp
());
//哈尔滨最高温度
haerbinMinTemp
.
add
(
chinaWeatherDataBeanTemp
.
getHaerbinMinTemp
());
}
//y轴数据
yAxisData
.
put
(
"北京 最高温度"
,
beijingMaxTemp
);
yAxisData
.
put
(
"北京 最低温度"
,
beijingMinTemp
);
yAxisData
.
put
(
"长春 最高温度"
,
changchunMaxTemp
);
yAxisData
.
put
(
"长春 最低温度"
,
changchunMinTemp
);
yAxisData
.
put
(
"沈阳 最高温度"
,
shenyangMaxTemp
);
yAxisData
.
put
(
"沈阳 最低温度"
,
shenyangMinTemp
);
yAxisData
.
put
(
"哈尔滨 最高温度"
,
haerbinMinTemp
);
yAxisData
.
put
(
"哈尔滨 最低温度"
,
haerbinMinTemp
);
//Y轴双轴情况下的位置定位
yAxisIndex
.
put
(
"北京 最高温度"
,
0
);
//0表示Y轴左轴
yAxisIndex
.
put
(
"长春 最高温度"
,
0
);
//0表示Y轴左轴
yAxisIndex
.
put
(
"沈阳 最高温度"
,
0
);
//0表示Y轴左轴
yAxisIndex
.
put
(
"哈尔滨 最高温度"
,
0
);
//0表示Y轴左轴
yAxisIndex
.
put
(
"北京 最低温度"
,
1
);
//1表示Y轴右轴
yAxisIndex
.
put
(
"长春 最低温度"
,
1
);
//1表示Y轴右轴
yAxisIndex
.
put
(
"沈阳 最低温度"
,
1
);
//1表示Y轴右轴
yAxisIndex
.
put
(
"哈尔滨 最低温度"
,
1
);
//1表示Y轴右轴
request
.
setAttribute
(
"yAxisIndex"
,
yAxisIndex
);
request
.
setAttribute
(
"xAxisData"
,
xAxisData
);
request
.
setAttribute
(
"yAxisData"
,
yAxisData
);
return
"modules/echarts/line"
;
}
}
Prev
1
…
8
9
10
11
12
13
14
15
16
…
20
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