Commit c1571580 authored by xixinzhao's avatar xixinzhao

组织机构相关

parent d85435bb
......@@ -135,4 +135,6 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
OrgUsr queryByCompanyCode(@Param("companyCode") String companyCode);
List<OrgUsrSyncDto> getOrgUsrSyncDataList(Map<String, Object> map);
List<OrgUsr> companyUserTreeByUserAndType(Map<String, Object> param);
}
......@@ -372,4 +372,7 @@ public interface IOrgUsrService {
OrgUsr selectParentOrgUsr(OrgUsr orgUsr);
List<OrgMenuDto> companyUserTreeByUserAndType(ReginParams reginParams);
List<DynamicFormInstance> selectTelById(List<String> ids, String type);
}
......@@ -1140,4 +1140,15 @@ LEFT JOIN (
GROUP BY
u.sequence_nbr
</select>
<select id="companyUserTreeByUserAndType"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
usr.*
FROM
cb_org_usr usr
where
usr.is_delete = false
and usr.biz_org_code like CONCAT(#{bizOrgCode},'%')
</select>
</mapper>
package com.yeejoin.amos.boot.module.jcs.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrganizationUser;
public interface IOrganizationUserService {
OrganizationUser saveOrganization(OrganizationUser organizationUser);
OrganizationUser updateModelById(OrganizationUser organizationUser);
OrganizationUser getDetailsById(Long id);
IPage<OrganizationUser> getListPage(int pageNumber, int pageSize, Long id);
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jcs.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Organization;
import java.util.List;
import java.util.Map;
......@@ -19,4 +20,22 @@ public interface OrganizationService {
List<OrganizationUserExportDto> selectOrganizationUserList(String bizOrgCode);
void saveOrganization(List<OrganizationExportDto> data, List<OrganizationUserExportDto> userData, String bizOrgCode);
/**
* 保存应急小组
* @param organization
* @return
*/
Organization saveOrganization(Organization organization);
Organization updateModelById(Organization organization);
boolean moveTeam(String method, Long id);
List<Organization> getList();
Organization getDetailsById(Long id);
boolean deleteById(Long id);
}
......@@ -10,6 +10,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -1023,4 +1024,32 @@ public class OrgUsrController extends BaseController {
}
/**
* 获取单位部门用户树
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyUserTreeByUserAndType", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登陆人获取单位部门用户树", notes = "根据登陆人获取单位部门用户树")
public ResponseModel<List<OrgMenuDto>> companyUserTreeByUserAndType() {
// 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
List<OrgMenuDto> menus = iOrgUsrService.companyUserTreeByUserAndType(reginParams);
return ResponseHelper.buildResponse(menus);
}
/**
* 获取人员电话
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/selectTelById", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id获取用户电话", notes = "根据id获取用户电话")
public ResponseModel<List<DynamicFormInstance>> selectTelById(@RequestParam List<String> ids, @RequestParam String type) {
List<DynamicFormInstance> menus = iOrgUsrService.selectTelById(ids, type);
return ResponseHelper.buildResponse(menus);
}
}
\ No newline at end of file
......@@ -3461,4 +3461,22 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return baseMapper.selectList(wrapper);
}
@Override
public List<OrgMenuDto> companyUserTreeByUserAndType(ReginParams reginParams) {
Map<String, Object> param = new HashMap<>();
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
param.put("bizOrgCode", reginParams.getPersonIdentity().getBizOrgCode());
List<OrgUsr> list = orgUsrMapper.companyUserTreeByUserAndType(param);
return buildTreeParallel(list);
}
@Override
public List<DynamicFormInstance> selectTelById(List<String> ids, String type) {
LambdaQueryWrapper<DynamicFormInstance> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DynamicFormInstance::getFieldCode, type);
wrapper.in(DynamicFormInstance::getInstanceId, ids);
return dynamicFormInstanceService.list(wrapper);
}
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Organization;
import com.yeejoin.amos.boot.module.jcs.api.service.OrganizationService;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import io.swagger.annotations.Api;
......@@ -24,14 +25,12 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
......@@ -176,4 +175,59 @@ public class OrganizationController extends BaseController {
return CommonResponseUtil.success();
}
/**
* 新增应急小组信息
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增应急小组信息", notes = "新增应急小组信息")
public ResponseModel<Organization> save(@RequestBody Organization organization) {
return ResponseHelper.buildResponse(organizationService.saveOrganization(organization));
}
/**
* 编辑应急小组信息
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "编辑应急小组信息", notes = "编辑应急小组信息")
public ResponseModel<Organization> updateByIdDeviceServicing(@RequestBody Organization organization){
return ResponseHelper.buildResponse(organizationService.updateModelById(organization));
}
/**
* 上移下移
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/moveTeam")
@ApiOperation(httpMethod = "GET", value = "上移下移", notes = "上移下移")
public ResponseModel<Boolean> moveTeam(@RequestParam() String method, @RequestParam Long id){
return ResponseHelper.buildResponse(organizationService.moveTeam(method, id));
}
@GetMapping(value = "/getList")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取列表", notes = "获取列表")
public ResponseModel<List<Organization>> getList() {
return ResponseHelper.buildResponse(organizationService.getList());
}
@GetMapping(value = "/getDetailsById")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取详情", notes = "获取详情")
public ResponseModel<Organization> getDetailsById(@RequestParam() Long id) {
return ResponseHelper.buildResponse(organizationService.getDetailsById(id));
}
@GetMapping(value = "/deleteById")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "删除", notes = "根据id删除")
public ResponseModel deleteById(@RequestParam() Long id) {
return ResponseHelper.buildResponse(organizationService.deleteById(id));
}
}
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jcs.api.entity.Organization;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrganizationUser;
import com.yeejoin.amos.boot.module.jcs.api.service.IOrganizationUserService;
import com.yeejoin.amos.boot.module.jcs.api.service.OrganizationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController
@Api(tags = "组织机构")
@RequestMapping(value = "/organization-user")
public class OrganizationUserController extends BaseController {
@Autowired
private IOrganizationUserService organizationUserService;
/**
* 新增应急小组成员
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增应急小组用户", notes = "新增应急小组用户")
public ResponseModel<OrganizationUser> save(@RequestBody OrganizationUser organizationUser) {
return ResponseHelper.buildResponse(organizationUserService.saveOrganization(organizationUser));
}
/**
* 编辑应急小组成员
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "编辑应急小组成员", notes = "编辑应急小组成员")
public ResponseModel<OrganizationUser> updateByIdDeviceServicing(@RequestBody OrganizationUser organizationUser){
return ResponseHelper.buildResponse(organizationUserService.updateModelById(organizationUser));
}
@GetMapping(value = "/getDetailsById")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取详情", notes = "获取详情")
public ResponseModel<OrganizationUser> getDetailsById(@RequestParam() Long id) {
return ResponseHelper.buildResponse(organizationUserService.getDetailsById(id));
}
@GetMapping(value = "/getListPage")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "删除", notes = "根据id删除")
public ResponseModel<IPage<OrganizationUser>> getListPage(@RequestParam(value = "pageNumber") int pageNumber,
@RequestParam(value = "pageSize") int pageSize, @RequestParam() Long id) {
return ResponseHelper.buildResponse(organizationUserService.getListPage(pageNumber, pageSize, id));
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto;
......@@ -8,10 +9,13 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.OrganizationUser;
import com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationUserMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.OrganizationService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.ArrayList;
import java.util.List;
......@@ -20,7 +24,7 @@ import java.util.stream.Collectors;
@Service
public class OrganizationImpl implements OrganizationService {
public class OrganizationImpl extends BaseService<Organization,Organization, OrganizationMapper> implements OrganizationService {
@Autowired
private OrganizationMapper organizationMapper;
......@@ -81,4 +85,71 @@ public class OrganizationImpl implements OrganizationService {
}
}
}
@Override
public Organization saveOrganization(Organization organization) {
return this.createWithModel(organization);
}
@Override
public Organization updateModelById(Organization organization) {
return this.updateWithModel(organization);
}
@Override
public boolean moveTeam(String method, Long id) {
Organization organization = this.baseMapper.selectById(id);
if ("up".equals(method)) {
// 获取需要移动数据
// 上移,查询上一条数据
LambdaQueryWrapper<Organization> wrapper = new LambdaQueryWrapper<>();
int sort = organization.getSort();
wrapper.lt(Organization::getSort, sort);
wrapper.orderByDesc(Organization::getSort);
wrapper.last(" limit 1");
Organization upOrganization = this.baseMapper.selectOne(wrapper);
if (ObjectUtils.isEmpty(upOrganization)) {
throw new BadRequest("最顶层数据不可上移");
}
organization.setSort(upOrganization.getSort());
this.updateById(organization);
upOrganization.setSort(sort);
this.updateById(upOrganization);
return true;
} else {
// 下移,查询下一条数据
LambdaQueryWrapper<Organization> wrapper = new LambdaQueryWrapper<>();
int sort = organization.getSort();
wrapper.gt(Organization::getSort, sort);
wrapper.orderByAsc(Organization::getSort);
wrapper.last(" limit 1");
Organization downOrganization = this.baseMapper.selectOne(wrapper);
if (ObjectUtils.isEmpty(downOrganization)) {
throw new BadRequest("最底层数据不可上移");
}
organization.setSort(downOrganization.getSort());
this.updateById(organization);
downOrganization.setSort(sort);
this.updateById(downOrganization);
return true;
}
}
@Override
public List<Organization> getList() {
LambdaQueryWrapper<Organization> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByAsc(Organization::getSort);
return this.baseMapper.selectList(wrapper);
}
@Override
public Organization getDetailsById(Long id) {
return this.baseMapper.selectById(id);
}
@Override
public boolean deleteById(Long id) {
return false;
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrganizationUser;
import com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationUserMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IOrganizationUserService;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
@Service
public class OrganizationUserImpl extends BaseService<OrganizationUser,OrganizationUser, OrganizationUserMapper> implements IOrganizationUserService {
@Override
public OrganizationUser saveOrganization(OrganizationUser organizationUser) {
return this.createWithModel(organizationUser);
}
@Override
public OrganizationUser updateModelById(OrganizationUser organizationUser) {
return this.updateWithModel(organizationUser);
}
@Override
public OrganizationUser getDetailsById(Long id) {
return this.baseMapper.selectById(id);
}
@Override
public IPage<OrganizationUser> getListPage(int pageNumber, int pageSize, Long id) {
Page<OrganizationUser> page = new Page<>();
page.setSize(pageSize);
page.setCurrent(pageNumber);
LambdaQueryWrapper<OrganizationUser> wrapper = new LambdaQueryWrapper<>();
if (!ObjectUtils.isEmpty(id) && id != 0) {
wrapper.eq(OrganizationUser::getEmergencyTeamId, id);
}
wrapper.orderByDesc(BaseEntity::getRecDate);
return this.baseMapper.selectPage(page, wrapper);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment