1修改审核退款订单

2新增取消退了订单接口
This commit is contained in:
fengjundan 2021-08-02 18:36:17 +08:00
parent 2a0765f62a
commit cd31ae2335
39 changed files with 360 additions and 196 deletions

View File

@ -6,7 +6,6 @@ import com.xhpc.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
/** /**
@ -90,7 +89,6 @@ public class SysRole extends BaseEntity
return roleId != null && 1L == roleId; return roleId != null && 1L == roleId;
} }
@NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
public String getRoleName() public String getRoleName()
{ {
@ -102,7 +100,6 @@ public class SysRole extends BaseEntity
this.roleName = roleName; this.roleName = roleName;
} }
@NotBlank(message = "权限字符不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
public String getRoleKey() public String getRoleKey()
{ {
@ -114,7 +111,6 @@ public class SysRole extends BaseEntity
this.roleKey = roleKey; this.roleKey = roleKey;
} }
@NotBlank(message = "显示顺序不能为空")
public String getRoleSort() public String getRoleSort()
{ {
return roleSort; return roleSort;

View File

@ -98,6 +98,11 @@ public class StatusConstants {
*/ */
public static final Integer REFUND_ORDER_STATUS_ERROR = 2; public static final Integer REFUND_ORDER_STATUS_ERROR = 2;
/**
* 退款订单状态取消
*/
public static final Integer REFUND_ORDER_STATUS_CANCEL = 3;
/** /**
* 流水类型充值 * 流水类型充值
*/ */

View File

@ -1,19 +1,5 @@
package com.xhpc.system.controller; package com.xhpc.system.controller;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xhpc.common.core.constant.UserConstants; import com.xhpc.common.core.constant.UserConstants;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.utils.poi.ExcelUtil; import com.xhpc.common.core.utils.poi.ExcelUtil;
@ -28,6 +14,13 @@ import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.domain.SysUserRole; import com.xhpc.system.domain.SysUserRole;
import com.xhpc.system.service.ISysRoleService; import com.xhpc.system.service.ISysRoleService;
import com.xhpc.system.service.ISysUserService; import com.xhpc.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/** /**
* 角色信息 * 角色信息
@ -103,14 +96,6 @@ public class SysRoleController extends BaseController
public AjaxResult edit(@Validated @RequestBody SysRole role) public AjaxResult edit(@Validated @RequestBody SysRole role)
{ {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
{
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
{
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setUpdateBy(SecurityUtils.getUsername()); role.setUpdateBy(SecurityUtils.getUsername());
return toAjax(roleService.updateRole(role)); return toAjax(roleService.updateRole(role));
} }

View File

@ -6,6 +6,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.system.api.domain.SysRole; import com.xhpc.system.api.domain.SysRole;
import com.xhpc.system.domain.SysMenu; import com.xhpc.system.domain.SysMenu;
import com.xhpc.system.domain.XhpcUserPrivilege; import com.xhpc.system.domain.XhpcUserPrivilege;
import com.xhpc.system.domain.vo.TreeSelect;
import com.xhpc.system.service.ISysMenuService; import com.xhpc.system.service.ISysMenuService;
import com.xhpc.system.service.ISysRoleService; import com.xhpc.system.service.ISysRoleService;
import com.xhpc.system.service.IXhpcUserPrivilegeService; import com.xhpc.system.service.IXhpcUserPrivilegeService;
@ -13,8 +14,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 用户信息 * 用户信息
@ -42,16 +43,22 @@ public class XhpcUserPrivilegeController extends BaseController {
public AjaxResult roleMenuTreeselect(@RequestParam Long userId) { public AjaxResult roleMenuTreeselect(@RequestParam Long userId) {
Long SecurityUserId = SecurityUtils.getUserId(); Long SecurityUserId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuList(SecurityUserId); List<SysMenu> menus = menuService.selectMenuList(SecurityUserId);
//登录用户拥有的数据权限树
List<Map<String, Object>> dataList = iXhpcUserPrivilegeService.dataList(SecurityUserId);
//选择用户拥有的权限
List<String> dataCheckedKeys = iXhpcUserPrivilegeService.dataCheckedKeys(userId);
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
SysRole sysRole = roleService.getRoleByUserID(userId); SysRole sysRole = roleService.getRoleByUserID(userId);
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(sysRole.getRoleId())); List<Integer> integers = new ArrayList<>();
ajax.put("menus", menuService.buildMenuTreeSelect(menus)); List<TreeSelect> treeSelectList = new ArrayList<>();
ajax.put("dataCheckedKeys", dataCheckedKeys); if (null != sysRole) {
ajax.put("dataList", dataList); integers = menuService.selectMenuListByRoleId(sysRole.getRoleId());
}
if (null != menus && menus.size() > 0) {
treeSelectList = menuService.buildMenuTreeSelect(menus);
}
ajax.put("checkedKeys", integers);
ajax.put("menus", treeSelectList);
//选择用户拥有的数据权限
ajax.put("dataCheckedKeys", iXhpcUserPrivilegeService.dataCheckedKeys(userId));
//登录用户拥有的数据权限树
ajax.put("dataList", iXhpcUserPrivilegeService.dataList(SecurityUserId));
return ajax; return ajax;
} }

View File

@ -37,7 +37,7 @@ public interface XhpcUserPrivilegeMapper {
* @param userId 用户id * @param userId 用户id
* @return 结果 * @return 结果
*/ */
public List<String> dataCheckedKeys(@Param("userId") Long userId); public List<Long> dataCheckedKeys(@Param("userId") Long userId);
/** /**
* 通过运营商id查询运营商 * 通过运营商id查询运营商

View File

@ -34,7 +34,7 @@ public interface IXhpcUserPrivilegeService {
* @param userId 用户id * @param userId 用户id
* @return 结果 * @return 结果
*/ */
public List<String> dataCheckedKeys(Long userId); public List<Long> dataCheckedKeys(Long userId);
/** /**
* 数据权限构建前端所需要下拉树结构 * 数据权限构建前端所需要下拉树结构

View File

@ -55,7 +55,7 @@ public class XhpcUserPrivilegeServiceImpl implements IXhpcUserPrivilegeService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public List<String> dataCheckedKeys(Long userId) { public List<Long> dataCheckedKeys(Long userId) {
return XhpcUserPrivilege.dataCheckedKeys(userId); return XhpcUserPrivilege.dataCheckedKeys(userId);
} }

View File

@ -29,10 +29,10 @@
</insert> </insert>
<delete id="delete" parameterType="Long"> <delete id="delete" parameterType="Long">
delete from xhpc_station_internet_blacklist where user_id = #{userId} delete from xhpc_user_privilege where user_id = #{userId}
</delete> </delete>
<select id="dataCheckedKeys" parameterType="Long" resultType="java.lang.String"> <select id="dataCheckedKeys" parameterType="Long" resultType="java.lang.Long">
select charging_station_id chargingStationId from xhpc_user_privilege where user_id = #{userId} select charging_station_id chargingStationId from xhpc_user_privilege where user_id = #{userId}
</select> </select>

View File

@ -1,14 +1,17 @@
package com.xhpc.order.aspect; package com.xhpc.order.aspect;
import com.xhpc.common.core.constant.CacheConstants;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.system.api.model.LoginUser; import com.xhpc.system.api.model.LoginUser;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
@ -39,6 +42,9 @@ public class DaoAspect {
public void daoCreate() { public void daoCreate() {
} }
@Autowired
private RedisService redisService;
@Around("daoUpdate()") @Around("daoUpdate()")
public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable { public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
@ -47,27 +53,32 @@ public class DaoAspect {
} }
HttpServletRequest request = attributes.getRequest(); HttpServletRequest request = attributes.getRequest();
try { try {
LogUserUtils logUserUtils = new LogUserUtils(); String token = request.getHeader(CacheConstants.HEADER);
LoginUser loginUser = logUserUtils.getLogUser(request); token = token.substring(7);
LoginUser loginUser = new LoginUser();
try {
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
} catch (Exception e) {
}
String userName = ""; String userName = "";
try { try {
userName = SecurityUtils.getUsername(); userName = SecurityUtils.getUsername();
} catch (Exception e) { } catch (Exception e) {
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = loginUser.getUsername(); userName = loginUser.getUsername();
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = "admin"; userName = "admin";
} }
if (userName != null) { if (userName != null) {
Object[] objects = point.getArgs(); Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) { if (objects != null && objects.length > 0) {
for (Object arg : objects) { for (Object arg : objects) {
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) { if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName); BeanUtils.setProperty(arg, UPDATE_USER, userName);
} }
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) { if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, new Date()); BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
} }
} }
@ -91,31 +102,36 @@ public class DaoAspect {
Object[] objects = point.getArgs(); Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) { if (objects != null && objects.length > 0) {
for (Object arg : objects) { for (Object arg : objects) {
LogUserUtils logUserUtils = new LogUserUtils(); String token = request.getHeader(CacheConstants.HEADER);
LoginUser loginUser = logUserUtils.getLogUser(request); token = token.substring(7);
LoginUser loginUser = new LoginUser();
try {
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
} catch (Exception e) {
}
String userName = ""; String userName = "";
try { try {
userName = SecurityUtils.getUsername(); userName = SecurityUtils.getUsername();
} catch (Exception e) { } catch (Exception e) {
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = loginUser.getUsername(); userName = loginUser.getUsername();
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = "admin"; userName = "admin";
} }
Date date = new Date(); Date date = new Date();
if (isProperty(arg, CREATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_USER))) { if (isProperty(arg, CREATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_USER))) {
BeanUtils.setProperty(arg, CREATE_USER, userName); BeanUtils.setProperty(arg, CREATE_USER, userName);
} }
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) { if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName); BeanUtils.setProperty(arg, UPDATE_USER, userName);
} }
if (isProperty(arg, CREATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_TIME))) { if (isProperty(arg, CREATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_TIME))) {
BeanUtils.setProperty(arg, CREATE_TIME, date); BeanUtils.setProperty(arg, CREATE_TIME, date);
} }
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) { if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, date); BeanUtils.setProperty(arg, UPDATE_TIME, date);
} }
} }

View File

@ -1,26 +0,0 @@
package com.xhpc.order.aspect;
import com.xhpc.common.core.constant.CacheConstants;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.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

@ -12,6 +12,7 @@ import com.xhpc.order.mapper.XhpcHistoryOrderReconciliationStatusMapper;
import com.xhpc.order.service.IXhpcHistoryOrderReconciliationStatusService; import com.xhpc.order.service.IXhpcHistoryOrderReconciliationStatusService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -39,6 +40,7 @@ public class XhpcHistoryOrderReconciliationStatusServiceImpl implements IXhpcHis
* @param xhpcHistoryOrderReconciliationStatus 历史订单对账状态 * @param xhpcHistoryOrderReconciliationStatus 历史订单对账状态
*/ */
@Override @Override
@Transactional
public int insert(XhpcHistoryOrderReconciliationStatus xhpcHistoryOrderReconciliationStatus) { public int insert(XhpcHistoryOrderReconciliationStatus xhpcHistoryOrderReconciliationStatus) {
return xhpcHistoryOrderReconciliationStatusMapper.insert(xhpcHistoryOrderReconciliationStatus); return xhpcHistoryOrderReconciliationStatusMapper.insert(xhpcHistoryOrderReconciliationStatus);
} }
@ -52,6 +54,7 @@ public class XhpcHistoryOrderReconciliationStatusServiceImpl implements IXhpcHis
* @return * @return
*/ */
@Override @Override
@Transactional
public AjaxResult status(String historyOrderIds, Integer status, String remark) { public AjaxResult status(String historyOrderIds, Integer status, String remark) {
for (String historyOrderId : historyOrderIds.split(",")) { for (String historyOrderId : historyOrderIds.split(",")) {
XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderMapper.info(Long.parseLong(historyOrderId)); XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderMapper.info(Long.parseLong(historyOrderId));

View File

@ -12,6 +12,7 @@ import com.xhpc.order.mapper.XhpcHistoryOrderSortingStatusMapper;
import com.xhpc.order.service.IXhpcHistoryOrderSortingStatusService; import com.xhpc.order.service.IXhpcHistoryOrderSortingStatusService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -39,6 +40,7 @@ public class XhpcHistoryOrderSortingStatusServiceImpl implements IXhpcHistoryOrd
* @param xhpcHistoryOrderSortingStatus 历史订单清分状态 * @param xhpcHistoryOrderSortingStatus 历史订单清分状态
*/ */
@Override @Override
@Transactional
public int insert(XhpcHistoryOrderSortingStatus xhpcHistoryOrderSortingStatus) { public int insert(XhpcHistoryOrderSortingStatus xhpcHistoryOrderSortingStatus) {
return xhpcHistoryOrderSortingStatusMapper.insert(xhpcHistoryOrderSortingStatus); return xhpcHistoryOrderSortingStatusMapper.insert(xhpcHistoryOrderSortingStatus);
} }
@ -52,6 +54,7 @@ public class XhpcHistoryOrderSortingStatusServiceImpl implements IXhpcHistoryOrd
* @return * @return
*/ */
@Override @Override
@Transactional
public AjaxResult status(String historyOrderIds, Integer status, String remark) { public AjaxResult status(String historyOrderIds, Integer status, String remark) {
for (String historyOrderId : historyOrderIds.split(",")) { for (String historyOrderId : historyOrderIds.split(",")) {
XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderMapper.info(Long.parseLong(historyOrderId)); XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderMapper.info(Long.parseLong(historyOrderId));

View File

@ -1,14 +1,17 @@
package com.xhpc.payment.aspect; package com.xhpc.payment.aspect;
import com.xhpc.common.core.constant.CacheConstants;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.system.api.model.LoginUser; import com.xhpc.system.api.model.LoginUser;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
@ -39,6 +42,9 @@ public class DaoAspect {
public void daoCreate() { public void daoCreate() {
} }
@Autowired
private RedisService redisService;
@Around("daoUpdate()") @Around("daoUpdate()")
public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable { public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
@ -47,33 +53,39 @@ public class DaoAspect {
} }
HttpServletRequest request = attributes.getRequest(); HttpServletRequest request = attributes.getRequest();
try { try {
LogUserUtils logUserUtils = new LogUserUtils(); String token = request.getHeader(CacheConstants.HEADER);
LoginUser loginUser = logUserUtils.getLogUser(request); token = token.substring(7);
LoginUser loginUser = new LoginUser();
try {
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
} catch (Exception e) {
}
String userName = ""; String userName = "";
try { try {
userName = SecurityUtils.getUsername(); userName = SecurityUtils.getUsername();
} catch (Exception e) { } catch (Exception e) {
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = loginUser.getUsername(); userName = loginUser.getUsername();
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = "admin"; userName = "admin";
} }
if (userName != null) { if (userName != null) {
Object[] objects = point.getArgs(); Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) { if (objects != null && objects.length > 0) {
for (Object arg : objects) { for (Object arg : objects) {
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) { if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName); BeanUtils.setProperty(arg, UPDATE_USER, userName);
} }
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) { if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, new Date()); BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
} }
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println(e.getMessage());
} }
Object object = point.proceed(); Object object = point.proceed();
return object; return object;
@ -91,31 +103,36 @@ public class DaoAspect {
Object[] objects = point.getArgs(); Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) { if (objects != null && objects.length > 0) {
for (Object arg : objects) { for (Object arg : objects) {
LogUserUtils logUserUtils = new LogUserUtils(); String token = request.getHeader(CacheConstants.HEADER);
LoginUser loginUser = logUserUtils.getLogUser(request); token = token.substring(7);
LoginUser loginUser = new LoginUser();
try {
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
} catch (Exception e) {
}
String userName = ""; String userName = "";
try { try {
userName = SecurityUtils.getUsername(); userName = SecurityUtils.getUsername();
} catch (Exception e) { } catch (Exception e) {
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = loginUser.getUsername(); userName = loginUser.getUsername();
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = "admin"; userName = "admin";
} }
Date date = new Date(); Date date = new Date();
if (isProperty(arg, CREATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_USER))) { if (isProperty(arg, CREATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_USER))) {
BeanUtils.setProperty(arg, CREATE_USER, userName); BeanUtils.setProperty(arg, CREATE_USER, userName);
} }
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) { if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName); BeanUtils.setProperty(arg, UPDATE_USER, userName);
} }
if (isProperty(arg, CREATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_TIME))) { if (isProperty(arg, CREATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_TIME))) {
BeanUtils.setProperty(arg, CREATE_TIME, date); BeanUtils.setProperty(arg, CREATE_TIME, date);
} }
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) { if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, date); BeanUtils.setProperty(arg, UPDATE_TIME, date);
} }
} }

View File

@ -1,26 +0,0 @@
package com.xhpc.payment.aspect;
import com.xhpc.common.core.constant.CacheConstants;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.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

@ -58,17 +58,17 @@ public class WxPaymentController {
@ApiOperation(value = "微信支付") @ApiOperation(value = "微信支付")
public AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception { public AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception {
String openid = StringUtils.valueOf(map.get("openid")); String openid = StringUtils.valueOf(map.get("openid"));
if (StringUtils.isNull(openid)) { if (StringUtils.isEmpty(openid)) {
return AjaxResult.error(HttpStatus.NOT_NULL, "openid不能为空"); return AjaxResult.error(HttpStatus.NOT_NULL, "openid不能为空");
} }
//总金额()订单总金额单位为分 //总金额()订单总金额单位为分
String amount = StringUtils.valueOf(map.get("amount")); String amount = StringUtils.valueOf(map.get("amount"));
if (StringUtils.isNull(amount)) { if (StringUtils.isEmpty(amount)) {
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能为空"); return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能为空");
} }
//用户信息id //用户信息id
String userId = StringUtils.valueOf(map.get("userId")); String userId = StringUtils.valueOf(map.get("userId"));
if (StringUtils.isNull(userId)) { if (StringUtils.isEmpty(userId)) {
return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空"); return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空");
} }
Double amount1 = Double.parseDouble(amount) * 100; Double amount1 = Double.parseDouble(amount) * 100;

View File

@ -16,10 +16,11 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.payment.domain.XhpcAppUser; import com.xhpc.payment.domain.XhpcAppUser;
import com.xhpc.payment.domain.XhpcRefundAudit; import com.xhpc.payment.domain.XhpcRefundAudit;
import com.xhpc.payment.domain.XhpcUserAccountStatement; import com.xhpc.payment.domain.XhpcRefundOrder;
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper; import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
import com.xhpc.payment.service.IXhpcRefundAuditService; import com.xhpc.payment.service.IXhpcRefundAuditService;
import com.xhpc.payment.service.IXhpcRefundOrderService; import com.xhpc.payment.service.IXhpcRefundOrderService;
import com.xhpc.payment.service.impl.XhpcUserAccountStatementServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
@ -33,6 +34,7 @@ import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
@ -58,6 +60,9 @@ public class XhpcRefundAuditController extends BaseController {
@Autowired @Autowired
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper; private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
@Autowired
private XhpcUserAccountStatementServiceImpl xhpcUserAccountStatementService;
@Autowired @Autowired
private Environment environment; private Environment environment;
@ -67,20 +72,65 @@ public class XhpcRefundAuditController extends BaseController {
* @param xhpcRefundAudit * @param xhpcRefundAudit
* @return * @return
*/ */
@GetMapping("/examine") @PostMapping("/examine")
@ApiOperation(value = "退款审核") @ApiOperation(value = "退款审核")
public AjaxResult info(@RequestBody XhpcRefundAudit xhpcRefundAudit) { public AjaxResult info(@RequestBody XhpcRefundAudit xhpcRefundAudit) {
if (StatusConstants.REFUND_ORDER_STATUS_SUCCESS == xhpcRefundAudit.getStatus()) { AjaxResult ajaxResult = iXhpcRefundAuditService.insert(xhpcRefundAudit);
if (StringUtils.isNotNull(ajaxResult)) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ajaxResult;
}
Map<String, Object> map = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId()); Map<String, Object> map = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId());
if (null == map) { if (null == map) {
AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单不存在"); AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单不存在");
} }
String refundOrderId = StringUtils.valueOf(map.get("refundOrderId")); String userId = StringUtils.valueOf(map.get("userId"));
if (StatusConstants.OPERATION_WX_TYPE.equals(refundOrderId)) { XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(Long.parseLong(userId));
xhpcAppUser.setIsRefundApplication(0);
int refundApplication = xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
if (refundApplication == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error();
}
if (StatusConstants.REFUND_ORDER_STATUS_SUCCESS == xhpcRefundAudit.getStatus()) {
String amount = "-" + StringUtils.valueOf(map.get("amount"));
xhpcUserAccountStatementService.add(xhpcRefundAudit.getRefundOrderId(), amount, userId, StatusConstants.FLOWING_WATER_REFUND);
String type = StringUtils.valueOf(map.get("type"));
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
enterpriseCheckOut(xhpcRefundAudit); enterpriseCheckOut(xhpcRefundAudit);
} }
} }
return AjaxResult.success(iXhpcRefundAuditService.insert(xhpcRefundAudit)); return AjaxResult.success();
}
/**
* 退款审核
*
* @param userId
* @return
*/
@PostMapping("/cancelExamine")
@ApiOperation(value = "退款审核")
public AjaxResult cancelExamine(@RequestParam Long userId) {
Map<String, Object> map = iXhpcRefundOrderService.addRefundOrder(userId);
if (StringUtils.isNull(map)) {
return AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单不存在");
}
String refundOrderId = StringUtils.valueOf(map.get("refundOrderId"));
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
xhpcRefundOrder.setRefundOrderId(Long.parseLong(refundOrderId));
xhpcRefundOrder.setStatus(StatusConstants.REFUND_ORDER_STATUS_CANCEL);
int updateStatus = iXhpcRefundOrderService.updateStatus(xhpcRefundOrder);
if (updateStatus == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error();
}
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(userId);
xhpcAppUser.setIsRefundApplication(0);
xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
return AjaxResult.success();
} }
/** /**
@ -99,7 +149,7 @@ public class XhpcRefundAuditController extends BaseController {
* *
* @return * @return
*/ */
public synchronized Object enterpriseCheckOut(@RequestBody XhpcRefundAudit xhpcRefundAudit) { public Object enterpriseCheckOut(@RequestBody XhpcRefundAudit xhpcRefundAudit) {
//只有审核通过才能退款 //只有审核通过才能退款
Map<String, Object> xhpcRefundOrder = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId()); Map<String, Object> xhpcRefundOrder = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId());
if (StringUtils.isNull(xhpcRefundOrder)) { if (StringUtils.isNull(xhpcRefundOrder)) {
@ -259,7 +309,6 @@ public class XhpcRefundAuditController extends BaseController {
return AjaxResult.error(map.get("err_code_des")); return AjaxResult.error(map.get("err_code_des"));
} else { } else {
//退款成功修改订单 //退款成功修改订单
iXhpcRefundOrderService.updateRefundOrder(id, StatusConstants.OPERATION_WX_TYPE, StatusConstants.REFUND_ORDER_STATUS_SUCCESS);
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId)); Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
if (StringUtils.isNotNull(appUserInfo)) { if (StringUtils.isNotNull(appUserInfo)) {
String balance = StringUtils.valueOf(appUserInfo.get("balance")); String balance = StringUtils.valueOf(appUserInfo.get("balance"));
@ -269,13 +318,6 @@ public class XhpcRefundAuditController extends BaseController {
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(amount); BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(amount);
xhpcAppUser.setBalance(surplus); xhpcAppUser.setBalance(surplus);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser); xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_REFUND_TYPE);
xhpcUserAccountStatement.setRefundOrderId(id);
xhpcUserAccountStatement.setUserId(Long.parseLong(userId));
xhpcUserAccountStatement.setAmount(amount);
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
} }
return AjaxResult.success("退款成功"); return AjaxResult.success("退款成功");
} }

View File

@ -33,21 +33,21 @@ public class XhpcRefundOrderController extends BaseController {
@ApiOperation(value = "申请退款") @ApiOperation(value = "申请退款")
public AjaxResult enterpriseCheckOut(@RequestBody Map<String, Object> map) { public AjaxResult enterpriseCheckOut(@RequestBody Map<String, Object> map) {
String amount = StringUtils.valueOf(map.get("amount")); String amount = StringUtils.valueOf(map.get("amount"));
if (StringUtils.isNull(amount)) { if (StringUtils.isEmpty(amount)) {
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能为空"); return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能为空");
} }
//用户信息id //用户信息id
String userId = StringUtils.valueOf(map.get("userId")); String userId = StringUtils.valueOf(map.get("userId"));
if (StringUtils.isNull(userId)) { if (StringUtils.isEmpty(userId)) {
return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空"); return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空");
} }
//openid //openid
String openid = StringUtils.valueOf(map.get("openid")); String openid = StringUtils.valueOf(map.get("openid"));
if (StringUtils.isNull(userId)) { if (StringUtils.isEmpty(userId)) {
return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空"); return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空");
} }
String type = StringUtils.valueOf(map.get("type")); String type = StringUtils.valueOf(map.get("type"));
if (StringUtils.isNull(type)) { if (StringUtils.isEmpty(type)) {
return AjaxResult.error(HttpStatus.NOT_NULL, "退款渠道不能为空"); return AjaxResult.error(HttpStatus.NOT_NULL, "退款渠道不能为空");
} }
//生成退款订单 //生成退款订单

View File

@ -67,6 +67,11 @@ public class XhpcAppUser extends BaseEntity {
*/ */
private Integer status; private Integer status;
/**
* 是否有退款订单审核0无 1有
*/
private Integer isRefundApplication;
/** /**
* 删除标志0代表存在 2代表删除 * 删除标志0代表存在 2代表删除
*/ */
@ -152,6 +157,14 @@ public class XhpcAppUser extends BaseEntity {
this.status = status; this.status = status;
} }
public Integer getIsRefundApplication() {
return isRefundApplication;
}
public void setIsRefundApplication(Integer isRefundApplication) {
this.isRefundApplication = isRefundApplication;
}
public String getDelFlag() { public String getDelFlag() {
return delFlag; return delFlag;
} }

View File

@ -54,7 +54,7 @@ public class XhpcRefundOrder extends BaseEntity {
private Integer examineStatus; private Integer examineStatus;
/** /**
* 状态0退款中 1退款成功2退款失败3退款异常 * 状态0退款中 1退款成功2退款失败3取消订单
*/ */
private Integer status; private Integer status;

View File

@ -29,6 +29,14 @@ public interface XhpcRefundOrderMapper {
*/ */
public int update(XhpcRefundOrder xhpcRefundOrder); public int update(XhpcRefundOrder xhpcRefundOrder);
/**
* 修改退款订单信息
*
* @param xhpcRefundOrder 退款订单信息
* @return 结果
*/
public int updateStatus(XhpcRefundOrder xhpcRefundOrder);
/** /**
* 查询退款订单详情 * 查询退款订单详情
* *
@ -57,4 +65,12 @@ public interface XhpcRefundOrderMapper {
*/ */
public List<Map<String, Object>> getNotChargeOrder(@Param("userId") Long userId); public List<Map<String, Object>> getNotChargeOrder(@Param("userId") Long userId);
/**
* 通过用户id查询未完成退款订单
*
* @param userId 用户id
* @return 结果
*/
public Map<String, Object> getNotRefundOrder(@Param("userId") Long userId);
} }

View File

@ -47,6 +47,14 @@ public interface XhpcUserAccountStatementMapper {
*/ */
public int updateAppUserBalance(XhpcAppUser xhpcAppUser); public int updateAppUserBalance(XhpcAppUser xhpcAppUser);
/**
* 更新C端退款订单审核
*
* @param xhpcAppUser C端用户
* @return
*/
public int updateAppUserRefundApplication(XhpcAppUser xhpcAppUser);
/** /**
* 用户流水列表 * 用户流水列表

View File

@ -52,12 +52,18 @@ public interface IXhpcRefundOrderService {
public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid); public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid);
/** /**
* 修改订单状态 退款订单 * 通过用户id查询未完成退款订单
* *
* @param refundOrderId 退款订单id * @param userId 用户id
* @param status 状态0待支付 1充值成功2充值失败 * @return 结果
* @param type 退款渠道1微信 2支付宝
* @return
*/ */
public void updateRefundOrder(Long refundOrderId, String type, Integer status); public Map<String, Object> addRefundOrder(Long userId);
/**
* 修改退款订单信息
*
* @param xhpcRefundOrder 退款订单信息
* @return 结果
*/
public int updateStatus(XhpcRefundOrder xhpcRefundOrder);
} }

View File

@ -7,6 +7,7 @@ import com.xhpc.payment.mapper.XhpcRechargeOrderMapper;
import com.xhpc.payment.service.IXhpcRechargeOrderService; import com.xhpc.payment.service.IXhpcRechargeOrderService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -32,6 +33,7 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
* @param xhpcRechargeOrder 充值订单 * @param xhpcRechargeOrder 充值订单
*/ */
@Override @Override
@Transactional
public int update(XhpcRechargeOrder xhpcRechargeOrder) { public int update(XhpcRechargeOrder xhpcRechargeOrder) {
return xhpcRechargeOrderMapper.update(xhpcRechargeOrder); return xhpcRechargeOrderMapper.update(xhpcRechargeOrder);
} }
@ -72,6 +74,7 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
* @return * @return
*/ */
@Override @Override
@Transactional
public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber) { public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber) {
XhpcRechargeOrder xhpcRechargeOrder = new XhpcRechargeOrder(); XhpcRechargeOrder xhpcRechargeOrder = new XhpcRechargeOrder();
xhpcRechargeOrder.setUserId(Long.parseLong(appUserId)); xhpcRechargeOrder.setUserId(Long.parseLong(appUserId));
@ -91,6 +94,7 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
* @return * @return
*/ */
@Override @Override
@Transactional
public void updateRechargeOrder(Long rechargeOrderId, String type, Integer status, String paymentNumber) { public void updateRechargeOrder(Long rechargeOrderId, String type, Integer status, String paymentNumber) {
XhpcRechargeOrder xhpcRechargeOrder = new XhpcRechargeOrder(); XhpcRechargeOrder xhpcRechargeOrder = new XhpcRechargeOrder();
xhpcRechargeOrder.setRechargeOrderId(rechargeOrderId); xhpcRechargeOrder.setRechargeOrderId(rechargeOrderId);

View File

@ -1,8 +1,5 @@
package com.xhpc.payment.service.impl; package com.xhpc.payment.service.impl;
import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.payment.domain.XhpcRefundAudit; import com.xhpc.payment.domain.XhpcRefundAudit;
import com.xhpc.payment.domain.XhpcRefundOrder; import com.xhpc.payment.domain.XhpcRefundOrder;
@ -11,6 +8,7 @@ import com.xhpc.payment.mapper.XhpcRefundOrderMapper;
import com.xhpc.payment.service.IXhpcRefundAuditService; import com.xhpc.payment.service.IXhpcRefundAuditService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -38,22 +36,17 @@ public class XhpcRefundAuditServiceImpl implements IXhpcRefundAuditService {
* @param xhpcRefundAudit 退款审核 * @param xhpcRefundAudit 退款审核
*/ */
@Override @Override
@Transactional
public AjaxResult insert(XhpcRefundAudit xhpcRefundAudit) { public AjaxResult insert(XhpcRefundAudit xhpcRefundAudit) {
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder(); XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
xhpcRefundOrder.setRefundOrderId(xhpcRefundAudit.getRefundOrderId()); xhpcRefundOrder.setRefundOrderId(xhpcRefundAudit.getRefundOrderId());
xhpcRefundOrder.setExamineStatus(xhpcRefundAudit.getStatus()); xhpcRefundOrder.setExamineStatus(xhpcRefundAudit.getStatus());
xhpcRefundOrderMapper.update(xhpcRefundOrder); int updateStatus = xhpcRefundOrderMapper.updateStatus(xhpcRefundOrder);
if (StatusConstants.REFUND_ORDER_STATUS_SUCCESS == xhpcRefundAudit.getStatus()) { if (updateStatus == 0) {
Map<String, Object> map = xhpcRefundOrderMapper.info(xhpcRefundOrder.getRefundOrderId()); return AjaxResult.error();
if (null == map) {
AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单不存在");
}
String amount = "-" + StringUtils.valueOf(map.get("amount"));
String userId = StringUtils.valueOf(map.get("userId"));
xhpcUserAccountStatementService.add(xhpcRefundAudit.getRefundOrderId(), amount, userId, StatusConstants.FLOWING_WATER_REFUND);
} }
xhpcRefundAuditMapper.insert(xhpcRefundAudit); xhpcRefundAuditMapper.insert(xhpcRefundAudit);
return AjaxResult.success(); return null;
} }
/** /**

View File

@ -2,12 +2,16 @@ package com.xhpc.payment.service.impl;
import com.xhpc.common.core.constant.HttpStatus; import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.payment.domain.XhpcAppUser;
import com.xhpc.payment.domain.XhpcRefundOrder; import com.xhpc.payment.domain.XhpcRefundOrder;
import com.xhpc.payment.mapper.XhpcRefundOrderMapper; import com.xhpc.payment.mapper.XhpcRefundOrderMapper;
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
import com.xhpc.payment.service.IXhpcRefundOrderService; import com.xhpc.payment.service.IXhpcRefundOrderService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -24,12 +28,16 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
@Autowired @Autowired
private XhpcRefundOrderMapper xhpcRefundOrderMapper; private XhpcRefundOrderMapper xhpcRefundOrderMapper;
@Autowired
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
/** /**
* 更新 退款订单 * 更新 退款订单
* *
* @param XhpcRefundOrder 退款订单 * @param XhpcRefundOrder 退款订单
*/ */
@Override @Override
@Transactional
public int update(XhpcRefundOrder XhpcRefundOrder) { public int update(XhpcRefundOrder XhpcRefundOrder) {
return xhpcRefundOrderMapper.update(XhpcRefundOrder); return xhpcRefundOrderMapper.update(XhpcRefundOrder);
} }
@ -69,11 +77,20 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
* @return * @return
*/ */
@Override @Override
@Transactional
public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid) { public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid) {
List<Map<String, Object>> list = xhpcRefundOrderMapper.getNotChargeOrder(Long.parseLong(appUserId)); List<Map<String, Object>> list = xhpcRefundOrderMapper.getNotChargeOrder(Long.parseLong(appUserId));
if (null != list && list.size() > 0) { if (null != list && list.size() > 0) {
return AjaxResult.error(HttpStatus.ERROR_STATUS, "还有未完成的订单,不能退款"); return AjaxResult.error(HttpStatus.ERROR_STATUS, "还有未完成的订单");
}
Map<String, Object> objectMap = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(appUserId));
if (StringUtils.isNull(objectMap)) {
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
}
String isRefundApplication = StringUtils.valueOf(objectMap.get("isRefundApplication"));
if ("1".equals(isRefundApplication)) {
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户已存在退款订单");
} }
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder(); XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
xhpcRefundOrder.setUserId(Long.parseLong(appUserId)); xhpcRefundOrder.setUserId(Long.parseLong(appUserId));
@ -86,23 +103,32 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
xhpcRefundOrder.setAlipayId(openid); xhpcRefundOrder.setAlipayId(openid);
} }
xhpcRefundOrderMapper.insert(xhpcRefundOrder); xhpcRefundOrderMapper.insert(xhpcRefundOrder);
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(Long.parseLong(appUserId));
xhpcAppUser.setIsRefundApplication(1);
xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
return AjaxResult.success(); return AjaxResult.success();
} }
/** /**
* 修改订单状态 退款订单 * 通过用户id查询未完成退款订单
* *
* @param refundOrderId 退款订单id * @param userId 用户id
* @param status 状态0待支付 1充值成功2充值失败 * @return 结果
* @param type 退款渠道1微信 2支付宝
* @return
*/ */
@Override @Override
public void updateRefundOrder(Long refundOrderId, String type, Integer status) { public Map<String, Object> addRefundOrder(Long userId) {
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder(); return xhpcRefundOrderMapper.getNotRefundOrder(userId);
xhpcRefundOrder.setRefundOrderId(refundOrderId); }
xhpcRefundOrder.setStatus(status);
xhpcRefundOrderMapper.update(xhpcRefundOrder);
/**
* 修改退款订单信息
*
* @param xhpcRefundOrder 退款订单信息
* @return 结果
*/
@Override
public int updateStatus(XhpcRefundOrder xhpcRefundOrder) {
return xhpcRefundOrderMapper.updateStatus(xhpcRefundOrder);
} }
} }

View File

@ -7,6 +7,7 @@ import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
import com.xhpc.payment.service.IXhpcUserAccountStatementService; import com.xhpc.payment.service.IXhpcUserAccountStatementService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -29,6 +30,7 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
* @param xhpcUserAccountStatement 用户流水 * @param xhpcUserAccountStatement 用户流水
*/ */
@Override @Override
@Transactional
public int insert(XhpcUserAccountStatement xhpcUserAccountStatement) { public int insert(XhpcUserAccountStatement xhpcUserAccountStatement) {
return xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement); return xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
} }

View File

@ -138,6 +138,14 @@
WHERE refund_order_id = #{refundOrderId} WHERE refund_order_id = #{refundOrderId}
</update> </update>
<update id="updateStatus" parameterType="com.xhpc.payment.domain.XhpcRefundOrder">
UPDATE xhpc_refund_order
<set>
<if test="null != status">status = #{status},</if>
</set>
WHERE refund_order_id = #{refundOrderId} and status = #{status}
</update>
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map"> <select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber, select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,
xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount, xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount,
@ -188,4 +196,21 @@
</if> </if>
ORDER BY xco.create_time DESC ORDER BY xco.create_time DESC
</select> </select>
<select id="getNotRefundOrder" parameterType="java.lang.String" resultType="java.util.Map">
select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,
xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount,
xro.type,xro.examine_status examineStatus,xro.`status`,xro.create_time createTime,
xau.phone,sdd.dict_label statusName,sdds.dict_label examineStatusName
from xhpc_refund_order xro
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'refund_order_status' and sdd.dict_value = xro.`status`
LEFT JOIN sys_dict_data sdds on sdds.`dict_type` = 'refund_examine_status' and sdds.dict_value =
xro.examine_status
where xro.del_flag = 0
<if test="userId != null and userId != ''">
and xau.app_user_id = {userId}
</if>
ORDER BY xro.create_time DESC LIMIT 1
</select>
</mapper> </mapper>

View File

@ -131,7 +131,7 @@
<select id="appUserInfo" parameterType="java.lang.Long" resultType="java.util.Map"> <select id="appUserInfo" parameterType="java.lang.Long" resultType="java.util.Map">
select app_user_id appUserId, phone, weixin_open_id weixinOpenId, select app_user_id appUserId, phone, weixin_open_id weixinOpenId,
weixin_login weixinlogin,alipay_login alipayLogin, weixin_login weixinlogin,alipay_login alipayLogin,is_refund_application isRefundApplication,
alipay_open_id alipayOpenId, avatar, balance, password, alipay_open_id alipayOpenId, avatar, balance, password,
`status`,create_by createBy ,create_time createTime, `status`,create_by createBy ,create_time createTime,
update_time updateTime, update_by updateBy, update_time updateTime, update_by updateBy,
@ -149,6 +149,15 @@
WHERE app_user_id = #{appUserId} WHERE app_user_id = #{appUserId}
</update> </update>
<update id="updateAppUserRefundApplication" parameterType="com.xhpc.payment.domain.XhpcAppUser">
UPDATE xhpc_app_user
<set>
<if test="null != isRefundApplication">is_refund_application = #{isRefundApplication},</if>
</set>
WHERE app_user_id = #{appUserId}
</update>
<select id="list" parameterType="java.lang.Long" resultType="java.util.Map"> <select id="list" parameterType="java.lang.Long" resultType="java.util.Map">
select xuas.user_account_statement_id userAccountStatementId,xuas.user_id appUserId,xau.phone , select xuas.user_account_statement_id userAccountStatementId,xuas.user_id appUserId,xau.phone ,
xuas.amount amount,xuas.remaining_sum remainingSum,xuas.create_time createTime, xuas.amount amount,xuas.remaining_sum remainingSum,xuas.create_time createTime,

View File

@ -54,20 +54,20 @@ public class DaoAspect {
userName = SecurityUtils.getUsername(); userName = SecurityUtils.getUsername();
} catch (Exception e) { } catch (Exception e) {
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = loginUser.getUsername(); userName = loginUser.getUsername();
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = "admin"; userName = "admin";
} }
if (userName != null) { if (userName != null) {
Object[] objects = point.getArgs(); Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) { if (objects != null && objects.length > 0) {
for (Object arg : objects) { for (Object arg : objects) {
if (isProperty(arg, UPDATE_BY) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_BY))) { if (isProperty(arg, UPDATE_BY) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_BY))) {
BeanUtils.setProperty(arg, UPDATE_BY, userName); BeanUtils.setProperty(arg, UPDATE_BY, userName);
} }
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) { if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, new Date()); BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
} }
} }
@ -98,24 +98,24 @@ public class DaoAspect {
userName = SecurityUtils.getUsername(); userName = SecurityUtils.getUsername();
} catch (Exception e) { } catch (Exception e) {
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = loginUser.getUsername(); userName = loginUser.getUsername();
} }
if (StringUtils.isNull(userName)) { if (StringUtils.isEmpty(userName)) {
userName = "admin"; userName = "admin";
} }
Date date = new Date(); Date date = new Date();
if (isProperty(arg, CREATE_BY) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_BY))) { if (isProperty(arg, CREATE_BY) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_BY))) {
BeanUtils.setProperty(arg, CREATE_BY, userName); BeanUtils.setProperty(arg, CREATE_BY, userName);
} }
if (isProperty(arg, UPDATE_BY) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_BY))) { if (isProperty(arg, UPDATE_BY) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_BY))) {
BeanUtils.setProperty(arg, UPDATE_BY, userName); BeanUtils.setProperty(arg, UPDATE_BY, userName);
} }
if (isProperty(arg, CREATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_TIME))) { if (isProperty(arg, CREATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_TIME))) {
BeanUtils.setProperty(arg, CREATE_TIME, date); BeanUtils.setProperty(arg, CREATE_TIME, date);
} }
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) { if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, date); BeanUtils.setProperty(arg, UPDATE_TIME, date);
} }
} }

View File

@ -149,10 +149,10 @@ public class XhpcAppUserController extends BaseController {
if (null != json) { if (null != json) {
String openid = json.getString("openid"); String openid = json.getString("openid");
String sessionKey = json.getString("session_key"); String sessionKey = json.getString("session_key");
if (StringUtils.isNull(openid)) { if (StringUtils.isEmpty(openid)) {
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败"); return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
} }
if (StringUtils.isNull(sessionKey)) { if (StringUtils.isEmpty(sessionKey)) {
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败"); return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
} }

View File

@ -67,6 +67,11 @@ public class XhpcAppUser extends BaseEntity {
*/ */
private Integer status; private Integer status;
/**
* 是否有退款订单审核0无 1有
*/
private Integer isRefundApplication;
/** /**
* 删除标志0代表存在 2代表删除 * 删除标志0代表存在 2代表删除
*/ */
@ -152,6 +157,14 @@ public class XhpcAppUser extends BaseEntity {
this.status = status; this.status = status;
} }
public Integer getIsRefundApplication() {
return isRefundApplication;
}
public void setIsRefundApplication(Integer isRefundApplication) {
this.isRefundApplication = isRefundApplication;
}
public String getDelFlag() { public String getDelFlag() {
return delFlag; return delFlag;
} }

View File

@ -84,6 +84,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public void status(Long appUserId) { public void status(Long appUserId) {
Map<String, Object> map = xhpcAppUserMapper.info(appUserId); Map<String, Object> map = xhpcAppUserMapper.info(appUserId);
String status = StringUtils.valueOf(map.get("status")); String status = StringUtils.valueOf(map.get("status"));
@ -100,7 +101,6 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public R<?> register(Map<String, Object> map) { public R<?> register(Map<String, Object> map) {
String code = StringUtils.valueOf(map.get("code")); String code = StringUtils.valueOf(map.get("code"));
String phone = StringUtils.valueOf(map.get("phone")); String phone = StringUtils.valueOf(map.get("phone"));
@ -195,12 +195,12 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
return R.fail(HttpStatus.DATA_ERROR, "对不起,您的账号:" + username + " 已停用"); return R.fail(HttpStatus.DATA_ERROR, "对不起,您的账号:" + username + " 已停用");
} }
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) { if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
if (StringUtils.isNull(user.getWeixinOpenId())) { if (StringUtils.isEmpty(user.getWeixinOpenId())) {
user.setWeixinOpenId(openid); user.setWeixinOpenId(openid);
} }
user.setWeixinLogin(UserConstants.LOGIN); user.setWeixinLogin(UserConstants.LOGIN);
} else { } else {
if (StringUtils.isNull(user.getAlipayOpenId())) { if (StringUtils.isEmpty(user.getAlipayOpenId())) {
user.setAlipayOpenId(openid); user.setAlipayOpenId(openid);
} }
user.setAlipayLogin(UserConstants.LOGIN); user.setAlipayLogin(UserConstants.LOGIN);

View File

@ -9,6 +9,7 @@ import com.xhpc.user.mapper.XhpcUserMapper;
import com.xhpc.user.service.IXhpcInternetUserService; import com.xhpc.user.service.IXhpcInternetUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -36,6 +37,7 @@ public class XhpcInternetUserServiceImpl implements IXhpcInternetUserService {
* @param xhpcInternetUser 流量用户信息 * @param xhpcInternetUser 流量用户信息
*/ */
@Override @Override
@Transactional
public int insert(XhpcInternetUser xhpcInternetUser) { public int insert(XhpcInternetUser xhpcInternetUser) {
return xhpcInternetUserMapper.insert(xhpcInternetUser); return xhpcInternetUserMapper.insert(xhpcInternetUser);
} }
@ -46,6 +48,7 @@ public class XhpcInternetUserServiceImpl implements IXhpcInternetUserService {
* @param xhpcInternetUser 流量用户信息 * @param xhpcInternetUser 流量用户信息
*/ */
@Override @Override
@Transactional
public int update(XhpcInternetUser xhpcInternetUser) { public int update(XhpcInternetUser xhpcInternetUser) {
return xhpcInternetUserMapper.update(xhpcInternetUser); return xhpcInternetUserMapper.update(xhpcInternetUser);
} }
@ -57,6 +60,7 @@ public class XhpcInternetUserServiceImpl implements IXhpcInternetUserService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public void deleteByIds(String[] ids) { public void deleteByIds(String[] ids) {
for (String id : ids) { for (String id : ids) {
SysUser sysUser = xhpcInternetUserMapper.getUserByInternetUserId(Long.parseLong(id)); SysUser sysUser = xhpcInternetUserMapper.getUserByInternetUserId(Long.parseLong(id));
@ -103,6 +107,7 @@ public class XhpcInternetUserServiceImpl implements IXhpcInternetUserService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public void status(Long internetUserId) { public void status(Long internetUserId) {
SysUser sysUser = xhpcInternetUserMapper.getUserByInternetUserId(internetUserId); SysUser sysUser = xhpcInternetUserMapper.getUserByInternetUserId(internetUserId);
if (null != sysUser) { if (null != sysUser) {

View File

@ -8,6 +8,7 @@ import com.xhpc.user.mapper.XhpcOperatorInternetBlacklistMapper;
import com.xhpc.user.service.IXhpcOperatorInternetBlacklistService; import com.xhpc.user.service.IXhpcOperatorInternetBlacklistService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -32,6 +33,7 @@ public class XhpcOperatorInternetBlacklistServiceImpl implements IXhpcOperatorIn
* @param xhpcOperatorInternetBlacklist 流量用户信息 * @param xhpcOperatorInternetBlacklist 流量用户信息
*/ */
@Override @Override
@Transactional
public int insert(XhpcOperatorInternetBlacklist xhpcOperatorInternetBlacklist) { public int insert(XhpcOperatorInternetBlacklist xhpcOperatorInternetBlacklist) {
return xhpcOperatorInternetBlacklistMapper.insert(xhpcOperatorInternetBlacklist); return xhpcOperatorInternetBlacklistMapper.insert(xhpcOperatorInternetBlacklist);
} }
@ -44,6 +46,7 @@ public class XhpcOperatorInternetBlacklistServiceImpl implements IXhpcOperatorIn
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public void deleteByIds(Long operatorId) { public void deleteByIds(Long operatorId) {
xhpcOperatorInternetBlacklistMapper.deleteByIds(operatorId); xhpcOperatorInternetBlacklistMapper.deleteByIds(operatorId);
} }

View File

@ -9,6 +9,7 @@ import com.xhpc.user.mapper.XhpcUserMapper;
import com.xhpc.user.service.IXhpcOperatorService; import com.xhpc.user.service.IXhpcOperatorService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -33,6 +34,7 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService {
* @param xhpcOperator 运营商信息 * @param xhpcOperator 运营商信息
*/ */
@Override @Override
@Transactional
public int insert(XhpcOperator xhpcOperator) { public int insert(XhpcOperator xhpcOperator) {
return xhpcOperatorMapper.insert(xhpcOperator); return xhpcOperatorMapper.insert(xhpcOperator);
} }
@ -43,6 +45,7 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService {
* @param xhpcOperator 运营商信息 * @param xhpcOperator 运营商信息
*/ */
@Override @Override
@Transactional
public int update(XhpcOperator xhpcOperator) { public int update(XhpcOperator xhpcOperator) {
return xhpcOperatorMapper.update(xhpcOperator); return xhpcOperatorMapper.update(xhpcOperator);
} }
@ -54,6 +57,7 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public void deleteByIds(String ids) { public void deleteByIds(String ids) {
for (String id : ids.split(",")) { for (String id : ids.split(",")) {
SysUser sysUser = xhpcOperatorMapper.getUserByOperatorId(Long.parseLong(id)); SysUser sysUser = xhpcOperatorMapper.getUserByOperatorId(Long.parseLong(id));
@ -112,6 +116,7 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public int removeUser(Long userId) { public int removeUser(Long userId) {
// 删除用户与角色关联 // 删除用户与角色关联
xhpcOperatorMapper.deleteUserRoleByUserId(userId); xhpcOperatorMapper.deleteUserRoleByUserId(userId);
@ -136,6 +141,7 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public void status(Long operatorId) { public void status(Long operatorId) {
SysUser sysUser = xhpcOperatorMapper.getUserByOperatorId(operatorId); SysUser sysUser = xhpcOperatorMapper.getUserByOperatorId(operatorId);
sysUser.setStatus(String.valueOf(UserConstants.NORMAL == Integer.parseInt(sysUser.getStatus()) ? UserConstants.EXCEPTION : UserConstants.NORMAL)); sysUser.setStatus(String.valueOf(UserConstants.NORMAL == Integer.parseInt(sysUser.getStatus()) ? UserConstants.EXCEPTION : UserConstants.NORMAL));

View File

@ -8,6 +8,7 @@ import com.xhpc.user.mapper.XhpcStationInternetBlacklistMapper;
import com.xhpc.user.service.IXhpcStationInternetBlacklistService; import com.xhpc.user.service.IXhpcStationInternetBlacklistService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,6 +34,7 @@ public class XhpcStationInternetBlacklistServiceImpl implements IXhpcStationInte
* @param xhpcStationInternetBlacklist 流量用户设置流量方黑名单信息 * @param xhpcStationInternetBlacklist 流量用户设置流量方黑名单信息
*/ */
@Override @Override
@Transactional
public int insert(XhpcStationInternetBlacklist xhpcStationInternetBlacklist) { public int insert(XhpcStationInternetBlacklist xhpcStationInternetBlacklist) {
return xhpcStationInternetBlacklistMapper.insert(xhpcStationInternetBlacklist); return xhpcStationInternetBlacklistMapper.insert(xhpcStationInternetBlacklist);
} }
@ -45,6 +47,7 @@ public class XhpcStationInternetBlacklistServiceImpl implements IXhpcStationInte
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public void deleteByIds(Long internetUserId) { public void deleteByIds(Long internetUserId) {
xhpcStationInternetBlacklistMapper.deleteByIds(internetUserId); xhpcStationInternetBlacklistMapper.deleteByIds(internetUserId);
} }

View File

@ -35,6 +35,7 @@ public class XhpcUserServiceImpl implements IXhpcUserService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public void deleteByIds(Long[] ids) { public void deleteByIds(Long[] ids) {
xhpcUserMapper.deleteByIds(ids); xhpcUserMapper.deleteByIds(ids);
} }
@ -98,6 +99,7 @@ public class XhpcUserServiceImpl implements IXhpcUserService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public void status(Long userId) { public void status(Long userId) {
SysUser sysUser = xhpcUserMapper.selectUserByUserId(userId); SysUser sysUser = xhpcUserMapper.selectUserByUserId(userId);
sysUser.setStatus(String.valueOf(UserConstants.NORMAL == Integer.parseInt(sysUser.getStatus()) ? UserConstants.EXCEPTION : UserConstants.NORMAL)); sysUser.setStatus(String.valueOf(UserConstants.NORMAL == Integer.parseInt(sysUser.getStatus()) ? UserConstants.EXCEPTION : UserConstants.NORMAL));

View File

@ -15,6 +15,7 @@
<result column="balance" property="balance"/> <result column="balance" property="balance"/>
<result column="password" property="password"/> <result column="password" property="password"/>
<result column="status" property="status"/> <result column="status" property="status"/>
<result column="is_refund_application" property="isRefundApplication"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/> <result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
@ -57,6 +58,9 @@
<if test="null != status and '' != status"> <if test="null != status and '' != status">
status, status,
</if> </if>
<if test="null != isRefundApplication and '' != isRefundApplication">
is_refund_application,
</if>
<if test="null != delFlag and '' != delFlag"> <if test="null != delFlag and '' != delFlag">
del_flag, del_flag,
</if> </if>
@ -107,6 +111,9 @@
<if test="null != status and '' != status"> <if test="null != status and '' != status">
#{status}, #{status},
</if> </if>
<if test="null != isRefundApplication and '' != isRefundApplication">
#{isRefundApplication},
</if>
<if test="null != delFlag and '' != delFlag"> <if test="null != delFlag and '' != delFlag">
#{delFlag}, #{delFlag},
</if> </if>
@ -140,6 +147,7 @@
<if test="null != balance ">balance = #{balance},</if> <if test="null != balance ">balance = #{balance},</if>
<if test="null != password and '' != password">password = #{password},</if> <if test="null != password and '' != password">password = #{password},</if>
<if test="null != status">status = #{status},</if> <if test="null != status">status = #{status},</if>
<if test="null != isRefundApplication">is_refund_application = #{isRefundApplication},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if> <if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if> <if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != createTime ">create_time = #{createTime},</if> <if test="null != createTime ">create_time = #{createTime},</if>
@ -156,7 +164,7 @@
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map"> <select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select app_user_id appUserId, phone, weixin_open_id weixinOpenId, select app_user_id appUserId, phone, weixin_open_id weixinOpenId,
weixin_login weixinlogin,alipay_login alipayLogin, weixin_login weixinlogin,alipay_login alipayLogin,is_refund_application isRefundApplication,
alipay_open_id alipayOpenId, avatar, balance, password, alipay_open_id alipayOpenId, avatar, balance, password,
`status`,create_by createBy ,create_time createTime, `status`,create_by createBy ,create_time createTime,
update_time updateTime, update_by updateBy, update_time updateTime, update_by updateBy,
@ -168,7 +176,7 @@
<select id="selectAppUserList" parameterType="java.lang.Long" resultType="java.util.Map"> <select id="selectAppUserList" parameterType="java.lang.Long" resultType="java.util.Map">
select xau.app_user_id appUserId, xau.phone, xau.balance, select xau.app_user_id appUserId, xau.phone, xau.balance,
xau.`status`,xau.create_time createTime, xau.`status`,xau.create_time createTime,xau.is_refund_application isRefundApplication,
CASE WHEN xau.`status` = 0 THEN '正常' else '禁用' end statusName, CASE WHEN xau.`status` = 0 THEN '正常' else '禁用' end statusName,
CASE WHEN a.count > 0 THEN '老用户' else '新用户' end newUser CASE WHEN a.count > 0 THEN '老用户' else '新用户' end newUser
from xhpc_app_user xau from xhpc_app_user xau

View File

@ -91,7 +91,7 @@
su.nick_name nickName, su.email,su.status,su.avatar, su.nick_name nickName, su.email,su.status,su.avatar,
su.create_by createBy ,su.create_time createTime,su.`status` , su.create_by createBy ,su.create_time createTime,su.`status` ,
CASE WHEN su.`status` = 0 THEN '正常' else '禁用' end statusName, CASE WHEN su.`status` = 0 THEN '正常' else '禁用' end statusName,
sdd.dict_label sexName sdd.dict_label sexName,(select role_id from sys_user_role where user_id = su.user_id LIMIT 1) roleId
from sys_user su from sys_user su
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = "sys_user_sex" and sdd.dict_code = su.sex LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = "sys_user_sex" and sdd.dict_code = su.sex
WHERE su.del_flag = 0 and su.user_id = #{userId} WHERE su.del_flag = 0 and su.user_id = #{userId}
@ -124,7 +124,7 @@
su.create_by createBy ,su.create_time createTime,xo.operator_id operatorId, su.create_by createBy ,su.create_time createTime,xo.operator_id operatorId,
xo.`name` operatorName,su.`status` , xo.`name` operatorName,su.`status` ,
CASE WHEN su.`status` = 0 THEN '正常' else '禁用' end statusName, CASE WHEN su.`status` = 0 THEN '正常' else '禁用' end statusName,
sdd.dict_label sexName sdd.dict_label sexName,(select role_id from sys_user_role where user_id = su.user_id LIMIT 1) roleId
from sys_user su from sys_user su
LEFT JOIN xhpc_operator xo on xo.operator_id = su.operator_id LEFT JOIN xhpc_operator xo on xo.operator_id = su.operator_id
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = "sys_user_sex" and sdd.dict_code = su.sex LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = "sys_user_sex" and sdd.dict_code = su.sex