parent
10d89e7126
commit
df37fd4ea8
|
|
@ -22,19 +22,10 @@ public class CorpInfoAddExe {
|
||||||
private final CorpInfoGateway corpInfoGateway;
|
private final CorpInfoGateway corpInfoGateway;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean execute(CorpInfoAddCmd cmd) {
|
public Long execute(CorpInfoAddCmd cmd) {
|
||||||
CorpInfoE examTypeE = new CorpInfoE();
|
CorpInfoE examTypeE = new CorpInfoE();
|
||||||
BeanUtils.copyProperties(cmd, examTypeE);
|
BeanUtils.copyProperties(cmd, examTypeE);
|
||||||
boolean res = false;
|
return corpInfoGateway.add(examTypeE);
|
||||||
try {
|
|
||||||
res = corpInfoGateway.add(examTypeE);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
if (!res) {
|
|
||||||
throw new BizException("保存失败");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.zcloud.basic.info.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum CorpTypeEnum {
|
||||||
|
OrdinaryEnterprises(0,"普通企业"),
|
||||||
|
groupUnits(1, "集团单位"),
|
||||||
|
share(2,"股份单位"),
|
||||||
|
serviceProvider(3, "相关方企业"),
|
||||||
|
cargoOwner(4, "货主单位"),
|
||||||
|
portUnit(5, "驻港单位");
|
||||||
|
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
CorpTypeEnum(Integer code, String name) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.zcloud.basic.info.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum UserTypeEnum {
|
||||||
|
JG(1,"监管"),
|
||||||
|
QY(2,"企业"),
|
||||||
|
XGF(3,"相关方")
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
UserTypeEnum(Integer code, String name) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getUserType(Integer corpType){
|
||||||
|
if (corpType.equals(CorpTypeEnum.OrdinaryEnterprises.getCode()) ||
|
||||||
|
corpType.equals(CorpTypeEnum.groupUnits.getCode())){
|
||||||
|
return UserTypeEnum.QY.getCode();
|
||||||
|
}else if (corpType.equals(CorpTypeEnum.share.getCode())){
|
||||||
|
return UserTypeEnum.JG.getCode();
|
||||||
|
}else {
|
||||||
|
return UserTypeEnum.XGF.getCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,17 +2,18 @@ package com.zcloud.basic.info.service;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.zcloud.basic.info.api.CorpInfoServiceI;
|
import com.zcloud.basic.info.api.CorpInfoServiceI;
|
||||||
import com.zcloud.basic.info.command.CorpInfoAddExe;
|
import com.zcloud.basic.info.command.CorpInfoAddExe;
|
||||||
import com.zcloud.basic.info.command.CorpInfoRemoveExe;
|
import com.zcloud.basic.info.command.CorpInfoRemoveExe;
|
||||||
import com.zcloud.basic.info.command.CorpInfoUpdateExe;
|
import com.zcloud.basic.info.command.CorpInfoUpdateExe;
|
||||||
|
import com.zcloud.basic.info.command.SysUserAddExe;
|
||||||
import com.zcloud.basic.info.command.query.CorpInfoQueryExe;
|
import com.zcloud.basic.info.command.query.CorpInfoQueryExe;
|
||||||
import com.zcloud.basic.info.dto.CorpDepartmentQry;
|
import com.zcloud.basic.info.dto.*;
|
||||||
import com.zcloud.basic.info.dto.CorpInfoAddCmd;
|
|
||||||
import com.zcloud.basic.info.dto.CorpInfoPageQry;
|
|
||||||
import com.zcloud.basic.info.dto.CorpInfoUpdateCmd;
|
|
||||||
import com.zcloud.basic.info.dto.clientobject.CorpDepartmentCO;
|
import com.zcloud.basic.info.dto.clientobject.CorpDepartmentCO;
|
||||||
import com.zcloud.basic.info.dto.clientobject.CorpInfoCO;
|
import com.zcloud.basic.info.dto.clientobject.CorpInfoCO;
|
||||||
|
import com.zcloud.basic.info.enums.UserTypeEnum;
|
||||||
|
import com.zcloud.gbscommon.utils.Tools;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -31,6 +32,7 @@ public class CorpInfoServiceImpl implements CorpInfoServiceI {
|
||||||
private final CorpInfoUpdateExe corpInfoUpdateExe;
|
private final CorpInfoUpdateExe corpInfoUpdateExe;
|
||||||
private final CorpInfoRemoveExe corpInfoRemoveExe;
|
private final CorpInfoRemoveExe corpInfoRemoveExe;
|
||||||
private final CorpInfoQueryExe corpInfoQueryExe;
|
private final CorpInfoQueryExe corpInfoQueryExe;
|
||||||
|
private final SysUserAddExe sysUserAddExe;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResponse<CorpInfoCO> listPage(CorpInfoPageQry qry) {
|
public PageResponse<CorpInfoCO> listPage(CorpInfoPageQry qry) {
|
||||||
|
|
@ -41,7 +43,15 @@ public class CorpInfoServiceImpl implements CorpInfoServiceI {
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse add(CorpInfoAddCmd cmd) {
|
public SingleResponse add(CorpInfoAddCmd cmd) {
|
||||||
|
|
||||||
corpInfoAddExe.execute(cmd);
|
Long userId = AuthContext.getUserId();
|
||||||
|
Long id = corpInfoAddExe.execute(cmd);
|
||||||
|
|
||||||
|
//新增企业成功后新增企业主账号用户(企业主账号的gbsId与企业的gbsId一致) 2025-10-31 huangyuxuan
|
||||||
|
SysUserAddCmd user = new SysUserAddCmd();
|
||||||
|
user.setId(userId).setUserId(Tools.get32UUID()).setUsername(cmd.getCorpName()).setName(cmd.getCorpName())
|
||||||
|
.setCorpinfoId(id).setUserType(UserTypeEnum.getUserType(cmd.getType())).setStatus("0")
|
||||||
|
.setDepartmentId(id);
|
||||||
|
sysUserAddExe.execute(user);
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -20,10 +22,11 @@ import java.time.LocalDateTime;
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
public class SysUserAddCmd extends Command {
|
public class SysUserAddCmd extends Command {
|
||||||
@ApiModelProperty(value = "GBS用户id", name = "id", required = true)
|
@ApiModelProperty(value = "GBS用户id", name = "id", required = true)
|
||||||
@NotEmpty(message = "GBS用户id不能为空")
|
@NotNull(message = "GBS用户id不能为空")
|
||||||
private Integer id;
|
private Long id;
|
||||||
@ApiModelProperty(value = "用户id", name = "userId", required = true)
|
@ApiModelProperty(value = "用户id", name = "userId", required = true)
|
||||||
@NotEmpty(message = "用户id不能为空")
|
@NotEmpty(message = "用户id不能为空")
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
@ -37,17 +40,17 @@ public class SysUserAddCmd extends Command {
|
||||||
@NotEmpty(message = "姓名不能为空")
|
@NotEmpty(message = "姓名不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
@ApiModelProperty(value = "企业", name = "corpinfoId", required = true)
|
@ApiModelProperty(value = "企业", name = "corpinfoId", required = true)
|
||||||
@NotEmpty(message = "企业不能为空")
|
@NotNull(message = "企业不能为空")
|
||||||
private String corpinfoId;
|
private Long corpinfoId;
|
||||||
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
|
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
|
||||||
@NotEmpty(message = "部门id不能为空")
|
@NotNull(message = "部门id不能为空")
|
||||||
private String departmentId;
|
private Long departmentId;
|
||||||
@ApiModelProperty(value = "角色id", name = "roleIds", required = true)
|
@ApiModelProperty(value = "角色id", name = "roleIds", required = true)
|
||||||
@NotEmpty(message = "角色id不能为空")
|
@NotEmpty(message = "角色id不能为空")
|
||||||
private String roleIds;
|
private String roleIds;
|
||||||
@ApiModelProperty(value = "1监管2企业3相关方", name = "userType", required = true)
|
@ApiModelProperty(value = "1监管2企业3相关方", name = "userType", required = true)
|
||||||
@NotEmpty(message = "1监管2企业3相关方不能为空")
|
@NotEmpty(message = "1监管2企业3相关方不能为空")
|
||||||
private String userType;
|
private Integer userType;
|
||||||
@ApiModelProperty(value = "状态0.正常 99.锁定 2密码错误次数超过当天限制", name = "status", required = true)
|
@ApiModelProperty(value = "状态0.正常 99.锁定 2密码错误次数超过当天限制", name = "status", required = true)
|
||||||
@NotEmpty(message = "状态0.正常 99.锁定 2密码错误次数超过当天限制不能为空")
|
@NotEmpty(message = "状态0.正常 99.锁定 2密码错误次数超过当天限制不能为空")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -22,8 +23,8 @@ import java.time.LocalDateTime;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class SysUserUpdateCmd extends Command {
|
public class SysUserUpdateCmd extends Command {
|
||||||
@ApiModelProperty(value = "GBS用户id", name = "id", required = true)
|
@ApiModelProperty(value = "GBS用户id", name = "id", required = true)
|
||||||
@NotEmpty(message = "GBS用户id不能为空")
|
@NotNull(message = "GBS用户id不能为空")
|
||||||
private Integer id;
|
private Long id;
|
||||||
@ApiModelProperty(value = "用户id", name = "userId", required = true)
|
@ApiModelProperty(value = "用户id", name = "userId", required = true)
|
||||||
@NotEmpty(message = "用户id不能为空")
|
@NotEmpty(message = "用户id不能为空")
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
@ -37,17 +38,17 @@ public class SysUserUpdateCmd extends Command {
|
||||||
@NotEmpty(message = "姓名不能为空")
|
@NotEmpty(message = "姓名不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
@ApiModelProperty(value = "企业", name = "corpinfoId", required = true)
|
@ApiModelProperty(value = "企业", name = "corpinfoId", required = true)
|
||||||
@NotEmpty(message = "企业不能为空")
|
@NotNull(message = "企业不能为空")
|
||||||
private String corpinfoId;
|
private Long corpinfoId;
|
||||||
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
|
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
|
||||||
@NotEmpty(message = "部门id不能为空")
|
@NotNull(message = "部门id不能为空")
|
||||||
private String departmentId;
|
private Long departmentId;
|
||||||
@ApiModelProperty(value = "角色id", name = "roleIds", required = true)
|
@ApiModelProperty(value = "角色id", name = "roleIds", required = true)
|
||||||
@NotEmpty(message = "角色id不能为空")
|
@NotEmpty(message = "角色id不能为空")
|
||||||
private String roleIds;
|
private String roleIds;
|
||||||
@ApiModelProperty(value = "1监管2企业3相关方", name = "userType", required = true)
|
@ApiModelProperty(value = "1监管2企业3相关方", name = "userType", required = true)
|
||||||
@NotEmpty(message = "1监管2企业3相关方不能为空")
|
@NotEmpty(message = "1监管2企业3相关方不能为空")
|
||||||
private String userType;
|
private Integer userType;
|
||||||
@ApiModelProperty(value = "状态0.正常 99.锁定 2密码错误次数超过当天限制", name = "status", required = true)
|
@ApiModelProperty(value = "状态0.正常 99.锁定 2密码错误次数超过当天限制", name = "status", required = true)
|
||||||
@NotEmpty(message = "状态0.正常 99.锁定 2密码错误次数超过当天限制不能为空")
|
@NotEmpty(message = "状态0.正常 99.锁定 2密码错误次数超过当天限制不能为空")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import java.util.Date;
|
||||||
public class SysUserCO extends ClientObject {
|
public class SysUserCO extends ClientObject {
|
||||||
//GBS用户id
|
//GBS用户id
|
||||||
@ApiModelProperty(value = "GBS用户id")
|
@ApiModelProperty(value = "GBS用户id")
|
||||||
private Integer id;
|
private Long id;
|
||||||
//用户id
|
//用户id
|
||||||
@ApiModelProperty(value = "用户id")
|
@ApiModelProperty(value = "用户id")
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
@ -32,16 +32,16 @@ public class SysUserCO extends ClientObject {
|
||||||
private String name;
|
private String name;
|
||||||
//企业
|
//企业
|
||||||
@ApiModelProperty(value = "企业")
|
@ApiModelProperty(value = "企业")
|
||||||
private String corpinfoId;
|
private Long corpinfoId;
|
||||||
//部门id
|
//部门id
|
||||||
@ApiModelProperty(value = "部门id")
|
@ApiModelProperty(value = "部门id")
|
||||||
private String departmentId;
|
private Long departmentId;
|
||||||
//角色id
|
//角色id
|
||||||
@ApiModelProperty(value = "角色id")
|
@ApiModelProperty(value = "角色id")
|
||||||
private String roleIds;
|
private String roleIds;
|
||||||
//1监管2企业3相关方
|
//1监管2企业3相关方
|
||||||
@ApiModelProperty(value = "1监管2企业3相关方")
|
@ApiModelProperty(value = "1监管2企业3相关方")
|
||||||
private String userType;
|
private Integer userType;
|
||||||
//状态0.正常 99.锁定 2密码错误次数超过当天限制
|
//状态0.正常 99.锁定 2密码错误次数超过当天限制
|
||||||
@ApiModelProperty(value = "状态0.正常 99.锁定 2密码错误次数超过当天限制")
|
@ApiModelProperty(value = "状态0.正常 99.锁定 2密码错误次数超过当天限制")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ public interface CorpInfoGateway {
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
Boolean add(CorpInfoE corpInfoE);
|
Long add(CorpInfoE corpInfoE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,13 @@ public class SysUserE extends BaseE {
|
||||||
//姓名
|
//姓名
|
||||||
private String name;
|
private String name;
|
||||||
//企业
|
//企业
|
||||||
private String corpinfoId;
|
private Long corpinfoId;
|
||||||
//部门id
|
//部门id
|
||||||
private String departmentId;
|
private Long departmentId;
|
||||||
//角色id
|
//角色id
|
||||||
private String roleIds;
|
private String roleIds;
|
||||||
//1监管2企业3相关方
|
//1监管2企业3相关方
|
||||||
private String userType;
|
private Integer userType;
|
||||||
//状态0.正常 99.锁定 2密码错误次数超过当天限制
|
//状态0.正常 99.锁定 2密码错误次数超过当天限制
|
||||||
private String status;
|
private String status;
|
||||||
//邮箱
|
//邮箱
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,11 @@ public class CorpInfoGatewayImpl implements CorpInfoGateway {
|
||||||
private final CorpInfoRepository corpInfoRepository;
|
private final CorpInfoRepository corpInfoRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean add(CorpInfoE corpInfoE) {
|
public Long add(CorpInfoE corpInfoE) {
|
||||||
CorpInfoDO d = new CorpInfoDO();
|
CorpInfoDO d = new CorpInfoDO();
|
||||||
BeanUtils.copyProperties(corpInfoE, d);
|
BeanUtils.copyProperties(corpInfoE, d);
|
||||||
corpInfoRepository.save(d);
|
corpInfoRepository.save(d);
|
||||||
return true;
|
return d.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -37,16 +37,16 @@ public class SysUserDO extends BaseDO {
|
||||||
private String name;
|
private String name;
|
||||||
//企业
|
//企业
|
||||||
@ApiModelProperty(value = "企业")
|
@ApiModelProperty(value = "企业")
|
||||||
private String corpinfoId;
|
private Long corpinfoId;
|
||||||
//部门id
|
//部门id
|
||||||
@ApiModelProperty(value = "部门id")
|
@ApiModelProperty(value = "部门id")
|
||||||
private String departmentId;
|
private Long departmentId;
|
||||||
//角色id
|
//角色id
|
||||||
@ApiModelProperty(value = "角色id")
|
@ApiModelProperty(value = "角色id")
|
||||||
private String roleIds;
|
private String roleIds;
|
||||||
//1监管2企业3相关方
|
//1监管2企业3相关方
|
||||||
@ApiModelProperty(value = "1监管2企业3相关方")
|
@ApiModelProperty(value = "1监管2企业3相关方")
|
||||||
private String userType;
|
private Integer userType;
|
||||||
//状态0.正常 99.锁定 2密码错误次数超过当天限制
|
//状态0.正常 99.锁定 2密码错误次数超过当天限制
|
||||||
@ApiModelProperty(value = "状态0.正常 99.锁定 2密码错误次数超过当天限制")
|
@ApiModelProperty(value = "状态0.正常 99.锁定 2密码错误次数超过当天限制")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue