server/platform/src/main/java/com/doumee/api/system/SystemUserController.java
@@ -24,6 +24,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; /** @@ -106,6 +107,17 @@ return ApiResponse.success(null); } @Trace(withRequestParameters = false) @ApiOperation("修改用户状态") @PostMapping("/updateStatusById") @RequiresPermissions("system:user:update") public ApiResponse updateStatusById(@RequestBody CreateSystemUserDTO systemUser){ systemUser.setUpdateUser(this.getLoginUser().getId()); systemUser.setUpdateTime(new Date()); systemUserBiz.updateStatusById(systemUser); return ApiResponse.success(null); } @ApiOperation("分页查询") @PostMapping("/page") @RequiresPermissions("system:user:query") server/services/src/main/java/com/doumee/biz/system/SystemUserBiz.java
@@ -56,6 +56,14 @@ */ void updateById(CreateSystemUserDTO systemUser); /** * 修改用户信息 * @author Eva.Caesar Liu * @date 2022/03/15 09:54 */ void updateStatusById(CreateSystemUserDTO systemUser); /** * 创建用户角色 * @author Eva.Caesar Liu server/services/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java
@@ -187,7 +187,7 @@ // throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号已存在"); // } // } if ("admin".equals(user.getUsername()) && Objects.equal(systemUser.getStatus(),1)){ if (user != null && "admin".equals(user.getUsername()) && Objects.equal(systemUser.getStatus(),1)){ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "超级管理员账号不允许禁用"); } // 修改用户 @@ -220,6 +220,22 @@ } } @Override public void updateStatusById(CreateSystemUserDTO systemUser) { SystemUser queryUserDto = new SystemUser(); queryUserDto.setId(systemUser.getId()); queryUserDto.setDeleted(Constants.ZERO); SystemUser user = systemUserService.findOne(queryUserDto); if ("admin".equals(user.getUsername()) && Objects.equal(systemUser.getStatus(),1)){ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "超级管理员账号不允许禁用"); } // 修改用户 systemUserService.updateById(systemUser); } @Override @Transactional public void createUserRole(CreateUserRoleDTO dto) { server/services/src/main/java/com/doumee/core/wx/WxMiniUtilService.java
@@ -134,8 +134,8 @@ * https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/qr-code/getUnlimitedQRCode.html * @return */ public void generateWXMiniCode(Locks locks){ SystemDictData systemDictData = systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.ACCESS_TOKEN); public void generateWXMiniCode(Locks locks,SystemDictData systemDictData){ if(Objects.isNull(systemDictData)){ return; } @@ -147,7 +147,8 @@ body.put("env_version", "release"); // 透明,根据你的场景自行设置body参数 body.put("is_hyaline", false); // body.put("page","pages/index/index"); body.put("check_path", false); body.put("page","pages/index/index"); OkHttpClient client = new OkHttpClient().newBuilder().build(); okhttp3.MediaType mediaType = okhttp3.MediaType.parse("application/json"); okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(mediaType, JSONObject.toJSONString(body)); @@ -156,28 +157,14 @@ Response response = client.newCall(request).execute(); if (response.isSuccessful()) { InputStream inputStream = new ByteArrayInputStream(response.body().bytes()); int i = inputStream.available(); // 得到文件大小 // 得到文件大小 int i = inputStream.available(); byte[] mFileBody = new byte[i]; inputStream.read(mFileBody); // 读数据 // 读数据 inputStream.read(mFileBody); locks.setInfo("data:image/Jpeg;base64," + Base64.getEncoder().encodeToString(mFileBody)); /* ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len = -1; while ((len = inputStream.read(buffer)) != -1) { baos.write(buffer, 0, len); }*/ // FileOutputStream out = new FileOutputStream("d:\\test.png"); // byte[] buffer = new byte[8192]; // int bytesRead = 0; // while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) { // out.write(buffer, 0, bytesRead); // } // out.flush(); // inputStream.close(); // out.close(); } } catch (Exception e) { e.printStackTrace(); server/services/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -229,7 +229,7 @@ queryWrapper.lambda().eq(Member::getPassword, pageWrap.getModel().getPassword()); } if (pageWrap.getModel().getCardNo() != null) { queryWrapper.lambda().eq(Member::getCardNo, pageWrap.getModel().getCardNo()); queryWrapper.lambda().like(Member::getCardNo, pageWrap.getModel().getCardNo()); } if (pageWrap.getModel().getCardSign() != null) { queryWrapper.lambda().eq(Member::getCardSign, pageWrap.getModel().getCardSign()); server/web/src/main/java/com/doumee/api/web/AccountApi.java
@@ -1,9 +1,11 @@ package com.doumee.api.web; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.core.Jwt.JwtPayLoad; import com.doumee.core.Jwt.JwtTokenUtil; import com.doumee.core.annotation.LoginRequired; import com.doumee.core.annotation.trace.Trace; import com.doumee.core.constants.Constants; import com.doumee.core.model.ApiResponse; import com.doumee.core.wx.WxMiniUtilService; import com.doumee.dao.business.model.Locks; @@ -11,6 +13,7 @@ import com.doumee.dao.business.web.request.WxPhoneRequest; import com.doumee.dao.business.web.response.AccountResponse; import com.doumee.dao.business.web.response.UserResponse; import com.doumee.dao.system.model.SystemDictData; import com.doumee.service.business.MemberService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -39,6 +42,9 @@ @Autowired private WxMiniUtilService wxMiniUtilService; @Autowired private SystemDictDataBiz systemDictDataBiz; // @ApiOperation(value = "用户注册", notes = "小程序端") // @PostMapping("/userRegister") @@ -107,7 +113,8 @@ Locks locks = new Locks(); locks.setCode(12); locks.setSiteId("1005"); wxMiniUtilService.generateWXMiniCode(locks); SystemDictData systemDictData = systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.ACCESS_TOKEN); wxMiniUtilService.generateWXMiniCode(locks,systemDictData); return ApiResponse.success("操作成功",locks); }