Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 237e68c9
authored
Mar 21, 2021
by
leejoker
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改AjaxResult
1 parent
f82c8d51
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
43 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTaskFissionController.java
linkwe-admin/src/main/java/com/linkwechat/web/core/config/ResponseAdvice.java
linkwe-common/src/main/java/com/linkwechat/common/core/domain/AjaxResult.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeTaskFissionPosterDTO.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionRewardServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTaskFissionController.java
View file @
237e68c
...
@@ -259,9 +259,9 @@ public class WeTaskFissionController extends BaseController {
...
@@ -259,9 +259,9 @@ public class WeTaskFissionController extends BaseController {
/**
/**
* 获取任务所有参与客户的完成情况
* 获取任务所有参与客户的完成情况
*/
*/
@ApiOperation
(
value
=
"获取
客户邀请列表和任务进度
"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取
任务所有参与客户的完成情况
"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:getCustomerProgress')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:getCustomerProgress')"
)
@Log
(
title
=
"获取
客户邀请列表和任务进度
"
,
businessType
=
BusinessType
.
OTHER
)
@Log
(
title
=
"获取
任务所有参与客户的完成情况
"
,
businessType
=
BusinessType
.
OTHER
)
@GetMapping
(
"/{id}/progress"
)
@GetMapping
(
"/{id}/progress"
)
public
AjaxResult
<
List
<
WeTaskFissionTotalProgressVO
>>
getAllCustomerProgress
(
@ApiParam
(
"任务id"
)
@PathVariable
(
"id"
)
Long
id
)
{
public
AjaxResult
<
List
<
WeTaskFissionTotalProgressVO
>>
getAllCustomerProgress
(
@ApiParam
(
"任务id"
)
@PathVariable
(
"id"
)
Long
id
)
{
WeTaskFission
weTaskFission
=
weTaskFissionService
.
selectWeTaskFissionById
(
id
);
WeTaskFission
weTaskFission
=
weTaskFissionService
.
selectWeTaskFissionById
(
id
);
...
...
linkwe-admin/src/main/java/com/linkwechat/web/core/config/ResponseAdvice.java
0 → 100644
View file @
237e68c
package
com
.
linkwechat
.
web
.
core
.
config
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.server.ServerHttpRequest
;
import
org.springframework.http.server.ServerHttpResponse
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice
;
import
java.util.Objects
;
@RestControllerAdvice
(
basePackages
=
"com.linkwechat"
)
@Slf4j
public
class
ResponseAdvice
implements
ResponseBodyAdvice
{
@Override
public
boolean
supports
(
MethodParameter
methodParameter
,
Class
aClass
)
{
return
true
;
}
@Override
public
Object
beforeBodyWrite
(
Object
o
,
MethodParameter
methodParameter
,
MediaType
mediaType
,
Class
aClass
,
ServerHttpRequest
serverHttpRequest
,
ServerHttpResponse
serverHttpResponse
)
{
if
(
Objects
.
isNull
(
o
))
{
return
AjaxResult
.
success
().
build
();
}
if
(
o
instanceof
AjaxResult
)
{
return
((
AjaxResult
)
o
).
build
();
}
return
AjaxResult
.
success
(
o
).
build
();
}
}
\ No newline at end of file
\ No newline at end of file
linkwe-common/src/main/java/com/linkwechat/common/core/domain/AjaxResult.java
View file @
237e68c
package
com
.
linkwechat
.
common
.
core
.
domain
;
package
com
.
linkwechat
.
common
.
core
.
domain
;
import
java.util.HashMap
;
import
com.alibaba.fastjson.JSONObject
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.constant.HttpStatus
;
import
com.linkwechat.common.constant.HttpStatus
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Optional
;
/**
/**
* 操作消息提醒
* 操作消息提醒
...
@@ -13,33 +16,42 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -13,33 +16,42 @@ import io.swagger.annotations.ApiModelProperty;
* @author ruoyi
* @author ruoyi
*/
*/
@ApiModel
@ApiModel
public
class
AjaxResult
<
T
>
@Data
{
public
class
AjaxResult
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** 状态码 */
private
static
final
long
serialVersionUID
=
7337293201809451832L
;
private
HashMap
<
String
,
Object
>
map
;
/**
* 状态码
*/
public
static
final
String
CODE_TAG
=
"code"
;
public
static
final
String
CODE_TAG
=
"code"
;
@ApiModelProperty
(
"状态码"
)
@ApiModelProperty
(
"状态码"
)
private
int
code
;
private
int
code
;
/** 返回内容 */
/**
* 返回内容
*/
public
static
final
String
MSG_TAG
=
"msg"
;
public
static
final
String
MSG_TAG
=
"msg"
;
@ApiModelProperty
(
"返回内容"
)
@ApiModelProperty
(
"返回内容"
)
private
String
msg
;
private
String
msg
;
/** 数据对象 */
/**
* 数据对象
*/
public
static
final
String
DATA_TAG
=
"data"
;
public
static
final
String
DATA_TAG
=
"data"
;
@ApiModelProperty
(
"数据对象"
)
@ApiModelProperty
(
"数据对象"
)
private
T
dat
e
;
private
T
dat
a
;
/**
/**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
*/
*/
public
AjaxResult
()
public
AjaxResult
()
{
{
this
.
map
=
new
HashMap
<>();
}
}
/**
/**
...
@@ -48,8 +60,8 @@ public class AjaxResult<T>
...
@@ -48,8 +60,8 @@ public class AjaxResult<T>
* @param code 状态码
* @param code 状态码
* @param msg 返回内容
* @param msg 返回内容
*/
*/
public
AjaxResult
(
int
code
,
String
msg
)
public
AjaxResult
(
int
code
,
String
msg
)
{
{
this
();
this
.
code
=
code
;
this
.
code
=
code
;
this
.
msg
=
msg
;
this
.
msg
=
msg
;
}
}
...
@@ -61,11 +73,11 @@ public class AjaxResult<T>
...
@@ -61,11 +73,11 @@ public class AjaxResult<T>
* @param msg 返回内容
* @param msg 返回内容
* @param data 数据对象
* @param data 数据对象
*/
*/
public
AjaxResult
(
int
code
,
String
msg
,
T
data
)
public
AjaxResult
(
int
code
,
String
msg
,
T
data
)
{
{
this
();
this
.
code
=
code
;
this
.
code
=
code
;
this
.
msg
=
msg
;
this
.
msg
=
msg
;
this
.
dat
e
=
data
;
this
.
dat
a
=
data
;
}
}
/**
/**
...
@@ -73,8 +85,7 @@ public class AjaxResult<T>
...
@@ -73,8 +85,7 @@ public class AjaxResult<T>
*
*
* @return 成功消息
* @return 成功消息
*/
*/
public
static
AjaxResult
success
()
public
static
AjaxResult
success
()
{
{
return
AjaxResult
.
success
(
"操作成功"
);
return
AjaxResult
.
success
(
"操作成功"
);
}
}
...
@@ -83,8 +94,7 @@ public class AjaxResult<T>
...
@@ -83,8 +94,7 @@ public class AjaxResult<T>
*
*
* @return 成功消息
* @return 成功消息
*/
*/
public
static
<
T
>
AjaxResult
success
(
T
data
)
public
static
<
T
>
AjaxResult
success
(
T
data
)
{
{
return
AjaxResult
.
success
(
"操作成功"
,
data
);
return
AjaxResult
.
success
(
"操作成功"
,
data
);
}
}
...
@@ -94,8 +104,7 @@ public class AjaxResult<T>
...
@@ -94,8 +104,7 @@ public class AjaxResult<T>
* @param msg 返回内容
* @param msg 返回内容
* @return 成功消息
* @return 成功消息
*/
*/
public
static
AjaxResult
success
(
String
msg
)
public
static
AjaxResult
success
(
String
msg
)
{
{
return
AjaxResult
.
success
(
msg
,
null
);
return
AjaxResult
.
success
(
msg
,
null
);
}
}
...
@@ -106,9 +115,8 @@ public class AjaxResult<T>
...
@@ -106,9 +115,8 @@ public class AjaxResult<T>
* @param data 数据对象
* @param data 数据对象
* @return 成功消息
* @return 成功消息
*/
*/
public
static
<
T
>
AjaxResult
success
(
String
msg
,
T
data
)
public
static
<
T
>
AjaxResult
<
T
>
success
(
String
msg
,
T
data
)
{
{
return
(
AjaxResult
<
T
>)
new
AjaxResult
(
HttpStatus
.
SUCCESS
,
msg
,
data
);
return
new
AjaxResult
(
HttpStatus
.
SUCCESS
,
msg
,
data
);
}
}
/**
/**
...
@@ -116,8 +124,7 @@ public class AjaxResult<T>
...
@@ -116,8 +124,7 @@ public class AjaxResult<T>
*
*
* @return
* @return
*/
*/
public
static
AjaxResult
error
()
public
static
AjaxResult
error
()
{
{
return
AjaxResult
.
error
(
"操作失败"
);
return
AjaxResult
.
error
(
"操作失败"
);
}
}
...
@@ -127,8 +134,7 @@ public class AjaxResult<T>
...
@@ -127,8 +134,7 @@ public class AjaxResult<T>
* @param msg 返回内容
* @param msg 返回内容
* @return 警告消息
* @return 警告消息
*/
*/
public
static
AjaxResult
error
(
String
msg
)
public
static
AjaxResult
error
(
String
msg
)
{
{
return
AjaxResult
.
error
(
msg
,
null
);
return
AjaxResult
.
error
(
msg
,
null
);
}
}
...
@@ -139,8 +145,7 @@ public class AjaxResult<T>
...
@@ -139,8 +145,7 @@ public class AjaxResult<T>
* @param data 数据对象
* @param data 数据对象
* @return 警告消息
* @return 警告消息
*/
*/
public
static
AjaxResult
error
(
String
msg
,
Object
data
)
public
static
AjaxResult
error
(
String
msg
,
Object
data
)
{
{
return
new
AjaxResult
(
HttpStatus
.
ERROR
,
msg
,
data
);
return
new
AjaxResult
(
HttpStatus
.
ERROR
,
msg
,
data
);
}
}
...
@@ -151,8 +156,20 @@ public class AjaxResult<T>
...
@@ -151,8 +156,20 @@ public class AjaxResult<T>
* @param msg 返回内容
* @param msg 返回内容
* @return 警告消息
* @return 警告消息
*/
*/
public
static
AjaxResult
error
(
int
code
,
String
msg
)
public
static
AjaxResult
error
(
int
code
,
String
msg
)
{
{
return
new
AjaxResult
(
code
,
msg
,
null
);
return
new
AjaxResult
(
code
,
msg
,
null
);
}
}
public
void
put
(
String
key
,
Object
value
)
{
this
.
map
.
put
(
key
,
value
);
}
public
JSONObject
build
()
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"code"
,
getCode
());
json
.
put
(
"msg"
,
getMsg
());
json
.
put
(
"data"
,
getData
());
Optional
.
ofNullable
(
getMap
()).
ifPresent
(
m
->
m
.
forEach
(
json:
:
put
));
return
json
;
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeTaskFissionPosterDTO.java
View file @
237e68c
...
@@ -12,8 +12,8 @@ import lombok.Data;
...
@@ -12,8 +12,8 @@ import lombok.Data;
@ApiModel
@ApiModel
@Data
@Data
public
class
WeTaskFissionPosterDTO
{
public
class
WeTaskFissionPosterDTO
{
@ApiModelProperty
(
"客户id
(微信用户Id)
"
)
@ApiModelProperty
(
"客户id"
)
private
String
unionI
d
;
private
String
ei
d
;
@ApiModelProperty
(
"任务id"
)
@ApiModelProperty
(
"任务id"
)
private
Long
taskFissionId
;
private
Long
taskFissionId
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionRewardServiceImpl.java
View file @
237e68c
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeCustomer
;
...
@@ -116,20 +117,21 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi
...
@@ -116,20 +117,21 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi
.
orElseThrow
(()
->
new
WeComException
(
"任务信息不存在"
));
.
orElseThrow
(()
->
new
WeComException
(
"任务信息不存在"
));
WeTaskFission
weTaskFission
=
weTaskFissionService
.
selectWeTaskFissionById
(
Long
.
valueOf
(
fissionId
));
WeTaskFission
weTaskFission
=
weTaskFissionService
.
selectWeTaskFissionById
(
Long
.
valueOf
(
fissionId
));
Optional
.
ofNullable
(
weTaskFission
).
ifPresent
(
fission
->{
Optional
.
ofNullable
(
weTaskFission
).
ifPresent
(
fission
->
{
weTaskFissionRewardVo
.
setRewardRule
(
fission
.
getRewardRule
());
weTaskFissionRewardVo
.
setRewardRule
(
fission
.
getRewardRule
());
weTaskFissionRewardVo
.
setRewardImageUrl
(
fission
.
getRewardImageUrl
());
weTaskFissionRewardVo
.
setRewardImageUrl
(
fission
.
getRewardImageUrl
());
weTaskFissionRewardVo
.
setRewardUrl
(
fission
.
getRewardUrl
());
weTaskFissionRewardVo
.
setRewardUrl
(
fission
.
getRewardUrl
());
});
});
if
(
completeTime
!=
null
)
{
if
(
completeTime
!=
null
)
{
WeTaskFissionReward
fissionReward
=
weTaskFissionRewardMapper
.
selectOne
(
new
LambdaQueryWrapper
<
WeTaskFissionReward
>()
WeTaskFissionReward
fissionReward
=
weTaskFissionRewardMapper
.
selectOne
(
new
LambdaQueryWrapper
<
WeTaskFissionReward
>()
.
eq
(
WeTaskFissionReward:
:
getTaskFissionId
,
fissionId
)
.
eq
(
WeTaskFissionReward:
:
getTaskFissionId
,
fissionId
)
.
eq
(
WeTaskFissionReward:
:
getRewardUserId
,
externalUseriId
));
.
eq
(
WeTaskFissionReward:
:
getRewardUserId
,
externalUseriId
));
weTaskFissionRewardVo
.
setWeTaskFissionReward
(
fissionReward
);
weTaskFissionRewardVo
.
setWeTaskFissionReward
(
fissionReward
);
//发放兑奖码之后,置为已使用
Optional
.
ofNullable
(
fissionReward
).
ifPresent
(
reward
->
weTaskFissionRewardMapper
.
update
(
reward
,
new
LambdaUpdateWrapper
<
WeTaskFissionReward
>()
.
set
(
WeTaskFissionReward:
:
getRewardCodeStatus
,
1
).
eq
(
WeTaskFissionReward:
:
getId
,
reward
.
getId
())));
}
}
return
weTaskFissionRewardVo
;
return
weTaskFissionRewardVo
;
}
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
View file @
237e68c
...
@@ -238,7 +238,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
...
@@ -238,7 +238,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
@Transactional
@Transactional
public
String
fissionPosterGenerate
(
WeTaskFissionPosterDTO
weTaskFissionPosterDTO
)
{
public
String
fissionPosterGenerate
(
WeTaskFissionPosterDTO
weTaskFissionPosterDTO
)
{
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>()
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>()
.
eq
(
WeCustomer:
:
get
Unionid
,
weTaskFissionPosterDTO
.
getUnionI
d
()));
.
eq
(
WeCustomer:
:
get
ExternalUserid
,
weTaskFissionPosterDTO
.
getEi
d
()));
if
(
weCustomer
!=
null
)
{
if
(
weCustomer
!=
null
)
{
//任务表添加当前客户任务
//任务表添加当前客户任务
WeTaskFissionRecord
record
=
getTaskFissionRecordId
(
weTaskFissionPosterDTO
.
getTaskFissionId
(),
weCustomer
.
getExternalUserid
(),
weCustomer
.
getName
());
WeTaskFissionRecord
record
=
getTaskFissionRecordId
(
weTaskFissionPosterDTO
.
getTaskFissionId
(),
weCustomer
.
getExternalUserid
(),
weCustomer
.
getName
());
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment