Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
D
data-server
Project
Project
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
licc
data-server
Commits
24570a08
Commit
24570a08
authored
Mar 10, 2021
by
codezwjava
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户直推信息接口修改
parent
3f614ade
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
275 additions
and
0 deletions
+275
-0
CustomerServiceMapper.java
.../main/java/cn/wisenergy/mapper/CustomerServiceMapper.java
+17
-0
CustomerServiceMapper.xml
...apper/src/main/resources/mapper/CustomerServiceMapper.xml
+51
-0
CustomerService.java
...src/main/java/cn/wisenergy/model/app/CustomerService.java
+47
-0
CustomerServiceService.java
...java/cn/wisenergy/service/app/CustomerServiceService.java
+24
-0
CustomerServiceServiceImpl.java
...isenergy/service/app/impl/CustomerServiceServiceImpl.java
+79
-0
CustomerServiceController.java
...y/web/admin/controller/app/CustomerServiceController.java
+57
-0
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/CustomerServiceMapper.java
0 → 100644
View file @
24570a08
package
cn
.
wisenergy
.
mapper
;
import
cn.wisenergy.model.app.CustomerService
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* 专属客服对应表
* @author zw
*/
public
interface
CustomerServiceMapper
extends
BaseMapper
<
CustomerService
>
{
/**
* 随机获得一条专属客服记录
* @return
*/
CustomerService
randService
();
}
wisenergy-mapper/src/main/resources/mapper/CustomerServiceMapper.xml
0 → 100644
View file @
24570a08
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.wisenergy.mapper.CustomerServiceMapper"
>
<resultMap
id=
"bankMap"
type=
"cn.wisenergy.model.app.CustomerService"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"wechat_id"
property=
"wechatId"
/>
<result
column=
"wechat_img_url"
property=
"wechatImgUrl"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<sql
id=
"table"
>
customer_service
</sql>
<sql
id=
"cols_all"
>
id,
<include
refid=
"cols_exclude_id"
/>
</sql>
<sql
id=
"cols_exclude_id"
>
wechat_id,wechat_img_url,create_time,update_time
</sql>
<sql
id=
"vals"
>
#{wechatId},#{wechatImgUrl},now(),now()
</sql>
<sql
id=
"updateCondition"
>
<if
test=
"wechatId != null"
>
service_id = #{wechatId},
</if>
<if
test=
"wechatImgUrl != null"
>
wechat_img_url = #{wechatImgUrl},
</if>
update_time =now()
</sql>
<sql
id=
"criteria"
>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"wechatId != null"
>
and service_id = #{wechatId}
</if>
<if
test=
"wechatImgUrl != null"
>
and wechat_img_url = #{wechatImgUrl}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
</sql>
<select
id=
"randService"
resultType=
"cn.wisenergy.model.app.CustomerService"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
order by rand() limit 1
</select>
</mapper>
\ No newline at end of file
wisenergy-model/src/main/java/cn/wisenergy/model/app/CustomerService.java
0 → 100644
View file @
24570a08
package
cn
.
wisenergy
.
model
.
app
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 专属客服实体类
*/
@Data
@ApiModel
(
value
=
"customerService"
)
public
class
CustomerService
implements
Serializable
{
private
static
final
long
serialVersionUID
=
4893386302084721578L
;
/**
* 主键id
*/
@ApiModelProperty
(
name
=
"id"
,
value
=
"主键id"
)
private
int
id
;
/**wechatImgUrl
* 专属客服id(微信号)
*/
@ApiModelProperty
(
name
=
"wechatId"
,
value
=
"专属客服id(微信号)"
)
private
String
wechatId
;
/**
* 专属客服微信二维码图片地址
*/
@ApiModelProperty
(
name
=
"wechatImgUrl"
,
value
=
"专属客服id(微信号)"
)
private
String
wechatImgUrl
;
/**
* 创建时间
*/
@ApiModelProperty
(
name
=
"createTime"
,
value
=
"创建时间"
)
private
Date
createTime
;
/**
* 修改时间
*/
@ApiModelProperty
(
name
=
"updateTime"
,
value
=
"修改时间"
)
private
Date
updateTime
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/CustomerServiceService.java
0 → 100644
View file @
24570a08
package
cn
.
wisenergy
.
service
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.CustomerService
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.util.Map
;
public
interface
CustomerServiceService
{
CustomerService
getServiceByRand
();
void
setWeChatQRImg
(
String
wechatId
,
String
file
);
/**
* 专属客服二维码图片上传
* @param file
* @param request
* @param wechatId
* @return
*/
R
uploadImage
(
MultipartFile
file
,
HttpServletRequest
request
,
String
wechatId
)
throws
IOException
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/CustomerServiceServiceImpl.java
0 → 100644
View file @
24570a08
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.CustomerServiceMapper
;
import
cn.wisenergy.model.app.CustomerService
;
import
cn.wisenergy.service.app.CustomerServiceService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
@Service
@Slf4j
public
class
CustomerServiceServiceImpl
implements
CustomerServiceService
{
@Autowired
private
CustomerServiceMapper
customerServiceMapper
;
@Value
(
"${uploadFile.location}"
)
private
String
uploadQRImagesLocation
;
@Override
public
CustomerService
getServiceByRand
(){
return
customerServiceMapper
.
randService
();
}
@Override
public
void
setWeChatQRImg
(
String
wechatId
,
String
wechatImgUrl
)
{
CustomerService
customerService
=
new
CustomerService
();
customerService
.
setWechatId
(
wechatId
);
customerService
.
setWechatImgUrl
(
wechatImgUrl
);
customerService
.
setCreateTime
(
new
Date
());
customerService
.
setUpdateTime
(
new
Date
());
customerServiceMapper
.
insert
(
customerService
);
}
/**
* 专属客服二维码图片文件上传
*/
@Override
public
R
uploadImage
(
MultipartFile
file
,
HttpServletRequest
request
,
String
wechatId
)
throws
IOException
{
// String basePath = request.getScheme() + "://" + request.getServerName()
// + ":" + request.getServerPort()+"/mimi/upload/images/";
Long
time
=
System
.
currentTimeMillis
();
String
originalFilename
=
file
.
getOriginalFilename
();
//文件原始名称
String
suffixName
=
originalFilename
.
substring
(
originalFilename
.
lastIndexOf
(
"."
));
//从最后一个.开始截取。截取zxName的后缀名
String
newName
=
time
+
suffixName
;
//文件新名称
//设置文件存储路径,可以存放在你想要指定的路径里面
// String rootPath="G:/mimi/"+ File.separator+"upload/images/"; //上传图片存放位置
String
filePath
=
uploadQRImagesLocation
+
newName
;
File
newFile
=
new
File
(
filePath
);
//判断目标文件所在目录是否存在
if
(!
newFile
.
getParentFile
().
exists
()){
//如果目标文件所在的目录不存在,则创建父目录
newFile
.
getParentFile
().
mkdirs
();
}
//将内存中的数据写入磁盘
file
.
transferTo
(
newFile
);
//图片上传保存url
// String imgUrl = basePath + newzxName;
CustomerService
customerService
=
new
CustomerService
();
customerService
.
setWechatId
(
wechatId
);
customerService
.
setWechatImgUrl
(
filePath
);
customerServiceMapper
.
insert
(
customerService
);
return
R
.
ok
(
"上传成功"
);
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/CustomerServiceController.java
0 → 100644
View file @
24570a08
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.CustomerService
;
import
cn.wisenergy.service.app.CustomerServiceService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
/**
* 专属客服
*/
@Api
(
tags
=
"专属客服"
)
@RestController
@RequestMapping
(
"/customerService"
)
@Slf4j
public
class
CustomerServiceController
{
@Autowired
private
CustomerServiceService
customerServiceService
;
@ApiOperation
(
value
=
"获取专属客服"
,
notes
=
"获取专属客服"
)
@GetMapping
(
"/service"
)
public
R
getServiceByRand
(){
try
{
CustomerService
serviceByRand
=
customerServiceService
.
getServiceByRand
();
String
wechatImgUrl
=
serviceByRand
.
getWechatImgUrl
();
return
R
.
ok
(
wechatImgUrl
);
}
catch
(
Exception
e
){
return
R
.
error
(
"获取失败,请重试"
);
}
}
/**
* String wechatId ,@RequestParam("file") MultipartFile file,
* 上传专属客服微信二维码图片
*/
@ResponseBody
@PostMapping
(
"/uploadWeChatImg"
)
public
R
uploadWeChatQRImg
(
@RequestParam
(
"file"
)
MultipartFile
file
,
HttpServletRequest
request
,
String
wechatId
){
try
{
customerServiceService
.
uploadImage
(
file
,
request
,
wechatId
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
R
.
error
(
"上传失败"
);
}
return
R
.
ok
(
"上传成功"
);
}
}
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