This commit is contained in:
许允枞 2025-03-21 11:14:12 +08:00
parent 5e83866b87
commit 564d36f2d8
8 changed files with 185 additions and 4 deletions

View File

@ -479,8 +479,8 @@ public class PartnerOwnController extends BaseController {
// return null;
// }
Page<InspectionAppointment> page = new Page<>(pageNum, pageSize);
ShopMallPartners shopMallPartners = partnerList.shopInfo();
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, shopMallPartners.getPartnerId(), phoneNum);
// ShopMallPartners shopMallPartners = partnerList.shopInfo();
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, null, phoneNum);
return success(appointments);
}

View File

@ -101,10 +101,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left JOIN order_info oi ON ip.order_id = oi.id and oi.deleted=0
left join shop_user_car suc on suc.car_id = oi.user_car_id and suc.deleted=0
LEFT JOIN inspection_goods_sku igs on igs.id = ip.sku_id
where ip.deleted=0 and ip.partner_id = #{partnerId} and oi.validation_time IS NULL
where ip.deleted=0 and oi.validation_time IS NULL
<if test="phoneNum!=null and phoneNum!=''">
and su.mobile like concat('%',#{phoneNum},'%')
</if>
<if test="partnerId!=null and partnerId!=''">
and ip.partner_id = #{partnerId}
</if>
order by ip.create_time desc
</select>
<select id="getAppointmentOwn" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionAppointment">

View File

@ -293,6 +293,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN
system_users su ON ii.lead_man_id = su.id
<where>
ii.deleted = 0
<!-- 车牌号模糊查询 -->
<if test="inspectionInfo.carNum != null">
AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')

View File

@ -106,6 +106,13 @@
<artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 -->
</dependency>
<dependency>
<groupId>com.qcloud</groupId>
<artifactId>cos-sts_api</artifactId>
<version>3.1.0</version>
</dependency>
<!-- 三方云服务相关 -->
<dependency>
<groupId>commons-net</groupId>
@ -125,6 +132,18 @@
<artifactId>tika-core</artifactId> <!-- 文件客户端:文件类型的识别 -->
</dependency>
<dependency>
<groupId>com.qcloud</groupId>
<artifactId>cos_api</artifactId>
<version>5.6.227</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-trace</artifactId>
<version>1.29.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.infra.controller.admin.cos;
import cn.hutool.json.JSONObject;
import cn.iocoder.yudao.module.infra.cos.CosStsService;
import com.tencent.cloud.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.security.PermitAll;
import java.util.HashMap;
import java.util.Map;
/**
* @Description: sts
* @Author: 86187
* @Date: 2025/03/20 16:34
* @Version: 1.0
*/
@RestController
@RequestMapping("/cos")
public class CosStsController {
@Autowired
CosStsService cosStsService;
@GetMapping("/sts")
@PermitAll
public Map<String, Object> getCosSts() {
Map<String, Object> result = cosStsService.getTempKeys();
return result;
}
}

View File

@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.*;
//import cn.iocoder.yudao.module.infra.cos.util.COSClientUtil;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.infra.service.file.FileService;
import io.swagger.v3.oas.annotations.Operation;
@ -114,4 +115,18 @@ public class FileController {
return success(BeanUtils.toBean(pageResult, FileRespVO.class));
}
}
/**
* 腾讯云COS上传
*
* @param file
* @return
* @throws Exception
*/
// @PostMapping(value = "/cosUpload")
// public CommonResult cosUpload(MultipartFile file) throws Exception {
// String filePath = COSClientUtil.upload(file);
// return success(filePath);
// }
}

View File

@ -0,0 +1,100 @@
package cn.iocoder.yudao.module.infra.cos;
import cn.hutool.json.JSONObject;
import com.tencent.cloud.CosStsClient;
import com.tencent.cloud.Response;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
/**
* @Description: sts
* @Author: 86187
* @Date: 2025/03/20 16:18
* @Version: 1.0
*/
@Service
public class CosStsService {
// 你的腾讯云账号的 SecretId SecretKey
@Value("${cos.accessKey}")
private String SECRET_ID;
@Value("${cos.secretKey}")
private String SECRET_KEY;
// 存储桶所属的地域例如 "ap-shanghai"
@Value("${cos.regionName}")
private String REGION;
// 你的存储桶名例如 "example-1250000000"
@Value("${cos.bucketName}")
private String BUCKET;
// 临时密钥有效期单位秒最长不超过 2 小时7200
private static final int DURATION_SECONDS = 1800;
public Map<String, Object> getTempKeys() {
TreeMap<String, Object> config = new TreeMap<String, Object>();
try {
// api 密钥 SecretId
config.put("secretId", SECRET_ID);
// api 密钥 SecretKey
config.put("secretKey", SECRET_KEY);
// if (properties.containsKey("https.proxyHost")) {
// System.setProperty("https.proxyHost", properties.getProperty("https.proxyHost"));
// System.setProperty("https.proxyPort", properties.getProperty("https.proxyPort"));
// }
// 设置域名,可通过此方式设置内网域名
//config.put("host", "sts.internal.tencentcloudapi.com");
// 临时密钥有效时长单位是秒
config.put("durationSeconds", 1800);
// 换成你的 bucket
config.put("bucket", BUCKET);
// 换成 bucket 所在地区
config.put("region", REGION);
// 可以通过 allowPrefixes 指定前缀数组, 例子 a.jpg 或者 a/* 或者 * (使用通配符*存在重大安全风险, 请谨慎评估使用)
config.put("allowPrefixes", new String[] {
"*"
});
// 密钥的权限列表简单上传和分片需要以下的权限其他权限列表请看 https://cloud.tencent.com/document/product/436/31923
String[] allowActions = new String[] {
// 简单上传
"name/cos:PutObject",
"name/cos:PostObject",
// 分片上传
"name/cos:InitiateMultipartUpload",
"name/cos:ListMultipartUploads",
"name/cos:ListParts",
"name/cos:UploadPart",
"name/cos:CompleteMultipartUpload"
};
config.put("allowActions", allowActions);
Response response = CosStsClient.getCredential(config);
System.out.println(response.credentials.tmpSecretId);
System.out.println(response.credentials.tmpSecretKey);
System.out.println(response.credentials.sessionToken);
Map<String, Object> result= new HashMap<>();
result.put("credentials", response.credentials);
result.put("startTime", response.startTime);
result.put("expiredTime", response.expiredTime);
return result;
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException("no valid secret !");
}
}
}

View File

@ -382,4 +382,13 @@ yudao:
key: pLXUGAwK5305
customer: E77DF18BE109F454A5CD319E44BF5177
--- #################### 腾讯COS相关配置 ####################
cos:
baseUrl: lanan-1319802091.cos.ap-chengdu.myqcloud.com
accessKey: AKIDFORM7h5H9xc7Uhj1Qg2MYZP4Xs20nQsB
secretKey: BE7pLfyAC7vZ3RgkdN0SjojU8nMjx0tb
regionName: ap-chengdu
bucketName: lanan-1319802091
folderPrefix: /files
debug: false