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

product
chuang 2 years ago
parent 685c8adfd2
commit 942a6465d5

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

@ -23,4 +23,6 @@ public class MobileContractSalesOrderVO {
/** 订单详情 **/
@JsonProperty("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.ApiOperation;
import jnpf.annotation.UserPermission;
import jnpf.base.ActionResult;
import jnpf.base.Page;
import jnpf.base.Pagination;
import jnpf.base.UserInfo;
import jnpf.base.util.RemoveUtil;
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.constant.MsgCode;
import jnpf.exception.DataException;
import jnpf.message.service.SynThirdDingTalkService;
import jnpf.message.service.SynThirdQyService;
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.PaginationUser;
import jnpf.permission.model.user.vo.*;
import jnpf.permission.service.*;
import jnpf.permission.util.PermissionUtil;
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.file.UploadUtil;
import jnpf.util.treeutil.SumTree;
import jnpf.util.treeutil.newtreeutil.TreeDotUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -407,6 +406,12 @@ public class UserController {
@PostMapping
public ActionResult<String> create(@RequestBody @Valid UserCrForm userCrForm) throws Exception {
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");
//获取头像
String oldHeadIcon = entity.getHeadIcon();
@ -451,6 +456,13 @@ public class UserController {
@PutMapping("/{id}")
public ActionResult<String> update(@PathVariable("id") String id, @RequestBody @Valid UserUpForm userUpForm) throws Exception {
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加进数据
UserEntity originUser = userService.getInfo(id);
if ("1".equals(String.valueOf(originUser.getIsAdministrator()))) {

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

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

@ -3,6 +3,7 @@ package jnpf.permission.service;
import com.baomidou.mybatisplus.extension.service.IService;
import jnpf.base.Pagination;
import jnpf.base.vo.DownloadVO;
import jnpf.permission.entity.OrganizeEntity;
import jnpf.permission.entity.UserEntity;
import jnpf.permission.model.user.page.PaginationUser;
import jnpf.permission.model.user.vo.UserExportVO;
@ -275,4 +276,18 @@ public interface UserService extends IService<UserEntity> {
* @return
*/
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
public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> implements UserService {
@Autowired
private UserService userService;
@Autowired
private UserProvider userProvider;
@Autowired
@ -323,6 +326,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
@Transactional(rollbackFor = Exception.class)
public Boolean create(UserEntity entity) throws Exception {
//添加用户 初始化
// String departmentId = entity.getDepartmentId();
String userId = RandomUtil.uuId();
entity.setId(userId);
entity.setSecretkey(RandomUtil.uuId());
@ -331,6 +335,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
entity.setCreatorUserId(userProvider.get().getUserId());
saveOrUpdateCommon(userId, entity);
this.save(entity);
this.updateOrg(userId,entity.getOrganizeId());
return true;
}
@ -348,6 +353,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
}
saveOrUpdateCommon(userId, entity);
this.updateById(entity);
this.updateOrg(userId,entity.getOrganizeId());
return true;
}
@ -1326,6 +1332,27 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
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) {
Map<Integer, String> map = new HashMap<>();
map.put(1, "账号");

Loading…
Cancel
Save