he2802 2 лет назад
Родитель
Сommit
14b6e16cd0

+ 1 - 0
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -14,6 +14,7 @@ import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.SecurityUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.file.FileUtils;
 import com.zhongzheng.common.utils.file.FileUtils;

+ 60 - 0
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -0,0 +1,60 @@
+package com.zhongzheng.controller.user;
+
+import cn.hutool.core.lang.Validator;
+import com.zhongzheng.common.annotation.Log;
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.framework.web.service.WxLoginService;
+import com.zhongzheng.framework.web.service.WxTokenService;
+import com.zhongzheng.modules.user.bo.*;
+import com.zhongzheng.modules.user.domain.UserWxFollow;
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
+import com.zhongzheng.modules.user.service.IUserService;
+import com.zhongzheng.modules.user.service.IUserVisitLogService;
+import com.zhongzheng.modules.user.service.IUserWxFollowService;
+import com.zhongzheng.modules.user.vo.UserVo;
+import com.zhongzheng.modules.wx.bo.WxLoginBody;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 客户端用户Controller
+ *
+ * @author hjl
+ * @date 2021-06-08
+ */
+@Api(value = "用户控制器", tags = {"客户端用户管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/app/user")
+public class UserController extends BaseController {
+
+    private final IUserService iUserService;
+
+
+    /**
+     * 修改客户端用户
+     */
+    @ApiOperation("修改客户端用户")
+    @Log(title = "客户端用户", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    public AjaxResult<Void> edit(@RequestBody UserEditBo bo) throws IllegalAccessException {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        return toAjax(iUserService.appUpdateByEditBo(bo) ? 1 : 0);
+    }
+
+
+}

+ 7 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -15,6 +15,7 @@ import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.common.type.EncryptHandler;
 import com.zhongzheng.common.type.EncryptHandler;
+import com.zhongzheng.common.utils.SecurityUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.file.FileUploadUtils;
 import com.zhongzheng.common.utils.file.FileUploadUtils;
@@ -443,6 +444,12 @@ public class CommonController extends BaseController {
         return AjaxResult.success("成功", EncryptHandler.decrypt(key));
         return AjaxResult.success("成功", EncryptHandler.decrypt(key));
     }
     }
 
 
+    @ApiOperation("pwd加密")
+    @GetMapping("common/free/pwd")
+    public AjaxResult<String> pwd(String key) {
+        return AjaxResult.success("成功", SecurityUtils.encryptPassword(key));
+    }
+
     @ApiOperation("分销打款结果回调")
     @ApiOperation("分销打款结果回调")
     @PreAuthorize("@ss.hasPermi('system:withdrawal:add')")
     @PreAuthorize("@ss.hasPermi('system:withdrawal:add')")
     @Log(title = "打款", businessType = BusinessType.INSERT)
     @Log(title = "打款", businessType = BusinessType.INSERT)

+ 10 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/ToolsUtils.java

@@ -392,6 +392,16 @@ public class ToolsUtils {
         return sb.toString();
         return sb.toString();
     }
     }
 
 
+    public static String getRandomNumString(int length){
+        String string = "0123456789";
+        StringBuffer sb = new StringBuffer();
+        int len = string.length();
+        for (int i = 0; i < length; i++) {
+            sb.append(string.charAt(getRandom(len-1)));
+        }
+        return sb.toString();
+    }
+
     public static BufferedImage toBufferedImage(BitMatrix matrix) {
     public static BufferedImage toBufferedImage(BitMatrix matrix) {
         int black = 0xFF000000;
         int black = 0xFF000000;
         int white  = 0x00FFFFFF;
         int white  = 0x00FFFFFF;

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

@@ -36,6 +36,7 @@ import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
 import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.system.service.ISysConfigService;
+import com.zhongzheng.modules.top.mall.domain.TopStore;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.*;
 import com.zhongzheng.modules.user.domain.*;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
@@ -1037,6 +1038,22 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         });
         });
     }
     }
 
 
+    @Override
+    public Boolean openVip(UserEditBo bo) {
+        User user = getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, bo.getUserId()));
+        if(Validator.isNotEmpty(user)&&(user.getVipTag()!=0)){
+            throw new CustomException("该会员已开通过会员");
+        }
+        String vipCard = "10001"+ToolsUtils.getRandomNumString(8);
+        LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+        objectLambdaUpdateWrapper.eq(User::getUserId, bo.getUserId());
+        objectLambdaUpdateWrapper.set(User::getVipTag, 1);
+        objectLambdaUpdateWrapper.set(User::getVipCard, vipCard);
+        objectLambdaUpdateWrapper.set(User::getVipOpenTime, DateUtils.getNowTime());
+        objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
+        return this.update(null, objectLambdaUpdateWrapper);
+    }
+
     private Long findSubjectId(String subject){
     private Long findSubjectId(String subject){
         if(subject!=null){
         if(subject!=null){
             String key = "SUB_"+subject;
             String key = "SUB_"+subject;

+ 0 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/bo/TopNuoMplatformLogAddBo.java

@@ -19,7 +19,6 @@ import java.util.List;
 @Data
 @Data
 @ApiModel("诺税通开单记录添加对象")
 @ApiModel("诺税通开单记录添加对象")
 public class TopNuoMplatformLogAddBo {
 public class TopNuoMplatformLogAddBo {
-
     /** 订单号(每个企业唯一) */
     /** 订单号(每个企业唯一) */
     @ApiModelProperty("订单号(每个企业唯一)")
     @ApiModelProperty("订单号(每个企业唯一)")
     private String orderNo;
     private String orderNo;

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

@@ -127,4 +127,6 @@ public interface IUserService extends IService<User> {
 
 
 	void batchUpdateTelId();
 	void batchUpdateTelId();
 
 
+	Boolean openVip(UserEditBo bo);
+
 }
 }