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