From cd31ae2335e5a80e78c09ead19fd34d9614a1a4f Mon Sep 17 00:00:00 2001 From: fengjundan <1436525664@qq.com> Date: Mon, 2 Aug 2021 18:36:17 +0800 Subject: [PATCH] =?UTF-8?q?1=E4=BF=AE=E6=94=B9=E5=AE=A1=E6=A0=B8=E9=80=80?= =?UTF-8?q?=E6=AC=BE=E8=AE=A2=E5=8D=95=202=E6=96=B0=E5=A2=9E=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E9=80=80=E4=BA=86=E8=AE=A2=E5=8D=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xhpc/system/api/domain/SysRole.java | 4 - .../common/core/constant/StatusConstants.java | 5 ++ .../system/controller/SysRoleController.java | 29 ++----- .../XhpcUserPrivilegeController.java | 25 +++--- .../mapper/XhpcUserPrivilegeMapper.java | 2 +- .../service/IXhpcUserPrivilegeService.java | 2 +- .../impl/XhpcUserPrivilegeServiceImpl.java | 2 +- .../mapper/system/XhpcUserPrivilegeMapper.xml | 4 +- .../java/com/xhpc/order/aspect/DaoAspect.java | 44 +++++++---- .../com/xhpc/order/aspect/LogUserUtils.java | 26 ------- ...yOrderReconciliationStatusServiceImpl.java | 3 + ...cHistoryOrderSortingStatusServiceImpl.java | 3 + .../com/xhpc/payment/aspect/DaoAspect.java | 45 +++++++---- .../com/xhpc/payment/aspect/LogUserUtils.java | 26 ------- .../controller/WxPaymentController.java | 6 +- .../controller/XhpcRefundAuditController.java | 78 ++++++++++++++----- .../controller/XhpcRefundOrderController.java | 8 +- .../com/xhpc/payment/domain/XhpcAppUser.java | 13 ++++ .../xhpc/payment/domain/XhpcRefundOrder.java | 2 +- .../payment/mapper/XhpcRefundOrderMapper.java | 16 ++++ .../XhpcUserAccountStatementMapper.java | 8 ++ .../service/IXhpcRefundOrderService.java | 18 +++-- .../impl/XhpcRechargeOrderServiceImpl.java | 4 + .../impl/XhpcRefundAuditServiceImpl.java | 19 ++--- .../impl/XhpcRefundOrderServiceImpl.java | 48 +++++++++--- .../XhpcUserAccountStatementServiceImpl.java | 2 + .../mapper/XhpcRefundOrderMapper.xml | 25 ++++++ .../mapper/XhpcUserAccountStatementMapper.xml | 11 ++- .../java/com/xhpc/user/aspect/DaoAspect.java | 20 ++--- .../controller/XhpcAppUserController.java | 4 +- .../com/xhpc/user/domain/XhpcAppUser.java | 13 ++++ .../service/impl/XhpcAppUserServiceImpl.java | 6 +- .../impl/XhpcInternetUserServiceImpl.java | 5 ++ ...cOperatorInternetBlacklistServiceImpl.java | 3 + .../service/impl/XhpcOperatorServiceImpl.java | 6 ++ ...pcStationInternetBlacklistServiceImpl.java | 3 + .../service/impl/XhpcUserServiceImpl.java | 2 + .../resources/mapper/XhpcAppUserMapper.xml | 12 ++- .../main/resources/mapper/XhpcUserMapper.xml | 4 +- 39 files changed, 360 insertions(+), 196 deletions(-) delete mode 100644 xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/aspect/LogUserUtils.java delete mode 100644 xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/aspect/LogUserUtils.java diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysRole.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysRole.java index 09ac9091..5aa9a336 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysRole.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysRole.java @@ -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.ToStringStyle; -import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; /** @@ -90,7 +89,6 @@ public class SysRole extends BaseEntity return roleId != null && 1L == roleId; } - @NotBlank(message = "角色名称不能为空") @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") public String getRoleName() { @@ -102,7 +100,6 @@ public class SysRole extends BaseEntity this.roleName = roleName; } - @NotBlank(message = "权限字符不能为空") @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") public String getRoleKey() { @@ -114,7 +111,6 @@ public class SysRole extends BaseEntity this.roleKey = roleKey; } - @NotBlank(message = "显示顺序不能为空") public String getRoleSort() { return roleSort; diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/StatusConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/StatusConstants.java index e89c06d5..c29e1bb3 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/StatusConstants.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/constant/StatusConstants.java @@ -98,6 +98,11 @@ public class StatusConstants { */ public static final Integer REFUND_ORDER_STATUS_ERROR = 2; + /** + * 退款订单状态取消 + */ + public static final Integer REFUND_ORDER_STATUS_CANCEL = 3; + /** * 流水类型充值 */ diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysRoleController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysRoleController.java index 69416aef..0ebe4846 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysRoleController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysRoleController.java @@ -1,19 +1,5 @@ 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.utils.SecurityUtils; 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.service.ISysRoleService; 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) { 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()); return toAjax(roleService.updateRole(role)); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/XhpcUserPrivilegeController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/XhpcUserPrivilegeController.java index aae70760..4ce0b206 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/XhpcUserPrivilegeController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/XhpcUserPrivilegeController.java @@ -6,6 +6,7 @@ import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.system.api.domain.SysRole; import com.xhpc.system.domain.SysMenu; import com.xhpc.system.domain.XhpcUserPrivilege; +import com.xhpc.system.domain.vo.TreeSelect; import com.xhpc.system.service.ISysMenuService; import com.xhpc.system.service.ISysRoleService; 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.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; -import java.util.Map; /** * 用户信息 @@ -42,16 +43,22 @@ public class XhpcUserPrivilegeController extends BaseController { public AjaxResult roleMenuTreeselect(@RequestParam Long userId) { Long SecurityUserId = SecurityUtils.getUserId(); List menus = menuService.selectMenuList(SecurityUserId); - //登录用户拥有的数据权限树 - List> dataList = iXhpcUserPrivilegeService.dataList(SecurityUserId); - //选择用户拥有的权限 - List dataCheckedKeys = iXhpcUserPrivilegeService.dataCheckedKeys(userId); AjaxResult ajax = AjaxResult.success(); SysRole sysRole = roleService.getRoleByUserID(userId); - ajax.put("checkedKeys", menuService.selectMenuListByRoleId(sysRole.getRoleId())); - ajax.put("menus", menuService.buildMenuTreeSelect(menus)); - ajax.put("dataCheckedKeys", dataCheckedKeys); - ajax.put("dataList", dataList); + List integers = new ArrayList<>(); + List treeSelectList = new ArrayList<>(); + if (null != sysRole) { + 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; } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/mapper/XhpcUserPrivilegeMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/mapper/XhpcUserPrivilegeMapper.java index 59037be6..ca94f733 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/mapper/XhpcUserPrivilegeMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/mapper/XhpcUserPrivilegeMapper.java @@ -37,7 +37,7 @@ public interface XhpcUserPrivilegeMapper { * @param userId 用户id * @return 结果 */ - public List dataCheckedKeys(@Param("userId") Long userId); + public List dataCheckedKeys(@Param("userId") Long userId); /** * 通过运营商id查询运营商 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/IXhpcUserPrivilegeService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/IXhpcUserPrivilegeService.java index 8dce9750..63cca793 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/IXhpcUserPrivilegeService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/IXhpcUserPrivilegeService.java @@ -34,7 +34,7 @@ public interface IXhpcUserPrivilegeService { * @param userId 用户id * @return 结果 */ - public List dataCheckedKeys(Long userId); + public List dataCheckedKeys(Long userId); /** * 数据权限构建前端所需要下拉树结构 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/XhpcUserPrivilegeServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/XhpcUserPrivilegeServiceImpl.java index dca511ef..c1b4458a 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/XhpcUserPrivilegeServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/XhpcUserPrivilegeServiceImpl.java @@ -55,7 +55,7 @@ public class XhpcUserPrivilegeServiceImpl implements IXhpcUserPrivilegeService { * @return 结果 */ @Override - public List dataCheckedKeys(Long userId) { + public List dataCheckedKeys(Long userId) { return XhpcUserPrivilege.dataCheckedKeys(userId); } diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/XhpcUserPrivilegeMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/XhpcUserPrivilegeMapper.xml index c16136d0..b62a0c33 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/XhpcUserPrivilegeMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/XhpcUserPrivilegeMapper.xml @@ -29,10 +29,10 @@ - delete from xhpc_station_internet_blacklist where user_id = #{userId} + delete from xhpc_user_privilege where user_id = #{userId} - select charging_station_id chargingStationId from xhpc_user_privilege where user_id = #{userId} diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/aspect/DaoAspect.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/aspect/DaoAspect.java index 220c5625..3ce86cc4 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/aspect/DaoAspect.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/aspect/DaoAspect.java @@ -1,14 +1,17 @@ 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.StringUtils; +import com.xhpc.common.redis.service.RedisService; import com.xhpc.system.api.model.LoginUser; import org.apache.commons.beanutils.BeanUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestContextHolder; @@ -39,6 +42,9 @@ public class DaoAspect { public void daoCreate() { } + @Autowired + private RedisService redisService; + @Around("daoUpdate()") public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable { ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); @@ -47,27 +53,32 @@ public class DaoAspect { } HttpServletRequest request = attributes.getRequest(); try { - LogUserUtils logUserUtils = new LogUserUtils(); - LoginUser loginUser = logUserUtils.getLogUser(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) { + } String userName = ""; try { userName = SecurityUtils.getUsername(); } catch (Exception e) { } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(userName)) { userName = loginUser.getUsername(); } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(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))) { + if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) { 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()); } } @@ -91,31 +102,36 @@ public class DaoAspect { Object[] objects = point.getArgs(); if (objects != null && objects.length > 0) { for (Object arg : objects) { - LogUserUtils logUserUtils = new LogUserUtils(); - LoginUser loginUser = logUserUtils.getLogUser(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) { + } String userName = ""; try { userName = SecurityUtils.getUsername(); } catch (Exception e) { } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(userName)) { userName = loginUser.getUsername(); } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(userName)) { userName = "admin"; } 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); } - 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); } - 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); } - 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); } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/aspect/LogUserUtils.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/aspect/LogUserUtils.java deleted file mode 100644 index 5b277f68..00000000 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/aspect/LogUserUtils.java +++ /dev/null @@ -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); - } -} diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderReconciliationStatusServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderReconciliationStatusServiceImpl.java index 5282ccdc..2c55ebe2 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderReconciliationStatusServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderReconciliationStatusServiceImpl.java @@ -12,6 +12,7 @@ import com.xhpc.order.mapper.XhpcHistoryOrderReconciliationStatusMapper; import com.xhpc.order.service.IXhpcHistoryOrderReconciliationStatusService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -39,6 +40,7 @@ public class XhpcHistoryOrderReconciliationStatusServiceImpl implements IXhpcHis * @param xhpcHistoryOrderReconciliationStatus 历史订单对账状态 */ @Override + @Transactional public int insert(XhpcHistoryOrderReconciliationStatus xhpcHistoryOrderReconciliationStatus) { return xhpcHistoryOrderReconciliationStatusMapper.insert(xhpcHistoryOrderReconciliationStatus); } @@ -52,6 +54,7 @@ public class XhpcHistoryOrderReconciliationStatusServiceImpl implements IXhpcHis * @return */ @Override + @Transactional public AjaxResult status(String historyOrderIds, Integer status, String remark) { for (String historyOrderId : historyOrderIds.split(",")) { XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderMapper.info(Long.parseLong(historyOrderId)); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderSortingStatusServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderSortingStatusServiceImpl.java index c4f903e0..bfa66e30 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderSortingStatusServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderSortingStatusServiceImpl.java @@ -12,6 +12,7 @@ import com.xhpc.order.mapper.XhpcHistoryOrderSortingStatusMapper; import com.xhpc.order.service.IXhpcHistoryOrderSortingStatusService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -39,6 +40,7 @@ public class XhpcHistoryOrderSortingStatusServiceImpl implements IXhpcHistoryOrd * @param xhpcHistoryOrderSortingStatus 历史订单清分状态 */ @Override + @Transactional public int insert(XhpcHistoryOrderSortingStatus xhpcHistoryOrderSortingStatus) { return xhpcHistoryOrderSortingStatusMapper.insert(xhpcHistoryOrderSortingStatus); } @@ -52,6 +54,7 @@ public class XhpcHistoryOrderSortingStatusServiceImpl implements IXhpcHistoryOrd * @return */ @Override + @Transactional public AjaxResult status(String historyOrderIds, Integer status, String remark) { for (String historyOrderId : historyOrderIds.split(",")) { XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderMapper.info(Long.parseLong(historyOrderId)); diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/aspect/DaoAspect.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/aspect/DaoAspect.java index 4d08f162..f1b194b5 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/aspect/DaoAspect.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/aspect/DaoAspect.java @@ -1,14 +1,17 @@ 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.StringUtils; +import com.xhpc.common.redis.service.RedisService; import com.xhpc.system.api.model.LoginUser; import org.apache.commons.beanutils.BeanUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestContextHolder; @@ -39,6 +42,9 @@ public class DaoAspect { public void daoCreate() { } + @Autowired + private RedisService redisService; + @Around("daoUpdate()") public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable { ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); @@ -47,33 +53,39 @@ public class DaoAspect { } HttpServletRequest request = attributes.getRequest(); try { - LogUserUtils logUserUtils = new LogUserUtils(); - LoginUser loginUser = logUserUtils.getLogUser(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) { + } String userName = ""; try { userName = SecurityUtils.getUsername(); } catch (Exception e) { } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(userName)) { userName = loginUser.getUsername(); } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(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))) { + if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) { 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()); } } } } } catch (Exception e) { + System.out.println(e.getMessage()); } Object object = point.proceed(); return object; @@ -91,31 +103,36 @@ public class DaoAspect { Object[] objects = point.getArgs(); if (objects != null && objects.length > 0) { for (Object arg : objects) { - LogUserUtils logUserUtils = new LogUserUtils(); - LoginUser loginUser = logUserUtils.getLogUser(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) { + } String userName = ""; try { userName = SecurityUtils.getUsername(); } catch (Exception e) { } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(userName)) { userName = loginUser.getUsername(); } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(userName)) { userName = "admin"; } 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); } - 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); } - 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); } - 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); } } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/aspect/LogUserUtils.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/aspect/LogUserUtils.java deleted file mode 100644 index 774e4b47..00000000 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/aspect/LogUserUtils.java +++ /dev/null @@ -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); - } -} diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java index a8967297..8dfaa468 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java @@ -58,17 +58,17 @@ public class WxPaymentController { @ApiOperation(value = "微信支付") public AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map map) throws Exception { String openid = StringUtils.valueOf(map.get("openid")); - if (StringUtils.isNull(openid)) { + if (StringUtils.isEmpty(openid)) { return AjaxResult.error(HttpStatus.NOT_NULL, "openid不能为空"); } //总金额(是)订单总金额,单位为分 String amount = StringUtils.valueOf(map.get("amount")); - if (StringUtils.isNull(amount)) { + if (StringUtils.isEmpty(amount)) { return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能为空"); } //用户信息id String userId = StringUtils.valueOf(map.get("userId")); - if (StringUtils.isNull(userId)) { + if (StringUtils.isEmpty(userId)) { return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空"); } Double amount1 = Double.parseDouble(amount) * 100; diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java index 350aad37..d091ecf4 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java @@ -16,10 +16,11 @@ import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.payment.domain.XhpcAppUser; 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.service.IXhpcRefundAuditService; import com.xhpc.payment.service.IXhpcRefundOrderService; +import com.xhpc.payment.service.impl.XhpcUserAccountStatementServiceImpl; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; @@ -33,6 +34,7 @@ import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; +import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.web.bind.annotation.*; import javax.net.ssl.SSLContext; @@ -58,6 +60,9 @@ public class XhpcRefundAuditController extends BaseController { @Autowired private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper; + @Autowired + private XhpcUserAccountStatementServiceImpl xhpcUserAccountStatementService; + @Autowired private Environment environment; @@ -67,20 +72,65 @@ public class XhpcRefundAuditController extends BaseController { * @param xhpcRefundAudit * @return */ - @GetMapping("/examine") + @PostMapping("/examine") @ApiOperation(value = "退款审核") public AjaxResult info(@RequestBody XhpcRefundAudit xhpcRefundAudit) { + AjaxResult ajaxResult = iXhpcRefundAuditService.insert(xhpcRefundAudit); + if (StringUtils.isNotNull(ajaxResult)) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return ajaxResult; + } + Map map = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId()); + if (null == map) { + AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单不存在"); + } + String userId = StringUtils.valueOf(map.get("userId")); + 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()) { - Map map = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId()); - if (null == map) { - AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单不存在"); - } - String refundOrderId = StringUtils.valueOf(map.get("refundOrderId")); - if (StatusConstants.OPERATION_WX_TYPE.equals(refundOrderId)) { + 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); } } - return AjaxResult.success(iXhpcRefundAuditService.insert(xhpcRefundAudit)); + return AjaxResult.success(); + } + + /** + * 退款审核 + * + * @param userId + * @return + */ + @PostMapping("/cancelExamine") + @ApiOperation(value = "退款审核") + public AjaxResult cancelExamine(@RequestParam Long userId) { + Map 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 */ - public synchronized Object enterpriseCheckOut(@RequestBody XhpcRefundAudit xhpcRefundAudit) { + public Object enterpriseCheckOut(@RequestBody XhpcRefundAudit xhpcRefundAudit) { //只有审核通过才能退款 Map xhpcRefundOrder = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId()); if (StringUtils.isNull(xhpcRefundOrder)) { @@ -259,7 +309,6 @@ public class XhpcRefundAuditController extends BaseController { return AjaxResult.error(map.get("err_code_des")); } else { //退款成功修改订单 - iXhpcRefundOrderService.updateRefundOrder(id, StatusConstants.OPERATION_WX_TYPE, StatusConstants.REFUND_ORDER_STATUS_SUCCESS); Map appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId)); if (StringUtils.isNotNull(appUserInfo)) { 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); xhpcAppUser.setBalance(surplus); 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("退款成功"); } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java index 5b6ef510..50b7c195 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java @@ -33,21 +33,21 @@ public class XhpcRefundOrderController extends BaseController { @ApiOperation(value = "申请退款") public AjaxResult enterpriseCheckOut(@RequestBody Map map) { String amount = StringUtils.valueOf(map.get("amount")); - if (StringUtils.isNull(amount)) { + if (StringUtils.isEmpty(amount)) { return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能为空"); } //用户信息id String userId = StringUtils.valueOf(map.get("userId")); - if (StringUtils.isNull(userId)) { + if (StringUtils.isEmpty(userId)) { return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空"); } //openid String openid = StringUtils.valueOf(map.get("openid")); - if (StringUtils.isNull(userId)) { + if (StringUtils.isEmpty(userId)) { return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空"); } String type = StringUtils.valueOf(map.get("type")); - if (StringUtils.isNull(type)) { + if (StringUtils.isEmpty(type)) { return AjaxResult.error(HttpStatus.NOT_NULL, "退款渠道不能为空"); } //生成退款订单 diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/domain/XhpcAppUser.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/domain/XhpcAppUser.java index fbda0e33..68082b08 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/domain/XhpcAppUser.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/domain/XhpcAppUser.java @@ -67,6 +67,11 @@ public class XhpcAppUser extends BaseEntity { */ private Integer status; + /** + * 是否有退款订单审核(0无 1有) + */ + private Integer isRefundApplication; + /** * 删除标志(0代表存在 2代表删除) */ @@ -152,6 +157,14 @@ public class XhpcAppUser extends BaseEntity { this.status = status; } + public Integer getIsRefundApplication() { + return isRefundApplication; + } + + public void setIsRefundApplication(Integer isRefundApplication) { + this.isRefundApplication = isRefundApplication; + } + public String getDelFlag() { return delFlag; } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/domain/XhpcRefundOrder.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/domain/XhpcRefundOrder.java index 325a275d..543c8646 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/domain/XhpcRefundOrder.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/domain/XhpcRefundOrder.java @@ -54,7 +54,7 @@ public class XhpcRefundOrder extends BaseEntity { private Integer examineStatus; /** - * 状态(0退款中 1退款成功,2退款失败,3退款异常) + * 状态(0退款中 1退款成功,2退款失败,3取消订单) */ private Integer status; diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java index 5ddcacdb..4adb56ef 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java @@ -29,6 +29,14 @@ public interface XhpcRefundOrderMapper { */ public int update(XhpcRefundOrder xhpcRefundOrder); + /** + * 修改退款订单信息 + * + * @param xhpcRefundOrder 退款订单信息 + * @return 结果 + */ + public int updateStatus(XhpcRefundOrder xhpcRefundOrder); + /** * 查询退款订单详情 * @@ -57,4 +65,12 @@ public interface XhpcRefundOrderMapper { */ public List> getNotChargeOrder(@Param("userId") Long userId); + /** + * 通过用户id查询未完成退款订单 + * + * @param userId 用户id + * @return 结果 + */ + public Map getNotRefundOrder(@Param("userId") Long userId); + } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcUserAccountStatementMapper.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcUserAccountStatementMapper.java index 1550e7ff..d0e5ef0e 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcUserAccountStatementMapper.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcUserAccountStatementMapper.java @@ -47,6 +47,14 @@ public interface XhpcUserAccountStatementMapper { */ public int updateAppUserBalance(XhpcAppUser xhpcAppUser); + /** + * 更新C端退款订单审核 + * + * @param xhpcAppUser C端用户 + * @return + */ + public int updateAppUserRefundApplication(XhpcAppUser xhpcAppUser); + /** * 用户流水列表 diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java index 41a87d27..4de37511 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java @@ -52,12 +52,18 @@ public interface IXhpcRefundOrderService { public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid); /** - * 修改订单状态 退款订单 + * 通过用户id查询未完成退款订单 * - * @param refundOrderId 退款订单id - * @param status 状态(0待支付 1充值成功,2充值失败) - * @param type 退款渠道(1微信 2支付宝) - * @return + * @param userId 用户id + * @return 结果 */ - public void updateRefundOrder(Long refundOrderId, String type, Integer status); + public Map addRefundOrder(Long userId); + + /** + * 修改退款订单信息 + * + * @param xhpcRefundOrder 退款订单信息 + * @return 结果 + */ + public int updateStatus(XhpcRefundOrder xhpcRefundOrder); } \ No newline at end of file diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java index 687483f8..4bd466f8 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java @@ -7,6 +7,7 @@ import com.xhpc.payment.mapper.XhpcRechargeOrderMapper; import com.xhpc.payment.service.IXhpcRechargeOrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.List; @@ -32,6 +33,7 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService { * @param xhpcRechargeOrder 充值订单 */ @Override + @Transactional public int update(XhpcRechargeOrder xhpcRechargeOrder) { return xhpcRechargeOrderMapper.update(xhpcRechargeOrder); } @@ -72,6 +74,7 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService { * @return */ @Override + @Transactional public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber) { XhpcRechargeOrder xhpcRechargeOrder = new XhpcRechargeOrder(); xhpcRechargeOrder.setUserId(Long.parseLong(appUserId)); @@ -91,6 +94,7 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService { * @return */ @Override + @Transactional public void updateRechargeOrder(Long rechargeOrderId, String type, Integer status, String paymentNumber) { XhpcRechargeOrder xhpcRechargeOrder = new XhpcRechargeOrder(); xhpcRechargeOrder.setRechargeOrderId(rechargeOrderId); diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundAuditServiceImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundAuditServiceImpl.java index aed4d8f0..f1fd455c 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundAuditServiceImpl.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundAuditServiceImpl.java @@ -1,8 +1,5 @@ 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.payment.domain.XhpcRefundAudit; import com.xhpc.payment.domain.XhpcRefundOrder; @@ -11,6 +8,7 @@ import com.xhpc.payment.mapper.XhpcRefundOrderMapper; import com.xhpc.payment.service.IXhpcRefundAuditService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -38,22 +36,17 @@ public class XhpcRefundAuditServiceImpl implements IXhpcRefundAuditService { * @param xhpcRefundAudit 退款审核 */ @Override + @Transactional public AjaxResult insert(XhpcRefundAudit xhpcRefundAudit) { XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder(); xhpcRefundOrder.setRefundOrderId(xhpcRefundAudit.getRefundOrderId()); xhpcRefundOrder.setExamineStatus(xhpcRefundAudit.getStatus()); - xhpcRefundOrderMapper.update(xhpcRefundOrder); - if (StatusConstants.REFUND_ORDER_STATUS_SUCCESS == xhpcRefundAudit.getStatus()) { - Map map = xhpcRefundOrderMapper.info(xhpcRefundOrder.getRefundOrderId()); - 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); + int updateStatus = xhpcRefundOrderMapper.updateStatus(xhpcRefundOrder); + if (updateStatus == 0) { + return AjaxResult.error(); } xhpcRefundAuditMapper.insert(xhpcRefundAudit); - return AjaxResult.success(); + return null; } /** diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java index 89af30a7..d548bc8b 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java @@ -2,12 +2,16 @@ 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.payment.domain.XhpcAppUser; import com.xhpc.payment.domain.XhpcRefundOrder; 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; +import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.List; @@ -24,12 +28,16 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService { @Autowired private XhpcRefundOrderMapper xhpcRefundOrderMapper; + @Autowired + private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper; + /** * 更新 退款订单 * * @param XhpcRefundOrder 退款订单 */ @Override + @Transactional public int update(XhpcRefundOrder XhpcRefundOrder) { return xhpcRefundOrderMapper.update(XhpcRefundOrder); } @@ -69,11 +77,20 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService { * @return */ @Override + @Transactional public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid) { List> list = xhpcRefundOrderMapper.getNotChargeOrder(Long.parseLong(appUserId)); if (null != list && list.size() > 0) { - return AjaxResult.error(HttpStatus.ERROR_STATUS, "还有未完成的订单,不能退款"); + return AjaxResult.error(HttpStatus.ERROR_STATUS, "还有未完成的订单"); + } + Map 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.setUserId(Long.parseLong(appUserId)); @@ -86,23 +103,32 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService { xhpcRefundOrder.setAlipayId(openid); } xhpcRefundOrderMapper.insert(xhpcRefundOrder); + XhpcAppUser xhpcAppUser = new XhpcAppUser(); + xhpcAppUser.setAppUserId(Long.parseLong(appUserId)); + xhpcAppUser.setIsRefundApplication(1); + xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser); return AjaxResult.success(); } /** - * 修改订单状态 退款订单 + * 通过用户id查询未完成退款订单 * - * @param refundOrderId 退款订单id - * @param status 状态(0待支付 1充值成功,2充值失败) - * @param type 退款渠道(1微信 2支付宝) - * @return + * @param userId 用户id + * @return 结果 */ @Override - public void updateRefundOrder(Long refundOrderId, String type, Integer status) { - XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder(); - xhpcRefundOrder.setRefundOrderId(refundOrderId); - xhpcRefundOrder.setStatus(status); - xhpcRefundOrderMapper.update(xhpcRefundOrder); + public Map addRefundOrder(Long userId) { + return xhpcRefundOrderMapper.getNotRefundOrder(userId); + } + /** + * 修改退款订单信息 + * + * @param xhpcRefundOrder 退款订单信息 + * @return 结果 + */ + @Override + public int updateStatus(XhpcRefundOrder xhpcRefundOrder) { + return xhpcRefundOrderMapper.updateStatus(xhpcRefundOrder); } } \ No newline at end of file diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcUserAccountStatementServiceImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcUserAccountStatementServiceImpl.java index 010a93ac..f64d3268 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcUserAccountStatementServiceImpl.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcUserAccountStatementServiceImpl.java @@ -7,6 +7,7 @@ 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 org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.List; @@ -29,6 +30,7 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat * @param xhpcUserAccountStatement 用户流水 */ @Override + @Transactional public int insert(XhpcUserAccountStatement xhpcUserAccountStatement) { return xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement); } diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml index 927e27f2..6268199a 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRefundOrderMapper.xml @@ -138,6 +138,14 @@ WHERE refund_order_id = #{refundOrderId} + + UPDATE xhpc_refund_order + + status = #{status}, + + WHERE refund_order_id = #{refundOrderId} and status = #{status} + + + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml index 4647a20b..0785e5e2 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcUserAccountStatementMapper.xml @@ -131,7 +131,7 @@ select xuas.user_account_statement_id userAccountStatementId,xuas.user_id appUserId,xau.phone , xuas.amount amount,xuas.remaining_sum remainingSum,xuas.create_time createTime, diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/aspect/DaoAspect.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/aspect/DaoAspect.java index fe8c75e1..19083e35 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/aspect/DaoAspect.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/aspect/DaoAspect.java @@ -54,20 +54,20 @@ public class DaoAspect { userName = SecurityUtils.getUsername(); } catch (Exception e) { } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(userName)) { userName = loginUser.getUsername(); } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(userName)) { userName = "admin"; } if (userName != null) { Object[] objects = point.getArgs(); if (objects != null && objects.length > 0) { 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); } - 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()); } } @@ -98,24 +98,24 @@ public class DaoAspect { userName = SecurityUtils.getUsername(); } catch (Exception e) { } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(userName)) { userName = loginUser.getUsername(); } - if (StringUtils.isNull(userName)) { + if (StringUtils.isEmpty(userName)) { userName = "admin"; } 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); } - 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); } - 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); } - 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); } } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java index 3ea031b4..3de1405f 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java @@ -149,10 +149,10 @@ public class XhpcAppUserController extends BaseController { if (null != json) { String openid = json.getString("openid"); String sessionKey = json.getString("session_key"); - if (StringUtils.isNull(openid)) { + if (StringUtils.isEmpty(openid)) { return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败"); } - if (StringUtils.isNull(sessionKey)) { + if (StringUtils.isEmpty(sessionKey)) { return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败"); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcAppUser.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcAppUser.java index 10cc1cfc..2abc0f0d 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcAppUser.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/domain/XhpcAppUser.java @@ -67,6 +67,11 @@ public class XhpcAppUser extends BaseEntity { */ private Integer status; + /** + * 是否有退款订单审核(0无 1有) + */ + private Integer isRefundApplication; + /** * 删除标志(0代表存在 2代表删除) */ @@ -152,6 +157,14 @@ public class XhpcAppUser extends BaseEntity { this.status = status; } + public Integer getIsRefundApplication() { + return isRefundApplication; + } + + public void setIsRefundApplication(Integer isRefundApplication) { + this.isRefundApplication = isRefundApplication; + } + public String getDelFlag() { return delFlag; } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java index 9618d424..dc6a2c76 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcAppUserServiceImpl.java @@ -84,6 +84,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { * @return 结果 */ @Override + @Transactional public void status(Long appUserId) { Map map = xhpcAppUserMapper.info(appUserId); String status = StringUtils.valueOf(map.get("status")); @@ -100,7 +101,6 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { * @return 结果 */ @Override - @Transactional public R register(Map map) { String code = StringUtils.valueOf(map.get("code")); String phone = StringUtils.valueOf(map.get("phone")); @@ -195,12 +195,12 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { return R.fail(HttpStatus.DATA_ERROR, "对不起,您的账号:" + username + " 已停用"); } if (StatusConstants.OPERATION_WX_TYPE.equals(type)) { - if (StringUtils.isNull(user.getWeixinOpenId())) { + if (StringUtils.isEmpty(user.getWeixinOpenId())) { user.setWeixinOpenId(openid); } user.setWeixinLogin(UserConstants.LOGIN); } else { - if (StringUtils.isNull(user.getAlipayOpenId())) { + if (StringUtils.isEmpty(user.getAlipayOpenId())) { user.setAlipayOpenId(openid); } user.setAlipayLogin(UserConstants.LOGIN); diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInternetUserServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInternetUserServiceImpl.java index d991833b..87dfe0be 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInternetUserServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInternetUserServiceImpl.java @@ -9,6 +9,7 @@ import com.xhpc.user.mapper.XhpcUserMapper; import com.xhpc.user.service.IXhpcInternetUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -36,6 +37,7 @@ public class XhpcInternetUserServiceImpl implements IXhpcInternetUserService { * @param xhpcInternetUser 流量用户信息 */ @Override + @Transactional public int insert(XhpcInternetUser xhpcInternetUser) { return xhpcInternetUserMapper.insert(xhpcInternetUser); } @@ -46,6 +48,7 @@ public class XhpcInternetUserServiceImpl implements IXhpcInternetUserService { * @param xhpcInternetUser 流量用户信息 */ @Override + @Transactional public int update(XhpcInternetUser xhpcInternetUser) { return xhpcInternetUserMapper.update(xhpcInternetUser); } @@ -57,6 +60,7 @@ public class XhpcInternetUserServiceImpl implements IXhpcInternetUserService { * @return 结果 */ @Override + @Transactional public void deleteByIds(String[] ids) { for (String id : ids) { SysUser sysUser = xhpcInternetUserMapper.getUserByInternetUserId(Long.parseLong(id)); @@ -103,6 +107,7 @@ public class XhpcInternetUserServiceImpl implements IXhpcInternetUserService { * @return 结果 */ @Override + @Transactional public void status(Long internetUserId) { SysUser sysUser = xhpcInternetUserMapper.getUserByInternetUserId(internetUserId); if (null != sysUser) { diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorInternetBlacklistServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorInternetBlacklistServiceImpl.java index 99cb6e27..cea4640e 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorInternetBlacklistServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorInternetBlacklistServiceImpl.java @@ -8,6 +8,7 @@ import com.xhpc.user.mapper.XhpcOperatorInternetBlacklistMapper; import com.xhpc.user.service.IXhpcOperatorInternetBlacklistService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -32,6 +33,7 @@ public class XhpcOperatorInternetBlacklistServiceImpl implements IXhpcOperatorIn * @param xhpcOperatorInternetBlacklist 流量用户信息 */ @Override + @Transactional public int insert(XhpcOperatorInternetBlacklist xhpcOperatorInternetBlacklist) { return xhpcOperatorInternetBlacklistMapper.insert(xhpcOperatorInternetBlacklist); } @@ -44,6 +46,7 @@ public class XhpcOperatorInternetBlacklistServiceImpl implements IXhpcOperatorIn * @return 结果 */ @Override + @Transactional public void deleteByIds(Long operatorId) { xhpcOperatorInternetBlacklistMapper.deleteByIds(operatorId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorServiceImpl.java index a0fa28a6..9410163a 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorServiceImpl.java @@ -9,6 +9,7 @@ import com.xhpc.user.mapper.XhpcUserMapper; import com.xhpc.user.service.IXhpcOperatorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -33,6 +34,7 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService { * @param xhpcOperator 运营商信息 */ @Override + @Transactional public int insert(XhpcOperator xhpcOperator) { return xhpcOperatorMapper.insert(xhpcOperator); } @@ -43,6 +45,7 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService { * @param xhpcOperator 运营商信息 */ @Override + @Transactional public int update(XhpcOperator xhpcOperator) { return xhpcOperatorMapper.update(xhpcOperator); } @@ -54,6 +57,7 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService { * @return 结果 */ @Override + @Transactional public void deleteByIds(String ids) { for (String id : ids.split(",")) { SysUser sysUser = xhpcOperatorMapper.getUserByOperatorId(Long.parseLong(id)); @@ -112,6 +116,7 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService { * @return 结果 */ @Override + @Transactional public int removeUser(Long userId) { // 删除用户与角色关联 xhpcOperatorMapper.deleteUserRoleByUserId(userId); @@ -136,6 +141,7 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService { * @return 结果 */ @Override + @Transactional public void status(Long operatorId) { SysUser sysUser = xhpcOperatorMapper.getUserByOperatorId(operatorId); sysUser.setStatus(String.valueOf(UserConstants.NORMAL == Integer.parseInt(sysUser.getStatus()) ? UserConstants.EXCEPTION : UserConstants.NORMAL)); diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcStationInternetBlacklistServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcStationInternetBlacklistServiceImpl.java index c9317a33..894d68d9 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcStationInternetBlacklistServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcStationInternetBlacklistServiceImpl.java @@ -8,6 +8,7 @@ import com.xhpc.user.mapper.XhpcStationInternetBlacklistMapper; import com.xhpc.user.service.IXhpcStationInternetBlacklistService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; @@ -33,6 +34,7 @@ public class XhpcStationInternetBlacklistServiceImpl implements IXhpcStationInte * @param xhpcStationInternetBlacklist 流量用户设置流量方黑名单信息 */ @Override + @Transactional public int insert(XhpcStationInternetBlacklist xhpcStationInternetBlacklist) { return xhpcStationInternetBlacklistMapper.insert(xhpcStationInternetBlacklist); } @@ -45,6 +47,7 @@ public class XhpcStationInternetBlacklistServiceImpl implements IXhpcStationInte * @return 结果 */ @Override + @Transactional public void deleteByIds(Long internetUserId) { xhpcStationInternetBlacklistMapper.deleteByIds(internetUserId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserServiceImpl.java index 2f000f4a..7b664a87 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserServiceImpl.java @@ -35,6 +35,7 @@ public class XhpcUserServiceImpl implements IXhpcUserService { * @return 结果 */ @Override + @Transactional public void deleteByIds(Long[] ids) { xhpcUserMapper.deleteByIds(ids); } @@ -98,6 +99,7 @@ public class XhpcUserServiceImpl implements IXhpcUserService { * @return 结果 */ @Override + @Transactional public void status(Long userId) { SysUser sysUser = xhpcUserMapper.selectUserByUserId(userId); sysUser.setStatus(String.valueOf(UserConstants.NORMAL == Integer.parseInt(sysUser.getStatus()) ? UserConstants.EXCEPTION : UserConstants.NORMAL)); diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml index 93804905..0fb8cf5e 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml @@ -15,6 +15,7 @@ + @@ -57,6 +58,9 @@ status, + + is_refund_application, + del_flag, @@ -107,6 +111,9 @@ #{status}, + + #{isRefundApplication}, + #{delFlag}, @@ -140,6 +147,7 @@ balance = #{balance}, password = #{password}, status = #{status}, + is_refund_application = #{isRefundApplication}, del_flag = #{delFlag}, create_by = #{createBy}, create_time = #{createTime}, @@ -156,7 +164,7 @@ 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 a.count > 0 THEN '老用户' else '新用户' end newUser from xhpc_app_user xau diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml index 2a5a6262..39674a0d 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserMapper.xml @@ -91,7 +91,7 @@ su.nick_name nickName, su.email,su.status,su.avatar, su.create_by createBy ,su.create_time createTime,su.`status` , 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 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} @@ -124,7 +124,7 @@ su.create_by createBy ,su.create_time createTime,xo.operator_id operatorId, xo.`name` operatorName,su.`status` , 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 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