修改增加企业和部门接口
parent
d7e75502ea
commit
fd11ffe72e
|
|
@ -1,10 +1,16 @@
|
||||||
package com.zcloud.basic.info.command;
|
package com.zcloud.basic.info.command;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.Response;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.jjb.saas.system.client.tenant.facade.TenantFacade;
|
||||||
|
import com.jjb.saas.system.client.tenant.request.OtaTenantAddCmd;
|
||||||
|
import com.zcloud.basic.info.domain.enums.CorpTypeEnum;
|
||||||
import com.zcloud.basic.info.domain.gateway.CorpInfoGateway;
|
import com.zcloud.basic.info.domain.gateway.CorpInfoGateway;
|
||||||
import com.zcloud.basic.info.domain.model.CorpInfoE;
|
import com.zcloud.basic.info.domain.model.CorpInfoE;
|
||||||
import com.zcloud.basic.info.dto.CorpInfoAddCmd;
|
import com.zcloud.basic.info.dto.CorpInfoAddCmd;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -18,14 +24,36 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class CorpInfoAddExe {
|
public class CorpInfoAddExe {
|
||||||
private final CorpInfoGateway corpInfoGateway;
|
private final CorpInfoGateway corpInfoGateway;
|
||||||
|
@DubboReference
|
||||||
|
private TenantFacade tenantFacade;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long execute(CorpInfoAddCmd cmd) {
|
public Long execute(CorpInfoAddCmd cmd) {
|
||||||
CorpInfoE examTypeE = new CorpInfoE();
|
CorpInfoE examTypeE = new CorpInfoE();
|
||||||
BeanUtils.copyProperties(cmd, examTypeE);
|
BeanUtils.copyProperties(cmd, examTypeE);
|
||||||
return corpInfoGateway.add(examTypeE);
|
|
||||||
|
Long corpInfoId ;
|
||||||
|
try {
|
||||||
|
corpInfoId = corpInfoGateway.add(examTypeE);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (corpInfoId == null) {
|
||||||
|
throw new BizException("保存失败");
|
||||||
|
}
|
||||||
|
OtaTenantAddCmd otaTenantAddCmd = new OtaTenantAddCmd();
|
||||||
|
otaTenantAddCmd.setAccount(examTypeE.getCorpName());
|
||||||
|
otaTenantAddCmd.setTenantId(corpInfoId);
|
||||||
|
otaTenantAddCmd.setTenantName(examTypeE.getCorpName());
|
||||||
|
otaTenantAddCmd.setPassword("Aa@123456789");
|
||||||
|
log.info("CorpInfoXgfAddExe,新增企业调用GBS请求:{}",otaTenantAddCmd.toString());
|
||||||
|
//TODO 企业推送gbs报错解密失败
|
||||||
|
// Response response = tenantFacade.addOtaTenant(otaTenantAddCmd);
|
||||||
|
//log.info("CorpInfoXgfAddExe,新增企业调用GBS返回:{}",response.toString());
|
||||||
|
return corpInfoId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.zcloud.basic.info.command;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.Response;
|
import com.alibaba.cola.dto.Response;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.jjb.saas.system.client.dept.facade.DeptFacade;
|
import com.jjb.saas.system.client.dept.facade.DeptFacade;
|
||||||
import com.jjb.saas.system.client.dept.request.FacadeAddDeptCmd;
|
import com.jjb.saas.system.client.dept.request.FacadeAddDeptCmd;
|
||||||
import com.jjb.saas.system.client.user.facade.UserFacade;
|
import com.jjb.saas.system.client.user.facade.UserFacade;
|
||||||
|
|
@ -36,12 +37,10 @@ public class DepartmentAddExe {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean execute(DepartmentAddCmd cmd) {
|
public boolean execute(DepartmentAddCmd cmd) {
|
||||||
DepartmentE examTypeE = new DepartmentE();
|
DepartmentE examTypeE = new DepartmentE();
|
||||||
|
/* if(examTypeE.getParentId()==null){
|
||||||
|
examTypeE.setParentId(AuthContext.getTenantId());
|
||||||
|
}*/
|
||||||
BeanUtils.copyProperties(cmd, examTypeE);
|
BeanUtils.copyProperties(cmd, examTypeE);
|
||||||
|
|
||||||
//a
|
|
||||||
// userFacade.addUser(new FacadeUserAddCmd());
|
|
||||||
// C = examTypeE.add(a,b,c);
|
|
||||||
|
|
||||||
Long id = null;
|
Long id = null;
|
||||||
try {
|
try {
|
||||||
id = departmentGateway.add(examTypeE);
|
id = departmentGateway.add(examTypeE);
|
||||||
|
|
@ -56,10 +55,12 @@ public class DepartmentAddExe {
|
||||||
FacadeAddDeptCmd deptCmd = new FacadeAddDeptCmd();
|
FacadeAddDeptCmd deptCmd = new FacadeAddDeptCmd();
|
||||||
deptCmd.setLinkId(id);
|
deptCmd.setLinkId(id);
|
||||||
deptCmd.setLinkName(examTypeE.getName());
|
deptCmd.setLinkName(examTypeE.getName());
|
||||||
|
|
||||||
deptCmd.setParentId(examTypeE.getParentId());
|
deptCmd.setParentId(examTypeE.getParentId());
|
||||||
deptCmd.setDeptTypeEnum(DeptTypeEnum.DEPARTMENT.getValue());
|
deptCmd.setDeptTypeEnum(DeptTypeEnum.DEPARTMENT.getValue());
|
||||||
Response response = deptFacade.addDept(deptCmd);
|
//TODO gbs部门表 sys_dept tenant_id,parent_ids,add_type_enum,存储错误,导致gbs页面看不到,参数还没有,待定
|
||||||
log.info("DepartmentAddExe,新增部门调用GBS返回:"+response.toString());
|
// Response response = deptFacade.addDept(deptCmd);
|
||||||
|
// log.info("DepartmentAddExe,新增部门调用GBS返回:"+response.toString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,6 @@ public class DepartmentRepositoryImpl extends BaseRepositoryImpl<DepartmentMappe
|
||||||
public List<DepartmentDO> listTree(Map<String, Object> parmas) {
|
public List<DepartmentDO> listTree(Map<String, Object> parmas) {
|
||||||
QueryWrapper<DepartmentDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<DepartmentDO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, parmas);
|
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, parmas);
|
||||||
// SSOUser ssoUser = AuthContext.getCurrentUser();
|
|
||||||
// queryWrapper.eq("tenant_id",ssoUser.getTenantId());
|
|
||||||
queryWrapper.orderByDesc("dep_order");
|
queryWrapper.orderByDesc("dep_order");
|
||||||
List<DepartmentDO> departmentDOList = departmentMapper.selectList(queryWrapper);
|
List<DepartmentDO> departmentDOList = departmentMapper.selectList(queryWrapper);
|
||||||
if (CollUtil.isEmpty(departmentDOList)) {
|
if (CollUtil.isEmpty(departmentDOList)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue