Commit b6d82795 authored by 郭凡凡's avatar 郭凡凡

修改bug

parent 7feab2ab
......@@ -406,28 +406,50 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
*/
@Override
public ResponseVO saveAndUpdateTenant(OcpBaseTiocnDto ocpBaseTiocnDto) {
String objId = ocpBaseTiocnDto.getObjId();
String tenantCode = ocpBaseTiocnDto.getTenantCode();
LambdaQueryWrapper<OcpTenantBase> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
lambdaQueryWrapper2.eq(OcpTenantBase::getTenantCode, tenantCode);
OcpTenantBase one = this.getOne(lambdaQueryWrapper2);
OcpTenantBase ocpTenantBase = new OcpTenantBase();
BeanUtils.copyProperties(ocpBaseTiocnDto, ocpTenantBase);
ocpTenantBase.setIsDelete((short) 0);
if (StringUtils.isEmpty(objId)){
if (one!=null){
return ResponseVO.error("应用编码不能重复");
}else {
ocpTenantBase.setTenantCtime(new Timestamp(System.currentTimeMillis()));
ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis()));
this.save(ocpTenantBase);
}
}else {
ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis()));
LambdaQueryWrapper<OcpTenantBase> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(OcpTenantBase::getObjId,ocpTenantBase.getObjId());
this.update(ocpTenantBase,lambdaQueryWrapper);
}
LambdaQueryWrapper<OcpTenantBase> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
lambdaQueryWrapper2.eq(OcpTenantBase::getTenantCode, tenantCode);
// boolean flag = this.update(ocpTenantBase, lambdaQueryWrapper2);
// if (flag) {
// log.info("应用基础表修改成功");
// System.out.println("应用基础表修改成功");
// }
int delete = tenantBasicManagementMapper.delete(lambdaQueryWrapper2);
if (delete == 0) {
log.info("增加");
ocpTenantBase.setTenantCtime(new Timestamp(System.currentTimeMillis()));
ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis()));
} else {
log.info("编辑");
ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis()));
}
boolean save1 = this.save(ocpTenantBase);
// int delete = tenantBasicManagementMapper.delete(lambdaQueryWrapper2);
// if (delete == 0) {
// log.info("增加");
// ocpTenantBase.setTenantCtime(new Timestamp(System.currentTimeMillis()));
// ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis()));
// } else {
// log.info("编辑");
// ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis()));
// }
// boolean save1 = this.save(ocpTenantBase);
OcpTenantExtent ocpTenantExtent = new OcpTenantExtent();
ocpTenantExtent.setTenantCode(tenantCode);
ocpTenantExtent.setTenantState((short) 0);
......@@ -457,7 +479,7 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
ocpTenantIocn.setIocn(ocpBaseTiocnDto.getIocn());
ocpTenantIocn.setCompanyCode(ownerCompanyCode);
boolean save = ocpTenantIocnService.save(ocpTenantIocn);
if (save1 && save) {
if ( save) {
return ResponseVO.ok("添加成功");
}
return ResponseVO.error("未知错误");
......
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