1、完善项目
2、完善合同 3、完善费用项 4、司机管理对接OCR 5、完善运输计划 6、完善临时额度
This commit is contained in:
@@ -22,14 +22,24 @@
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-core-auto</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.idev.excel</groupId>
|
||||
<artifactId>fastexcel</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-core-auto</artifactId>
|
||||
<scope>provided</scope>
|
||||
<groupId>com.huaweicloud</groupId>
|
||||
<artifactId>esdk-obs-java-bundle</artifactId>
|
||||
<version>3.24.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.16.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -72,4 +72,35 @@ public interface CommonConstant {
|
||||
*/
|
||||
Integer API_SCOPE_CATEGORY = 2;
|
||||
|
||||
|
||||
/**
|
||||
* 是 2
|
||||
*/
|
||||
Integer YES = 2;
|
||||
/**
|
||||
* 不是 1
|
||||
*/
|
||||
Integer NO = 1;
|
||||
/**
|
||||
* 系统名称
|
||||
*/
|
||||
String SYSTEM_CODE = "CK-ERP";
|
||||
/**
|
||||
* 默认密码参数值
|
||||
*/
|
||||
String DEFAULT_PARAM_PASSWORD = "account.initPassword";
|
||||
/**
|
||||
* 默认角色参数值
|
||||
*/
|
||||
String DEFAULT_PARAM_ROLE = "account.initRole";
|
||||
/**
|
||||
* 默认角色
|
||||
*/
|
||||
String DEFAULT_ROLE = "default";
|
||||
/**
|
||||
* 同步的子公司名称根公司的值
|
||||
*/
|
||||
String DICT_KEY_SYNC_ROOT_COMPANY_NAME = "root_company";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.springblade.common.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 数据状态枚举
|
||||
*
|
||||
* @author vic
|
||||
* @date 2024/8/26 6:45 PM
|
||||
* @description DataStatusEnum
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DataStatusEnum {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
ENABLE(1, "启用"),
|
||||
|
||||
DISABLE(2, "禁用"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String name;
|
||||
|
||||
|
||||
/**
|
||||
* 匹配枚举值
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static boolean match(Integer code) {
|
||||
for (DataStatusEnum state : values()) {
|
||||
if (state.code.equals(code)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getNameStr(Integer code) {
|
||||
for (DataStatusEnum state : values()) {
|
||||
if (state.code.equals(code)) {
|
||||
return state.name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否可以编辑修改表单 .没有审批业务的使用此方法, 系统设计的是反的
|
||||
* true:可编辑 false:不可编辑
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static boolean canEdit(Integer value) {
|
||||
return DISABLE.getCode().equals(value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package org.springblade.common.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 系统字典类型枚举
|
||||
* 响功能和流程的字典
|
||||
* @author vic
|
||||
* @date 2024/9/9 8:56 PM
|
||||
* @description DictTypeEnum
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DictTypeEnum {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
DATA_STATUS("data_status", "数据状态"),
|
||||
APPROVE_STATUS("approve_state", "通用审批状态"),
|
||||
COOPERATE_STATUS("cooperate_status", "合作状态"),
|
||||
CUSTOMER_TYPE("customer_type", "客户类型"),
|
||||
DELIVERER_TYPE("deliverer_type", "投送人类型"),
|
||||
ENTERPRISE_TYPE("enterprise_type", "企业类型"),
|
||||
SETTLEMENT_TYPE("settlement_type", "结算中心类型"),
|
||||
CUSTOMER_COMPANY_TYPE("company_type","客户管理的企业类型"),
|
||||
PARTNER_TYPE("partner_type","合作伙伴类型"),
|
||||
SYSTEM_YES_NO("yes_no","系统是否"),
|
||||
PLATFORM_TYPE("settlement_type","平台类型/结算中心类型"),
|
||||
TAXPAYER_TYPE("taxpayer_type","纳税人分类"),
|
||||
//部门简称
|
||||
DEPARTMENT_SHORT_NAME("department_short_name","部门简称"),
|
||||
PROCESS_TYPE("process_type","流程类型"),
|
||||
|
||||
//评级维度
|
||||
RATING_DIMENSION("rating_dimension","评级维度"),
|
||||
// oa公司部门同步
|
||||
SYNC_COMPANY_NAME("sync_company_name","同步公司名称"),
|
||||
SYNC_ROOT_COMPANY_DEPT_NAME("sync_root_company_dept_name","同步根公司下部门名称"),
|
||||
DEPARTMENT_CODE("department_code","部门编号"),
|
||||
|
||||
//公式管理
|
||||
FORMULA_TYPE("formula_type","公式类型"),
|
||||
|
||||
//财务管理
|
||||
FINANCIAL_TYPE("financial_type","财务类型"),
|
||||
SAP_TYPE("sap_type","财务结算类型"),
|
||||
SETTLEMENT_CLASSIFICATION("settlement_classification","财务结算分类"),//内部结算、外部结算
|
||||
SAP_DATA_STATUS("sap_data_status","财务结算单状态"),
|
||||
SETTLEMENT_VOUCHER_TYPE("settlement_voucher_type","结算凭证类型"),
|
||||
SETTLEMENT_NEXT_STATUS("settlement_next_status","下一步结算状态"),
|
||||
|
||||
PAYMENT_TYPE("payment_type","财务付款分类"),
|
||||
PAYMENT_DATA_STATUS("payment_data_status","财务付款单状态"),
|
||||
PAYEMENT_CLASSIFICATION("payment_classification","财务付款分类"), //内部付款、外部付款
|
||||
PAYMENT_METHOD_TYPE("payment_method_type","财务付款支付方式"),
|
||||
|
||||
SAP_VERIFICATION_METHOD("verification_method","验证方式"),
|
||||
|
||||
/** 结算管理列表页的开票状态、付款状态 **/
|
||||
SETT_PAYMENT_STATUS("payment_status","付款状态"),
|
||||
SETT_INVOICE_STATUS("invoice_status","开票状态"),
|
||||
|
||||
|
||||
// 车辆运输凭证
|
||||
CERTIFICATE_BATCH_STATUS("certificate_batch_status","车辆运输凭证批次状态"),
|
||||
CERTIFICATE_IDENTIFICATION_STATUS("certificate_identification_status","车辆运输凭证识别状态"),
|
||||
CERTIFICATE_IDENTIFICATION_RESULT("certificate_identification_result","车辆运输凭证识别结果"),
|
||||
|
||||
// 文件任务状态
|
||||
FILE_TASK_STATUS("file_task_status", "文件任务状态"),
|
||||
// 运单管理-差异项 总净重
|
||||
WEIGHT_STATUS("weight_status", "总净重"),
|
||||
// 运单管理-比对结果 差异类型
|
||||
DIFFERENCE_TYPE("difference_type", "差异类型"),
|
||||
// 收款
|
||||
CLAIM_STATUS("claim_status", "认领状态"),
|
||||
RECEIPT_SOURCE("receipt_source", "收款来源"),
|
||||
CURRENCY("currency", "币种"),
|
||||
|
||||
TRAJECTORY_STATUS("trajectory_status", "轨迹状态"),
|
||||
|
||||
HOME_BASE_TYPE("base_type","基地类型"),
|
||||
|
||||
FEE_NAME_TYPE("fee_name_type","费用类型"),
|
||||
|
||||
TAX_CODE("taxCode","税收编码"),
|
||||
INPUT_INVOICE_STATUS("input_invoice_status","录入开票状态"),
|
||||
|
||||
/**
|
||||
* 城矿结算公司财务负责人
|
||||
*/
|
||||
SETTLEMENT_FINANCE_CONTROLLER("settlement_finance_controller", "城矿结算公司财务负责人"),
|
||||
|
||||
/**
|
||||
* 付款单据类型
|
||||
*/
|
||||
PAYMENT_DOCUMENT_TYPE("payment_document_type", "付款单据类型"),
|
||||
|
||||
/**
|
||||
* 归档状态
|
||||
*/
|
||||
ARCHIVE_STATUS("archive_status", "归档状态"),
|
||||
|
||||
/**
|
||||
* 预警类型
|
||||
*/
|
||||
WARNING_TYPE("warning_type", "预警类型"),
|
||||
|
||||
/**
|
||||
* 消息状态
|
||||
*/
|
||||
MESSAGE_STATUS("message_status", "消息状态"),
|
||||
|
||||
/**
|
||||
* 通知类型
|
||||
*/
|
||||
NOTICE_TYPE("notice_type", "通知类型"),
|
||||
|
||||
/**
|
||||
* 通知对象类型
|
||||
*/
|
||||
NOTICE_OBJECT_TYPE("notice_object_type", "通知对象类型"),
|
||||
|
||||
/**
|
||||
* 项目磅单校验类型
|
||||
*/
|
||||
PROJECT_POUND_VALID_TYPE("project_pound_valid_type", "项目磅单校验类型"),
|
||||
|
||||
/**
|
||||
* 推送单据类型
|
||||
*/
|
||||
PUSH_DOC_TYPE("push_doc_type", "推送单据类型"),
|
||||
|
||||
/**
|
||||
* mk流程状态
|
||||
*/
|
||||
MK_STATUS("mk_status", "mk流程状态"),
|
||||
|
||||
;
|
||||
|
||||
final String type;
|
||||
|
||||
final String text;
|
||||
|
||||
|
||||
/**
|
||||
* 匹配枚举值
|
||||
*
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public static boolean match(String type) {
|
||||
for (DictTypeEnum state : values()) {
|
||||
if (state.type.equals(type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getNameStr(String type) {
|
||||
for (DictTypeEnum state : values()) {
|
||||
if (state.type.equals(type)) {
|
||||
return state.text;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
package org.springblade.common.utils;
|
||||
|
||||
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||
import com.obs.services.ObsClient;
|
||||
import com.obs.services.exception.ObsException;
|
||||
import com.obs.services.model.*;
|
||||
import jakarta.activation.MimetypesFileTypeMap;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: OBSUtil
|
||||
* @Description:
|
||||
* @Author: zhaowei
|
||||
* @Date: 2024/8/22
|
||||
*/
|
||||
public class ObsUtil {
|
||||
private final static Logger logger = LoggerFactory.getLogger(ObsUtil.class);
|
||||
|
||||
private static MimetypesFileTypeMap fileTypeMap = new MimetypesFileTypeMap();
|
||||
/**
|
||||
* 华为云OBS
|
||||
*/
|
||||
public static String obsEndpoint;
|
||||
public static String obsAccessKeyId;
|
||||
public static String obsAccessKeySecret;
|
||||
public static String obsBucketName;
|
||||
public static String obsRootDirectory;
|
||||
|
||||
@Value("${obs.endpoint}")
|
||||
public void setObsEndpoint(String endpoint) {
|
||||
ObsUtil.obsEndpoint = endpoint;
|
||||
}
|
||||
|
||||
@Value("${obs.access-key-id}")
|
||||
public void setObsAccessKeyId(String accessKeyId) {
|
||||
ObsUtil.obsAccessKeyId = accessKeyId;
|
||||
}
|
||||
|
||||
@Value("${obs.access-key-secret}")
|
||||
public void setObsAccessKeySecret(String accessKeySecret) {
|
||||
ObsUtil.obsAccessKeySecret = accessKeySecret;
|
||||
}
|
||||
|
||||
@Value("${obs.bucket-name}")
|
||||
public void setObsBucketName(String bucketName) {
|
||||
ObsUtil.obsBucketName = bucketName;
|
||||
}
|
||||
|
||||
@Value("${obs.root-directory}")
|
||||
public void setObsRootDirectory(String rootDirectory) {
|
||||
ObsUtil.obsRootDirectory = rootDirectory;
|
||||
}
|
||||
|
||||
|
||||
// 如果Bucket不存在,则创建它。
|
||||
private static void ensureBucket(ObsClient client, String bucketName) throws ObsException {
|
||||
|
||||
if (client.headBucket(bucketName)) {
|
||||
return;
|
||||
}
|
||||
// 创建bucket
|
||||
client.createBucket(bucketName);
|
||||
}
|
||||
|
||||
// 把Bucket设置为所有人可读
|
||||
private static void setBucketPublicReadable(String bucketName) throws ObsException {
|
||||
//华为云OBS
|
||||
ObsClient obsClient = new ObsClient(obsAccessKeyId, obsAccessKeySecret, obsEndpoint);
|
||||
if (obsClient.doesObjectExist(obsBucketName, obsRootDirectory)) {
|
||||
|
||||
} else {
|
||||
obsClient.createBucket(obsBucketName);
|
||||
}
|
||||
obsClient.setBucketAcl(obsBucketName, com.obs.services.model.AccessControlList.REST_CANNED_PUBLIC_READ_WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传一个Object
|
||||
*
|
||||
* @param key
|
||||
* @param content
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public static String putObject(String key, InputStream content) throws IOException {
|
||||
//华为云OBS
|
||||
ObsClient obsClient = new ObsClient(obsAccessKeyId, obsAccessKeySecret, obsEndpoint);
|
||||
try {
|
||||
obsClient.putObject(obsBucketName, key, content);
|
||||
} catch (Exception e) {
|
||||
logger.error("obs put object error", e);
|
||||
throw new RuntimeException("obs eror" + e.getMessage());
|
||||
} finally {
|
||||
obsClient.close();
|
||||
}
|
||||
return getExpireUrl(key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
* @param objectKey 上传到OBS起的名
|
||||
* @param filename 文件下载到本地保存的路径
|
||||
* @throws ObsException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void downloadFile(String objectKey, String filename) throws ObsException, IOException {
|
||||
//华为云OBS
|
||||
ObsClient obsClient = new ObsClient(obsAccessKeyId, obsAccessKeySecret, obsEndpoint);
|
||||
try {
|
||||
obsClient.getObject(obsBucketName, objectKey);
|
||||
} finally {
|
||||
obsClient.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个Bucket和其中的Objects
|
||||
*
|
||||
* @param bucketName Bucket名
|
||||
* @throws ObsException
|
||||
*/
|
||||
private static void deleteBucket(String bucketName) throws ObsException {
|
||||
ObsClient obsClient = new ObsClient(obsAccessKeyId, obsAccessKeySecret, obsEndpoint);
|
||||
com.obs.services.model.ObjectListing objectListing = obsClient.listObjects(bucketName);
|
||||
List<ObsObject> listObject = objectListing.getObjects();
|
||||
for (ObsObject o : listObject) {
|
||||
obsClient.deleteObject(bucketName, o.getObjectKey());
|
||||
}
|
||||
obsClient.deleteBucket(bucketName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除Object
|
||||
* @param objList Object的key(目录路径/文件名)
|
||||
*/
|
||||
public static void delelteObjectList(List<String> objList) {
|
||||
ObsClient obsClient = new ObsClient(obsAccessKeyId, obsAccessKeySecret, obsEndpoint);
|
||||
for (String key : objList) {
|
||||
obsClient.deleteObject(obsBucketName, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除Object
|
||||
* @param key 目录路径/文件名
|
||||
*/
|
||||
public static void delelteObject(String key) {
|
||||
ObsClient obsClient = new ObsClient(obsAccessKeyId, obsAccessKeySecret, obsEndpoint);
|
||||
obsClient.deleteObject(obsBucketName, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过key获取带签名的url
|
||||
*/
|
||||
public static String getExpireUrl(String key) {
|
||||
String fileUrl = "";
|
||||
ObsClient obsClient = new ObsClient(obsAccessKeyId, obsAccessKeySecret, obsEndpoint);
|
||||
// URL有效期,3600秒.5分钟
|
||||
// long expireSeconds = 3600L;
|
||||
// 约等于1年
|
||||
long expireSeconds = 31536000L;
|
||||
TemporarySignatureRequest request = new TemporarySignatureRequest(HttpMethodEnum.GET, expireSeconds);
|
||||
request.setBucketName(obsBucketName);
|
||||
request.setObjectKey(key);
|
||||
TemporarySignatureResponse response = obsClient.createTemporarySignature(request);
|
||||
fileUrl = response.getSignedUrl();
|
||||
return fileUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件至OSS并且返回链接地址
|
||||
* @param url 远程路径
|
||||
* @param ossDir OSS目录
|
||||
* @param fileName 文件名
|
||||
* @return 文件OSS链接
|
||||
* @modify
|
||||
*/
|
||||
public static String uploadFile2Oss(URL url, String ossDir, String fileName) {
|
||||
InputStream is;
|
||||
String key = ossDir + fileName;
|
||||
try {
|
||||
is = url.openStream();
|
||||
return uploadFile2OSS(is, key);
|
||||
} catch (Exception ex) {
|
||||
logger.error("上传失败!", ex);
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传到OSS服务器 如果同名文件会覆盖服务器上的
|
||||
*
|
||||
* @param inputStream 文件流
|
||||
* @return 返回文件访问路径
|
||||
*/
|
||||
@SneakyThrows
|
||||
public static String uploadFile2OSS(InputStream inputStream, String key) {
|
||||
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||
objectMetadata.setCacheControl("no-cache");
|
||||
String fileName = FilenameUtils.getName(key);
|
||||
objectMetadata.setContentType(fileTypeMap.getContentType(fileName));
|
||||
objectMetadata.addUserMetadata("filename", fileName);
|
||||
|
||||
ObsClient obsClient = new ObsClient(obsAccessKeyId,
|
||||
obsAccessKeySecret, obsEndpoint);
|
||||
try {
|
||||
obsClient.putObject(obsBucketName, obsRootDirectory + key, inputStream, objectMetadata);
|
||||
return obsRootDirectory + "/" + key;
|
||||
} finally {
|
||||
obsClient.close();
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public Boolean checkObjectExist(String key) {
|
||||
Boolean existsFlag = false;
|
||||
ObsClient obsClient = new ObsClient(obsAccessKeyId, obsAccessKeySecret, obsEndpoint);
|
||||
try {
|
||||
existsFlag = obsClient.doesObjectExist(obsBucketName, key);
|
||||
} finally {
|
||||
obsClient.close();
|
||||
}
|
||||
return existsFlag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
* @param objectKey 上传到OBS起的名
|
||||
* @param filename 文件下载到本地保存的路径
|
||||
* @throws ObsException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void downloadFileNew(String objectKey, String filename){
|
||||
//华为云OBS
|
||||
ObsClient obsClient = new ObsClient(obsAccessKeyId, obsAccessKeySecret, obsEndpoint);
|
||||
try {
|
||||
ObsObject ossObject = obsClient.getObject(obsBucketName, objectKey);
|
||||
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
outputStream = new BufferedOutputStream(new FileOutputStream(filename));
|
||||
byte[] buffer = new byte[8192];
|
||||
int bytesRead;
|
||||
while ((bytesRead = ossObject.getObjectContent().read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
} finally {
|
||||
if (outputStream != null) {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (obsClient != null) {
|
||||
try {
|
||||
obsClient.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user