添加Base64文件上传支持并扩展企业类型查询功能
parent
0efc7e3124
commit
54f8586d1f
|
|
@ -9,6 +9,7 @@ import com.zcloud.basic.info.domain.utils.Smb;
|
|||
import com.zcloud.basic.info.dto.ImgFilesQryCmd;
|
||||
import com.zcloud.basic.info.dto.clientobject.ImgFilesCO;
|
||||
import com.zcloud.gbscommon.utils.DateUtil;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.request.ZcloudImgFilesQryCmd;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.response.ZcloudImgFilesCO;
|
||||
|
|
@ -18,6 +19,9 @@ import org.springframework.util.ObjectUtils;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -40,16 +44,29 @@ public class ZcloudImgFilesFacadeImpl implements ZcloudImgFilesFacade {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String saveFile(MultipartFile multipartFile, String path) {
|
||||
public String saveFile(String multipartFile, String fileName, String path) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
String filePath = ssoUser.getTenantId().toString() + "/" + DateUtil.getMonth() + "/" + path;
|
||||
// 文件上传并获取上传路径
|
||||
String resultFilePath = null;
|
||||
try {
|
||||
resultFilePath = Smb.saveFile(multipartFile, filePath);
|
||||
resultFilePath = Smb.saveFile(base64ToInputStream(multipartFile),fileName, filePath);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return resultFilePath;
|
||||
}
|
||||
public static InputStream base64ToInputStream(String base64String) {
|
||||
if (base64String == null || base64String.isEmpty()) {
|
||||
throw new IllegalArgumentException("Base64 string is null or empty");
|
||||
}
|
||||
|
||||
String data = base64String;
|
||||
if (base64String.contains(",")) {
|
||||
data = base64String.substring(base64String.indexOf(",") + 1);
|
||||
}
|
||||
|
||||
byte[] bytes = Base64.getDecoder().decode(data);
|
||||
return new ByteArrayInputStream(bytes);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,10 @@ public class CorpInfoPageQry extends PageQuery {
|
|||
@ApiModelProperty(value = "企业类型1:监管 2:企业 3:相关方", name = "enterpriseType", required = true)
|
||||
private Integer enterpriseType;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "企业类型1:监管 2:企业 3:相关方", name = "enterpriseTypeList", required = true)
|
||||
private List<Integer> enterpriseTypeList;
|
||||
|
||||
@ApiModelProperty(value = "统一社会信用代码", name = "code", required = true)
|
||||
private String eqCode;
|
||||
|
||||
|
|
|
|||
|
|
@ -280,5 +280,11 @@ public class Smb {
|
|||
// 返回文件保存目录
|
||||
return filePath + "/" + fileName;
|
||||
}
|
||||
public static String saveFile(InputStream fileio, String fileName, String filePath) throws Exception{
|
||||
// 根据项目类型生成项目文件
|
||||
sshSftpForInput(fileio, fileName, filePath);
|
||||
// 返回文件保存目录
|
||||
return filePath + "/" + fileName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,17 @@ public class CorpInfoRepositoryImpl extends BaseRepositoryImpl<CorpInfoMapper, C
|
|||
if (CollUtil.isNotEmpty(enterpriseType)) {
|
||||
queryWrapper.in("type", enterpriseType);
|
||||
}
|
||||
if (params.get("enterpriseTypeList") != null
|
||||
&& params.get("enterpriseTypeList") instanceof List){
|
||||
List<Integer> enterpriseTypeList = (List<Integer>) params.get("enterpriseTypeList");
|
||||
if (enterpriseTypeList != null && enterpriseTypeList.size() > 0){
|
||||
List<Integer> entTypeList = CorpTypeEnum.getCodesByEnterpriseType(enterpriseTypeList);
|
||||
if (CollUtil.isNotEmpty(entTypeList)) {
|
||||
queryWrapper.in("type", entTypeList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
queryWrapper.orderByAsc("corp_order").orderByDesc("create_time");
|
||||
|
||||
if (!ObjectUtils.isEmpty(params.get("menuPath"))) {
|
||||
|
|
|
|||
|
|
@ -225,7 +225,6 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
|
||||
@Override
|
||||
public UserDO getInfoByUserName(String username) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("username", username);
|
||||
return userMapper.getInfoByUserName(params);
|
||||
|
|
|
|||
Loading…
Reference in New Issue