Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
0dd1527b
Commit
0dd1527b
authored
Nov 09, 2018
by
songxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模板消息发送增加来源分类和类型
parent
8b4e8aee
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
164 additions
and
74 deletions
+164
-74
BaseDao.java
...ore/src/main/java/com/pcloud/common/core/dao/BaseDao.java
+18
-16
BaseDaoImpl.java
...src/main/java/com/pcloud/common/core/dao/BaseDaoImpl.java
+23
-1
TemplateMessageDto.java
...n/java/com/pcloud/common/core/dto/TemplateMessageDto.java
+14
-1
BeanNewUtils.java
...n/src/main/java/com/pcloud/common/utils/BeanNewUtils.java
+33
-10
LocalDateUtils.java
...src/main/java/com/pcloud/common/utils/LocalDateUtils.java
+41
-5
ResultUtils.java
...on/src/main/java/com/pcloud/common/utils/ResultUtils.java
+0
-0
StringUtil.java
.../main/java/com/pcloud/common/utils/string/StringUtil.java
+35
-41
No files found.
pcloud-common-core/src/main/java/com/pcloud/common/core/dao/BaseDao.java
View file @
0dd1527b
...
@@ -19,8 +19,7 @@ public interface BaseDao<T> {
...
@@ -19,8 +19,7 @@ public interface BaseDao<T> {
/**
/**
* 根据实体对象新增记录.
* 根据实体对象新增记录.
*
*
* @param entity
* @param entity .
* .
* @return id .
* @return id .
*/
*/
long
insert
(
T
entity
);
long
insert
(
T
entity
);
...
@@ -28,8 +27,7 @@ public interface BaseDao<T> {
...
@@ -28,8 +27,7 @@ public interface BaseDao<T> {
/**
/**
* 批量保存对象.
* 批量保存对象.
*
*
* @param entity
* @param entity .
* .
* @return id .
* @return id .
*/
*/
long
insert
(
List
<
T
>
list
);
long
insert
(
List
<
T
>
list
);
...
@@ -37,8 +35,7 @@ public interface BaseDao<T> {
...
@@ -37,8 +35,7 @@ public interface BaseDao<T> {
/**
/**
* 更新实体对应的记录.
* 更新实体对应的记录.
*
*
* @param entity
* @param entity .
* .
* @return
* @return
*/
*/
long
update
(
T
entity
);
long
update
(
T
entity
);
...
@@ -53,10 +50,19 @@ public interface BaseDao<T> {
...
@@ -53,10 +50,19 @@ public interface BaseDao<T> {
long
update
(
T
entity
,
String
sqlId
);
long
update
(
T
entity
,
String
sqlId
);
/**
/**
* 批量更新对象.
* 更新实体对应的记录.
*
*
* @param entity
* @param entity
* .
* @param sqlId
* @param errorMessage 错误消息
* @return
*/
long
update
(
T
entity
,
String
sqlId
,
String
errorMessage
);
/**
* 批量更新对象.
*
* @param entity .
* @return int .
* @return int .
*/
*/
long
update
(
List
<
T
>
list
);
long
update
(
List
<
T
>
list
);
...
@@ -64,8 +70,7 @@ public interface BaseDao<T> {
...
@@ -64,8 +70,7 @@ public interface BaseDao<T> {
/**
/**
* 根据ID查找记录.
* 根据ID查找记录.
*
*
* @param id
* @param id .
* .
* @return entity .
* @return entity .
*/
*/
T
getById
(
long
id
);
T
getById
(
long
id
);
...
@@ -73,8 +78,7 @@ public interface BaseDao<T> {
...
@@ -73,8 +78,7 @@ public interface BaseDao<T> {
/**
/**
* 根据ID删除记录.
* 根据ID删除记录.
*
*
* @param id
* @param id .
* .
* @return
* @return
*/
*/
long
deleteById
(
long
id
);
long
deleteById
(
long
id
);
...
@@ -82,10 +86,8 @@ public interface BaseDao<T> {
...
@@ -82,10 +86,8 @@ public interface BaseDao<T> {
/**
/**
* 分页查询 .
* 分页查询 .
*
*
* @param pageParam
* @param pageParam 分页参数.
* 分页参数.
* @param paramMap 业务条件查询参数.
* @param paramMap
* 业务条件查询参数.
* @return
* @return
*/
*/
PageBean
listPage
(
PageParam
pageParam
,
Map
<
String
,
Object
>
paramMap
);
PageBean
listPage
(
PageParam
pageParam
,
Map
<
String
,
Object
>
paramMap
);
...
...
pcloud-common-core/src/main/java/com/pcloud/common/core/dao/BaseDaoImpl.java
View file @
0dd1527b
...
@@ -5,6 +5,7 @@ import java.util.HashMap;
...
@@ -5,6 +5,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.apache.ibatis.jdbc.SqlRunner
;
import
org.apache.ibatis.jdbc.SqlRunner
;
import
org.apache.ibatis.session.RowBounds
;
import
org.apache.ibatis.session.RowBounds
;
import
org.apache.ibatis.session.SqlSession
;
import
org.apache.ibatis.session.SqlSession
;
...
@@ -118,6 +119,27 @@ public abstract class BaseDaoImpl<T extends BaseEntity> implements BaseDao<T> {
...
@@ -118,6 +119,27 @@ public abstract class BaseDaoImpl<T extends BaseEntity> implements BaseDao<T> {
return
result
;
return
result
;
}
}
public
long
update
(
T
t
,
String
sqlId
,
String
errorMessage
)
{
if
(
t
==
null
)
throw
new
RuntimeException
(
"T is null"
);
int
result
=
0
;
try
{
result
=
sqlSessionTemplate
.
update
(
getStatement
(
sqlId
),
t
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"update fail["
+
sqlId
+
"]:"
+
e
.
getMessage
(),
e
);
throw
BizException
.
DB_DML_FAIL
;
}
if
(
result
<=
0
)
{
if
(
StringUtil
.
isEmpty
(
errorMessage
))
throw
BizException
.
DB_UPDATE_RESULT_0
;
else
throw
new
BizException
(
10000
,
errorMessage
);
}
return
result
;
}
public
long
update
(
List
<
T
>
list
)
{
public
long
update
(
List
<
T
>
list
)
{
if
(
list
==
null
||
list
.
size
()
<=
0
)
if
(
list
==
null
||
list
.
size
()
<=
0
)
...
@@ -230,7 +252,7 @@ public abstract class BaseDaoImpl<T extends BaseEntity> implements BaseDao<T> {
...
@@ -230,7 +252,7 @@ public abstract class BaseDaoImpl<T extends BaseEntity> implements BaseDao<T> {
}
}
}
}
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
List
<
T
>
listBy
(
Map
<
String
,
Object
>
paramMap
)
{
public
List
<
T
>
listBy
(
Map
<
String
,
Object
>
paramMap
)
{
return
(
List
)
this
.
listBy
(
paramMap
,
SQL_LIST_BY
);
return
(
List
)
this
.
listBy
(
paramMap
,
SQL_LIST_BY
);
}
}
...
...
pcloud-common-core/src/main/java/com/pcloud/common/core/dto/TemplateMessageDto.java
View file @
0dd1527b
...
@@ -6,9 +6,10 @@ import java.util.Map;
...
@@ -6,9 +6,10 @@ import java.util.Map;
/**
/**
* 模板消息dto
* 模板消息dto
*
* @author 作者 : lili
* @author 作者 : lili
* @date 创建时间:2016年11月17日 下午12:03:48
* @version 1.0
* @version 1.0
* @date 创建时间:2016年11月17日 下午12:03:48
* @return
* @return
*/
*/
public
class
TemplateMessageDto
implements
Serializable
{
public
class
TemplateMessageDto
implements
Serializable
{
...
@@ -93,6 +94,18 @@ public class TemplateMessageDto implements Serializable {
...
@@ -93,6 +94,18 @@ public class TemplateMessageDto implements Serializable {
*/
*/
private
String
appType
;
private
String
appType
;
/**
* 消息来源分类
*/
private
String
fromCategory
;
public
String
getFromCategory
()
{
return
fromCategory
;
}
public
void
setFromCategory
(
String
fromCategory
)
{
this
.
fromCategory
=
fromCategory
;
}
public
Long
getAccountSettingId
()
{
public
Long
getAccountSettingId
()
{
return
accountSettingId
;
return
accountSettingId
;
...
...
pcloud-common/src/main/java/com/pcloud/common/utils/BeanNewUtils.java
View file @
0dd1527b
...
@@ -2,6 +2,7 @@ package com.pcloud.common.utils;
...
@@ -2,6 +2,7 @@ package com.pcloud.common.utils;
import
java.util.List
;
import
java.util.List
;
import
com.pcloud.common.page.PageBeanNew
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -9,8 +10,6 @@ import org.springframework.beans.BeanUtils;
...
@@ -9,8 +10,6 @@ import org.springframework.beans.BeanUtils;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
/**
/**
*
*
* @author:songx
* @author:songx
* @date:2018年8月24日,下午2:18:40
* @date:2018年8月24日,下午2:18:40
*/
*/
...
@@ -21,10 +20,8 @@ public class BeanNewUtils {
...
@@ -21,10 +20,8 @@ public class BeanNewUtils {
/**
/**
* 实体类之间的转换
* 实体类之间的转换
*
*
* @param source
* @param source 来源
* 来源
* @param clazz 目标对象
* @param clazz
* 目标对象
* @return
* @return
*/
*/
public
static
<
T
>
T
copyProperties
(
Object
source
,
Class
<
T
>
clazz
)
{
public
static
<
T
>
T
copyProperties
(
Object
source
,
Class
<
T
>
clazz
)
{
...
@@ -44,10 +41,8 @@ public class BeanNewUtils {
...
@@ -44,10 +41,8 @@ public class BeanNewUtils {
/**
/**
* 实体类之间的转换
* 实体类之间的转换
*
*
* @param sources
* @param sources 来源
* 来源
* @param clazz 目标对象
* @param clazz
* 目标对象
* @return
* @return
*/
*/
public
static
<
T
>
List
<
T
>
copyProperties
(
List
<?>
sources
,
Class
<
T
>
clazz
)
{
public
static
<
T
>
List
<
T
>
copyProperties
(
List
<?>
sources
,
Class
<
T
>
clazz
)
{
...
@@ -61,4 +56,32 @@ public class BeanNewUtils {
...
@@ -61,4 +56,32 @@ public class BeanNewUtils {
return
results
;
return
results
;
}
}
/**
* 分页结果的实体类之间的转换
*
* @param source
* @param clazz
* @param <T>
* @return
*/
public
static
<
T
>
PageBeanNew
<
T
>
copyProperties
(
PageBeanNew
<?>
source
,
Class
<
T
>
clazz
)
{
if
(
source
==
null
)
{
return
null
;
}
List
<?>
recordList
=
source
.
getRecordList
();
PageBeanNew
<
T
>
result
=
new
PageBeanNew
<
T
>();
result
.
setCurrentPage
(
source
.
getCurrentPage
());
result
.
setNumPerPage
(
source
.
getNumPerPage
());
result
.
setPageCount
(
source
.
getPageCount
());
result
.
setTotalCount
(
source
.
getTotalCount
());
source
.
setBeginPageIndex
(
source
.
getBeginPageIndex
());
source
.
setEndPageIndex
(
source
.
getEndPageIndex
());
if
(
ListUtils
.
isEmpty
(
recordList
))
{
result
.
setRecordList
(
Lists
.
newArrayList
());
return
result
;
}
result
.
setRecordList
(
copyProperties
(
recordList
,
clazz
));
return
result
;
}
}
}
pcloud-common/src/main/java/com/pcloud/common/utils/LocalDateUtils.java
View file @
0dd1527b
...
@@ -20,13 +20,38 @@ import com.pcloud.common.utils.string.StringUtil;
...
@@ -20,13 +20,38 @@ import com.pcloud.common.utils.string.StringUtil;
*/
*/
public
class
LocalDateUtils
{
public
class
LocalDateUtils
{
private
static
final
DateTimeFormatter
TIME
=
DateTimeFormatter
.
ofPattern
(
"HHmmss"
);
private
static
final
DateTimeFormatter
SHORT_MILLISECOND
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmssSSS"
);
private
static
final
DateTimeFormatter
SHORT_DATETIME
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmss"
);
private
static
final
DateTimeFormatter
DATETIME
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
private
static
final
DateTimeFormatter
SHORT_DATE
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
);
private
static
final
DateTimeFormatter
DATE
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
/**
/**
* 获取当前的日期字符串(yyyy-MM-dd)
* 获取当前的日期字符串(yyyy-MM-dd)
*
*
* @return
* @return
*/
*/
public
static
String
getDateNow
()
{
public
static
String
getDateNow
()
{
return
LocalDate
.
now
().
toString
();
return
LocalDate
.
now
().
format
(
DATE
);
}
/**
* 获取当前的日期字符串(yyyyMMdd)
*
* @return
*/
public
static
String
getShortDateNow
()
{
return
LocalDate
.
now
().
format
(
SHORT_DATE
);
}
/**
* 获取当前的时间字符串(HHmmss)
*
* @return
*/
public
static
String
getShortTimeNow
()
{
return
LocalDateTime
.
now
().
format
(
TIME
);
}
}
/**
/**
...
@@ -35,7 +60,16 @@ public class LocalDateUtils {
...
@@ -35,7 +60,16 @@ public class LocalDateUtils {
* @return
* @return
*/
*/
public
static
String
getDateTimeNow
()
{
public
static
String
getDateTimeNow
()
{
return
LocalDateTime
.
now
().
withNano
(
0
).
toString
().
replace
(
"T"
,
" "
);
return
LocalDateTime
.
now
().
format
(
DATETIME
);
}
/**
* 获取当前的日期字符串(yyyyMMddHHmmss)
*
* @return
*/
public
static
String
getShortDateTimeNow
()
{
return
LocalDateTime
.
now
().
format
(
SHORT_DATETIME
);
}
}
/**
/**
...
@@ -44,8 +78,7 @@ public class LocalDateUtils {
...
@@ -44,8 +78,7 @@ public class LocalDateUtils {
* @return
* @return
*/
*/
public
static
String
getYmdhmss
()
{
public
static
String
getYmdhmss
()
{
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmssSSS"
);
return
LocalDateTime
.
now
().
format
(
SHORT_MILLISECOND
);
return
LocalDateTime
.
now
().
format
(
formatter
);
}
}
/**
/**
...
@@ -65,7 +98,10 @@ public class LocalDateUtils {
...
@@ -65,7 +98,10 @@ public class LocalDateUtils {
* @return
* @return
*/
*/
public
static
String
convertToString
(
LocalDateTime
localDateTime
)
{
public
static
String
convertToString
(
LocalDateTime
localDateTime
)
{
return
localDateTime
.
withNano
(
0
).
toString
().
replace
(
"T"
,
" "
);
if
(
localDateTime
==
null
)
{
return
null
;
}
return
localDateTime
.
format
(
DATETIME
);
}
}
/**
/**
...
...
pcloud-common/src/main/java/com/pcloud/common/utils/ResultUtils.java
View file @
0dd1527b
pcloud-common/src/main/java/com/pcloud/common/utils/string/StringUtil.java
View file @
0dd1527b
...
@@ -20,6 +20,7 @@ import com.pcloud.common.exceptions.BizException;
...
@@ -20,6 +20,7 @@ import com.pcloud.common.exceptions.BizException;
* @创建时间:2016年3月10日,上午11:49:07 @版本:1.0
* @创建时间:2016年3月10日,上午11:49:07 @版本:1.0
*/
*/
public
class
StringUtil
extends
StringUtilParent
{
public
class
StringUtil
extends
StringUtilParent
{
/**
/**
* 判断字符串是否为空
* 判断字符串是否为空
*
*
...
@@ -51,8 +52,7 @@ public class StringUtil extends StringUtilParent {
...
@@ -51,8 +52,7 @@ public class StringUtil extends StringUtilParent {
/**
/**
* 判断字符串是否为空(自动截取首尾空白)
* 判断字符串是否为空(自动截取首尾空白)
*
*
* @param str
* @param str 源字符串
* 源字符串
* @return
* @return
*/
*/
public
static
boolean
isEmpty
(
String
str
)
{
public
static
boolean
isEmpty
(
String
str
)
{
...
@@ -62,10 +62,8 @@ public class StringUtil extends StringUtilParent {
...
@@ -62,10 +62,8 @@ public class StringUtil extends StringUtilParent {
/**
/**
* 判断字符串是否为空
* 判断字符串是否为空
*
*
* @param str
* @param str 源字符串
* 源字符串
* @param trim 是否截取首尾空白
* @param trim
* 是否截取首尾空白
* @return
* @return
*/
*/
public
static
boolean
isEmpty
(
String
str
,
boolean
trim
)
{
public
static
boolean
isEmpty
(
String
str
,
boolean
trim
)
{
...
@@ -83,12 +81,10 @@ public class StringUtil extends StringUtilParent {
...
@@ -83,12 +81,10 @@ public class StringUtil extends StringUtilParent {
}
}
/**
/**
* @param str
* @param str the string need to be parsed
* the string need to be parsed
* @param delim the delimiter to seperate created by zqf at 6/1/2013
* @param delim
* the delimiter to seperate created by zqf at 6/1/2013
*/
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
static
String
[]
parseToArray
(
String
str
,
String
delim
)
{
public
static
String
[]
parseToArray
(
String
str
,
String
delim
)
{
ArrayList
arr
=
new
ArrayList
();
ArrayList
arr
=
new
ArrayList
();
StringTokenizer
st
=
new
StringTokenizer
(
str
,
delim
);
StringTokenizer
st
=
new
StringTokenizer
(
str
,
delim
);
...
@@ -105,12 +101,9 @@ public class StringUtil extends StringUtilParent {
...
@@ -105,12 +101,9 @@ public class StringUtil extends StringUtilParent {
/**
/**
* replace a old substring with rep in str
* replace a old substring with rep in str
*
*
* @param str
* @param str the string need to be replaced
* the string need to be replaced
* @param old the string need to be removed
* @param old
* @param rep the string to be inserted
* the string need to be removed
* @param rep
* the string to be inserted
* @return string replaced
* @return string replaced
*/
*/
public
static
String
replace
(
String
str
,
String
old
,
String
rep
)
{
public
static
String
replace
(
String
str
,
String
old
,
String
rep
)
{
...
@@ -165,12 +158,9 @@ public class StringUtil extends StringUtilParent {
...
@@ -165,12 +158,9 @@ public class StringUtil extends StringUtilParent {
/**
/**
* 用于字符串替换
* 用于字符串替换
*
*
* @param target
* @param target 目标对象 需要替换的字符串
* 目标对象 需要替换的字符串
* @param replacement 要替换的字符串
* @param replacement
* @param value 替换的值
* 要替换的字符串
* @param value
* 替换的值
* @return
* @return
*/
*/
public
static
String
replacement
(
String
target
,
String
replacement
,
String
value
)
{
public
static
String
replacement
(
String
target
,
String
replacement
,
String
value
)
{
...
@@ -225,8 +215,8 @@ public class StringUtil extends StringUtilParent {
...
@@ -225,8 +215,8 @@ public class StringUtil extends StringUtilParent {
}
}
/**
/**
* @description 获取当前服务器日期
* @return
* @return
* @description 获取当前服务器日期
*/
*/
public
static
String
getCurrdate
(
String
formatStr
)
{
public
static
String
getCurrdate
(
String
formatStr
)
{
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
...
@@ -274,11 +264,24 @@ public class StringUtil extends StringUtilParent {
...
@@ -274,11 +264,24 @@ public class StringUtil extends StringUtilParent {
return
Integer
.
valueOf
(
String
.
valueOf
(
value
));
return
Integer
.
valueOf
(
String
.
valueOf
(
value
));
}
}
/**
* 将Object值转换成String类型
*
* @param value
* @return
*/
public
static
String
getByObj
(
Object
value
)
{
if
(
value
==
null
)
{
return
null
;
}
return
value
.
toString
();
}
/**
/**
* 解析字符串 ---> 去掉字符串中回车、换行、空格
* 解析字符串 ---> 去掉字符串中回车、换行、空格
*
*
* @param str
* @param str 被解析字符串
* 被解析字符串
* @return String 解析后的字符串
* @return String 解析后的字符串
*/
*/
public
static
String
parse
(
String
str
)
{
public
static
String
parse
(
String
str
)
{
...
@@ -344,13 +347,9 @@ public class StringUtil extends StringUtilParent {
...
@@ -344,13 +347,9 @@ public class StringUtil extends StringUtilParent {
}
}
/**
/**
*
* @param initCode 初始化编码
* @param initCode
* @param length 需要生成编码长度
* 初始化编码
* @param ind 地增量
* @param length
* 需要生成编码长度
* @param ind
* 地增量
* @return 递增后的编码
* @return 递增后的编码
*/
*/
public
static
String
getNextCode
(
String
initCode
,
int
length
,
int
ind
)
{
public
static
String
getNextCode
(
String
initCode
,
int
length
,
int
ind
)
{
...
@@ -414,8 +413,7 @@ public class StringUtil extends StringUtilParent {
...
@@ -414,8 +413,7 @@ public class StringUtil extends StringUtilParent {
/**
/**
* 中文数字转换为阿拉伯数
* 中文数字转换为阿拉伯数
*
*
* @param String
* @param String s
* s
*/
*/
public
static
int
cnNumToInt
(
String
s
)
{
public
static
int
cnNumToInt
(
String
s
)
{
int
result
=
0
;
int
result
=
0
;
...
@@ -520,9 +518,7 @@ public class StringUtil extends StringUtilParent {
...
@@ -520,9 +518,7 @@ public class StringUtil extends StringUtilParent {
}
}
/**
/**
*
* @param obj 传数值类型的obj
* @param obj
* 传数值类型的obj
* @param format
* @param format
* @return
* @return
*/
*/
...
@@ -534,9 +530,7 @@ public class StringUtil extends StringUtilParent {
...
@@ -534,9 +530,7 @@ public class StringUtil extends StringUtilParent {
}
}
/**
/**
*
* @param obj 传数值类型的obj
* @param obj
* 传数值类型的obj
* @param format
* @param format
* @return
* @return
*/
*/
...
...
Write
Preview
Markdown
is supported
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