1修改账号管理

2新增文件上传服务
This commit is contained in:
fengjundan 2021-07-27 18:38:32 +08:00
parent ec72b1ee39
commit 487768b9ba
44 changed files with 1576 additions and 295 deletions

View File

@ -1,6 +1,14 @@
package com.ruoyi.gateway.filter;
import javax.annotation.Resource;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.gateway.config.properties.IgnoreWhiteProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -15,27 +23,19 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.gateway.config.properties.IgnoreWhiteProperties;
import reactor.core.publisher.Mono;
import javax.annotation.Resource;
/**
* 网关鉴权
*
*
* @author ruoyi
*/
@Component
public class AuthFilter implements GlobalFilter, Ordered
{
public class AuthFilter implements GlobalFilter, Ordered {
private static final Logger log = LoggerFactory.getLogger(AuthFilter.class);
private final static long EXPIRE_TIME = Constants.TOKEN_EXPIRE * 60;
// 排除过滤的 uri 地址nacos自行添加
@ -44,37 +44,35 @@ public class AuthFilter implements GlobalFilter, Ordered
@Resource(name = "stringRedisTemplate")
private ValueOperations<String, String> sops;
@Autowired
private RedisService redisService;
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain)
{
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
String url = exchange.getRequest().getURI().getPath();
// 跳过不需要验证的路径
if (StringUtils.matches(url, ignoreWhite.getWhites()))
{
if (StringUtils.matches(url, ignoreWhite.getWhites())) {
return chain.filter(exchange);
}
String token = getToken(exchange.getRequest());
if (StringUtils.isBlank(token))
{
if (StringUtils.isBlank(token)) {
return setUnauthorizedResponse(exchange, "令牌不能为空");
}
String userStr = sops.get(getTokenKey(token));
if (StringUtils.isNull(userStr))
{
return setUnauthorizedResponse(exchange, "登录状态已过期");
if (StringUtils.isNull(userStr)) {
userStr = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
if (StringUtils.isNull(userStr)) {
return setUnauthorizedResponse(exchange, "登录状态已过期");
}
}
JSONObject obj = JSONObject.parseObject(userStr);
String userid = obj.getString("userid");
String username = obj.getString("username");
if (StringUtils.isBlank(userid) || StringUtils.isBlank(username))
{
if (StringUtils.isBlank(userid) || StringUtils.isBlank(username)) {
return setUnauthorizedResponse(exchange, "令牌验证失败");
}
// 设置过期时间
redisService.expire(getTokenKey(token), EXPIRE_TIME);
// 设置用户信息到请求
@ -85,8 +83,7 @@ public class AuthFilter implements GlobalFilter, Ordered
return chain.filter(mutableExchange);
}
private Mono<Void> setUnauthorizedResponse(ServerWebExchange exchange, String msg)
{
private Mono<Void> setUnauthorizedResponse(ServerWebExchange exchange, String msg) {
ServerHttpResponse response = exchange.getResponse();
response.getHeaders().setContentType(MediaType.APPLICATION_JSON);
response.setStatusCode(HttpStatus.OK);
@ -99,27 +96,23 @@ public class AuthFilter implements GlobalFilter, Ordered
}));
}
private String getTokenKey(String token)
{
private String getTokenKey(String token) {
return CacheConstants.LOGIN_TOKEN_KEY + token;
}
/**
* 获取请求token
*/
private String getToken(ServerHttpRequest request)
{
private String getToken(ServerHttpRequest request) {
String token = request.getHeaders().getFirst(CacheConstants.HEADER);
if (StringUtils.isNotEmpty(token) && token.startsWith(CacheConstants.TOKEN_PREFIX))
{
if (StringUtils.isNotEmpty(token) && token.startsWith(CacheConstants.TOKEN_PREFIX)) {
token = token.replace(CacheConstants.TOKEN_PREFIX, "");
}
return token;
}
@Override
public int getOrder()
{
public int getOrder() {
return -200;
}
}

View File

@ -65,7 +65,34 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -1,9 +1,10 @@
package com.ruoyi.file;
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* 文件服务
@ -11,7 +12,9 @@ import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
* @author ruoyi
*/
@EnableCustomSwagger2
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
@EnableFeignClients
@SpringBootApplication
@MapperScan("com.ruoyi.file.mapper")
public class RuoYFileApplication
{
public static void main(String[] args)

View File

@ -1,15 +1,34 @@
package com.ruoyi.file.controller;
import com.aliyun.oss.OSSClient;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.file.FileUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.file.domain.XhpcImg;
import com.ruoyi.file.service.ISysFileService;
import com.ruoyi.file.service.IXhpcImgService;
import com.ruoyi.system.api.domain.SysFile;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.file.FileUtils;
import com.ruoyi.file.service.ISysFileService;
import com.ruoyi.system.api.domain.SysFile;
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* 文件请求处理
@ -24,6 +43,14 @@ public class SysFileController
@Autowired
private ISysFileService sysFileService;
@Autowired
private Environment environment;
@Autowired
private IXhpcImgService iXhpcImgService;
/**
* 文件上传请求
*/
@ -45,4 +72,66 @@ public class SysFileController
return R.fail(e.getMessage());
}
}
/*
* TODO 阿里云图片上传
* @author fjd
* @date 2020-07-03 16:13
*/
@PostMapping("photoupload")
@ApiOperation(value = "上传", notes = "上传")
public AjaxResult myphotoupload(HttpServletRequest request) {
String fileNames = "";
try {
StandardMultipartHttpServletRequest req = (StandardMultipartHttpServletRequest) request;
Iterator<String> iterator = req.getFileNames();
while (iterator.hasNext()) {
MultipartFile file = req.getFile(iterator.next());
fileNames = file.getOriginalFilename();
fileNames = DateUtils.timePath() + fileNames;
InputStream input = file.getInputStream();
// 创建OSSClient实例
OSSClient ossClient = new OSSClient(environment.getProperty("oss.endpoint"), environment.getProperty("oss.access-key"), environment.getProperty("oss.secret-key"));
// 上传文件流
ossClient.putObject(environment.getProperty("oss.bucket-name"), fileNames, input);
ossClient.shutdown();
}
XhpcImg xhpcImg = new XhpcImg();
xhpcImg.setUrl(fileNames);
iXhpcImgService.insert(xhpcImg);
Map<String, Object> map = new HashMap<>(16);
map.put("imgId", StringUtils.valueOf(xhpcImg.getImgId()));
map.put("url", "https://dx-gzxh.oss-cn-beijing.aliyuncs.com/" + fileNames);
return AjaxResult.success(map);
} catch (IOException e) {
e.printStackTrace();
}
return AjaxResult.error();
}
/*
* TODO 阿里云图片删除
* @author fjd
* @date 2020-07-03 16:14
*/
@GetMapping("alyRemove")
@ApiOperation(value = "删除", notes = "删除")
public Object deleteImage(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
if (StringUtils.isNull(ids)) {
return AjaxResult.error(1006, "图片id不能未空");
}
String[] idList = ids.split(",");
for (String id : idList) {
XhpcImg xhpcImg = iXhpcImgService.info(Long.parseLong(id));
if (null != xhpcImg) {
OSSClient ossClient = new OSSClient(environment.getProperty("oss.endpoint"), environment.getProperty("oss.access-key"), environment.getProperty("oss.secret-key"));
ossClient.deleteObject(environment.getProperty("oss.bucket-name"), xhpcImg.getUrl());
ossClient.shutdown();
xhpcImg.setDelFlag(1);
iXhpcImgService.update(xhpcImg);
}
}
return AjaxResult.success();
}
}

View File

@ -0,0 +1,64 @@
package com.ruoyi.file.domain;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* @author
* @description 上传图片 xhpc_img
* @date 2021-07-22
*/
public class XhpcImg extends BaseEntity {
/**
* 上传id
*/
private Long imgId;
/**
* 路径
*/
private String url;
/**
* 状态0正常 1停用
*/
private Integer status;
/**
* 删除标志0代表存在 2代表删除
*/
private Integer delFlag;
public Long getImgId() {
return imgId;
}
public void setImgId(Long imgId) {
this.imgId = imgId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
}

View File

@ -0,0 +1,36 @@
package com.ruoyi.file.mapper;
import com.ruoyi.file.domain.XhpcImg;
import org.apache.ibatis.annotations.Param;
/**
* 上传图片信息 数据层
*
* @author ruoyi
*/
public interface XhpcImgMapper {
/**
* 新增 上传图片信息
*
* @param xhpcImg 上传图片信息
* @return 结果
*/
public int insert(XhpcImg xhpcImg);
/**
* 更新 上传图片信息
*
* @param xhpcImg 上传图片信息
* @return 结果
*/
public int update(XhpcImg xhpcImg);
/**
* 查询
*
* @param imgId 上传图片id
* @return 结果
*/
public XhpcImg info(@Param("imgId") Long imgId);
}

View File

@ -0,0 +1,38 @@
package com.ruoyi.file.service;
import com.ruoyi.file.domain.XhpcImg;
/**
* 上传图片 服务类
*
* @author BladeX
* @since 2020-06-17
*/
public interface IXhpcImgService {
/**
* 新增
*
* @param xhpcImg 上传图片信息
* @return 结果
*/
public int insert(XhpcImg xhpcImg);
/**
* 更新
*
* @param xhpcImg 上传图片信息
* @return 结果
*/
public int update(XhpcImg xhpcImg);
/**
* 查询
*
* @param imgId 上传图片id
* @return 结果
*/
public XhpcImg info(Long imgId);
}

View File

@ -0,0 +1,49 @@
package com.ruoyi.file.service;
import com.ruoyi.file.domain.XhpcImg;
import com.ruoyi.file.mapper.XhpcImgMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 上传图片 服务实现类
*
* @author BladeX
* @since 2020-06-17
*/
@Service
public class XhpcImgServiceImpl implements IXhpcImgService {
@Autowired
private XhpcImgMapper xhpcImgMapper;
/**
* 新增
*
* @param xhpcImg 上传图片信息
* @return 结果
*/
public int insert(XhpcImg xhpcImg) {
return xhpcImgMapper.insert(xhpcImg);
}
/**
* 更新
*
* @param xhpcImg 上传图片信息
* @return 结果
*/
public int update(XhpcImg xhpcImg) {
return xhpcImgMapper.update(xhpcImg);
}
/**
* 查询
*
* @param imgId 上传图片id
* @return 结果
*/
public XhpcImg info(Long imgId) {
return xhpcImgMapper.info(imgId);
}
}

View File

@ -0,0 +1,95 @@
<?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="com.ruoyi.file.mapper.XhpcImgMapper">
<resultMap type="com.ruoyi.file.domain.XhpcImg" id="XhpcImgResult">
<result column="img_id" property="imgId"/>
<result column="url" property="url"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_time" property="createTime"/>
<result column="create_by" property="createBy"/>
<result column="update_time" property="updateTime"/>
<result column="update_by" property="updateBy"/>
<result column="remark" property="remark"/>
</resultMap>
<insert id="insert" parameterType="com.ruoyi.file.domain.XhpcImg" useGeneratedKeys="true"
keyProperty="imgId">
INSERT INTO xhpc_img
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != url and '' != url">
url,
</if>
<if test="null != status">
status,
</if>
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createTime">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != url and '' != url">
#{url},
</if>
<if test="null != status">
#{status},
</if>
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createTime">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
</trim>
</insert>
<update id="update" parameterType="com.ruoyi.file.domain.XhpcImg">
UPDATE xhpc_img
<set>
<if test="null != url and '' != url">url = #{url},</if>
<if test="null != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updateTime">update_time = #{updateTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>
WHERE img_id = #{imgId}
</update>
<select id="info" parameterType="java.lang.Long" resultMap="XhpcImgResult">
select * from xhpc_history_order where img_id = #{imgId}
</select>
</mapper>

View File

@ -1,7 +1,9 @@
package com.xhpc.order.aspect;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.api.model.LoginUser;
import org.apache.commons.beanutils.BeanUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
@ -12,6 +14,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
/*
@ -42,23 +45,35 @@ public class DaoAspect {
if (attributes == null) {
return point.proceed();
}
//String userName = StringUtils.valueOf(SecurityUtils.getUsername());
String userName = "";
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (userName != null) {
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
HttpServletRequest request = attributes.getRequest();
try {
LogUserUtils logUserUtils = new LogUserUtils();
LoginUser loginUser = logUserUtils.getLogUser(request);
String userName = "";
try {
userName = SecurityUtils.getUsername();
} catch (Exception e) {
}
if (StringUtils.isNull(userName)) {
userName = loginUser.getUsername();
}
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (userName != null) {
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
}
}
}
}
} catch (Exception e) {
}
Object object = point.proceed();
return object;
@ -71,29 +86,41 @@ public class DaoAspect {
if (attributes == null) {
return point.proceed();
}
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
//String userName = StringUtils.valueOf(SecurityUtils.getUsername());
String userName = "";
Date date = new Date();
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (isProperty(arg, CREATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_USER))) {
BeanUtils.setProperty(arg, CREATE_USER, userName);
}
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
HttpServletRequest request = attributes.getRequest();
try {
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
LogUserUtils logUserUtils = new LogUserUtils();
LoginUser loginUser = logUserUtils.getLogUser(request);
String userName = "";
try {
userName = SecurityUtils.getUsername();
} catch (Exception e) {
}
if (StringUtils.isNull(userName)) {
userName = loginUser.getUsername();
}
if (StringUtils.isNull(userName)) {
userName = "admin";
}
Date date = new Date();
if (isProperty(arg, CREATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_USER))) {
BeanUtils.setProperty(arg, CREATE_USER, userName);
}
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, CREATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_TIME))) {
BeanUtils.setProperty(arg, CREATE_TIME, date);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, date);
if (isProperty(arg, CREATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_TIME))) {
BeanUtils.setProperty(arg, CREATE_TIME, date);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, date);
}
}
}
} catch (Exception e) {
}
Object object = point.proceed();
return object;

View File

@ -0,0 +1,26 @@
package com.xhpc.order.aspect;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
public class LogUserUtils {
@Autowired
private RedisService redisService;
/**
* 获取登录信息
*
* @param request 请求参数
* @return LoginUser 登录用户信息
*/
public LoginUser getLogUser(HttpServletRequest request) {
String token = request.getHeader(CacheConstants.HEADER);
token = token.substring(7);
return redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
}
}

View File

@ -67,7 +67,7 @@
</root>
<!--系统操作日志-->
<root level="debug">
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>

View File

@ -37,7 +37,7 @@
</resultMap>
<insert id="insert" parameterType="com.xhpc.order.domain.XhpcHistoryOrder" useGeneratedKeys="true"
keyProperty="XhpcHistoryOrderId">
keyProperty="historyOrderId">
INSERT INTO xhpc_history_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != chargingStationId and '' != chargingStationId">
@ -112,13 +112,13 @@
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
@ -201,13 +201,13 @@
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
@ -232,43 +232,43 @@
<if test="null != internetSerialNumber and '' != internetSerialNumber">internet_serial_number =
#{internetSerialNumber},
</if>
<if test="null != totalPrice and '' != totalPrice">total_price = #{totalPrice},</if>
<if test="null != promotionDiscount and '' != promotionDiscount">promotion_discount =
<if test="null != totalPrice">total_price = #{totalPrice},</if>
<if test="null != promotionDiscount">promotion_discount =
#{promotionDiscount},
</if>
<if test="null != actPrice and '' != actPrice">act_price = #{actPrice},</if>
<if test="null != actPowerPrice and '' != actPowerPrice">act_power_price = #{actPowerPrice},</if>
<if test="null != actServicePrice and '' != actServicePrice">act_service_price = #{actServicePrice},</if>
<if test="null != internetCommission and '' != internetCommission">internet_commission =
<if test="null != actPrice">act_price = #{actPrice},</if>
<if test="null != actPowerPrice">act_power_price = #{actPowerPrice},</if>
<if test="null != actServicePrice">act_service_price = #{actServicePrice},</if>
<if test="null != internetCommission ">internet_commission =
#{internetCommission},
</if>
<if test="null != internetSvcCommission and '' != internetSvcCommission">internet_svc_commission =
<if test="null != internetSvcCommission">internet_svc_commission =
#{internetSvcCommission},
</if>
<if test="null != platformCommission and '' != platformCommission">platform_commission =
<if test="null != platformCommission">platform_commission =
#{platformCommission},
</if>
<if test="null != platformSvcCommisssion and '' != platformSvcCommisssion">platform_svc_commisssion =
<if test="null != platformSvcCommisssion">platform_svc_commisssion =
#{platformSvcCommisssion},
</if>
<if test="null != operationCommission and '' != operationCommission">operation_commission =
<if test="null != operationCommission ">operation_commission =
#{operationCommission},
</if>
<if test="null != operationSvcCommission and '' != operationSvcCommission">operation_svc_commission =
<if test="null != operationSvcCommission">operation_svc_commission =
#{operationSvcCommission},
</if>
<if test="null != startSoc and '' != startSoc">start_soc = #{startSoc},</if>
<if test="null != endSoc and '' != endSoc">end_soc = #{endSoc},</if>
<if test="null != reconciliationStatus and '' != reconciliationStatus">reconciliation_status =
<if test="null != reconciliationStatus ">reconciliation_status =
#{reconciliationStatus},
</if>
<if test="null != sortingStatus and '' != sortingStatus">sorting_status = #{sortingStatus},</if>
<if test="null != type and '' != type">type = #{type},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != sortingStatus ">sorting_status = #{sortingStatus},</if>
<if test="null != type">type = #{type},</if>
<if test="null != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if>
<if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if>
<if test="null != updateTime">update_time = #{updateTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>

View File

@ -18,7 +18,7 @@
</resultMap>
<insert id="insert" parameterType="com.xhpc.order.domain.XhpcHistoryOrderReconciliationStatus"
useGeneratedKeys="true" keyProperty="XhpcHistoryOrderReconciliationStatusId">
useGeneratedKeys="true" keyProperty="historyOrderReconciliationStatusId">
INSERT INTO xhpc_recharge_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != historyOrderId and '' != historyOrderId">

View File

@ -17,7 +17,7 @@
</resultMap>
<insert id="insert" parameterType="com.xhpc.order.domain.XhpcHistoryOrderSortingStatus" useGeneratedKeys="true"
keyProperty="XhpcHistoryOrderSortingStatusId">
keyProperty="historyOrderSortingStatusId">
INSERT INTO xhpc_recharge_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != historyOrderId and '' != historyOrderId">
@ -29,13 +29,13 @@
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
@ -55,13 +55,13 @@
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
@ -77,11 +77,11 @@
UPDATE xhpc_history_order_reconciliation_status
<set>
<if test="null != historyOrderId and '' != historyOrderId">history_order_id = #{historyOrderId},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if>
<if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if>
<if test="null != updateTime">update_time = #{updateTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>

View File

@ -1,7 +1,9 @@
package com.xhpc.payment.aspect;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.api.model.LoginUser;
import org.apache.commons.beanutils.BeanUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
@ -12,6 +14,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
/*
@ -42,23 +45,35 @@ public class DaoAspect {
if (attributes == null) {
return point.proceed();
}
//String userName = StringUtils.valueOf(SecurityUtils.getUsername());
String userName = "";
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (userName != null) {
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
HttpServletRequest request = attributes.getRequest();
try {
LogUserUtils logUserUtils = new LogUserUtils();
LoginUser loginUser = logUserUtils.getLogUser(request);
String userName = "";
try {
userName = SecurityUtils.getUsername();
} catch (Exception e) {
}
if (StringUtils.isNull(userName)) {
userName = loginUser.getUsername();
}
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (userName != null) {
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
}
}
}
}
} catch (Exception e) {
}
Object object = point.proceed();
return object;
@ -71,29 +86,41 @@ public class DaoAspect {
if (attributes == null) {
return point.proceed();
}
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
//String userName = StringUtils.valueOf(SecurityUtils.getUsername());
String userName = "";
Date date = new Date();
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (isProperty(arg, CREATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_USER))) {
BeanUtils.setProperty(arg, CREATE_USER, userName);
}
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
HttpServletRequest request = attributes.getRequest();
try {
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
LogUserUtils logUserUtils = new LogUserUtils();
LoginUser loginUser = logUserUtils.getLogUser(request);
String userName = "";
try {
userName = SecurityUtils.getUsername();
} catch (Exception e) {
}
if (StringUtils.isNull(userName)) {
userName = loginUser.getUsername();
}
if (StringUtils.isNull(userName)) {
userName = "admin";
}
Date date = new Date();
if (isProperty(arg, CREATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_USER))) {
BeanUtils.setProperty(arg, CREATE_USER, userName);
}
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, CREATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_TIME))) {
BeanUtils.setProperty(arg, CREATE_TIME, date);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, date);
if (isProperty(arg, CREATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_TIME))) {
BeanUtils.setProperty(arg, CREATE_TIME, date);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, date);
}
}
}
} catch (Exception e) {
}
Object object = point.proceed();
return object;

View File

@ -0,0 +1,26 @@
package com.xhpc.payment.aspect;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
public class LogUserUtils {
@Autowired
private RedisService redisService;
/**
* 获取登录信息
*
* @param request 请求参数
* @return LoginUser 登录用户信息
*/
public LoginUser getLogUser(HttpServletRequest request) {
String token = request.getHeader(CacheConstants.HEADER);
token = token.substring(7);
return redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
}
}

View File

@ -0,0 +1,32 @@
package com.xhpc.payment.controller;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.xhpc.payment.service.IXhpcUserAccountStatementService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/account/statement")
@Api(value = "用户流水接口", tags = "用户流水接口")
public class XhpcUserAccountStatementController extends BaseController {
@Autowired
private IXhpcUserAccountStatementService iXhpcUserAccountStatementService;
/**
* 用户流水页列表
*/
@GetMapping("/list")
public TableDataInfo page(@RequestParam Long refundOrderId) {
List<Map<String, Object>> list = iXhpcUserAccountStatementService.list(refundOrderId);
return getDataTable(list);
}
}

View File

@ -12,10 +12,6 @@ import java.math.BigDecimal;
*/
public class XhpcRefundOrder extends BaseEntity {
/**
* 退款订单审核id
*/
private Long refundAuditId;
/**
* 退款订单id
@ -52,6 +48,11 @@ public class XhpcRefundOrder extends BaseEntity {
*/
private Integer type;
/**
* 审核状态0审核中 1审核通过2审核失败
*/
private Integer examineStatus;
/**
* 状态0退款中 1退款成功2退款失败3退款异常
*/
@ -62,14 +63,6 @@ public class XhpcRefundOrder extends BaseEntity {
*/
private Integer delFlag;
public Long getRefundAuditId() {
return refundAuditId;
}
public void setRefundAuditId(Long refundAuditId) {
this.refundAuditId = refundAuditId;
}
public Long getRefundOrderId() {
return refundOrderId;
}
@ -141,4 +134,12 @@ public class XhpcRefundOrder extends BaseEntity {
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
public Integer getExamineStatus() {
return examineStatus;
}
public void setExamineStatus(Integer examineStatus) {
this.examineStatus = examineStatus;
}
}

View File

@ -0,0 +1,119 @@
package com.xhpc.payment.domain;
import com.ruoyi.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
/**
* @author
* @description 用户流水 xhpc_user_account_statement
* @date 2021-07-22
*/
public class XhpcUserAccountStatement extends BaseEntity {
/**
* 用户流水id
*/
private Long userAccountStatementId;
/**
* 用户id
*/
private Long userId;
/**
* 流水金额
*/
private BigDecimal amount;
/**
* 充电订单id
*/
private Long chargeOrderId;
/**
* 充值订单id
*/
private Long rechargeOrderId;
/**
* 退款订单id
*/
private Long refundOrderId;
/**
* 状态0正常 1停用
*/
private Integer status;
/**
* 删除标志0代表存在 2代表删除
*/
private Integer delFlag;
public Long getUserAccountStatementId() {
return userAccountStatementId;
}
public void setUserAccountStatementId(Long userAccountStatementId) {
this.userAccountStatementId = userAccountStatementId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public Long getChargeOrderId() {
return chargeOrderId;
}
public void setChargeOrderId(Long chargeOrderId) {
this.chargeOrderId = chargeOrderId;
}
public Long getRechargeOrderId() {
return rechargeOrderId;
}
public void setRechargeOrderId(Long rechargeOrderId) {
this.rechargeOrderId = rechargeOrderId;
}
public Long getRefundOrderId() {
return refundOrderId;
}
public void setRefundOrderId(Long refundOrderId) {
this.refundOrderId = refundOrderId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
}

View File

@ -0,0 +1,31 @@
package com.xhpc.payment.mapper;
import com.xhpc.payment.domain.XhpcUserAccountStatement;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 用户流水信息 数据层
*
* @author ruoyi
*/
public interface XhpcUserAccountStatementMapper {
/**
* 新增 用户流水信息
*
* @param xhpcUserAccountStatement 用户流水信息
* @return 结果
*/
public int insert(XhpcUserAccountStatement xhpcUserAccountStatement);
/**
* 用户流水列表
*
* @param refundOrderId
* @return
*/
public List<Map<String, Object>> list(@Param("refundOrderId") Long refundOrderId);
}

View File

@ -0,0 +1,30 @@
package com.xhpc.payment.service;
import com.xhpc.payment.domain.XhpcUserAccountStatement;
import java.util.List;
import java.util.Map;
/**
* 用户流水信息 服务层
*
* @author ruoyi
*/
public interface IXhpcUserAccountStatementService {
/**
* 新增 用户流水
*
* @param xhpcUserAccountStatement 用户流水
*/
public int insert(XhpcUserAccountStatement xhpcUserAccountStatement);
/**
* 用户流水列表
*
* @param refundOrderId
* @return
*/
public List<Map<String, Object>> list(Long refundOrderId);
}

View File

@ -1,7 +1,10 @@
package com.xhpc.payment.service.impl;
import com.ruoyi.common.core.utils.StringUtils;
import com.xhpc.payment.domain.XhpcRechargeOrder;
import com.xhpc.payment.domain.XhpcUserAccountStatement;
import com.xhpc.payment.mapper.XhpcRechargeOrderMapper;
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
import com.xhpc.payment.service.IXhpcRechargeOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -21,6 +24,9 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
@Autowired
private XhpcRechargeOrderMapper xhpcRechargeOrderMapper;
@Autowired
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
/**
* 更新 充值订单
*
@ -94,6 +100,16 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
} else {
xhpcRechargeOrder.setAlipayNumber(paymentNumber);
}
if ("1".equals(xhpcRechargeOrder.getStatus())) {
Map<String, Object> map = xhpcRechargeOrderMapper.info(rechargeOrderId);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
String amount = "-" + StringUtils.valueOf(map.get("amount"));
String userId = StringUtils.valueOf(map.get("uUserId"));
xhpcUserAccountStatement.setAmount(BigDecimal.valueOf(Double.valueOf(amount)));
xhpcUserAccountStatement.setRechargeOrderId(rechargeOrderId);
xhpcUserAccountStatement.setUserId(Long.parseLong(userId));
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
}
xhpcRechargeOrderMapper.update(xhpcRechargeOrder);
}
}

View File

@ -1,7 +1,9 @@
package com.xhpc.payment.service.impl;
import com.xhpc.payment.domain.XhpcRefundAudit;
import com.xhpc.payment.domain.XhpcRefundOrder;
import com.xhpc.payment.mapper.XhpcRefundAuditMapper;
import com.xhpc.payment.mapper.XhpcRefundOrderMapper;
import com.xhpc.payment.service.IXhpcRefundAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -20,6 +22,9 @@ public class XhpcRefundAuditServiceImpl implements IXhpcRefundAuditService {
@Autowired
private XhpcRefundAuditMapper xhpcRefundAuditMapper;
@Autowired
private XhpcRefundOrderMapper xhpcRefundOrderMapper;
/**
* 新增 退款审核
*
@ -27,6 +32,10 @@ public class XhpcRefundAuditServiceImpl implements IXhpcRefundAuditService {
*/
@Override
public int insert(XhpcRefundAudit xhpcRefundAudit) {
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
xhpcRefundOrder.setRefundOrderId(xhpcRefundAudit.getRefundOrderId());
xhpcRefundOrder.setStatus(xhpcRefundAudit.getStatus());
xhpcRefundOrderMapper.update(xhpcRefundOrder);
return xhpcRefundAuditMapper.insert(xhpcRefundAudit);
}

View File

@ -1,7 +1,10 @@
package com.xhpc.payment.service.impl;
import com.ruoyi.common.core.utils.StringUtils;
import com.xhpc.payment.domain.XhpcRefundOrder;
import com.xhpc.payment.domain.XhpcUserAccountStatement;
import com.xhpc.payment.mapper.XhpcRefundOrderMapper;
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
import com.xhpc.payment.service.IXhpcRefundOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -21,6 +24,9 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
@Autowired
private XhpcRefundOrderMapper xhpcRefundOrderMapper;
@Autowired
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
/**
* 更新 退款订单
*
@ -67,12 +73,12 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
*/
@Override
public XhpcRefundOrder addRefundOrder(String appUserId, BigDecimal amount, String type) {
XhpcRefundOrder XhpcRefundOrder = new XhpcRefundOrder();
XhpcRefundOrder.setUserId(Long.parseLong(appUserId));
XhpcRefundOrder.setAmount(amount);
XhpcRefundOrder.setType(Integer.parseInt(type));
xhpcRefundOrderMapper.insert(XhpcRefundOrder);
return XhpcRefundOrder;
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
xhpcRefundOrder.setUserId(Long.parseLong(appUserId));
xhpcRefundOrder.setAmount(amount);
xhpcRefundOrder.setType(Integer.parseInt(type));
xhpcRefundOrderMapper.insert(xhpcRefundOrder);
return xhpcRefundOrder;
}
/**
@ -85,14 +91,24 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
*/
@Override
public void updateRefundOrder(Long refundOrderId, String type, String status, String paymentNumber) {
XhpcRefundOrder XhpcRefundOrder = new XhpcRefundOrder();
XhpcRefundOrder.setRefundOrderId(refundOrderId);
XhpcRefundOrder.setStatus(Integer.parseInt(status));
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
xhpcRefundOrder.setRefundOrderId(refundOrderId);
xhpcRefundOrder.setStatus(Integer.parseInt(status));
if ("1".equals(type)) {
XhpcRefundOrder.setPrepayId(paymentNumber);
xhpcRefundOrder.setPrepayId(paymentNumber);
} else {
XhpcRefundOrder.setAlipayNumber(paymentNumber);
xhpcRefundOrder.setAlipayNumber(paymentNumber);
}
xhpcRefundOrderMapper.update(XhpcRefundOrder);
if ("1".equals(xhpcRefundOrder.getStatus())) {
Map<String, Object> map = xhpcRefundOrderMapper.info(refundOrderId);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
String amount = "-" + StringUtils.valueOf(map.get("amount"));
String userId = StringUtils.valueOf(map.get("uUserId"));
xhpcUserAccountStatement.setAmount(BigDecimal.valueOf(Double.valueOf(amount)));
xhpcUserAccountStatement.setRefundOrderId(refundOrderId);
xhpcUserAccountStatement.setUserId(Long.parseLong(userId));
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
}
xhpcRefundOrderMapper.update(xhpcRefundOrder);
}
}

View File

@ -0,0 +1,43 @@
package com.xhpc.payment.service.impl;
import com.xhpc.payment.domain.XhpcUserAccountStatement;
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
import com.xhpc.payment.service.IXhpcUserAccountStatementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 用户流水信息 服务层
*
* @author ruoyi
*/
@Service
public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStatementService {
@Autowired
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
/**
* 新增 用户流水
*
* @param xhpcUserAccountStatement 用户流水
*/
@Override
public int insert(XhpcUserAccountStatement xhpcUserAccountStatement) {
return xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
}
/**
* 用户流水列表
*
* @param refundOrderId
* @return
*/
@Override
public List<Map<String, Object>> list(Long refundOrderId) {
return xhpcUserAccountStatementMapper.list(refundOrderId);
}
}

View File

@ -21,7 +21,7 @@
</resultMap>
<insert id="insert" parameterType="com.xhpc.payment.domain.XhpcRechargeOrder" useGeneratedKeys="true"
keyProperty="XhpcRechargeOrderId">
keyProperty="rechargeOrderId">
INSERT INTO xhpc_recharge_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != userId and '' != userId">
@ -48,13 +48,13 @@
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
@ -89,13 +89,13 @@
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
@ -116,13 +116,13 @@
</if>
<if test="null != prepayId and '' != prepayId">prepay_id = #{prepayId},</if>
<if test="null != alipayNumber and '' != alipayNumber">alipay_number = #{alipayNumber},</if>
<if test="null != amount and '' != amount">amount = #{amount},</if>
<if test="null != type and '' != type">type = #{type},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != amount ">amount = #{amount},</if>
<if test="null != type">type = #{type},</if>
<if test="null != status ">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if>
<if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if>
<if test="null != updateTime">update_time = #{updateTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>

View File

@ -17,7 +17,7 @@
</resultMap>
<insert id="insert" parameterType="com.xhpc.payment.domain.XhpcRefundAudit" useGeneratedKeys="true"
keyProperty="XhpcRefundAuditId">
keyProperty="refundAuditId">
INSERT INTO xhpc_recharge_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != refundOrderId and '' != refundOrderId">
@ -29,13 +29,13 @@
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
@ -55,13 +55,13 @@
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">

View File

@ -12,6 +12,7 @@
<result column="alipay_number" property="alipayNumber"/>
<result column="amount" property="amount"/>
<result column="type" property="type"/>
<result column="examine_status" property="examineStatus"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_time" property="createTime"/>
@ -22,7 +23,7 @@
</resultMap>
<insert id="insert" parameterType="com.xhpc.payment.domain.XhpcRefundOrder" useGeneratedKeys="true"
keyProperty="XhpcRefundOrderId">
keyProperty="refundOrderId">
INSERT INTO xhpc_recharge_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != refundOrderNumber and '' != refundOrderNumber">
@ -43,19 +44,22 @@
<if test="null != type and '' != type">
type,
</if>
<if test="null != examineStatus and '' != examineStatus">
examine_status,
</if>
<if test="null != status and '' != status">
status,
</if>
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
@ -84,19 +88,22 @@
<if test="null != type and '' != type">
#{type},
</if>
<if test="null != examineStatus and '' != examineStatus">
#{examineStatus},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
@ -117,13 +124,14 @@
<if test="null != userId and '' != userId">user_id = #{userId},</if>
<if test="null != prepayId and '' != prepayId">prepay_id = #{prepayId},</if>
<if test="null != alipayNumber and '' != alipayNumber">alipay_number = #{alipayNumber},</if>
<if test="null != amount and '' != amount">amount = #{amount},</if>
<if test="null != type and '' != type">type = #{type},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != amount ">amount = #{amount},</if>
<if test="null != type ">type = #{type},</if>
<if test="null != examineStatus ">examine_status = #{examineStatus},</if>
<if test="null != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if>
<if test="null != createTime">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if>
<if test="null != updateTime">update_time = #{updateTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>
@ -133,7 +141,7 @@
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,
xro.alipay_number alipayNumber ,xro.prepay_id prepayid,xro.user_id userId,xro.amount,
xro.type ,xro.`status`,xro.create_time createTime,xau.phone,xdb.dict_value statusName
xro.type,xro.examine_status examineStatus,xro.`status`,xro.create_time createTime,xau.phone,xdb.dict_value statusName
from xhpc_refund_order xro
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'refund_order_status' and xdb.dict_key = xro.`status`
@ -143,10 +151,13 @@
<select id="page" parameterType="java.lang.String" resultType="java.util.Map">
select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,
xro.alipay_number alipayNumber ,xro.prepay_id prepayid,xro.user_id userId,xro.amount,
xro.type ,xro.`status`,xro.create_time createTime,xau.phone,xdb.dict_value statusName
xro.type,xro.examine_status examineStatus,xro.`status`,xro.create_time createTime,
xau.phone,xdb.dict_value statusName,xdbes.dict_value examineStatusName
from xhpc_refund_order xro
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'refund_order_status' and xdb.dict_key = xro.`status`
LEFT JOIN xhpc_dict_biz xdbes on xdbes.`code` = 'refund_examine_status' and xdbes.dict_key =
xro.`examine_status`
where xro.del_flag = 0
<if test="phone != null and phone != ''">
and xau.phone like concat(concat('%', #{phone}), '%')

View File

@ -0,0 +1,118 @@
<?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="com.xhpc.payment.mapper.XhpcUserAccountStatementMapper">
<resultMap type="com.xhpc.payment.domain.XhpcUserAccountStatement" id="XhpcUserAccountStatementResult">
<result column="user_account_statement_id" property="userAccountStatementId"/>
<result column="user_id" property="userId"/>
<result column="amount" property="amount"/>
<result column="charge_order_id" property="chargeOrderId"/>
<result column="recharge_order_id" property="rechargeOrderId"/>
<result column="refund_order_id" property="refundOrderId"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_time" property="createTime"/>
<result column="create_by" property="createBy"/>
<result column="update_time" property="updateTime"/>
<result column="update_by" property="updateBy"/>
<result column="remark" property="remark"/>
</resultMap>
<insert id="insert" parameterType="com.xhpc.payment.domain.XhpcUserAccountStatement" useGeneratedKeys="true"
keyProperty="userAccountStatementId">
INSERT INTO xhpc_user_account_statement
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != userId and '' != userId">
user_id,
</if>
<if test="null != amount and '' != amount">
amount,
</if>
<if test="null != chargeOrderId and '' != chargeOrderId">
charge_order_id,
</if>
<if test="null != rechargeOrderId and '' != rechargeOrderId">
recharge_order_id,
</if>
<if test="null != refundOrderId and '' != refundOrderId">
refund_order_id,
</if>
<if test="null != status and '' != status">
status,
</if>
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createTime">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != userId and '' != userId">
#{userId},
</if>
<if test="null != amount and '' != amount">
#{amount},
</if>
<if test="null != chargeOrderId and '' != chargeOrderId">
#{chargeOrderId},
</if>
<if test="null != rechargeOrderId and '' != rechargeOrderId">
#{rechargeOrderId},
</if>
<if test="null != refundOrderId and '' != refundOrderId">
#{refundOrderId},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createTime">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
</trim>
</insert>
<select id="list" parameterType="java.lang.Long" resultType="java.util.Map">
select xro.refund_order_id refundOrderId ,
xro.`status`,xdb.dict_value statusName,
xra.remark,xra.create_time createTime
from xhpc_refund_audit xra
LEFT JOIN xhpc_refund_order xro on xra.refund_order_id = xro.refund_order_id
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'refund_order_status' and xdb.dict_key = xro.`status`
where xra.del_flag = 0
<if test="refundOrderId != null and refundOrderId != ''">
and xro.refund_order_id = #{refundOrderId}
</if>
ORDER BY xra.create_time DESC
</select>
</mapper>

View File

@ -3,6 +3,7 @@ package com.xhpc.user.aspect;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.api.model.LoginUser;
import org.apache.commons.beanutils.BeanUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
@ -25,84 +26,108 @@ import java.util.Date;
@Component
@Configuration
public class DaoAspect {
private static final String CREATE_USER = "createUser";
private static final String CREATE_TIME = "createTime";
private static final String UPDATE_USER = "updateUser";
private static final String UPDATE_TIME = "updateTime";
private static final String CREATE_USER = "createUser";
private static final String CREATE_TIME = "createTime";
private static final String UPDATE_USER = "updateUser";
private static final String UPDATE_TIME = "updateTime";
@Pointcut("execution(* com.xhpc..*.update*(..))")
public void daoUpdate() {
}
@Pointcut("execution(* com.xhpc..*.update*(..))")
public void daoUpdate() {
}
@Pointcut("execution(* com.xhpc..*.insert*(..))")
public void daoCreate() {
}
@Pointcut("execution(* com.xhpc..*.insert*(..))")
public void daoCreate() {
}
@Around("daoUpdate()")
public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
return point.proceed();
}
//String userName = StringUtils.valueOf(SecurityUtils.getUsername());
String userName = "";
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (userName != null){
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
}
}
}
}
Object object = point.proceed();
return object;
@Around("daoUpdate()")
public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
return point.proceed();
}
HttpServletRequest request = attributes.getRequest();
try {
LogUserUtils logUserUtils = new LogUserUtils();
LoginUser loginUser = logUserUtils.getLogUser(request);
String userName = "";
try {
userName = SecurityUtils.getUsername();
} catch (Exception e) {
}
if (StringUtils.isNull(userName)) {
userName = loginUser.getUsername();
}
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (userName != null) {
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
}
}
}
}
} catch (Exception e) {
}
Object object = point.proceed();
return object;
}
}
@Around("daoCreate()")
public Object doAroundCreate(ProceedingJoinPoint point) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
return point.proceed();
}
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
//String userName = StringUtils.valueOf(SecurityUtils.getUsername());
String userName = "";
Date date = new Date();
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (isProperty(arg, CREATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_USER))) {
BeanUtils.setProperty(arg, CREATE_USER, userName);
}
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
@Around("daoCreate()")
public Object doAroundCreate(ProceedingJoinPoint point) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
return point.proceed();
}
HttpServletRequest request = attributes.getRequest();
try {
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
LogUserUtils logUserUtils = new LogUserUtils();
LoginUser loginUser = logUserUtils.getLogUser(request);
String userName = "";
try {
userName = SecurityUtils.getUsername();
} catch (Exception e) {
}
if (StringUtils.isNull(userName)) {
userName = loginUser.getUsername();
}
if (StringUtils.isNull(userName)) {
userName = "admin";
}
Date date = new Date();
if (isProperty(arg, CREATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_USER))) {
BeanUtils.setProperty(arg, CREATE_USER, userName);
}
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, CREATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_TIME))) {
BeanUtils.setProperty(arg, CREATE_TIME, date);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, date);
}
}
}
Object object = point.proceed();
return object;
}
if (isProperty(arg, CREATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_TIME))) {
BeanUtils.setProperty(arg, CREATE_TIME, date);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, date);
}
}
}
} catch (Exception e) {
}
Object object = point.proceed();
return object;
}
public static boolean isProperty(Object bean, String field){
return StringUtils.isProperty(bean, field);
}
public static boolean isProperty(Object bean, String field) {
return StringUtils.isProperty(bean, field);
}
}

View File

@ -0,0 +1,33 @@
package com.xhpc.user.aspect;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
@Service
public class LogUserUtils {
@Autowired
private RedisService redisService;
/**
* 获取登录信息
*
* @param request 请求参数
* @return LoginUser 登录用户信息
*/
public LoginUser getLogUser(HttpServletRequest request) {
String token = request.getHeader(CacheConstants.HEADER);
token = token.substring(7);
LoginUser loginUser = new LoginUser();
try {
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
} catch (Exception e) {
}
return loginUser;
}
}

View File

@ -105,8 +105,8 @@ public class XhpcAppUserController extends BaseController {
*/
@ApiOperation("小程序用户详情")
@GetMapping("/appInfo")
public AjaxResult appInfo(@RequestParam Long appUserId) {
return AjaxResult.success(iXhpcAppUserUserService.info(appUserId));
public AjaxResult appInfo(HttpServletRequest request) {
return AjaxResult.success(iXhpcAppUserUserService.appInfo(request));
}
/**

View File

@ -1,6 +1,7 @@
package com.xhpc.user.domain;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.hibernate.validator.constraints.Length;
import java.math.BigDecimal;
@ -21,16 +22,19 @@ public class XhpcAppUser extends BaseEntity {
/**
* 手机号码
*/
@Length(max = 11, message = "手机号码不能超过11位")
private String phone;
/**
* weixin_open_id
*/
@Length(max = 50, message = "openId不能超过50位")
private String weixinOpenId;
/**
* alipay_open_id
*/
@Length(max = 50, message = "openId不能超过50位")
private String alipayOpenId;
/**

View File

@ -1,6 +1,7 @@
package com.xhpc.user.domain;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@ -23,37 +24,43 @@ public class XhpcInternetUser extends BaseEntity {
* 名称
*/
@NotBlank(message = "名称不能为空")
@Length(max = 12, message = "名称不能超过12位")
private String name;
/**
* 手机号码帐号
*/
@NotBlank(message = "手机号码不能为空")
@Length(max = 11, message = "手机号码不能超过11位")
private String phone;
/**
* 联系人
*/
@NotBlank(message = "联系人不能为空")
@Length(max = 12, message = "联系人不能超过12位")
private String contactName;
/**
* 联系人电话
*/
@NotBlank(message = "联系人电话不能为空")
@Length(max = 11, message = "联系人电话不能超过11位")
private String contactPhone;
/**
* 开户行
*/
@NotBlank(message = "开户行不能为空")
@Length(max = 20, message = "开户行电话不能超过20位")
private String openBank;
/**
* 卡号
*/
@NotNull(message = "卡号不能为空")
private Long cardNumber;
@Length(max = 20, message = "卡号不能超过20位")
private String cardNumber;
/**
* 合作开始时间
@ -80,12 +87,14 @@ public class XhpcInternetUser extends BaseEntity {
* 地址
*/
@NotBlank(message = "地址不能为空")
@Length(max = 50, message = "地址不能超过50位")
private String address;
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空")
@Length(max = 50, message = "详细地址不能超过50位")
private String detailedAddress;
/**
@ -170,11 +179,11 @@ public class XhpcInternetUser extends BaseEntity {
this.openBank = openBank;
}
public Long getCardNumber() {
public String getCardNumber() {
return cardNumber;
}
public void setCardNumber(Long cardNumber) {
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}

View File

@ -51,17 +51,28 @@ public class XhpcOperator extends BaseEntity {
@NotNull(message = "运营商属性不能为空")
private Integer attribute;
/**
* 税号
*/
@NotNull(message = "税号不能为空")
@Length(max = 50, message = "税号不能超过50位")
private String dutyParagraph;
/**
* 开户行
*/
@NotBlank(message = "开户行不能为空")
@Length(max = 20, message = "开户行电话不能超过20位")
private String openBank;
/**
* 卡号
*/
@NotNull(message = "卡号不能为空")
private Long cardNumber;
@Length(max = 20, message = "卡号不能超过20位")
private String cardNumber;
/**
* 地址code
@ -73,8 +84,16 @@ public class XhpcOperator extends BaseEntity {
* 地址
*/
@NotBlank(message = "地址不能为空")
@Length(max = 50, message = "地址不能超过50位")
private String address;
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空")
@Length(max = 50, message = "详细地址不能超过50位")
private String detailedAddress;
/**
* 经度
*/
@ -91,6 +110,7 @@ public class XhpcOperator extends BaseEntity {
* 邮箱
*/
@NotBlank(message = "邮箱不能为空")
@Length(max = 50, message = "邮箱不能超过50位")
private String email;
/**
@ -127,6 +147,7 @@ public class XhpcOperator extends BaseEntity {
* 设置充电终止的soc
*/
@NotBlank(message = "充电终止的soc不能为空")
@Length(max = 10, message = "充电终止的soc不能超过10位")
private String soc;
/**
@ -300,11 +321,27 @@ public class XhpcOperator extends BaseEntity {
this.openBank = openBank;
}
public Long getCardNumber() {
public String getCardNumber() {
return cardNumber;
}
public void setCardNumber(Long cardNumber) {
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
public String getDutyParagraph() {
return dutyParagraph;
}
public void setDutyParagraph(String dutyParagraph) {
this.dutyParagraph = dutyParagraph;
}
public String getDetailedAddress() {
return detailedAddress;
}
public void setDetailedAddress(String detailedAddress) {
this.detailedAddress = detailedAddress;
}
}

View File

@ -80,6 +80,14 @@ public interface IXhpcAppUserUserService {
*/
public R<?> voluntaryLogin(Map<String, Object> map);
/**
* 小程序用户详情
*
* @param
* @return 结果
*/
public Map<String, Object> appInfo(HttpServletRequest request);
/**
* 注销账号
*

View File

@ -11,6 +11,7 @@ import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser;
import com.xhpc.user.aspect.LogUserUtils;
import com.xhpc.user.domain.XhpcAppUser;
import com.xhpc.user.mapper.XhpcAppUserMapper;
import com.xhpc.user.service.IXhpcAppUserUserService;
@ -38,6 +39,9 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
@Autowired
private TokenService tokenService;
@Autowired
private LogUserUtils logUserUtils;
/**
* 更新C端用户
*
@ -216,7 +220,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
// 删除用户缓存记录
tokenService.delLoginUser(loginUser.getToken());
XhpcAppUser user = xhpcAppUserMapper.getAppUserByPhone(username);
if (StringUtils.isNull(user)) {
if (!StringUtils.isNull(user)) {
if ("1".equals(type)) {
user.setWeixinLogin(0);
} else {
@ -242,9 +246,31 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
if (StringUtils.isNull(user)) {
throw new BaseException("用户不存在");
}
if ("2".equals(type)) {
if ("0".equals(StringUtils.valueOf(user.getWeixinLogin()))) {
return R.fail(400, "用户未登录");
}
} else if ("1".equals(type)) {
if ("0".equals(StringUtils.valueOf(user.getWeixinLogin()))) {
return R.fail(400, "用户未登录");
}
}
return appLogin(user.getPhone(), type, openid);
}
/**
* 小程序用户详情
*
* @param
* @return 结果
*/
@Override
public Map<String, Object> appInfo(HttpServletRequest request) {
LoginUser loginUser = logUserUtils.getLogUser(request);
String userId = StringUtils.valueOf(loginUser.getUserid());
return xhpcAppUserMapper.info(Long.parseLong(userId));
}
/**
* 注销账号
*

View File

@ -0,0 +1,192 @@
<?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="com.xhpc.user.mapper.XhpcAppUserMapper">
<resultMap type="com.xhpc.user.domain.XhpcAppUser" id="XhpcAppUserResult">
<result column="app_user_id" property="appUserId"/>
<result column="phone" property="phone"/>
<result column="weixin_open_id" property="weixinOpenId"/>
<result column="alipay_open_id" property="alipayOpenId"/>
<result column="weixin_login" property="weixinLogin"/>
<result column="alipay_login" property="alipayLogin"/>
<result column="avatar" property="avatar"/>
<result column="balance" property="balance"/>
<result column="password" property="password"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/>
</resultMap>
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcAppUser" useGeneratedKeys="true"
keyProperty="appUserId">
INSERT INTO xhpc_app_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != appUserId and '' != appUserId">
app_user_id,
</if>
<if test="null != phone and '' != phone">
phone,
</if>
<if test="null != weixinOpenId and '' != weixinOpenId">
weixin_open_id,
</if>
<if test="null != alipayOpenId and '' != alipayOpenId">
alipay_open_id,
</if>
<if test="null != weixinLogin and '' != weixinLogin">
weixin_login,
</if>
<if test="null != alipayLogin and '' != alipayLogin">
alipay_login,
</if>
<if test="null != avatar and '' != avatar">
avatar,
</if>
<if test="null != balance and '' != balance">
balance,
</if>
<if test="null != password and '' != password">
password,
</if>
<if test="null != status and '' != status">
status,
</if>
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != remark and '' != remark">
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != appUserId and '' != appUserId">
#{appUserId},
</if>
<if test="null != phone and '' != phone">
#{phone},
</if>
<if test="null != weixinOpenId and '' != weixinOpenId">
#{weixinOpenId},
</if>
<if test="null != alipayOpenId and '' != alipayOpenId">
#{alipayOpenId},
</if>
<if test="null != weixinLogin and '' != weixinLogin">
#{weixinLogin},
</if>
<if test="null != alipayLogin and '' != alipayLogin">
#{alipayLogin},
</if>
<if test="null != avatar and '' != avatar">
#{avatar},
</if>
<if test="null != balance and '' != balance">
#{balance},
</if>
<if test="null != password and '' != password">
#{password},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
</trim>
</insert>
<update id="update" parameterType="com.xhpc.user.domain.XhpcInternetUser">
UPDATE xhpc_app_user
<set>
<if test="null != phone and '' != phone">phone = #{phone},</if>
<if test="null != weixinOpenId and '' != weixinOpenId">weixin_open_id = #{weixinOpenId},</if>
<if test="null != alipayOpenId and '' != alipayOpenId">alipay_open_id = #{alipayOpenId},</if>
<if test="null != weixinLogin and ''">weixin_login = #{weixinLogin},</if>
<if test="null != alipayLogin and ''">alipay_login = #{alipayLogin},</if>
<if test="null != avatar and '' != avatar">avatar = #{avatar},</if>
<if test="null != balance and '' != balance">balance = #{balance},</if>
<if test="null != password and '' != password">password = #{password},</if>
<if test="null != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != updateTime ">update_time = #{updateTime},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>
WHERE app_user_id = #{appUserId}
</update>
<delete id="deleteById" parameterType="java.lang.Long">
update xhpc_app_user set del_flag = 2 where app_user_id = #{appUserId}
</delete>
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select app_user_id appUserId, phone, weixin_open_id weixinOpenId,
weixin_login weixinlogin,alipay_login alipayLogin,
alipay_open_id alipayOpenId, avatar, balance, password,
`status`,create_by createBy ,create_time createTime,
update_time updateTime, update_by updateBy,
del_flag delflag, remark,
CASE WHEN `status` = 0 THEN '正常' else '禁用' end statusName
from xhpc_app_user
WHERE del_flag = 0 and app_user_id = #{appUserId}
</select>
<select id="selectAppUserList" parameterType="java.lang.Long" resultType="java.util.Map">
select app_user_id appUserId, phone, balance,
`status`,create_time createTime,
CASE WHEN `status` = 0 THEN '正常' else '禁用' end statusName
from xhpc_app_user
WHERE del_flag = 0
<if test="phone != null and phone != ''">
and phone like concat(concat('%', #{phone}), '%')
</if>
ORDER BY create_time DESC
</select>
<select id="getAppUserByPhone" parameterType="java.lang.String" resultMap="XhpcAppUserResult">
select *
from xhpc_app_user
WHERE del_flag = 0 and phone = #{phone} LIMIT 1
</select>
<select id="getAppUserByOpenid" parameterType="java.lang.String" resultMap="XhpcAppUserResult">
select *
from xhpc_app_user
WHERE del_flag = 0 and (weixin_open_id = #{openid}or alipay_open_id = #{openid}) LIMIT 1
</select>
</mapper>

View File

@ -33,7 +33,7 @@
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcInternetUser" useGeneratedKeys="true"
keyProperty="XhpcInternetUserId">
keyProperty="internetUserId">
INSERT INTO xhpc_internet_user
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -199,11 +199,11 @@
<if test="null != areaCode and '' != areaCode">area_code = #{areaCode},</if>
<if test="null != address and '' != address">address = #{address},</if>
<if test="null != detailedAddress and '' != detailedAddress">detailed_address = #{detailedAddress},</if>
<if test="null != commissionType and '' != commissionType">commission_type = #{commissionType},</if>
<if test="null != commissionType and ''">commission_type = #{commissionType},</if>
<if test="null != commissionRate and '' != commissionRate">commission_rate = #{commissionRate},</if>
<if test="null != longitude and '' != longitude">longitude = #{longitude},</if>
<if test="null != latitude and '' != latitude">latitude = #{latitude},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != status ">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != createTime ">create_time = #{createTime},</if>

View File

@ -18,7 +18,7 @@
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcInternetUser" useGeneratedKeys="true"
keyProperty="XhpcInternetUserId">
keyProperty="xhpcOperatorInternetBlacklistId">
insert into xhpc_operator_internet_blacklist
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != operatorId and '' != operatorId">

View File

@ -11,10 +11,12 @@
<result column="contact_phone" property="contactPhone"/>
<result column="phone" property="phone"/>
<result column="attribute" property="attribute"/>
<result column="duty_paragraph" property="dutyParagraph"/>
<result column="open_bank" property="openBank"/>
<result column="card_number" property="cardNumber"/>
<result column="area_code" property="areaCode"/>
<result column="address" property="address"/>
<result column="detailed_address" property="detailedAddress"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="email" property="email"/>
@ -36,6 +38,7 @@
<sql id="Base_Column_List">
xo.operator_id operatorId, xo.name, xo.contact_name contactName, xo.contact_phone contactPhone,
xo.phone, xo.attribute,xo.open_bank openBank,xo.card_number cardNumber, xo.area_code areaCode, xo.address,
xo.detailed_address detailedAddress, xo.duty_paragraph dutyParagraph,
xo.longitude, xo.latitude, xo.email, xo.commission_type commissionType,
xo.platform_commission_rate platformCommissionRate,
xo.maintenance_commission_rate maintenanceCommissionRate,
@ -45,7 +48,7 @@
</sql>
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcOperator" useGeneratedKeys="true"
keyProperty="XhpcOperatorId">
keyProperty="operatorId">
insert into xhpc_operator
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != name and '' != name">
@ -63,6 +66,12 @@
<if test="null != attribute and '' != attribute">
attribute,
</if>
<if test="null != dutyParagraph and '' != dutyParagraph">
duty_paragraph,
</if>
<if test="null != detailedAddress and '' != detailedAddress">
detailed_address,
</if>
<if test="null != openBank and '' != openBank">
open_bank,
</if>
@ -140,6 +149,12 @@
<if test="null != attribute and '' != attribute">
#{attribute},
</if>
<if test="null != dutyParagraph and '' != dutyParagraph">
#{dutyParagraph},
</if>
<if test="null != detailedAddress and '' != detailedAddress">
#{detailedAddress},
</if>
<if test="null != openBank and '' != openBank">
#{openBank},
</if>
@ -213,13 +228,13 @@
<if test="null != phone and '' != phone">phone = #{phone},</if>
<if test="null != attribute and '' != attribute">attribute = #{attribute},</if>
<if test="null != openBank and '' != openBank">open_bank = #{openBank},</if>
<if test="null != cardNumber and '' != cardNumber">card_number = #{cardNumber},</if>
<if test="null != cardNumber">card_number = #{cardNumber},</if>
<if test="null != areaCode and '' != areaCode">area_code = #{areaCode},</if>
<if test="null != address and '' != address">address = #{address},</if>
<if test="null != longitude and '' != longitude">longitude = #{longitude},</if>
<if test="null != latitude and '' != latitude">latitude = #{latitude},</if>
<if test="null != email and '' != email">email = #{email},</if>
<if test="null != commissionType and '' != commissionType">commission_type = #{commissionType},</if>
<if test="null != commissionType ">commission_type = #{commissionType},</if>
<if test="null != platformCommissionRate and '' != platformCommissionRate">platform_commission_rate =
#{platformCommissionRate},
</if>
@ -231,7 +246,7 @@
</if>
<if test="null != withdrawalTime and '' != withdrawalTime">withdrawal_time = #{withdrawalTime},</if>
<if test="null != soc and '' != soc">soc = #{soc},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
@ -266,8 +281,8 @@
</select>
<select id="selectOperatorList" parameterType="java.lang.Long" resultType="java.util.Map">
select xo.operator_id operatorId, xo.name, xo.contact_name contactName,
xo.contact_phone contactPhone, xo.phone, xo.attribute,xiu.create_time createTime,
select xo.operator_id operatorId, xo.name, xo.contact_name contactName, xo.duty_paragraph dutyParagraph,
xo.contact_phone contactPhone, xo.phone, xo.attribute,`xo`.create_time createTime,
xdb.dict_value attributenName
from xhpc_operator `xo`
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
@ -310,7 +325,7 @@
<select id="getOperatorId" resultType="java.util.Map">
select xo.operator_id operatorId, xo.name, xo.contact_name contactName,
xo.contact_phone contactPhone, xo.phone, xo.attribute,
xo.contact_phone contactPhone, xo.phone, xo.attribute, xo.duty_paragraph dutyParagraph,
xdb.dict_value attributenName
from xhpc_operator `xo`
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute

View File

@ -18,7 +18,7 @@
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcInternetUser" useGeneratedKeys="true"
keyProperty="XhpcInternetUserId">
keyProperty="xhpcStationInternetBlackId">
insert into xhpc_station_internet_blacklist
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != internetUserId and '' != internetUserId">
@ -30,13 +30,13 @@
<if test="null != status and '' != status">
status,
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
@ -56,13 +56,13 @@
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != createTime and '' != createTime">
<if test="null != createTime">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime and '' != updateTime">
<if test="null != updateTime">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">

View File

@ -43,7 +43,7 @@
<if test="null != avatar and '' != avatar">avatar = #{avatar},</if>
<if test="null != password and '' != password">password = #{password},</if>
<if test="null != dataPowerType and '' != dataPowerType">data_power_type = #{dataPowerType},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != loginIp and '' != loginIp">login_ip = #{loginIp},</if>
<if test="null != loginDate and '' != loginDate">login_date = #{loginDate},</if>
@ -133,8 +133,14 @@
WHERE su.del_flag = 0 and user_id = #{userId}
</select>
<select id="selectUserByUserName" parameterType="java.lang.Long" resultMap="XhpcUserResult">
select *
<select id="selectUserByUserName" parameterType="java.lang.String" resultType="com.ruoyi.system.api.domain.SysUser">
select user_id userId, dept_id deptid,user_name userName,
nick_name nickName, user_type userType, email,
phonenumber,operator_id operatorId, internet_user_id internetUserId,
sex,avatar,password,data_power_type dataPowerType, status,
del_flag delFlag, login_ip loginIp, login_date loginDate,
create_by createBy, create_time createTime, update_by updateBy,
update_time updateTime, remark
from sys_user
where user_name = #{userName}
</select>