he2802 2 lat temu
rodzic
commit
9e5b4be96c

+ 14 - 1
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -55,7 +55,7 @@ public class UserController extends BaseController {
     @ApiOperation("客户端用户开通会员")
     @ApiOperation("客户端用户开通会员")
     @Log(title = "客户端用户开通会员", businessType = BusinessType.UPDATE)
     @Log(title = "客户端用户开通会员", businessType = BusinessType.UPDATE)
     @PostMapping("/openVip")
     @PostMapping("/openVip")
-    public AjaxResult<Void> openVip(@RequestBody UserEditBo bo) throws IllegalAccessException {
+    public AjaxResult<Void> openVip(@RequestBody UserEditBo bo) {
         return toAjax(iUserService.openVip(bo) ? 1 : 0);
         return toAjax(iUserService.openVip(bo) ? 1 : 0);
     }
     }
 
 
@@ -74,4 +74,17 @@ public class UserController extends BaseController {
         return AjaxResult.success(iUserService.queryUserByTelphoneTenant(bo.getTelphone(),Long.parseLong("867735392558919680")));
         return AjaxResult.success(iUserService.queryUserByTelphoneTenant(bo.getTelphone(),Long.parseLong("867735392558919680")));
     }
     }
 
 
+    @ApiOperation("批量注销会员")
+    @Log(title = "批量注销会员", businessType = BusinessType.UPDATE)
+    @PostMapping("/closeBatchVip")
+    public AjaxResult<Void> closeBatchVip(@RequestBody UserEditBo bo){
+        return toAjax(iUserService.closeBatchVip(bo) ? 1 : 0);
+    }
+
+    @ApiOperation("批量恢复会员")
+    @Log(title = "批量恢复会员", businessType = BusinessType.UPDATE)
+    @PostMapping("/restoreBatchVip")
+    public AjaxResult<Void> restoreBatchVip(@RequestBody UserEditBo bo){
+        return toAjax(iUserService.restoreBatchVip(bo) ? 1 : 0);
+    }
 }
 }

+ 34 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -1060,6 +1060,40 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return baseMapper.vipUserList(bo);
         return baseMapper.vipUserList(bo);
     }
     }
 
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean closeBatchVip(UserEditBo bo) {
+        for(Long userId : bo.getUserIdList()){
+            User user = getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, userId));
+            if(Validator.isNotEmpty(user)&&(user.getVipTag()!=1||user.getVipTag()!=3)){
+                throw new CustomException("该会员未开通会员");
+            }
+            LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+            objectLambdaUpdateWrapper.eq(User::getUserId, userId);
+            objectLambdaUpdateWrapper.set(User::getVipTag, 2);
+            objectLambdaUpdateWrapper.set(User::getVipCloseTime, DateUtils.getNowTime());
+            objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
+            this.update(null, objectLambdaUpdateWrapper);
+        }
+        return true;
+    }
+
+    @Override
+    public Boolean restoreBatchVip(UserEditBo bo) {
+        for(Long userId : bo.getUserIdList()){
+            User user = getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, userId));
+            if(Validator.isNotEmpty(user)&&(user.getVipTag()!=2)){
+                throw new CustomException("该会员未被注销");
+            }
+            LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+            objectLambdaUpdateWrapper.eq(User::getUserId, userId);
+            objectLambdaUpdateWrapper.set(User::getVipTag, 1);
+            objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
+            this.update(null, objectLambdaUpdateWrapper);
+        }
+        return true;
+    }
+
     private Long findSubjectId(String subject){
     private Long findSubjectId(String subject){
         if(subject!=null){
         if(subject!=null){
             String key = "SUB_"+subject;
             String key = "SUB_"+subject;

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserEditBo.java

@@ -8,6 +8,7 @@ import lombok.Data;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 
 
 
 
 /**
 /**
@@ -230,4 +231,5 @@ public class UserEditBo {
     /** 会员来源 1云学堂PC 2云学堂h5 3云学堂小程序 4e管证 5教育智慧管理系统 6中正总平台*/
     /** 会员来源 1云学堂PC 2云学堂h5 3云学堂小程序 4e管证 5教育智慧管理系统 6中正总平台*/
     @ApiModelProperty("会员来源 1云学堂PC 2云学堂h5 3云学堂小程序 4e管证 5教育智慧管理系统 6中正总平台")
     @ApiModelProperty("会员来源 1云学堂PC 2云学堂h5 3云学堂小程序 4e管证 5教育智慧管理系统 6中正总平台")
     private Integer vipFrom;
     private Integer vipFrom;
+    private List<Long> userIdList;
 }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java

@@ -131,4 +131,9 @@ public interface IUserService extends IService<User> {
 
 
 	List<UserVo> vipUserList(UserQueryBo bo);
 	List<UserVo> vipUserList(UserQueryBo bo);
 
 
+	Boolean closeBatchVip(UserEditBo bo);
+
+	Boolean restoreBatchVip(UserEditBo bo);
+
+	List<UserVipExportVo> vipUserListExport(UserQueryBo bo);
 }
 }

+ 51 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserVipExportVo.java

@@ -0,0 +1,51 @@
+package com.zhongzheng.modules.user.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+
+/**
+ * 用户视图对象 mall_package
+ *
+ * @author change
+ * @date 2021-05-25
+ */
+@Data
+@ApiModel("用户视图对象")
+//@TableName(autoResultMap = true)
+public class UserVipExportVo {
+	private static final long serialVersionUID = 1L;
+
+	@Excel(name = "会员状态")
+	@ApiModelProperty("会员标识 1已开通 0未开通 2已注销")
+	private String vipTag;
+
+	@Excel(name = "会员来源")
+	@ApiModelProperty("会员标识 1已开通 0未开通 2已注销")
+	private String vipFrom;
+
+	@Excel(name = "关联机构")
+	private String tenantName;
+
+	@Excel(name = "会员卡号")
+	@ApiModelProperty("会员卡号")
+	private String vipCard;
+
+	@Excel(name = "姓名")
+	@ApiModelProperty("真实姓名")
+	private String realname;
+
+	@Excel(name = "性别")
+	@ApiModelProperty("性别1男2女")
+	private String sex;
+
+	@Excel(name = "身份证号")
+	@ApiModelProperty("身份证号")
+	private String idCard;
+}

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserVo.java

@@ -326,6 +326,7 @@ public class UserVo {
 	@Excel(name = "会员来源 1云学堂PC 2云学堂h5 3云学堂小程序 4e管证 5教育智慧管理系统 6中正总平台")
 	@Excel(name = "会员来源 1云学堂PC 2云学堂h5 3云学堂小程序 4e管证 5教育智慧管理系统 6中正总平台")
 	@ApiModelProperty("会员来源 1云学堂PC 2云学堂h5 3云学堂小程序 4e管证 5教育智慧管理系统 6中正总平台")
 	@ApiModelProperty("会员来源 1云学堂PC 2云学堂h5 3云学堂小程序 4e管证 5教育智慧管理系统 6中正总平台")
 	private Integer vipFrom;
 	private Integer vipFrom;
+	private String tenantName;
 
 
 	public void setNull(){
 	public void setNull(){
 		this.setOpenId(null);
 		this.setOpenId(null);

+ 2 - 1
zhongzheng-system/src/main/resources/mapper/modules/user/UserMapper.xml

@@ -487,9 +487,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="vipUserList" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultType="com.zhongzheng.modules.user.vo.UserVo">
     <select id="vipUserList" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultType="com.zhongzheng.modules.user.vo.UserVo">
         SELECT
         SELECT
-            *
+        u.*,st.tenant_name
         FROM
         FROM
             `user` u
             `user` u
+        LEFT JOIN sys_tenant st ON u.tenant_id = st.tenant_id
         WHERE
         WHERE
             u.vip_tag !=0
             u.vip_tag !=0
         <if test="idCard != null and idCard != ''" >
         <if test="idCard != null and idCard != ''" >