修改检验报告、保险信息文件查询,短信配置

This commit is contained in:
bonus 2023-12-11 10:51:50 +08:00
parent 1e8eaaaaab
commit 21345aaa5d
9 changed files with 263 additions and 259 deletions

View File

@ -204,6 +204,7 @@ public class DevInfoServiceImpl implements IDevInfoService
// } // }
if (devInfoVo.getCityId().equals(Integer.valueOf(address.getCode()))) { if (devInfoVo.getCityId().equals(Integer.valueOf(address.getCode()))) {
devInfoVo.setCityStr(address.getName()); devInfoVo.setCityStr(address.getName());
break;
} }
// if (String.valueOf(devInfoVo.getAreaId()).equals(String.valueOf(address.getId()))) { // if (String.valueOf(devInfoVo.getAreaId()).equals(String.valueOf(address.getId()))) {
// devInfoVo.setAreaStr(address.getName()); // devInfoVo.setAreaStr(address.getName());

View File

@ -251,13 +251,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT s.dic_id, s.file_name as name,s.file_url as url SELECT s.dic_id, s.file_name as name,s.file_url as url
from ma_dev_info d from ma_dev_info d
left join sys_file_info s on d.ma_id = s.model_id left join sys_file_info s on d.ma_id = s.model_id
WHERE d.ma_id = #{maId} and d.is_active='1' and s.dic_id = 20 WHERE d.ma_id = #{maId} and d.is_active='1' and s.dic_id in (20,28,29)
</select> </select>
<select id="getCompanyUpNum" parameterType="Long" resultType="Long"> <select id="getCompanyUpNum" parameterType="Long" resultType="Long">
select count(up.ma_id) from ma_dev_info d select count(d.ma_id) from ma_dev_info d
left join ma_up_off up on d.ma_id = up.ma_id and up.`status`=1
where d.own_co= #{ownCo} and d.is_active='1' where d.own_co= #{ownCo} and d.ma_status in(16,17) and d.is_active='1'
GROUP BY d.own_co GROUP BY d.own_co
</select> </select>

View File

@ -1,82 +1,82 @@
package com.bonus.zlpt.file.config; //package com.bonus.zlpt.file.config;
//
import org.springframework.boot.context.properties.ConfigurationProperties; //import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
import io.minio.MinioClient; //import io.minio.MinioClient;
//
/** ///**
* Minio 配置信息 // * Minio 配置信息
* // *
* @author ruoyi // * @author ruoyi
*/ // */
@Configuration //@Configuration
@ConfigurationProperties(prefix = "minio") //@ConfigurationProperties(prefix = "minio")
public class MinioConfig //public class MinioConfig
{ //{
/** // /**
* 服务地址 // * 服务地址
*/ // */
private String url; // private String url;
//
/** // /**
* 用户名 // * 用户名
*/ // */
private String accessKey; // private String accessKey;
//
/** // /**
* 密码 // * 密码
*/ // */
private String secretKey; // private String secretKey;
//
/** // /**
* 存储桶名称 // * 存储桶名称
*/ // */
private String bucketName; // private String bucketName;
//
public String getUrl() // public String getUrl()
{ // {
return url; // return url;
} // }
//
public void setUrl(String url) // public void setUrl(String url)
{ // {
this.url = url; // this.url = url;
} // }
//
public String getAccessKey() // public String getAccessKey()
{ // {
return accessKey; // return accessKey;
} // }
//
public void setAccessKey(String accessKey) // public void setAccessKey(String accessKey)
{ // {
this.accessKey = accessKey; // this.accessKey = accessKey;
} // }
//
public String getSecretKey() // public String getSecretKey()
{ // {
return secretKey; // return secretKey;
} // }
//
public void setSecretKey(String secretKey) // public void setSecretKey(String secretKey)
{ // {
this.secretKey = secretKey; // this.secretKey = secretKey;
} // }
//
public String getBucketName() // public String getBucketName()
{ // {
return bucketName; // return bucketName;
} // }
//
public void setBucketName(String bucketName) // public void setBucketName(String bucketName)
{ // {
this.bucketName = bucketName; // this.bucketName = bucketName;
} // }
//
@Bean // @Bean
public MinioClient getMinioClient() // public MinioClient getMinioClient()
{ // {
return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build(); // return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
} // }
} //}

View File

@ -1,50 +1,50 @@
package com.bonus.zlpt.file.config; //package com.bonus.zlpt.file.config;
//
import java.io.File; //import java.io.File;
import org.springframework.beans.factory.annotation.Value; //import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry; //import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; //import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
/** ///**
* 通用映射配置 // * 通用映射配置
* // *
* @author ruoyi // * @author ruoyi
*/ // */
@Configuration //@Configuration
public class ResourcesConfig implements WebMvcConfigurer //public class ResourcesConfig implements WebMvcConfigurer
{ //{
/** // /**
* 上传文件存储在本地的根路径 // * 上传文件存储在本地的根路径
*/ // */
@Value("${file.path}") // @Value("${file.path}")
private String localFilePath; // private String localFilePath;
//
/** // /**
* 资源映射路径 前缀 // * 资源映射路径 前缀
*/ // */
@Value("${file.prefix}") // @Value("${file.prefix}")
public String localFilePrefix; // public String localFilePrefix;
//
@Override // @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) // public void addResourceHandlers(ResourceHandlerRegistry registry)
{ // {
/** 本地文件上传路径 */ // /** 本地文件上传路径 */
registry.addResourceHandler(localFilePrefix + "/**") // registry.addResourceHandler(localFilePrefix + "/**")
.addResourceLocations("file:" + localFilePath + File.separator); // .addResourceLocations("file:" + localFilePath + File.separator);
} // }
//
/** // /**
* 开启跨域 // * 开启跨域
*/ // */
@Override // @Override
public void addCorsMappings(CorsRegistry registry) { // public void addCorsMappings(CorsRegistry registry) {
// 设置允许跨域的路由 // // 设置允许跨域的路由
registry.addMapping(localFilePrefix + "/**") // registry.addMapping(localFilePrefix + "/**")
// 设置允许跨域请求的域名 // // 设置允许跨域请求的域名
.allowedOrigins("*") // .allowedOrigins("*")
// 设置允许的方法 // // 设置允许的方法
.allowedMethods("GET"); // .allowedMethods("GET");
} // }
} //}

View File

@ -1,48 +1,48 @@
package com.bonus.zlpt.file.controller; //package com.bonus.zlpt.file.controller;
//
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; //import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController; //import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; //import org.springframework.web.multipart.MultipartFile;
import com.bonus.zlpt.common.core.domain.R; //import com.bonus.zlpt.common.core.domain.R;
import com.bonus.zlpt.common.core.utils.file.FileUtils; //import com.bonus.zlpt.common.core.utils.file.FileUtils;
import com.bonus.zlpt.file.service.ISysFileService; //import com.bonus.zlpt.file.service.ISysFileService;
import com.bonus.zlpt.system.api.domain.SysFile; //import com.bonus.zlpt.system.api.domain.SysFile;
//
/** ///**
* 文件请求处理 // * 文件请求处理
* // *
* @author ruoyi // * @author ruoyi
*/ // */
@RestController //@RestController
public class SysFileController //public class SysFileController
{ //{
private static final Logger log = LoggerFactory.getLogger(SysFileController.class); // private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
//
@Autowired // @Autowired
private ISysFileService sysFileService; // private ISysFileService sysFileService;
//
/** // /**
* 文件上传请求 // * 文件上传请求
*/ // */
@PostMapping("upload") // @PostMapping("upload")
public R<SysFile> upload(MultipartFile file) // public R<SysFile> upload(MultipartFile file)
{ // {
try // try
{ // {
// 上传并返回访问地址 // // 上传并返回访问地址
String url = sysFileService.uploadFile(file); // String url = sysFileService.uploadFile(file);
SysFile sysFile = new SysFile(); // SysFile sysFile = new SysFile();
sysFile.setName(FileUtils.getName(url)); // sysFile.setName(FileUtils.getName(url));
sysFile.setUrl(url); // sysFile.setUrl(url);
return R.ok(sysFile); // return R.ok(sysFile);
} // }
catch (Exception e) // catch (Exception e)
{ // {
log.error("上传文件失败", e); // log.error("上传文件失败", e);
return R.fail(e.getMessage()); // return R.fail(e.getMessage());
} // }
} // }
} //}

View File

@ -1,49 +1,49 @@
package com.bonus.zlpt.file.service; //package com.bonus.zlpt.file.service;
//
import java.io.InputStream; //import java.io.InputStream;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; //import org.springframework.web.multipart.MultipartFile;
import com.alibaba.nacos.common.utils.IoUtils; //import com.alibaba.nacos.common.utils.IoUtils;
import com.bonus.zlpt.file.config.MinioConfig; //import com.bonus.zlpt.file.config.MinioConfig;
import com.bonus.zlpt.file.utils.FileUploadUtils; //import com.bonus.zlpt.file.utils.FileUploadUtils;
import io.minio.MinioClient; //import io.minio.MinioClient;
import io.minio.PutObjectArgs; //import io.minio.PutObjectArgs;
//
/** ///**
* Minio 文件存储 // * Minio 文件存储
* // *
* @author ruoyi // * @author ruoyi
*/ // */
@Service //@Service
public class MinioSysFileServiceImpl implements ISysFileService //public class MinioSysFileServiceImpl implements ISysFileService
{ //{
@Autowired //// @Autowired
private MinioConfig minioConfig; //// private MinioConfig minioConfig;
//
@Autowired // @Autowired
private MinioClient client; // private MinioClient client;
//
/** // /**
* Minio文件上传接口 // * Minio文件上传接口
* // *
* @param file 上传的文件 // * @param file 上传的文件
* @return 访问地址 // * @return 访问地址
* @throws Exception // * @throws Exception
*/ // */
@Override // @Override
public String uploadFile(MultipartFile file) throws Exception // public String uploadFile(MultipartFile file) throws Exception
{ // {
String fileName = FileUploadUtils.extractFilename(file); // String fileName = FileUploadUtils.extractFilename(file);
InputStream inputStream = file.getInputStream(); // InputStream inputStream = file.getInputStream();
PutObjectArgs args = PutObjectArgs.builder() // PutObjectArgs args = PutObjectArgs.builder()
.bucket(minioConfig.getBucketName()) // .bucket(minioConfig.getBucketName())
.object(fileName) // .object(fileName)
.stream(inputStream, file.getSize(), -1) // .stream(inputStream, file.getSize(), -1)
.contentType(file.getContentType()) // .contentType(file.getContentType())
.build(); // .build();
client.putObject(args); // client.putObject(args);
IoUtils.closeQuietly(inputStream); // IoUtils.closeQuietly(inputStream);
return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; // return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName;
} // }
} //}

View File

@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -86,10 +87,12 @@ public class SmsComponent {
req.setPhoneNumberSet(phoneNumberSet); req.setPhoneNumberSet(phoneNumberSet);
req.setSignName(signName); req.setSignName(signName);
req.setTemplateId(templateId); req.setTemplateId(templateId);
// 根据模板所需参数量选择 String[] templateParamSet = new String[2];
String[] templateParamSetOne = {code}; templateParamSet[0] = code;
String[] templateParamSetTwo = {code,param2}; if (templateId.equals("2014506")){
req.setTemplateParamSet(templateParamSetOne); templateParamSet[1] = param2;
}
req.setTemplateParamSet(templateParamSet);
return req; // 返回请求参数内容 return req; // 返回请求参数内容
} }

View File

@ -61,7 +61,7 @@ public class ISmsServiceImpl implements ISmsService {
String code = getSixBitCode(); // 生成新的验证码 String code = getSixBitCode(); // 生成新的验证码
//存储 phone -> code到Redis中 //存储 phone -> code到Redis中
redisCache.setCacheObject(RedisConstants.REDIS_PHONE_CODE_KEY + phone, code, Long.parseLong(leastTime+""), TimeUnit.MILLISECONDS); redisCache.setCacheObject(RedisConstants.REDIS_PHONE_CODE_KEY + phone, code, Long.parseLong(leastTime+""), TimeUnit.MILLISECONDS);
smsComponent.sendCode(phone, code,"",type); smsComponent.sendCode(phone, code,""+leastTime/1000/60,type);
return "已发送验证码 " + phone; return "已发送验证码 " + phone;
} }

View File

@ -7,11 +7,11 @@ tencent:
sms: sms:
# 腾讯云账户API访问密钥 # 腾讯云账户API访问密钥
secretId: AKIDbF1pTyU6iHn6EH9uc9O6kJgrrfI2rV04 secretId: AKIDbF1pTyU6iHn6EH9uc9O6kJgrrfI2rV04
keysecret: zGPRJ9z68AGZVMAoHYyDFDAxhR2Xs0Qf secretKey: zGPRJ9z68AGZVMAoHYyDFDAxhR2Xs0Qf
# 短信应用ID # 短信应用ID
smsSdkAppId: 1400874270 sdkAppId: 1400874270
# 短信签名内容 # 短信签名内容
signName: 南网机具租赁共享平台 signName: 作业智慧管控系统小程序
# 正文模板ID # 正文模板ID
templateCodeIds: templateCodeIds:
1: 2014506 1: 2014506
@ -35,19 +35,19 @@ spring:
name: zlpt-system name: zlpt-system
profiles: profiles:
# 环境配置 # 环境配置
active: zlpt_cloud_de active: zlpt_cloud_dev
cloud: cloud:
nacos: nacos:
# username: nacos username: nacos
# password: Bonus@admin123! password: nacos
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 10.40.92.74:8848 server-addr: 127.0.0.1:8848
namespace: zlpt_cloud_de namespace: zlpt_cloud_dev
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 10.40.92.74:8848 server-addr: 127.0.0.1:8848
namespace: zlpt_cloud_de namespace: zlpt_cloud_dev
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置