解决组织机构修改的时候无法去掉父级目录的bug
This commit is contained in:
@@ -123,45 +123,4 @@ public class OrganizationController {
|
|||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* create by: cjl
|
|
||||||
* description:
|
|
||||||
* 新增机构信息
|
|
||||||
* create time: 2019/2/19 17:17
|
|
||||||
* @Param: beanJson
|
|
||||||
* @return java.lang.Object
|
|
||||||
*/
|
|
||||||
@PostMapping(value = "/addOrganization")
|
|
||||||
@ApiOperation(value = "新增机构信息")
|
|
||||||
public Object addOrganization(@RequestParam("info") String beanJson) throws Exception {
|
|
||||||
JSONObject result = ExceptionConstants.standardSuccess();
|
|
||||||
Organization org= JSON.parseObject(beanJson, Organization.class);
|
|
||||||
int i= organizationService.addOrganization(org);
|
|
||||||
if(i<1){
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_ADD_FAILED_CODE,
|
|
||||||
ExceptionConstants.ORGANIZATION_ADD_FAILED_MSG);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* create by: cjl
|
|
||||||
* description:
|
|
||||||
* 修改机构信息
|
|
||||||
* create time: 2019/2/20 9:30
|
|
||||||
* @Param: beanJson
|
|
||||||
* @return java.lang.Object
|
|
||||||
*/
|
|
||||||
@PostMapping(value = "/editOrganization")
|
|
||||||
@ApiOperation(value = "修改机构信息")
|
|
||||||
public Object editOrganization(@RequestParam("info") String beanJson) throws Exception {
|
|
||||||
JSONObject result = ExceptionConstants.standardSuccess();
|
|
||||||
Organization org= JSON.parseObject(beanJson, Organization.class);
|
|
||||||
int i= organizationService.editOrganization(org);
|
|
||||||
if(i<1){
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_EDIT_FAILED_CODE,
|
|
||||||
ExceptionConstants.ORGANIZATION_EDIT_FAILED_MSG);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class OrganizationService {
|
|||||||
organization.setUpdateTime(new Date());
|
organization.setUpdateTime(new Date());
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result=organizationMapper.updateByPrimaryKeySelective(organization);
|
result=organizationMapperEx.editOrganization(organization);
|
||||||
logService.insertLog("机构",
|
logService.insertLog("机构",
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(organization.getOrgAbr()).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(organization.getOrgAbr()).toString(), request);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
@@ -143,66 +143,6 @@ public class OrganizationService {
|
|||||||
return list==null?0:list.size();
|
return list==null?0:list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
||||||
public int addOrganization(Organization org) throws Exception{
|
|
||||||
logService.insertLog("机构",
|
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(org.getOrgAbr()).toString(),
|
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
|
||||||
//新增时间
|
|
||||||
Date date=new Date();
|
|
||||||
User userInfo=userService.getCurrentUser();
|
|
||||||
org.setCreateTime(date);
|
|
||||||
//修改时间
|
|
||||||
org.setUpdateTime(date);
|
|
||||||
/**
|
|
||||||
*添加的时候检测机构编号是否已存在
|
|
||||||
* */
|
|
||||||
if(StringUtil.isNotEmpty(org.getOrgNo())){
|
|
||||||
checkOrgNoIsExists(org.getOrgNo(),null);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 未指定父级机构的时候默认为根机构
|
|
||||||
* */
|
|
||||||
if(org.getParentId()!=null){
|
|
||||||
org.setParentId(null);
|
|
||||||
}
|
|
||||||
int result=0;
|
|
||||||
try{
|
|
||||||
result=organizationMapperEx.addOrganization(org);
|
|
||||||
}catch(Exception e){
|
|
||||||
JshException.writeFail(logger, e);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
||||||
public int editOrganization(Organization org)throws Exception {
|
|
||||||
logService.insertLog("机构",
|
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(org.getOrgAbr()).toString(),
|
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
|
||||||
//修改时间
|
|
||||||
org.setUpdateTime(new Date());
|
|
||||||
User userInfo=userService.getCurrentUser();
|
|
||||||
/**
|
|
||||||
* 修改的时候检测机构编号是否已存在
|
|
||||||
* */
|
|
||||||
if(StringUtil.isNotEmpty(org.getOrgNo())){
|
|
||||||
checkOrgNoIsExists(org.getOrgNo(),org.getId());
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 未指定父级机构的时候默认为根机构
|
|
||||||
* */
|
|
||||||
if(org.getParentId()!=null){
|
|
||||||
org.setParentId(null);
|
|
||||||
}
|
|
||||||
int result=0;
|
|
||||||
try{
|
|
||||||
result=organizationMapperEx.editOrganization(org);
|
|
||||||
}catch(Exception e){
|
|
||||||
JshException.writeFail(logger, e);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<TreeNode> getOrganizationTree(Long id)throws Exception {
|
public List<TreeNode> getOrganizationTree(Long id)throws Exception {
|
||||||
List<TreeNode> list=null;
|
List<TreeNode> list=null;
|
||||||
try{
|
try{
|
||||||
|
|||||||
Reference in New Issue
Block a user