瀏覽代碼

Merge remote-tracking branch 'origin/develop' into develop

FengChaoYu 9 月之前
父節點
當前提交
5a3a6e0604

+ 2 - 2
mall-server-api/src/main/java/com/gree/mall/manager/bean/admin/reqDto/AdminUserAddReqBean.java

@@ -12,9 +12,9 @@ import java.util.List;
 @ApiModel(value="AdminUserAddBean对象", description="新增用户对象")
 public class AdminUserAddReqBean extends AdminUser {
 
-    @ApiModelProperty("网点部门id")
+    @ApiModelProperty("网点id")
     private String adminWebsitId;
 
-    @ApiModelProperty("选择得部门")
+    @ApiModelProperty("选择得部门id")
     private String adminDeptId;
 }

+ 10 - 2
mall-server-api/src/main/java/com/gree/mall/manager/logic/admin/AdminUserLogic.java

@@ -273,7 +273,7 @@ public class AdminUserLogic {
         }
         adminUserDeptRelaService.lambdaUpdate().eq(AdminUserDeptRela::getAdminUserId, adminUser.getAdminUserId()).remove();
 
-        List<AdminDept> adminDepts = adminDeptService.lambdaQuery().eq(AdminDept::getAdminDeptId, adminUser.getAdminWebsitId()).list();
+        List<AdminDept> adminDepts = adminDeptService.lambdaQuery().eq(AdminDept::getAdminDeptId, adminUser.getAdminDeptId()).list();
         if (adminDepts.size() == 0) {
             throw new RemoteServiceException("请选择至少1个部门");
         }
@@ -292,6 +292,7 @@ public class AdminUserLogic {
     /**
      * 修改帐号
      */
+    @Transactional(rollbackFor = Exception.class)
     public void update(HttpServletRequest request, AdminUserAddReqBean newUser) {
 
         AdminUserCom admin = commonLogic.getAdminUser(request);
@@ -329,12 +330,16 @@ public class AdminUserLogic {
                 newUser.setType(2);
             }
         }else {
-            AdminDept adminDept = adminDeptService.getById(newUser.getAdminDeptId());
+
+            if (!StringUtil.isEmpty(newUser.getAdminDeptId())){
+
+                AdminDept adminDept = adminDeptService.getById(newUser.getAdminDeptId());
 
             newUser.setCompanyWechatId(adminDept.getCompanyWechatId());
             newUser.setCompanyName(adminDept.getCompanyWechatName());
 
             newUser.setType(0);
+            }
         }
 
 
@@ -345,6 +350,9 @@ public class AdminUserLogic {
         newUser.updateById();
 
 
+        adminUserWebsitRelaService.lambdaUpdate().eq(AdminUserWebsitRela::getAdminUserId,newUser.getAdminUserId()).remove();
+        adminUserDeptRelaService.lambdaUpdate().eq(AdminUserDeptRela::getAdminUserId,newUser.getAdminUserId()).remove();
+
         //部门账号(商户账号在生成商户的时候已经处理了部门)
         if (newUser.getType() != 2) {
             //添加部门

+ 7 - 3
mall-server-api/src/main/java/com/gree/mall/manager/logic/common/CommonLogic.java

@@ -122,7 +122,9 @@ public class CommonLogic {
             adminUserCom.setJoinCode(adminCompanyWechat.getJoinCode());
 
             AdminUserDeptRela adminUserDeptRela = adminUserDeptRelaService.lambdaQuery().eq(AdminUserDeptRela::getAdminUserId, admin.getAdminUserId()).last("limit 1").one();
-            adminUserCom.setAdminDept(adminDeptService.getById(adminUserDeptRela.getAdminDeptId()));
+            if (adminUserDeptRela != null) {
+                adminUserCom.setAdminDept(adminDeptService.getById(adminUserDeptRela.getAdminDeptId()));
+            }
 
             return adminUserCom;
         }
@@ -142,8 +144,7 @@ public class CommonLogic {
         adminUserCom = new AdminUserCom();
         BeanUtils.copyProperties(adminUser,adminUserCom);
 
-        //所有帐号
-        adminUserCom = this.websitAccount(adminUserCom);
+
 
         //商品出入库是否关联条码\
         AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getById(adminUser.getCompanyWechatId());
@@ -164,6 +165,9 @@ public class CommonLogic {
             }else {
                 adminUserCom.setAdminWebsitIds(collect);
             }
+        }else {
+            //所有帐号
+            adminUserCom = this.websitAccount(adminUserCom);
         }
         return adminUserCom;
     }