检验放在前面

master
XI_TENG\xixi_ 6 months ago
parent 8a297783f2
commit 8878e322c6

@ -54,6 +54,7 @@ import jnpf.util.treeutil.newtreeutil.TreeDotUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@ -422,6 +423,7 @@ public class OrganizeController extends SuperController<OrganizeService, Organiz
})
@SaCheckPermission(value = {"permission.organize"})
@PostMapping
@Transactional
public ActionResult create(@RequestBody @Valid OrganizeCrForm organizeCrForm) {
OrganizeEntity entity = JsonUtil.getJsonToBean(organizeCrForm, OrganizeEntity.class);
entity.setCategory("company");
@ -462,7 +464,7 @@ public class OrganizeController extends SuperController<OrganizeService, Organiz
})
@SaCheckPermission(value = {"permission.organize.check"})
@PostMapping("/check")
@DSTransactional
// @Transactional
public ActionResult checkCreate(@RequestBody @Valid OrganizeCrForm organizeCrForm) throws Exception {
OrganizeEntity entity = JsonUtil.getJsonToBean(organizeCrForm, OrganizeEntity.class);
entity.setCategory("company");
@ -473,9 +475,13 @@ public class OrganizeController extends SuperController<OrganizeService, Organiz
if (areEqual == false) {
return ActionResult.fail("验证码必须为000000");
}
// if (organizeService.isExistByEnCode(entity.getEnCode(), entity.getId())) {
// return ActionResult.fail("公司编码不能重复");
// }
QueryWrapper<UserEntity> queryWrapperuser =new QueryWrapper<>();
queryWrapperuser.lambda().eq(UserEntity::getAccount,organizeCrForm.getPropertyJson().getManagerTelePhone());
List<UserEntity> userEntityList =userService.list(queryWrapperuser);
if (userEntityList!=null && userEntityList.size()>0){
return ActionResult.fail("账户名称不能重复");
}
if (organizeCrForm.getEnabledMark() == 1) {
// 通过组织id获取父级组织
String organizeIdTree = getOrganizeIdTree(entity);
@ -492,9 +498,9 @@ public class OrganizeController extends SuperController<OrganizeService, Organiz
userCrForm.setMobilePhone(organizeCrForm.getPropertyJson().getManagerTelePhone());
UserEntity userEntity = JsonUtil.getJsonToBean(userCrForm, UserEntity.class);
userEntity.setPassword("4a7d1ed414474e4033ac29ccb8653d9b");
if (userService.isExistByAccount(userCrForm.getAccount())) {
return ActionResult.fail("账户名称不能重复");
}
// if (userService.isExistByAccount(userCrForm.getAccount())) {
// return ActionResult.fail("账户名称不能重复");
// }
userService.create(userEntity);
//申请入住赋予分级权限
@ -693,7 +699,8 @@ public class OrganizeController extends SuperController<OrganizeService, Organiz
userService.update(userEntity.id, userEntity);
return ActionResult.success(MsgCode.SU001.get());
} else if (organizeCrForm.getEnabledMark() == 2) {
}
else if (organizeCrForm.getEnabledMark() == 2) {
// 通过组织id获取父级组织
String organizeIdTree = getOrganizeIdTree(entity);
entity.setOrganizeIdTree(organizeIdTree);
@ -709,9 +716,9 @@ public class OrganizeController extends SuperController<OrganizeService, Organiz
userCrForm.setMobilePhone(organizeCrForm.getPropertyJson().getManagerTelePhone());
UserEntity userEntity = JsonUtil.getJsonToBean(userCrForm, UserEntity.class);
userEntity.setPassword("4a7d1ed414474e4033ac29ccb8653d9b");
if (userService.isExistByAccount(userCrForm.getAccount())) {
return ActionResult.fail("账户名称不能重复");
}
// if (userService.isExistByAccount(userCrForm.getAccount())) {
// return ActionResult.fail("账户名称不能重复");
// }
userService.create(userEntity);
//申请入住赋予分级权限

Loading…
Cancel
Save