用户管理-部门主键的添加

product
chuang 2 years ago
parent 685c8adfd2
commit 942a6465d5

@ -31,12 +31,11 @@ public class MobileContractSalesOrderListVO {
/** 客户名称 **/ /** 客户名称 **/
@JsonProperty("supplierName") @JsonProperty("supplierName")
private String supplierName; private String supplierName;
/** 制单人 **/ /** 制单人 **/
@JsonProperty("creatorUserName") @JsonProperty("creatorUserName")
private String creatorUserName; private String creatorUserName;
// /** 合同名称 **/
// @JsonProperty("contractName")
// private String contractName;
/** 垫资金额 **/ /** 垫资金额 **/
@JsonProperty("advanceAmount") @JsonProperty("advanceAmount")
private BigDecimal advanceAmount; private BigDecimal advanceAmount;

@ -23,4 +23,6 @@ public class MobileContractSalesOrderVO {
/** 订单详情 **/ /** 订单详情 **/
@JsonProperty("salesOrderList") @JsonProperty("salesOrderList")
private List<MobileContractSalesOrderListVO> salesOrderList; private List<MobileContractSalesOrderListVO> salesOrderList;
} }

@ -4,11 +4,18 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import jnpf.annotation.UserPermission; import jnpf.annotation.UserPermission;
import jnpf.base.ActionResult;
import jnpf.base.Page; import jnpf.base.Page;
import jnpf.base.Pagination;
import jnpf.base.UserInfo; import jnpf.base.UserInfo;
import jnpf.base.util.RemoveUtil;
import jnpf.base.vo.DownloadVO; import jnpf.base.vo.DownloadVO;
import jnpf.base.vo.ListVO;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.config.ConfigValueUtil; import jnpf.config.ConfigValueUtil;
import jnpf.constant.MsgCode; import jnpf.constant.MsgCode;
import jnpf.exception.DataException;
import jnpf.message.service.SynThirdDingTalkService; import jnpf.message.service.SynThirdDingTalkService;
import jnpf.message.service.SynThirdQyService; import jnpf.message.service.SynThirdQyService;
import jnpf.permission.constant.PermissionConst; import jnpf.permission.constant.PermissionConst;
@ -23,22 +30,14 @@ import jnpf.permission.model.user.mod.UsersByPositionModel;
import jnpf.permission.model.user.page.PageUser; import jnpf.permission.model.user.page.PageUser;
import jnpf.permission.model.user.page.PaginationUser; import jnpf.permission.model.user.page.PaginationUser;
import jnpf.permission.model.user.vo.*; import jnpf.permission.model.user.vo.*;
import jnpf.permission.service.*;
import jnpf.permission.util.PermissionUtil; import jnpf.permission.util.PermissionUtil;
import jnpf.util.*; import jnpf.util.*;
import jnpf.base.ActionResult;
import jnpf.base.vo.PageListVO;
import jnpf.base.Pagination;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.ListVO;
import jnpf.exception.DataException;
import jnpf.permission.service.*;
import jnpf.base.util.*;
import jnpf.util.enums.FileTypeEnum; import jnpf.util.enums.FileTypeEnum;
import jnpf.util.file.UploadUtil; import jnpf.util.file.UploadUtil;
import jnpf.util.treeutil.SumTree; import jnpf.util.treeutil.SumTree;
import jnpf.util.treeutil.newtreeutil.TreeDotUtils; import jnpf.util.treeutil.newtreeutil.TreeDotUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -407,6 +406,12 @@ public class UserController {
@PostMapping @PostMapping
public ActionResult<String> create(@RequestBody @Valid UserCrForm userCrForm) throws Exception { public ActionResult<String> create(@RequestBody @Valid UserCrForm userCrForm) throws Exception {
UserEntity entity = JsonUtil.getJsonToBean(userCrForm, UserEntity.class); UserEntity entity = JsonUtil.getJsonToBean(userCrForm, UserEntity.class);
List<OrganizeEntity> parentId = userService.getParentId(entity.getOrganizeId());
if (parentId!=null&&parentId.size()>0){
}else {
return ActionResult.fail("不能选择公司!或者选中了多个部门!");
}
entity.setPassword("4a7d1ed414474e4033ac29ccb8653d9b"); entity.setPassword("4a7d1ed414474e4033ac29ccb8653d9b");
//获取头像 //获取头像
String oldHeadIcon = entity.getHeadIcon(); String oldHeadIcon = entity.getHeadIcon();
@ -451,6 +456,13 @@ public class UserController {
@PutMapping("/{id}") @PutMapping("/{id}")
public ActionResult<String> update(@PathVariable("id") String id, @RequestBody @Valid UserUpForm userUpForm) throws Exception { public ActionResult<String> update(@PathVariable("id") String id, @RequestBody @Valid UserUpForm userUpForm) throws Exception {
UserEntity entity = JsonUtil.getJsonToBean(userUpForm, UserEntity.class); UserEntity entity = JsonUtil.getJsonToBean(userUpForm, UserEntity.class);
List<OrganizeEntity> parentId = userService.getParentId(entity.getOrganizeId());
if (parentId!=null&&parentId.size()>0){
}else {
return ActionResult.fail("不能选择公司!或者选中了多个部门!");
}
//将禁用的id加进数据 //将禁用的id加进数据
UserEntity originUser = userService.getInfo(id); UserEntity originUser = userService.getInfo(id);
if ("1".equals(String.valueOf(originUser.getIsAdministrator()))) { if ("1".equals(String.valueOf(originUser.getIsAdministrator()))) {

@ -348,4 +348,10 @@ public class UserEntity {
@TableField("F_GROUPID") @TableField("F_GROUPID")
private String groupId; private String groupId;
/**
* id
* */
@TableField("F_DepartmentId")
private String departmentId;
} }

@ -33,6 +33,8 @@ public class UserListVO {
private Long creatorTime; private Long creatorTime;
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Long sortCode; private Long sortCode;
@ApiModelProperty(value = "部门")
private String departmentId;
// 是否显示修改选项(暂时停用) // 是否显示修改选项(暂时停用)
// @ApiModelProperty(value = "是否管理员") // @ApiModelProperty(value = "是否管理员")
// private Integer isAdministrator; // private Integer isAdministrator;

@ -3,6 +3,7 @@ package jnpf.permission.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import jnpf.base.Pagination; import jnpf.base.Pagination;
import jnpf.base.vo.DownloadVO; import jnpf.base.vo.DownloadVO;
import jnpf.permission.entity.OrganizeEntity;
import jnpf.permission.entity.UserEntity; import jnpf.permission.entity.UserEntity;
import jnpf.permission.model.user.page.PaginationUser; import jnpf.permission.model.user.page.PaginationUser;
import jnpf.permission.model.user.vo.UserExportVO; import jnpf.permission.model.user.vo.UserExportVO;
@ -275,4 +276,18 @@ public interface UserService extends IService<UserEntity> {
* @return * @return
*/ */
List<UserEntity> getList(List<String> orgIdList, String keyword); List<UserEntity> getList(List<String> orgIdList, String keyword);
/**
*
* @param organizeId
* @return
*/
List<OrganizeEntity> getParentId(String organizeId);
/**
* org
* @param userId
* @param organizeId
*/
void updateOrg(String userId, String organizeId);
} }

@ -55,6 +55,9 @@ import java.util.stream.Collectors;
@DSTransactional @DSTransactional
public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> implements UserService { public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> implements UserService {
@Autowired
private UserService userService;
@Autowired @Autowired
private UserProvider userProvider; private UserProvider userProvider;
@Autowired @Autowired
@ -323,6 +326,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean create(UserEntity entity) throws Exception { public Boolean create(UserEntity entity) throws Exception {
//添加用户 初始化 //添加用户 初始化
// String departmentId = entity.getDepartmentId();
String userId = RandomUtil.uuId(); String userId = RandomUtil.uuId();
entity.setId(userId); entity.setId(userId);
entity.setSecretkey(RandomUtil.uuId()); entity.setSecretkey(RandomUtil.uuId());
@ -331,6 +335,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
entity.setCreatorUserId(userProvider.get().getUserId()); entity.setCreatorUserId(userProvider.get().getUserId());
saveOrUpdateCommon(userId, entity); saveOrUpdateCommon(userId, entity);
this.save(entity); this.save(entity);
this.updateOrg(userId,entity.getOrganizeId());
return true; return true;
} }
@ -348,6 +353,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
} }
saveOrUpdateCommon(userId, entity); saveOrUpdateCommon(userId, entity);
this.updateById(entity); this.updateById(entity);
this.updateOrg(userId,entity.getOrganizeId());
return true; return true;
} }
@ -1326,6 +1332,27 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
return this.list(queryWrapper); return this.list(queryWrapper);
} }
@Override
public List<OrganizeEntity> getParentId(String organizeId) {
QueryWrapper<OrganizeEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(OrganizeEntity::getId,organizeId);
wrapper.lambda().eq(OrganizeEntity::getCategory,"department");
List<OrganizeEntity> list = organizeService.list(wrapper);
return list;
}
@Override
public void updateOrg(String userId, String organizeId) {
List<OrganizeEntity> parentId = userService.getParentId(organizeId);
UserEntity entity = new UserEntity();
entity.setDepartmentId(parentId.get(0).getId());
entity.setOrganizeId(parentId.get(0).getParentId());
entity.setId(userId);
this.updateById(entity);
}
private String getColumns(Integer key) { private String getColumns(Integer key) {
Map<Integer, String> map = new HashMap<>(); Map<Integer, String> map = new HashMap<>();
map.put(1, "账号"); map.put(1, "账号");

Loading…
Cancel
Save