Commit 001d0710 authored by 曹盼盼's avatar 曹盼盼

部门新增

parent a10f27e1
...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum; ...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService; import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.DepartmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company; import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl; import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl;
...@@ -234,5 +235,22 @@ public class CompanyController extends BaseController { ...@@ -234,5 +235,22 @@ public class CompanyController extends BaseController {
public ResponseModel<OrgUsrDto> getInfo(@RequestBody JSONObject jsonObject, String bizOrgType,String sequenceNbr){ public ResponseModel<OrgUsrDto> getInfo(@RequestBody JSONObject jsonObject, String bizOrgType,String sequenceNbr){
return ResponseHelper.buildResponse(orgServiceImpl.dataHandling(jsonObject,bizOrgType,sequenceNbr)); return ResponseHelper.buildResponse(orgServiceImpl.dataHandling(jsonObject,bizOrgType,sequenceNbr));
} }
/***
* 部門新增
* @param dto
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "department")
@ApiOperation(httpMethod = "POST", value = "部門新增", notes = "部門新增")
public ResponseModel<Boolean> getInfo(@RequestBody DepartmentDto dto){
return ResponseHelper.buildResponse(companyServiceImpl.saveDepartment(dto));
}
} }
...@@ -4,10 +4,17 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,10 +4,17 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper; import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.DepartmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company; import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.ICompanyService; import com.yeejoin.amos.boot.module.ugp.api.service.ICompanyService;
import com.yeejoin.amos.boot.module.ugp.api.dto.CompanyDto; import com.yeejoin.amos.boot.module.ugp.api.dto.CompanyDto;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import org.apache.lucene.queryparser.flexible.messages.Message; import org.apache.lucene.queryparser.flexible.messages.Message;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -29,9 +36,12 @@ import java.util.stream.Collectors; ...@@ -29,9 +36,12 @@ import java.util.stream.Collectors;
* @date 2022-09-22 * @date 2022-09-22
*/ */
@Service @Service
public class CompanyServiceImpl extends BaseService<CompanyDto, Company, CompanyMapper> implements ICompanyService { public class CompanyServiceImpl extends BaseService<CompanyDto, Company, CompanyMapper> implements ICompanyService {
@Autowired @Autowired
CompanyMapper companyMapper; CompanyMapper companyMapper;
@Autowired
OrgServiceImpl orgService;
/** /**
* 列表查询 示例 * 列表查询 示例
...@@ -58,4 +68,33 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company ...@@ -58,4 +68,33 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
return page1; return page1;
} }
/**
* 新增部门和负责人
* @return
*/
@BusinessIdentify
public Boolean saveDepartment(DepartmentDto dto){
if (dto == null) {
return false;
}
//平台添加
DepartmentModel departmentModel1 = new DepartmentModel( );
ReginParams reginParams = orgService.getReginParams();
departmentModel1.setCompanySeq(reginParams.getCompany().getSequenceNbr());
departmentModel1.setDepartmentName(dto.getDepartmentName());
departmentModel1.setLevel("dept");
departmentModel1.setParentId(1L);
DepartmentModel departmentModel = Privilege.departmentClient.create(departmentModel1).getResult();
//业务添加
JSONObject jsonObject = new JSONObject( );
jsonObject.put("amosOrgId",departmentModel.getSequenceNbr());
jsonObject.put("amosOrgCode",departmentModel.getOrgCode());
jsonObject.put("departmentName",dto.getDepartmentName());
jsonObject.put("departmentHead",dto.getDepartmentHead());
OrgUsrDto orgUsrDto = orgService.dataHandling(jsonObject, OrgEnum.部门.getKey( ), null);
return true;
}
} }
\ No newline at end of file
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