package appapi.common;
public enum BusinessTypeEnum {
// 其它
other,
//新增
insert,
//修改
update,
// 删除
delete,
//查询
select,
//授权
empower,
//导出
export,
//导入
eximport,
//强退
forceout,
//生成代码
generating,
//清空数据
cleardata;
// private int code;
//
// BusinessTypeEnum(int code){
// this.code = code;
// }
//
// public int getCode() {
// return code;
// }
}
@ApiOperation(value = “新增公司”, notes = “新增公司”)
@PostMapping(value = “/newCompany”,produces = “application/json;charset=UTF-8”)
@MyLog(title = “新增公司”,businessType = BusinessTypeEnum.insert)
public ResponseBean insertCompany(@Valid @RequestBody AddCompanyVo companyVo) {
CompanyDto entity = companyVo.vo2Entity();
entity.setCreateTime(LocalDateTime.now());
entity.setUpdateTime(LocalDateTime.now());
try {
int iRet = iCompanyService.InsertCompany(entity);
if (iRet > 0) {
//同时增加组织机构
OrganizationDto dto = new OrganizationDto();
dto.setOrgaName(entity.getCompName());
dto.setCreateTime(LocalDateTime.now());
dto.setUpdateTime(LocalDateTime.now());
dto.setIsEnable(0);
dto.setOrgaLevel(1);
dto.setOrgaPid(1);
dto.setOrgaNote(entity.getCompNote());
dto.setOrgaSort(1);
organization.InsertOrganization(dto);
//获取组织机构id
Integer orgaId = Integer.parseInt(dto.getOrgaId().toString());
entity.setOrgaId(orgaId);
iCompanyService.UpdateCompany(entity);
return ResponseBean.success(“保存成功!”);
} else {
return ResponseBean.fail(“保存失败!”);
}
} catch (BusinessException exception) {
return ResponseBean.fail(exception.getMessage());
}
}