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 5748f95e
authored
Mar 25, 2021
by
水库浪子
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/back_end_dev' into back_end_dev
2 parents
1aed84ba
d6f585de
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
313 additions
and
138 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTaskFissionController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTaskFissionRewardController.java
linkwe-admin/src/main/java/com/linkwechat/web/core/config/ResponseAdvice.java
linkwe-common/src/main/java/com/linkwechat/common/core/controller/BaseController.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/domain/vo/WeTaskFissionProgressVO.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeTaskFissionTotalProgressVO.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeTaskFissionRewardService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeTaskFissionService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.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-wecom/src/main/resources/mapper/wecom/WeTaskFissionMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTaskFissionController.java
View file @
5748f95
...
@@ -3,6 +3,8 @@ package com.linkwechat.web.controller.wecom;
...
@@ -3,6 +3,8 @@ package com.linkwechat.web.controller.wecom;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.nacos.common.utils.CollectionUtils
;
import
com.google.common.collect.Lists
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.config.CosConfig
;
import
com.linkwechat.common.config.CosConfig
;
import
com.linkwechat.common.constant.HttpStatus
;
import
com.linkwechat.common.constant.HttpStatus
;
...
@@ -20,7 +22,9 @@ import com.linkwechat.wecom.domain.WeTaskFission;
...
@@ -20,7 +22,9 @@ import com.linkwechat.wecom.domain.WeTaskFission;
import
com.linkwechat.wecom.domain.dto.WeChatUserDTO
;
import
com.linkwechat.wecom.domain.dto.WeChatUserDTO
;
import
com.linkwechat.wecom.domain.dto.WeTaskFissionPosterDTO
;
import
com.linkwechat.wecom.domain.dto.WeTaskFissionPosterDTO
;
import
com.linkwechat.wecom.domain.query.WeTaskFissionStatisticQO
;
import
com.linkwechat.wecom.domain.query.WeTaskFissionStatisticQO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionProgressVO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionStatisticVO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionStatisticVO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionTotalProgressVO
;
import
com.linkwechat.wecom.service.IWeTaskFissionService
;
import
com.linkwechat.wecom.service.IWeTaskFissionService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -35,6 +39,7 @@ import java.io.IOException;
...
@@ -35,6 +39,7 @@ import java.io.IOException;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
/**
/**
...
@@ -58,7 +63,7 @@ public class WeTaskFissionController extends BaseController {
...
@@ -58,7 +63,7 @@ public class WeTaskFissionController extends BaseController {
@ApiOperation
(
value
=
"查询任务宝列表"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"查询任务宝列表"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:list')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:list')"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
WeTaskFission
weTaskFission
)
{
public
TableDataInfo
<
List
<
WeTaskFission
>>
list
(
WeTaskFission
weTaskFission
)
throws
ParseException
{
startPage
();
startPage
();
List
<
WeTaskFission
>
list
=
weTaskFissionService
.
selectWeTaskFissionList
(
weTaskFission
);
List
<
WeTaskFission
>
list
=
weTaskFissionService
.
selectWeTaskFissionList
(
weTaskFission
);
return
getDataTable
(
list
);
return
getDataTable
(
list
);
...
@@ -70,7 +75,7 @@ public class WeTaskFissionController extends BaseController {
...
@@ -70,7 +75,7 @@ public class WeTaskFissionController extends BaseController {
@ApiOperation
(
value
=
"查询统计信息"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"查询统计信息"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:stat')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:stat')"
)
@GetMapping
(
"/stat"
)
@GetMapping
(
"/stat"
)
public
AjaxResult
statistics
(
WeTaskFissionStatisticQO
weTaskFissionStatisticQO
)
throws
ParseException
{
public
AjaxResult
<
WeTaskFissionStatisticVO
>
statistics
(
WeTaskFissionStatisticQO
weTaskFissionStatisticQO
)
throws
ParseException
{
Date
st
;
Date
st
;
Date
et
=
DateUtils
.
getNowDate
();
Date
et
=
DateUtils
.
getNowDate
();
if
(
weTaskFissionStatisticQO
.
getSeven
())
{
if
(
weTaskFissionStatisticQO
.
getSeven
())
{
...
@@ -95,7 +100,7 @@ public class WeTaskFissionController extends BaseController {
...
@@ -95,7 +100,7 @@ public class WeTaskFissionController extends BaseController {
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:export')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:export')"
)
@Log
(
title
=
"任务宝"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"任务宝"
,
businessType
=
BusinessType
.
EXPORT
)
@GetMapping
(
"/export"
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
WeTaskFission
weTaskFission
)
{
public
AjaxResult
export
(
WeTaskFission
weTaskFission
)
throws
ParseException
{
List
<
WeTaskFission
>
list
=
weTaskFissionService
.
selectWeTaskFissionList
(
weTaskFission
);
List
<
WeTaskFission
>
list
=
weTaskFissionService
.
selectWeTaskFissionList
(
weTaskFission
);
ExcelUtil
<
WeTaskFission
>
util
=
new
ExcelUtil
<
WeTaskFission
>(
WeTaskFission
.
class
);
ExcelUtil
<
WeTaskFission
>
util
=
new
ExcelUtil
<
WeTaskFission
>(
WeTaskFission
.
class
);
return
util
.
exportExcel
(
list
,
"fission"
);
return
util
.
exportExcel
(
list
,
"fission"
);
...
@@ -107,7 +112,7 @@ public class WeTaskFissionController extends BaseController {
...
@@ -107,7 +112,7 @@ public class WeTaskFissionController extends BaseController {
@ApiOperation
(
value
=
"获取任务宝详细信息"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取任务宝详细信息"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:query')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:query')"
)
@GetMapping
(
value
=
"/getInfo/{id}"
)
@GetMapping
(
value
=
"/getInfo/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
public
AjaxResult
<
WeTaskFission
>
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
AjaxResult
.
success
(
weTaskFissionService
.
selectWeTaskFissionById
(
id
));
return
AjaxResult
.
success
(
weTaskFissionService
.
selectWeTaskFissionById
(
id
));
}
}
...
@@ -190,7 +195,7 @@ public class WeTaskFissionController extends BaseController {
...
@@ -190,7 +195,7 @@ public class WeTaskFissionController extends BaseController {
return
AjaxResult
.
error
(
HttpStatus
.
NOT_FOUND
,
"数据不存在"
);
return
AjaxResult
.
error
(
HttpStatus
.
NOT_FOUND
,
"数据不存在"
);
}
}
weTaskFissionService
.
completeFissionRecord
(
id
,
recordId
,
weChatUserDTO
);
weTaskFissionService
.
completeFissionRecord
(
id
,
recordId
,
weChatUserDTO
);
return
AjaxResult
.
success
(
taskFission
.
getFissQrcode
());
return
AjaxResult
.
success
(
"操作成功"
,
taskFission
.
getFissQrcode
());
}
}
/**
/**
...
@@ -200,7 +205,7 @@ public class WeTaskFissionController extends BaseController {
...
@@ -200,7 +205,7 @@ public class WeTaskFissionController extends BaseController {
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:poster')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:poster')"
)
@Log
(
title
=
"生成带二维码的海报"
,
businessType
=
BusinessType
.
OTHER
)
@Log
(
title
=
"生成带二维码的海报"
,
businessType
=
BusinessType
.
OTHER
)
@PostMapping
(
"/poster"
)
@PostMapping
(
"/poster"
)
public
AjaxResult
posterGenerate
(
@RequestBody
WeTaskFissionPosterDTO
weTaskFissionPosterDTO
)
{
public
AjaxResult
<
JSONObject
>
posterGenerate
(
@RequestBody
WeTaskFissionPosterDTO
weTaskFissionPosterDTO
)
{
String
posterUrl
=
weTaskFissionService
.
fissionPosterGenerate
(
weTaskFissionPosterDTO
);
String
posterUrl
=
weTaskFissionService
.
fissionPosterGenerate
(
weTaskFissionPosterDTO
);
JSONObject
json
=
new
JSONObject
();
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"posterUrl"
,
posterUrl
);
json
.
put
(
"posterUrl"
,
posterUrl
);
...
@@ -214,7 +219,7 @@ public class WeTaskFissionController extends BaseController {
...
@@ -214,7 +219,7 @@ public class WeTaskFissionController extends BaseController {
@Log
(
title
=
"上传兑奖图片"
,
businessType
=
BusinessType
.
OTHER
)
@Log
(
title
=
"上传兑奖图片"
,
businessType
=
BusinessType
.
OTHER
)
@PostMapping
(
"/upload"
)
@PostMapping
(
"/upload"
)
@ApiOperation
(
value
=
"上传兑奖图片"
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"上传兑奖图片"
,
httpMethod
=
"POST"
)
public
AjaxResult
upload
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
)
throws
IOException
{
public
AjaxResult
<
JSONObject
>
upload
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
)
throws
IOException
{
String
url
=
FileUploadUtils
.
upload2Cos
(
file
,
cosConfig
);
String
url
=
FileUploadUtils
.
upload2Cos
(
file
,
cosConfig
);
JSONObject
json
=
new
JSONObject
();
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"rewardImageUrl"
,
url
);
json
.
put
(
"rewardImageUrl"
,
url
);
...
@@ -223,14 +228,57 @@ public class WeTaskFissionController extends BaseController {
...
@@ -223,14 +228,57 @@ public class WeTaskFissionController extends BaseController {
/**
/**
* 根据任务id
和unionId获取添加
客户列表
* 根据任务id
获取参与任务
客户列表
*/
*/
@ApiOperation
(
value
=
"根据任务id
和unionId获取添加
客户列表"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"根据任务id
获取参与任务
客户列表"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:getCustomerListById')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:getCustomerListById')"
)
@Log
(
title
=
"根据任务id和unionId获取添加客户列表"
,
businessType
=
BusinessType
.
OTHER
)
@Log
(
title
=
"根据任务id获取参与任务客户列表"
,
businessType
=
BusinessType
.
OTHER
)
@GetMapping
(
"/getCustomerListById/{fissionId}/{unionId}"
)
@GetMapping
(
"/getCustomerListById/{id}"
)
public
AjaxResult
<
List
<
WeCustomer
>>
getCustomerListById
(
@ApiParam
(
"任务id"
)
@PathVariable
(
"fissionId"
)
String
fissionId
public
AjaxResult
<
List
<
WeCustomer
>>
getCustomerListById
(
@ApiParam
(
"任务id"
)
@PathVariable
(
"id"
)
String
id
)
{
,
@PathVariable
(
"unionId"
)
@ApiParam
(
"微信用户id"
)
String
unionId
)
{
return
AjaxResult
.
success
(
weTaskFissionService
.
getCustomerListById
(
null
,
id
));
return
AjaxResult
.
success
(
weTaskFissionService
.
getCustomerListById
(
unionId
,
fissionId
));
}
/**
* 获取客户邀请列表和任务进度
*/
@ApiOperation
(
value
=
"获取客户邀请列表和任务进度"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:getCustomerProgress')"
)
@Log
(
title
=
"获取客户邀请列表和任务进度"
,
businessType
=
BusinessType
.
OTHER
)
@GetMapping
(
"/{id}/progress/{eid}"
)
public
AjaxResult
<
WeTaskFissionProgressVO
>
getCustomerProgress
(
@ApiParam
(
"任务id"
)
@PathVariable
(
"id"
)
Long
id
,
@PathVariable
(
"eid"
)
@ApiParam
(
"客户id"
)
String
eid
)
{
WeTaskFission
weTaskFission
=
weTaskFissionService
.
selectWeTaskFissionById
(
id
);
if
(
weTaskFission
!=
null
)
{
return
AjaxResult
.
success
(
weTaskFissionService
.
getCustomerTaskProgress
(
weTaskFission
,
eid
));
}
else
{
throw
new
WeComException
(
"任务不存在"
);
}
}
/**
* 获取任务所有参与客户的完成情况
*/
@ApiOperation
(
value
=
"获取任务所有参与客户的完成情况"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:fission:getCustomerProgress')"
)
@Log
(
title
=
"获取任务所有参与客户的完成情况"
,
businessType
=
BusinessType
.
OTHER
)
@GetMapping
(
"/{id}/progress"
)
public
AjaxResult
<
List
<
WeTaskFissionTotalProgressVO
>>
getAllCustomerProgress
(
@ApiParam
(
"任务id"
)
@PathVariable
(
"id"
)
Long
id
)
{
WeTaskFission
weTaskFission
=
weTaskFissionService
.
selectWeTaskFissionById
(
id
);
List
<
WeTaskFissionTotalProgressVO
>
list
=
Lists
.
newArrayList
();
if
(
weTaskFission
!=
null
)
{
List
<
WeCustomer
>
customers
=
weTaskFissionService
.
getCustomerListById
(
null
,
String
.
valueOf
(
id
));
if
(
CollectionUtils
.
isNotEmpty
(
customers
))
{
customers
.
stream
().
filter
(
Objects:
:
nonNull
).
forEach
(
customer
->
{
WeTaskFissionTotalProgressVO
vo
=
new
WeTaskFissionTotalProgressVO
();
vo
.
setCustomer
(
customer
);
vo
.
setProgress
(
weTaskFissionService
.
getCustomerTaskProgress
(
weTaskFission
,
customer
.
getUnionid
()));
list
.
add
(
vo
);
});
}
return
AjaxResult
.
success
(
list
);
}
else
{
throw
new
WeComException
(
"任务不存在"
);
}
}
}
}
}
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTaskFissionRewardController.java
View file @
5748f95
...
@@ -105,10 +105,10 @@ public class WeTaskFissionRewardController extends BaseController {
...
@@ -105,10 +105,10 @@ public class WeTaskFissionRewardController extends BaseController {
* 根据微信用户id和任务id获取任务裂变奖励详细信息
* 根据微信用户id和任务id获取任务裂变奖励详细信息
*/
*/
@ApiOperation
(
value
=
"根据微信用户id和任务id获取任务裂变奖励详细信息"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"根据微信用户id和任务id获取任务裂变奖励详细信息"
,
httpMethod
=
"GET"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:getRewardById:query')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:getRewardBy
Fission
Id:query')"
)
@GetMapping
(
value
=
"/getRewardByFissionId/{fissionId}/{
unionI
d}"
)
@GetMapping
(
value
=
"/getRewardByFissionId/{fissionId}/{
ei
d}"
)
public
AjaxResult
<
WeTaskFissionRewardVo
>
getRewardByFissionId
(
@ApiParam
(
"任务id"
)
@PathVariable
(
"fissionId"
)
String
fissionId
public
AjaxResult
<
WeTaskFissionRewardVo
>
getRewardByFissionId
(
@ApiParam
(
"任务id"
)
@PathVariable
(
"fissionId"
)
String
fissionId
,
@PathVariable
(
"
unionId"
)
@ApiParam
(
"微信用户id"
)
String
unionI
d
)
{
,
@PathVariable
(
"
eid"
)
@ApiParam
(
"客户id"
)
String
ei
d
)
{
return
AjaxResult
.
success
(
weTaskFissionRewardService
.
getRewardByFissionId
(
fissionId
,
unionI
d
));
return
AjaxResult
.
success
(
weTaskFissionRewardService
.
getRewardByFissionId
(
fissionId
,
ei
d
));
}
}
}
}
linkwe-admin/src/main/java/com/linkwechat/web/core/config/ResponseAdvice.java
0 → 100644
View file @
5748f95
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
o
;
}
}
\ No newline at end of file
\ No newline at end of file
linkwe-common/src/main/java/com/linkwechat/common/core/controller/BaseController.java
View file @
5748f95
...
@@ -64,7 +64,7 @@ public class BaseController
...
@@ -64,7 +64,7 @@ public class BaseController
* 响应请求分页数据
* 响应请求分页数据
*/
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
protected
TableDataInfo
getDataTable
(
List
<?
>
list
)
protected
<
T
>
TableDataInfo
getDataTable
(
List
<
T
>
list
)
{
{
TableDataInfo
rspData
=
new
TableDataInfo
();
TableDataInfo
rspData
=
new
TableDataInfo
();
rspData
.
setCode
(
HttpStatus
.
SUCCESS
);
rspData
.
setCode
(
HttpStatus
.
SUCCESS
);
...
@@ -78,7 +78,7 @@ public class BaseController
...
@@ -78,7 +78,7 @@ public class BaseController
* 响应请求分页数据
* 响应请求分页数据
*/
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
protected
TableDataInfo
getDataTable
(
PageInfo
<?
>
pageInfo
)
protected
<
T
>
TableDataInfo
getDataTable
(
PageInfo
<
T
>
pageInfo
)
{
{
TableDataInfo
rspData
=
new
TableDataInfo
();
TableDataInfo
rspData
=
new
TableDataInfo
();
rspData
.
setCode
(
HttpStatus
.
SUCCESS
);
rspData
.
setCode
(
HttpStatus
.
SUCCESS
);
...
...
linkwe-common/src/main/java/com/linkwechat/common/core/domain/AjaxResult.java
View file @
5748f95
package
com
.
linkwechat
.
common
.
core
.
domain
;
package
com
.
linkwechat
.
common
.
core
.
domain
;
import
java.util.HashMap
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
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.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Optional
;
/**
/**
* 操作消息提醒
* 操作消息提醒
*
*
* @author ruoyi
* @author ruoyi
*/
*/
public
class
AjaxResult
<
T
>
extends
HashMap
<
String
,
Object
>
@ApiModel
{
@Data
private
static
final
long
serialVersionUID
=
1L
;
public
class
AjaxResult
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
7337293201809451832L
;
@JsonIgnore
private
HashMap
<
String
,
Object
>
map
;
/** 状态码 */
/**
* 状态码
*/
public
static
final
String
CODE_TAG
=
"code"
;
public
static
final
String
CODE_TAG
=
"code"
;
/** 返回内容 */
@ApiModelProperty
(
"状态码"
)
private
int
code
;
/**
* 返回内容
*/
public
static
final
String
MSG_TAG
=
"msg"
;
public
static
final
String
MSG_TAG
=
"msg"
;
/** 数据对象 */
@ApiModelProperty
(
"返回内容"
)
private
String
msg
;
/**
* 数据对象
*/
public
static
final
String
DATA_TAG
=
"data"
;
public
static
final
String
DATA_TAG
=
"data"
;
@ApiModelProperty
(
"数据对象"
)
private
T
data
;
/**
/**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
*/
*/
public
AjaxResult
()
public
AjaxResult
()
{
{
this
.
map
=
new
HashMap
<>();
}
}
/**
/**
* 初始化一个新创建的 AjaxResult 对象
* 初始化一个新创建的 AjaxResult 对象
*
*
* @param code 状态码
* @param code 状态码
* @param msg 返回内容
* @param msg
返回内容
*/
*/
public
AjaxResult
(
int
code
,
String
msg
)
public
AjaxResult
(
int
code
,
String
msg
)
{
{
this
();
super
.
put
(
CODE_TAG
,
code
)
;
this
.
code
=
code
;
super
.
put
(
MSG_TAG
,
msg
)
;
this
.
msg
=
msg
;
}
}
/**
/**
* 初始化一个新创建的 AjaxResult 对象
* 初始化一个新创建的 AjaxResult 对象
*
*
* @param code 状态码
* @param code 状态码
* @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
();
super
.
put
(
CODE_TAG
,
code
);
this
.
code
=
code
;
super
.
put
(
MSG_TAG
,
msg
);
this
.
msg
=
msg
;
if
(
StringUtils
.
isNotNull
(
data
))
this
.
data
=
data
;
{
super
.
put
(
DATA_TAG
,
data
);
}
}
}
/**
/**
* 返回成功消息
* 返回成功消息
*
*
* @return 成功消息
* @return 成功消息
*/
*/
public
static
AjaxResult
success
()
public
static
AjaxResult
success
()
{
{
return
AjaxResult
.
success
(
"操作成功"
);
return
AjaxResult
.
success
(
"操作成功"
);
}
}
/**
/**
* 返回成功数据
* 返回成功数据
*
*
* @return 成功消息
* @return 成功消息
*/
*/
public
static
AjaxResult
success
(
Object
data
)
public
static
<
T
>
AjaxResult
success
(
T
data
)
{
{
return
AjaxResult
.
success
(
"操作成功"
,
data
);
return
AjaxResult
.
success
(
"操作成功"
,
data
);
}
}
/**
/**
* 返回成功消息
* 返回成功消息
*
*
* @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
);
}
}
/**
/**
* 返回成功消息
* 返回成功消息
*
*
* @param msg 返回内容
* @param msg
返回内容
* @param data 数据对象
* @param data 数据对象
* @return 成功消息
* @return 成功消息
*/
*/
public
static
AjaxResult
success
(
String
msg
,
Object
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
);
}
}
/**
/**
* 返回错误消息
* 返回错误消息
*
*
* @return
* @return
*/
*/
public
static
AjaxResult
error
()
public
static
AjaxResult
error
()
{
{
return
AjaxResult
.
error
(
"操作失败"
);
return
AjaxResult
.
error
(
"操作失败"
);
}
}
/**
/**
* 返回错误消息
* 返回错误消息
*
*
* @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
);
}
}
/**
/**
* 返回错误消息
* 返回错误消息
*
*
* @param msg 返回内容
* @param msg
返回内容
* @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
);
}
}
/**
/**
* 返回错误消息
* 返回错误消息
*
*
* @param code 状态码
* @param code 状态码
* @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 @
5748f95
...
@@ -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/domain/vo/WeTaskFissionProgressVO.java
0 → 100644
View file @
5748f95
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author leejoker <1056650571@qq.com>
* @version 1.0
* @date 2021/3/20 13:12
*
* <p>
* 客户任务进度和邀请列表
* </p>
*/
@Data
@Builder
public
class
WeTaskFissionProgressVO
{
private
Long
total
;
private
Long
completed
;
private
List
<
WeCustomer
>
customers
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeTaskFissionTotalProgressVO.java
0 → 100644
View file @
5748f95
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
lombok.Data
;
/**
* @author leejoker <1056650571@qq.com>
* @version 1.0
* @date 2021/3/20 13:50
*/
@Data
public
class
WeTaskFissionTotalProgressVO
{
private
WeCustomer
customer
;
private
WeTaskFissionProgressVO
progress
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeTaskFissionRewardService.java
View file @
5748f95
...
@@ -63,8 +63,8 @@ public interface IWeTaskFissionRewardService {
...
@@ -63,8 +63,8 @@ public interface IWeTaskFissionRewardService {
/**
/**
* 根据微信用户id和任务id获取任务裂变奖励详细信息
* 根据微信用户id和任务id获取任务裂变奖励详细信息
* @param fissionId 任务id
* @param fissionId 任务id
* @param
unionId 微信用
户id
* @param
eid 客
户id
* @return
* @return
*/
*/
public
WeTaskFissionRewardVo
getRewardByFissionId
(
String
fissionId
,
String
unionI
d
);
public
WeTaskFissionRewardVo
getRewardByFissionId
(
String
fissionId
,
String
ei
d
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeTaskFissionService.java
View file @
5748f95
...
@@ -4,8 +4,10 @@ import com.linkwechat.wecom.domain.WeCustomer;
...
@@ -4,8 +4,10 @@ import com.linkwechat.wecom.domain.WeCustomer;
import
com.linkwechat.wecom.domain.WeTaskFission
;
import
com.linkwechat.wecom.domain.WeTaskFission
;
import
com.linkwechat.wecom.domain.dto.WeChatUserDTO
;
import
com.linkwechat.wecom.domain.dto.WeChatUserDTO
;
import
com.linkwechat.wecom.domain.dto.WeTaskFissionPosterDTO
;
import
com.linkwechat.wecom.domain.dto.WeTaskFissionPosterDTO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionProgressVO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionStatisticVO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionStatisticVO
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -30,7 +32,7 @@ public interface IWeTaskFissionService {
...
@@ -30,7 +32,7 @@ public interface IWeTaskFissionService {
* @param weTaskFission 任务宝
* @param weTaskFission 任务宝
* @return 任务宝集合
* @return 任务宝集合
*/
*/
public
List
<
WeTaskFission
>
selectWeTaskFissionList
(
WeTaskFission
weTaskFission
);
public
List
<
WeTaskFission
>
selectWeTaskFissionList
(
WeTaskFission
weTaskFission
)
throws
ParseException
;
/**
/**
* 新增任务宝
* 新增任务宝
...
@@ -90,4 +92,6 @@ public interface IWeTaskFissionService {
...
@@ -90,4 +92,6 @@ public interface IWeTaskFissionService {
List
<
WeCustomer
>
getCustomerListById
(
String
unionId
,
String
fissionId
);
List
<
WeCustomer
>
getCustomerListById
(
String
unionId
,
String
fissionId
);
WeTaskFissionStatisticVO
taskFissionStatistic
(
Long
taskFissionId
,
Date
startTime
,
Date
endTime
);
WeTaskFissionStatisticVO
taskFissionStatistic
(
Long
taskFissionId
,
Date
startTime
,
Date
endTime
);
WeTaskFissionProgressVO
getCustomerTaskProgress
(
WeTaskFission
taskFission
,
String
eid
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
View file @
5748f95
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.core.redis.RedisCache
;
import
com.linkwechat.common.core.redis.RedisCache
;
import
com.linkwechat.common.enums.ChatType
;
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.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.client.WeCustomerMessagePushClient
;
import
com.linkwechat.wecom.client.WeCustomerMessagePushClient
;
import
com.linkwechat.wecom.domain.*
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.dto.message.*
;
import
com.linkwechat.wecom.domain.WeCustomerMessageTimeTask
;
import
com.linkwechat.wecom.domain.WeGroup
;
import
com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto
;
import
com.linkwechat.wecom.domain.vo.CustomerMessagePushVo
;
import
com.linkwechat.wecom.domain.vo.CustomerMessagePushVo
;
import
com.linkwechat.wecom.mapper.WeCustomerMessageTimeTaskMapper
;
import
com.linkwechat.wecom.mapper.WeCustomerMessageTimeTaskMapper
;
import
com.linkwechat.wecom.service.*
;
import
com.linkwechat.wecom.service.*
;
import
lombok.SneakyThrows
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -27,8 +24,9 @@ import org.springframework.stereotype.Service;
...
@@ -27,8 +24,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.stream.Collectors
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* @description: 群发消息服务类
* @description: 群发消息服务类
...
@@ -85,9 +83,13 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -85,9 +83,13 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
// 0 发给客户
// 0 发给客户
if
(
customerMessagePushDto
.
getPushType
().
equals
(
WeConstans
.
SEND_MESSAGE_CUSTOMER
))
{
if
(
customerMessagePushDto
.
getPushType
().
equals
(
WeConstans
.
SEND_MESSAGE_CUSTOMER
))
{
//查询客户信息列表
//查询客户信息列表
customers
=
externalUserIds
(
customerMessagePushDto
.
getPushRange
(),
customerMessagePushDto
.
getStaffId
()
if
(
"all"
.
equals
(
customerMessagePushDto
.
getTag
()))
{
,
customerMessagePushDto
.
getDepartment
(),
customerMessagePushDto
.
getTag
());
customers
=
externalUserIds
(
WeConstans
.
SEND_MESSAGE_CUSTOMER_ALL
,
null
,
null
,
null
);
if
(
CollectionUtils
.
isEmpty
(
customers
)){
}
else
{
customers
=
externalUserIds
(
customerMessagePushDto
.
getPushRange
(),
customerMessagePushDto
.
getStaffId
()
,
customerMessagePushDto
.
getDepartment
(),
customerMessagePushDto
.
getTag
());
}
if
(
CollectionUtils
.
isEmpty
(
customers
))
{
throw
new
WeComException
(
"没有外部联系人"
);
throw
new
WeComException
(
"没有外部联系人"
);
}
}
}
}
...
@@ -104,7 +106,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -104,7 +106,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
WeGroup
weGroup
=
new
WeGroup
();
WeGroup
weGroup
=
new
WeGroup
();
weGroup
.
setUserIds
(
customerMessagePushDto
.
getStaffId
());
weGroup
.
setUserIds
(
customerMessagePushDto
.
getStaffId
());
groups
=
weGroupService
.
selectWeGroupList
(
weGroup
);
groups
=
weGroupService
.
selectWeGroupList
(
weGroup
);
if
(
CollectionUtils
.
isEmpty
(
customers
))
{
if
(
CollectionUtils
.
isEmpty
(
customers
))
{
throw
new
WeComException
(
"没有客户群!"
);
throw
new
WeComException
(
"没有客户群!"
);
}
}
...
@@ -116,10 +118,10 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -116,10 +118,10 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
long
messageId
=
SnowFlakeUtil
.
nextId
();
long
messageId
=
SnowFlakeUtil
.
nextId
();
//保存映射信息
//保存映射信息
int
size
=
weCustomerMessgaeResultService
.
workerMappingCustomer
(
customerMessagePushDto
,
messageId
,
customers
,
groups
);
int
size
=
weCustomerMessgaeResultService
.
workerMappingCustomer
(
customerMessagePushDto
,
messageId
,
customers
,
groups
);
//保存微信消息
//保存微信消息
weCustomerMessageService
.
saveWeCustomerMessage
(
messageId
,
messageOriginalId
,
customerMessagePushDto
,
size
,
customerMessagePushDto
.
content
());
weCustomerMessageService
.
saveWeCustomerMessage
(
messageId
,
messageOriginalId
,
customerMessagePushDto
,
size
,
customerMessagePushDto
.
content
());
//保存分类消息信息
//保存分类消息信息
weCustomerSeedMessageService
.
saveSeedMessage
(
customerMessagePushDto
,
messageId
);
weCustomerSeedMessageService
.
saveSeedMessage
(
customerMessagePushDto
,
messageId
);
...
@@ -127,11 +129,11 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -127,11 +129,11 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
//发送群发消息
//发送群发消息
//调用微信api发送消息
//调用微信api发送消息
if
(
null
==
customerMessagePushDto
.
getSettingTime
()
||
customerMessagePushDto
.
getSettingTime
().
equals
(
""
))
{
if
(
null
==
customerMessagePushDto
.
getSettingTime
()
||
customerMessagePushDto
.
getSettingTime
().
equals
(
""
))
{
weCustomerMessageService
.
sendMessgae
(
customerMessagePushDto
,
messageId
,
customers
,
groups
);
weCustomerMessageService
.
sendMessgae
(
customerMessagePushDto
,
messageId
,
customers
,
groups
);
}
else
{
}
else
{
WeCustomerMessageTimeTask
timeTask
=
new
WeCustomerMessageTimeTask
(
messageId
,
customerMessagePushDto
,
customers
,
groups
WeCustomerMessageTimeTask
timeTask
=
new
WeCustomerMessageTimeTask
(
messageId
,
customerMessagePushDto
,
customers
,
groups
,
DateUtils
.
getMillionSceondsBydate
(
customerMessagePushDto
.
getSettingTime
()));
,
DateUtils
.
getMillionSceondsBydate
(
customerMessagePushDto
.
getSettingTime
()));
customerMessageTimeTaskMapper
.
saveWeCustomerMessageTimeTask
(
timeTask
);
customerMessageTimeTaskMapper
.
saveWeCustomerMessageTimeTask
(
timeTask
);
...
@@ -156,7 +158,12 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -156,7 +158,12 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
public
List
<
WeCustomer
>
externalUserIds
(
String
pushRange
,
String
staffId
,
String
department
,
String
tag
)
{
public
List
<
WeCustomer
>
externalUserIds
(
String
pushRange
,
String
staffId
,
String
department
,
String
tag
)
{
if
(
pushRange
.
equals
(
WeConstans
.
SEND_MESSAGE_CUSTOMER_ALL
))
{
if
(
pushRange
.
equals
(
WeConstans
.
SEND_MESSAGE_CUSTOMER_ALL
))
{
//从redis中读取数据
//从redis中读取数据
return
redisCache
.
getCacheList
(
WeConstans
.
WECUSTOMERS_KEY
);
List
<
WeCustomer
>
customers
=
redisCache
.
getCacheList
(
WeConstans
.
WECUSTOMERS_KEY
);
if
(
CollectionUtils
.
isEmpty
(
customers
))
{
customers
=
weCustomerService
.
selectWeCustomerList
(
null
);
redisCache
.
setCacheList
(
WeConstans
.
WECUSTOMERS_KEY
,
customers
);
}
return
customers
;
}
else
{
}
else
{
//按条件查询客户
//按条件查询客户
//通过部门id查询所有的员工
//通过部门id查询所有的员工
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
5748f95
...
@@ -227,18 +227,14 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -227,18 +227,14 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
});
});
List
<
WeFlowerCustomerRel
>
weFlowerCustomerRels
=
iWeFlowerCustomerRelService
.
list
(
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
List
<
WeFlowerCustomerRel
>
weFlowerCustomerRels
=
iWeFlowerCustomerRelService
.
list
(
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
.
eq
(
WeFlowerCustomerRel:
:
getExternalUserid
,
weCustomer
.
getExternalUserid
()));
.
eq
(
WeFlowerCustomerRel:
:
getExternalUserid
,
weCustomer
.
getExternalUserid
())
.
eq
(
WeFlowerCustomerRel:
:
getUserId
,
userId
));
if
(
CollectionUtil
.
isNotEmpty
(
weFlowerCustomerRels
))
{
if
(
CollectionUtil
.
isNotEmpty
(
weFlowerCustomerRels
))
{
List
<
Long
>
weFlowerCustomerRelIds
=
weFlowerCustomerRels
.
stream
().
map
(
WeFlowerCustomerRel:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
weFlowerCustomerRelIds
=
weFlowerCustomerRels
.
stream
().
map
(
WeFlowerCustomerRel:
:
getId
).
collect
(
Collectors
.
toList
());
iWeFlowerCustomerTagRelService
.
remove
(
iWeFlowerCustomerTagRelService
.
remove
(
new
LambdaQueryWrapper
<
WeFlowerCustomerTagRel
>()
new
LambdaQueryWrapper
<
WeFlowerCustomerTagRel
>().
in
(
WeFlowerCustomerTagRel:
:
getFlowerCustomerRelId
,
.
in
(
WeFlowerCustomerTagRel:
:
getFlowerCustomerRelId
,
weFlowerCustomerRelIds
));
weFlowerCustomerRelIds
)
iWeFlowerCustomerRelService
.
removeByIds
(
weFlowerCustomerRelIds
);
);
iWeFlowerCustomerRelService
.
removeByIds
(
weFlowerCustomerRelIds
);
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionRewardServiceImpl.java
View file @
5748f95
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
;
...
@@ -105,9 +106,9 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi
...
@@ -105,9 +106,9 @@ public class WeTaskFissionRewardServiceImpl implements IWeTaskFissionRewardServi
}
}
@Override
@Override
public
WeTaskFissionRewardVo
getRewardByFissionId
(
String
fissionId
,
String
unionI
d
)
{
public
WeTaskFissionRewardVo
getRewardByFissionId
(
String
fissionId
,
String
ei
d
)
{
WeTaskFissionRewardVo
weTaskFissionRewardVo
=
new
WeTaskFissionRewardVo
();
WeTaskFissionRewardVo
weTaskFissionRewardVo
=
new
WeTaskFissionRewardVo
();
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
get
Unionid
,
unionI
d
));
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
get
ExternalUserid
,
ei
d
));
String
externalUseriId
=
Optional
.
ofNullable
(
weCustomer
).
map
(
WeCustomer:
:
getExternalUserid
)
String
externalUseriId
=
Optional
.
ofNullable
(
weCustomer
).
map
(
WeCustomer:
:
getExternalUserid
)
.
orElseThrow
(()
->
new
WeComException
(
"用户信息不存在"
));
.
orElseThrow
(()
->
new
WeComException
(
"用户信息不存在"
));
...
@@ -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 @
5748f95
...
@@ -23,6 +23,7 @@ import com.linkwechat.wecom.domain.dto.WeTaskFissionPosterDTO;
...
@@ -23,6 +23,7 @@ import com.linkwechat.wecom.domain.dto.WeTaskFissionPosterDTO;
import
com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto
;
import
com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto
;
import
com.linkwechat.wecom.domain.dto.message.LinkMessageDto
;
import
com.linkwechat.wecom.domain.dto.message.LinkMessageDto
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionDailyDataVO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionDailyDataVO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionProgressVO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionStatisticVO
;
import
com.linkwechat.wecom.domain.vo.WeTaskFissionStatisticVO
;
import
com.linkwechat.wecom.mapper.WeTaskFissionMapper
;
import
com.linkwechat.wecom.mapper.WeTaskFissionMapper
;
import
com.linkwechat.wecom.service.*
;
import
com.linkwechat.wecom.service.*
;
...
@@ -38,6 +39,7 @@ import javax.imageio.ImageIO;
...
@@ -38,6 +39,7 @@ import javax.imageio.ImageIO;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -100,7 +102,13 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
...
@@ -100,7 +102,13 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
* @return 任务宝
* @return 任务宝
*/
*/
@Override
@Override
public
List
<
WeTaskFission
>
selectWeTaskFissionList
(
WeTaskFission
weTaskFission
)
{
public
List
<
WeTaskFission
>
selectWeTaskFissionList
(
WeTaskFission
weTaskFission
)
throws
ParseException
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
sdf_day
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
if
(
weTaskFission
.
getStartTime
()
!=
null
&&
weTaskFission
.
getOverTime
()
!=
null
)
{
weTaskFission
.
setStartTime
(
sdf
.
parse
(
sdf_day
.
format
(
weTaskFission
.
getStartTime
())
+
" 00:00:00"
));
weTaskFission
.
setOverTime
(
sdf
.
parse
(
sdf_day
.
format
(
weTaskFission
.
getOverTime
())
+
" 23:59:59"
));
}
return
weTaskFissionMapper
.
selectWeTaskFissionList
(
weTaskFission
);
return
weTaskFissionMapper
.
selectWeTaskFissionList
(
weTaskFission
);
}
}
...
@@ -237,7 +245,7 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
...
@@ -237,7 +245,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
());
...
@@ -282,31 +290,28 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
...
@@ -282,31 +290,28 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
}
}
@Override
@Override
public
List
<
WeCustomer
>
getCustomerListById
(
String
unionId
,
String
fissionId
)
{
public
List
<
WeCustomer
>
getCustomerListById
(
String
eid
,
String
fissionId
)
{
WeTaskFissionRecord
weTaskFissionRecord
=
null
;
WeTaskFissionRecord
weTaskFissionRecord
;
if
(
StringUtils
.
isEmpty
(
unionId
))
{
if
(
StringUtils
.
isEmpty
(
eid
))
{
weTaskFissionRecord
=
weTaskFissionRecordService
List
<
WeTaskFissionRecord
>
weTaskFissionRecords
=
weTaskFissionRecordService
.
getOne
(
new
LambdaQueryWrapper
<
WeTaskFissionRecord
>().
eq
(
WeTaskFissionRecord:
:
getTaskFissionId
,
fissionId
));
.
list
(
new
LambdaQueryWrapper
<
WeTaskFissionRecord
>().
eq
(
WeTaskFissionRecord:
:
getTaskFissionId
,
fissionId
));
return
Optional
.
ofNullable
(
weTaskFissionRecords
).
orElseGet
(
ArrayList:
:
new
).
stream
()
.
map
(
record
->
weCustomerService
.
selectWeCustomerById
(
record
.
getCustomerId
()))
.
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
}
else
{
}
else
{
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
get
Unionid
,
unionI
d
));
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
get
ExternalUserid
,
ei
d
));
String
externalUseriId
=
Optional
.
ofNullable
(
weCustomer
).
map
(
WeCustomer:
:
getExternalUserid
)
String
externalUseriId
=
Optional
.
ofNullable
(
weCustomer
).
map
(
WeCustomer:
:
getExternalUserid
)
.
orElseThrow
(()
->
new
WeComException
(
"用户信息不存在"
));
.
orElseThrow
(()
->
new
WeComException
(
"用户信息不存在"
));
weTaskFissionRecord
=
weTaskFissionRecordService
weTaskFissionRecord
=
weTaskFissionRecordService
.
selectWeTaskFissionRecordByIdAndCustomerId
(
Long
.
valueOf
(
fissionId
),
externalUseriId
);
.
selectWeTaskFissionRecordByIdAndCustomerId
(
Long
.
valueOf
(
fissionId
),
externalUseriId
);
Optional
.
ofNullable
(
weTaskFissionRecord
).
map
(
WeTaskFissionRecord:
:
getId
)
.
orElseThrow
(()
->
new
WeComException
(
"任务记录信息不存在"
));
List
<
WeFlowerCustomerRel
>
list
=
weFlowerCustomerRelService
.
list
(
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
.
eq
(
WeFlowerCustomerRel:
:
getState
,
WeConstans
.
FISSION_PREFIX
+
weTaskFissionRecord
.
getId
()));
List
<
String
>
eidList
=
Optional
.
ofNullable
(
list
).
orElseGet
(
ArrayList:
:
new
).
stream
()
.
map
(
WeFlowerCustomerRel:
:
getExternalUserid
).
collect
(
Collectors
.
toList
());
return
weCustomerService
.
listByIds
(
eidList
);
}
}
Long
recordId
=
Optional
.
ofNullable
(
weTaskFissionRecord
).
map
(
WeTaskFissionRecord:
:
getId
)
.
orElseThrow
(()
->
new
WeComException
(
"任务记录信息不存在"
));
List
<
WeFlowerCustomerRel
>
list
=
weFlowerCustomerRelService
.
list
(
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
.
eq
(
WeFlowerCustomerRel:
:
getState
,
WeConstans
.
FISSION_PREFIX
+
weTaskFissionRecord
.
getId
()));
List
<
String
>
eidList
=
Optional
.
ofNullable
(
list
).
orElseGet
(
ArrayList:
:
new
).
stream
()
.
map
(
WeFlowerCustomerRel:
:
getExternalUserid
).
collect
(
Collectors
.
toList
());
return
weCustomerService
.
listByIds
(
eidList
);
}
}
@Override
@Override
...
@@ -343,6 +348,19 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
...
@@ -343,6 +348,19 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
return
vo
;
return
vo
;
}
}
@Override
public
WeTaskFissionProgressVO
getCustomerTaskProgress
(
WeTaskFission
taskFission
,
String
eid
)
{
long
complete
=
0L
;
long
total
=
taskFission
.
getFissNum
();
List
<
WeCustomer
>
list
=
getCustomerListById
(
eid
,
String
.
valueOf
(
taskFission
.
getId
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
complete
=
list
.
size
();
}
else
{
list
=
new
ArrayList
<>();
}
return
WeTaskFissionProgressVO
.
builder
().
total
(
total
).
completed
(
complete
).
customers
(
list
).
build
();
}
/*************************************** private functions **************************************/
/*************************************** private functions **************************************/
private
String
getPosterQRCode
(
String
fissionTargetId
,
WeTaskFissionRecord
record
,
WeCustomer
weCustomer
)
{
private
String
getPosterQRCode
(
String
fissionTargetId
,
WeTaskFissionRecord
record
,
WeCustomer
weCustomer
)
{
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeTaskFissionMapper.xml
View file @
5748f95
...
@@ -41,8 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -41,8 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"taskName != null and taskName != ''"
>
and task_name like concat('%', #{taskName}, '%')
</if>
<if
test=
"taskName != null and taskName != ''"
>
and task_name like concat('%', #{taskName}, '%')
</if>
<if
test=
"fissInfo != null and fissInfo != ''"
>
and fiss_info = #{fissInfo}
</if>
<if
test=
"fissInfo != null and fissInfo != ''"
>
and fiss_info = #{fissInfo}
</if>
<if
test=
"fissNum != null "
>
and fiss_num = #{fissNum}
</if>
<if
test=
"fissNum != null "
>
and fiss_num = #{fissNum}
</if>
<if
test=
"startTime != null "
>
and start_time = #{startTime}
</if>
<if
test=
"startTime != null "
>
and start_time
>
= #{startTime}
</if>
<if
test=
"overTime != null "
>
and over_time = #{overTime}
</if>
<if
test=
"overTime != null "
>
<![CDATA[and over_time <= #{overTime}]]>
</if>
<if
test=
"customerTagId != null and customerTagId != ''"
>
and customer_tag_id = #{customerTagId}
</if>
<if
test=
"customerTagId != null and customerTagId != ''"
>
and customer_tag_id = #{customerTagId}
</if>
<if
test=
"customerTag != null and customerTag != ''"
>
and customer_tag = #{customerTag}
</if>
<if
test=
"customerTag != null and customerTag != ''"
>
and customer_tag = #{customerTag}
</if>
<if
test=
"postersId != null "
>
and posters_id = #{postersId}
</if>
<if
test=
"postersId != null "
>
and posters_id = #{postersId}
</if>
...
@@ -56,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -56,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"fissStatus != null "
>
and fiss_status = #{fissStatus}
</if>
<if
test=
"fissStatus != null "
>
and fiss_status = #{fissStatus}
</if>
<if
test=
"welcomeMsg != null and welcomeMsg != ''"
>
and welcome_msg = #{welcomeMsg}
</if>
<if
test=
"welcomeMsg != null and welcomeMsg != ''"
>
and welcome_msg = #{welcomeMsg}
</if>
</where>
</where>
order by create_time desc
</select>
</select>
<select
id=
"selectWeTaskFissionById"
parameterType=
"Long"
resultMap=
"WeTaskFissionResult"
>
<select
id=
"selectWeTaskFissionById"
parameterType=
"Long"
resultMap=
"WeTaskFissionResult"
>
...
...
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