From d95a0f020ea2e3e5b96880792f7b735ae6a8767d Mon Sep 17 00:00:00 2001 From: cy <1664593601@qq.com> Date: 星期四, 07 十二月 2023 13:49:17 +0800 Subject: [PATCH] feat: 添加用户、角色 失败, --- consum-base/src/main/java/com/consum/base/controller/FinSysTenantUserController.java | 73 ++++++++++++++---------------------- 1 files changed, 28 insertions(+), 45 deletions(-) diff --git a/consum-base/src/main/java/com/consum/base/controller/FinSysTenantUserController.java b/consum-base/src/main/java/com/consum/base/controller/FinSysTenantUserController.java index 8c26bf4..6a92d2c 100644 --- a/consum-base/src/main/java/com/consum/base/controller/FinSysTenantUserController.java +++ b/consum-base/src/main/java/com/consum/base/controller/FinSysTenantUserController.java @@ -1,28 +1,6 @@ package com.consum.base.controller; -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; - -import org.apache.commons.compress.utils.Lists; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; - +import cn.hutool.core.util.ReflectUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.event.AnalysisEventListener; @@ -53,18 +31,22 @@ import com.iplatform.model.po.S_role; import com.iplatform.model.po.S_user_core; import com.walker.db.page.GenericPager; -import com.walker.infrastructure.utils.CollectionUtils; -import com.walker.infrastructure.utils.DateUtils; -import com.walker.infrastructure.utils.NumberGenerator; -import com.walker.infrastructure.utils.PhoneNumberUtils; -import com.walker.infrastructure.utils.StringUtils; +import com.walker.infrastructure.utils.*; import com.walker.web.ResponseValue; - -import cn.hutool.core.util.ReflectUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.commons.compress.utils.Lists; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.*; /** * @Description 绯荤粺鐢ㄦ埛 @@ -205,7 +187,7 @@ @PostMapping("/add") @Transactional(rollbackFor = Exception.class) public ResponseValue add() { - FinSysTenantUserParam user = CommonUtil.getObjFromReqBody(FinSysTenantUserParam.class); + FinSysTenantUser user = CommonUtil.getObjFromReqBody(FinSysTenantUser.class); FinSysTenantUser tenantUser = new FinSysTenantUser(); CommonUtil.copyProperties(user, tenantUser); @@ -244,32 +226,33 @@ // 鎬庝箞鑾峰彇宸︿晶鏈烘瀯鏍戞暟鎹� tenantUser.setSysDeptId(3L); // 瀵瑰簲骞冲彴鏈烘瀯id 榛樿涓哄钩鍙扮鐞� this.finSysTenantUserService.insert(tenantUser); + // 鎻掑叆骞冲彴鐢ㄦ埛 S_user_core userCore = new S_user_core(); - userCore.setId(user.getSysUserId()); + userCore.setId(tenantUser.getSysUserId()); userCore.setDept_id(3L); // 閮ㄩ棬id锛岀洰鍓嶅啓姝� - userCore.setOrg_id(user.getSysDeptId()); // 鏈烘瀯id + userCore.setOrg_id(tenantUser.getSysDeptId()); // 鏈烘瀯id userCore.setOrg_id(1L); - userCore.setUser_name(user.getUserCode()); // 鐢ㄦ埛璐﹀彿 - userCore.setNick_name(user.getUserName()); + userCore.setUser_name(tenantUser.getUserCode()); // 鐢ㄦ埛璐﹀彿 + userCore.setNick_name(tenantUser.getUserName()); // 鐢ㄦ埛绫诲瀷 鍏堥粯璁よ缃负2 userCore.setUser_type(2); userCore.setPhonenumber(encPhone); - userCore.setSex(user.getSex().toString()); + userCore.setSex(tenantUser.getSex().toString()); // 鍒濆鍖栧瘑鐮� 123456 String pws = this.getArgumentVariable(ArgumentsConstants.KEY_SECURITY_PASSWORD_INIT).getStringValue(); userCore.setPassword(pws); // 骞冲彴鐢ㄦ埛琛ㄥ拰绯荤粺鐢ㄦ埛 琛ㄧ姸鎬佺浉鍙� - if (user.getStatus() == 0) { - user.setStatus(1); + if (tenantUser.getStatus() == 0) { + tenantUser.setStatus(1); } else { - user.setStatus(0); + tenantUser.setStatus(0); } - userCore.setStatus(user.getStatus()); + userCore.setStatus(tenantUser.getStatus()); userCore.setDel_flag(0); userCore.setCreate_by(this.getCurrentUser().getUser_name()); userCore.setCreate_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); - userCore.setRemark(user.getRemark()); + userCore.setRemark(tenantUser.getRemark()); userCore.setType(1); userCore.setBind_client_id("0"); userCore.setBind_wechat(0); @@ -293,7 +276,7 @@ // 灏戣鑹瞚d List<Long> roleList = user.getRoleList(); // 鏈烘瀯id 澶氫釜 if (!CollectionUtils.isEmpty(roleList)) { - Long sysUserId = user.getSysUserId(); // 鐢ㄦ埛id + Long sysUserId = tenantUser.getSysUserId(); // 鐢ㄦ埛id this.finSysTenantUserService.execInsertRoleUserList(roleList, sysUserId); } // this.getFinCustomerCache().remove(); @@ -486,7 +469,7 @@ @PostMapping("/update") @Transactional(rollbackFor = Exception.class) public ResponseValue update() { - FinSysTenantUserParam user = CommonUtil.getObjFromReqBody(FinSysTenantUserParam.class); + FinSysTenantUser user = CommonUtil.getObjFromReqBody(FinSysTenantUser.class); FinSysTenantUser tenantUser = new FinSysTenantUser(); CommonUtil.copyProperties(user, tenantUser); @@ -683,8 +666,8 @@ */ @PostMapping("/updRole") public ResponseValue updRole() { - FinSysTenantUserParam user = CommonUtil.getObjFromReqBody(FinSysTenantUserParam.class); - FinSysTenantUserParam tenantUser = new FinSysTenantUserParam(); + FinSysTenantUser user = CommonUtil.getObjFromReqBody(FinSysTenantUser.class); + FinSysTenantUser tenantUser = new FinSysTenantUser(); CommonUtil.copyProperties(user, tenantUser); user = tenantUser; -- Gitblit v1.9.1