Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dmp
Project
Project
Details
Activity
Releases
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
liling
dmp
Commits
28027150
Commit
28027150
authored
Nov 18, 2019
by
liling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add code
parent
bed17023
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
394 additions
and
14 deletions
+394
-14
AppCategoryappInterestDto.java
...cn/com/duia/dmp/common/dto/AppCategoryappInterestDto.java
+31
-0
AppEntity.java
...rc/main/java/cn/com/duia/dmp/common/entity/AppEntity.java
+8
-0
Result.java
...mon/src/main/java/cn/com/duia/dmp/common/util/Result.java
+163
-0
ResultUtil.java
...src/main/java/cn/com/duia/dmp/common/util/ResultUtil.java
+100
-0
SimpleStringFormat.java
.../java/cn/com/duia/dmp/common/util/SimpleStringFormat.java
+65
-0
sqlinfotable.xml
...dmp-dal/src/main/resources/mybatis/druid/sqlinfotable.xml
+2
-2
build.gradle
dmp/dmp-web/build.gradle
+1
-0
Application.java
dmp/dmp-web/src/main/java/cn/com/duia/dmp/Application.java
+2
-2
TestController.java
.../main/java/cn/com/duia/dmp/controller/TestController.java
+22
-10
No files found.
dmp/dmp-common/src/main/java/cn/com/duia/dmp/common/dto/AppCategoryappInterestDto.java
0 → 100644
View file @
28027150
package
cn
.
com
.
duia
.
dmp
.
common
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.List
;
@ApiModel
(
"人群包配置详情表"
)
public
class
AppCategoryappInterestDto
{
@ApiModelProperty
(
"应用类别"
)
private
String
appCategory
;
@ApiModelProperty
(
"应用兴趣"
)
private
List
<
String
>
appInterest
;
public
String
getAppCategory
()
{
return
appCategory
;
}
public
void
setAppCategory
(
String
appCategory
)
{
this
.
appCategory
=
appCategory
;
}
public
List
<
String
>
getAppInterest
()
{
return
appInterest
;
}
public
void
setAppInterest
(
List
<
String
>
appInterest
)
{
this
.
appInterest
=
appInterest
;
}
}
dmp/dmp-common/src/main/java/cn/com/duia/dmp/common/entity/AppEntity.java
View file @
28027150
...
...
@@ -19,4 +19,12 @@ public class AppEntity {
public
void
setAppId
(
Long
appId
)
{
this
.
appId
=
appId
;
}
@Override
public
String
toString
()
{
return
"AppEntity{"
+
"appName='"
+
appName
+
'\''
+
", appId="
+
appId
+
'}'
;
}
}
dmp/dmp-common/src/main/java/cn/com/duia/dmp/common/util/Result.java
0 → 100644
View file @
28027150
package
cn
.
com
.
duia
.
dmp
.
common
.
util
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
/**
* ClassName:Result <br/>
* ajax请求结果封装类 <br/>
* Date: 2017年5月10日 下午7:26:16 <br/>
*
* @author zhanglihui
* @version
* @param <K>
* @since JDK 1.6
* @see
*/
@ApiModel
(
value
=
"请求结果封装"
)
public
class
Result
<
K
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1467576157657126613L
;
@ApiModelProperty
(
value
=
"请求是否成功"
,
required
=
true
)
private
Boolean
success
;
@ApiModelProperty
(
value
=
"错误码"
)
private
String
errorCode
;
@ApiModelProperty
(
"响应信息"
)
private
String
desc
;
@ApiModelProperty
(
"请求成功时的响应数据"
)
private
transient
K
data
;
/**
* 构造成功响应
*
* @param data
* @param <K>
* @return Result
*/
public
static
<
K
>
Result
<
K
>
successResult
(
K
data
)
{
Result
<
K
>
result
=
new
Result
<>();
result
.
success
=
Boolean
.
TRUE
;
result
.
data
=
data
;
return
result
;
}
/**
* 构造成功响应
*
* @param <K>
* @return Result
*/
public
static
<
K
>
Result
<
K
>
successResult
()
{
Result
<
K
>
result
=
new
Result
<>();
result
.
success
=
Boolean
.
TRUE
;
return
result
;
}
/**
* 构造失败响应
*
* @param message
* @param errorCode
* @return Result
*/
public
static
<
K
>
Result
<
K
>
failResult
(
String
message
,
String
errorCode
)
{
Result
<
K
>
result
=
new
Result
<>();
result
.
success
=
Boolean
.
FALSE
;
result
.
desc
=
message
;
result
.
errorCode
=
errorCode
;
return
result
;
}
/**
* 构造失败响应
*
* @param errorCode
* @param e
* @return Result
*/
public
static
<
K
>
Result
<
K
>
failResult
(
String
errorCode
,
Throwable
e
)
{
Result
<
K
>
result
=
new
Result
<>();
result
.
success
=
Boolean
.
FALSE
;
result
.
desc
=
e
.
getMessage
();
result
.
errorCode
=
errorCode
;
return
result
;
}
/**
* @return success
*/
public
Boolean
getSuccess
()
{
return
success
;
}
/**
* @param success
*/
public
void
setSuccess
(
Boolean
success
)
{
this
.
success
=
success
;
}
/**
* desc.
*
* @return the desc
*/
public
String
getDesc
()
{
return
desc
;
}
/**
* desc.
*
* @param desc the desc to set
*/
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
/**
* data.
*
* @return the data
*/
public
K
getData
()
{
return
data
;
}
/**
* data.
*
* @param data the data to set
*/
public
void
setData
(
K
data
)
{
this
.
data
=
data
;
}
/**
* errorCode.
*
* @return the errorCode
*/
public
String
getErrorCode
()
{
return
errorCode
;
}
/**
* errorCode.
*
* @param errorCode the errorCode to set
*/
public
void
setErrorCode
(
String
errorCode
)
{
this
.
errorCode
=
errorCode
;
}
}
dmp/dmp-common/src/main/java/cn/com/duia/dmp/common/util/ResultUtil.java
0 → 100644
View file @
28027150
package
cn
.
com
.
duia
.
dmp
.
common
.
util
;
import
static
cn
.
com
.
duia
.
dmp
.
common
.
util
.
SimpleStringFormat
.
format
;
/**
* ClassName:ResultUtil <br/>
* 请求结果构建类 <br/>
* Date: 2017年5月10日 下午7:29:22 <br/>
* @author zhanglihui
* @version
* @since JDK 1.6
* @see
*/
public
class
ResultUtil
{
private
ResultUtil
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
/**
* 构造一个失败的返回结果.
*
* @param <T> the generic type
* @param desc 错误描述
* @param errorCode
* @param args
* @return 失败的返回结果
*/
public
static
<
T
>
Result
<
T
>
fail
(
String
desc
,
String
errorCode
,
Object
...
args
)
{
Result
<
T
>
result
=
new
Result
<>();
result
.
setSuccess
(
false
);
result
.
setDesc
(
format
(
desc
,
args
));
result
.
setErrorCode
(
errorCode
);
return
result
;
}
/**
* 构造一个成功的返回结果.<br>
*
* @param <T> the generic type
* @param desc 成功描述信息
* @param args
* @return Result对象
*/
public
static
<
T
>
Result
<
T
>
successWithDesc
(
String
desc
,
Object
...
args
)
{
Result
<
T
>
result
=
new
Result
<>();
result
.
setSuccess
(
true
);
result
.
setDesc
(
format
(
desc
,
args
));
return
result
;
}
/**
* 构造一个成功的返回结果.
*
* @param <T> the generic type
* @param t 数据
* @param desc 描述信息
* @param args
* @return ResultDO对象带有Message
*/
public
static
<
T
>
Result
<
T
>
success
(
T
t
,
String
desc
,
Object
...
args
)
{
Result
<
T
>
result
=
new
Result
<>();
result
.
setData
(
t
);
result
.
setDesc
(
format
(
desc
,
args
));
result
.
setSuccess
(
true
);
return
result
;
}
/**
*
* <一句话功能描述>
* @param t
* @return xx
*/
public
static
<
T
>
Result
<
T
>
successWithData
(
T
t
)
{
Result
<
T
>
result
=
new
Result
<>();
result
.
setData
(
t
);
result
.
setSuccess
(
true
);
return
result
;
}
/**
*
* <一句话功能描述>
* @return xx
*/
public
static
<
T
>
Result
<
T
>
success
()
{
Result
<
T
>
result
=
new
Result
<>();
result
.
setSuccess
(
true
);
return
result
;
}
}
dmp/dmp-common/src/main/java/cn/com/duia/dmp/common/util/SimpleStringFormat.java
0 → 100644
View file @
28027150
package
cn
.
com
.
duia
.
dmp
.
common
.
util
;
/**
* ClassName:SimpleStringFormat <br/>
* 简单的字符串模板实现
* 支持 {} 替代符
* Date: 2016年8月11日 下午2:33:26 <br/>
* @author zhanglihui
* @version
* @since JDK 1.6
* @see
*/
public
class
SimpleStringFormat
{
private
SimpleStringFormat
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
/**
* 格式化String
*
* @param template
* @param args
* @return formatString
*/
public
static
String
format
(
String
template
,
Object
...
args
)
{
String
format
=
String
.
valueOf
(
template
);
// null -> "null"
if
(
args
==
null
||
args
.
length
==
0
)
{
return
format
;
}
// start substituting the arguments into the '%s' placeholders
StringBuilder
builder
=
new
StringBuilder
(
template
.
length
()
+
16
*
args
.
length
);
int
templateStart
=
0
;
int
i
=
0
;
while
(
i
<
args
.
length
)
{
int
placeholderStart
=
template
.
indexOf
(
"{}"
,
templateStart
);
if
(
placeholderStart
==
-
1
)
{
break
;
}
builder
.
append
(
template
.
substring
(
templateStart
,
placeholderStart
));
builder
.
append
(
args
[
i
++]);
templateStart
=
placeholderStart
+
2
;
}
builder
.
append
(
template
.
substring
(
templateStart
));
// if we run out of placeholders, append the extra args in square braces
if
(
i
<
args
.
length
)
{
builder
.
append
(
" ["
);
builder
.
append
(
args
[
i
++]);
while
(
i
<
args
.
length
)
{
builder
.
append
(
", "
);
builder
.
append
(
args
[
i
++]);
}
builder
.
append
(
']'
);
}
return
builder
.
toString
();
}
}
dmp/dmp-dal/src/main/resources/mybatis/druid/sqlinfotable.xml
View file @
28027150
...
...
@@ -5,8 +5,8 @@
<select
id=
"selectApp"
resultType=
"cn.com.duia.dmp.common.entity.AppEntity"
>
SELECT
app_id AS
i
d,
slot_name AS appName
s
app_id AS
appI
d,
slot_name AS appName
FROM tb_slot
</select>
...
...
dmp/dmp-web/build.gradle
View file @
28027150
...
...
@@ -16,6 +16,7 @@ description = 'web'
dependencies
{
compile
project
(
':dmp-core'
)
compile
project
(
':dmp-dal'
)
compile
project
(
':dmp-common'
)
//swagger
compile
(
'io.springfox:springfox-swagger2'
)
compile
(
'io.springfox:springfox-swagger-ui'
)
...
...
dmp/dmp-web/src/main/java/cn/com/duia/dmp/Application.java
View file @
28027150
...
...
@@ -10,13 +10,13 @@ import org.springframework.context.annotation.ComponentScan;
import
org.springframework.context.annotation.ImportResource
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
//
@EnableSwagger2
@EnableSwagger2
@SpringBootApplication
(
exclude
={
DataSourceAutoConfiguration
.
class
})
@ImportResource
({
"classpath:/spring/spring.xml"
})
@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableDuibaFeignClients
(
basePackages
=
{
"cn.com.duia"
})
@ComponentScan
(
basePackages
=
{
"cn.com.dui
ba.*
"
})
@ComponentScan
(
basePackages
=
{
"cn.com.dui
a
"
})
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
...
...
dmp/dmp-web/src/main/java/cn/com/duia/dmp/controller/TestController.java
View file @
28027150
package
cn
.
com
.
duia
.
dmp
.
controller
;
import
cn.com.duia.dmp.common.dto.AppCategoryappInterestDto
;
import
cn.com.duia.dmp.common.entity.AppEntity
;
import
cn.com.duia.dmp.common.util.Result
;
import
cn.com.duia.dmp.common.util.ResultUtil
;
import
cn.com.duia.dmp.core.service.AppService
;
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.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.*
;
@RestController
public
class
TestController
{
//@Resource
//private AppService appService;
// @ApiOperation(value = "第一个接口", httpMethod = "GET")
@RequestMapping
(
value
=
"/hello"
,
method
=
RequestMethod
.
GET
)
public
List
<
AppEntity
>
hello
(){
return
new
ArrayList
<>();
//return appService.selectApp();
@Resource
private
AppService
appService
;
@ApiOperation
(
value
=
"第一个接口"
,
httpMethod
=
"GET"
)
@RequestMapping
(
value
=
"/querydmp"
)
public
Result
hello
(){
Map
<
String
,
List
<
String
>>
am
=
new
HashMap
<>();
List
<
AppCategoryappInterestDto
>
a
=
new
ArrayList
<>();
AppCategoryappInterestDto
d
=
new
AppCategoryappInterestDto
();
d
.
setAppCategory
(
"电商"
);
d
.
setAppInterest
(
Arrays
.
asList
(
"网购"
,
"海淘"
,
"网上购物"
));
AppCategoryappInterestDto
c
=
new
AppCategoryappInterestDto
();
c
.
setAppCategory
(
"社交"
);
c
.
setAppInterest
(
Arrays
.
asList
(
"QQ"
,
"微信"
,
"飞秋"
));
a
.
add
(
d
);
a
.
add
(
c
);
am
.
put
(
"电商"
,
Arrays
.
asList
(
"网购"
,
"海淘"
,
"网上购物"
));
am
.
put
(
"社交"
,
Arrays
.
asList
(
"QQ"
,
"微信"
,
"飞秋"
));
return
ResultUtil
.
successWithData
(
a
)
;
}
}
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