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 dfb9cde9..49dc6a12 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 @@ -288,6 +288,24 @@ public class XhpcAppUserController extends BaseController { } + /** + * 设置小程序用户自动退款功能 + * @param + */ + @ApiOperation("设置小程序用户自动退款功能") + @PostMapping("/updateIsRefund") + public R updateIsRefund(@RequestBody Map map) { + if(map !=null){ + Long userId = Long.parseLong(map.get("userId").toString()); + Integer userType = Integer.parseInt(map.get("userType").toString()); + Integer isRefund = Integer.parseInt(map.get("isRefund").toString()); + return iXhpcAppUserUserService.updateIsRefund(userId,userType,isRefund); + } + return R.fail(HttpStatus.ERROR_STATUS, "修改失败"); + } + + + public static void main(String[] args) { try { diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcAppUserMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcAppUserMapper.java index 6176c5e6..27ad3c31 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcAppUserMapper.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcAppUserMapper.java @@ -72,4 +72,8 @@ public interface XhpcAppUserMapper { * @return 结果 */ public XhpcAppUser getAppUserByOpenid(@Param("openid") String openid); + + int updateUserIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund); + + int updateCommunityIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcAppUserUserService.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcAppUserUserService.java index 94101f78..7cbda087 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcAppUserUserService.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/IXhpcAppUserUserService.java @@ -97,4 +97,10 @@ public interface IXhpcAppUserUserService { * @return */ public R logout(String phone, String code); + + /** + * 设置小程序用户自动退款功能 + * @return + */ + public R updateIsRefund(Long userId, Integer userType,Integer isRefund); } 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 75edadee..a8254581 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 @@ -359,4 +359,28 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService { redisService.deleteObject("pvToken:" + phone); return R.ok(); } + + @Override + public R updateIsRefund(Long userId, Integer userType, Integer isRefund) { + + if(isRefund>2 || isRefund<0){ + return R.fail(HttpStatus.ERROR_STATUS, "参数错误"); + } + if(userType==0){ + int i = xhpcAppUserMapper.updateUserIsRefund(userId, isRefund); + if(i>0){ + return R.ok(); + }else{ + return R.fail(HttpStatus.ERROR_STATUS, "修改失败"); + } + }else if(userType==2){ + int i = xhpcAppUserMapper.updateCommunityIsRefund(userId, isRefund); + if(i>0){ + return R.ok(); + }else{ + return R.fail(HttpStatus.ERROR_STATUS, "修改失败"); + } + } + return R.fail(HttpStatus.ERROR_STATUS, "参数错误"); + } } 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 aa8bd560..69445eb4 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcAppUserMapper.xml @@ -221,4 +221,11 @@ from xhpc_app_user WHERE del_flag = 0 and (weixin_open_id = #{openid}or alipay_open_id = #{openid}) LIMIT 1 + + update xhpc_app_user set is_refund=#{isRefund} where app_user_id=#{userId} + + + + update xhpc_community_personnel set is_refund=#{isRefund} where community_personnel_id=#{userId} + \ No newline at end of file