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

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

@ -34,12 +34,12 @@ import static com.bonus.zlpt.common.core.web.domain.AjaxResult.error;
/**
* 设备信息Service业务层处理
*
*
* @author xsheng
* @date 2023-12-02
*/
@Service
public class DevInfoServiceImpl implements IDevInfoService
public class DevInfoServiceImpl implements IDevInfoService
{
private final Integer ASPECT_PICTURE = 20;
private final Integer EXAMINATION_PDF = 28;
@ -54,7 +54,7 @@ public class DevInfoServiceImpl implements IDevInfoService
/**
* 查询设备信息
*
*
* @param maId 设备信息主键
* @return 设备信息
*/
@ -121,7 +121,7 @@ public class DevInfoServiceImpl implements IDevInfoService
/**
* 查询设备信息列表
*
*
* @param devInfo 设备信息
* @return 设备信息
*/
@ -204,6 +204,7 @@ public class DevInfoServiceImpl implements IDevInfoService
// }
if (devInfoVo.getCityId().equals(Integer.valueOf(address.getCode()))) {
devInfoVo.setCityStr(address.getName());
break;
}
// if (String.valueOf(devInfoVo.getAreaId()).equals(String.valueOf(address.getId()))) {
// devInfoVo.setAreaStr(address.getName());
@ -214,7 +215,7 @@ public class DevInfoServiceImpl implements IDevInfoService
/**
* 新增设备信息
*
*
* @param devInfo 设备信息
* @return 结果
*/
@ -243,7 +244,7 @@ public class DevInfoServiceImpl implements IDevInfoService
/**
* 修改设备信息
*
*
* @param devInfo 设备信息
* @return 结果
*/
@ -256,7 +257,7 @@ public class DevInfoServiceImpl implements IDevInfoService
/**
* 批量删除设备信息
*
*
* @param maIds 需要删除的设备信息主键
* @return 结果
*/
@ -268,7 +269,7 @@ public class DevInfoServiceImpl implements IDevInfoService
/**
* 删除设备信息信息
*
*
* @param maId 设备信息主键
* @return 结果
*/

View File

@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_type_info mt2 on mt1.parent_id = mt2.type_id
left join ma_type_info mt3 on mt2.parent_id = mt3.type_id
left join bm_company_info c on d.own_co = c.company_id
<where>
<where>
<if test="maId != null "> and d.ma_id = #{maId}</if>
<if test="code != null and code != ''"> and d.code = #{code}</if>
<if test="typeId != null">
@ -251,16 +251,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT s.dic_id, s.file_name as name,s.file_url as url
from ma_dev_info d
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 id="getCompanyUpNum" parameterType="Long" resultType="Long">
select count(up.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'
select count(d.ma_id) from ma_dev_info d
where d.own_co= #{ownCo} and d.ma_status in(16,17) and d.is_active='1'
GROUP BY d.own_co
</select>
<insert id="insertDevInfo" parameterType="com.bonus.zlpt.equip.api.domain.DevInfo" useGeneratedKeys="true" keyProperty="maId">
insert into ma_dev_info
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -458,4 +458,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_up_off u on d.ma_id = u.ma_id ORDER BY d.create_time desc
</select>
</mapper>
</mapper>

View File

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

View File

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

View File

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

View File

@ -1,49 +1,49 @@
package com.bonus.zlpt.file.service;
import java.io.InputStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.nacos.common.utils.IoUtils;
import com.bonus.zlpt.file.config.MinioConfig;
import com.bonus.zlpt.file.utils.FileUploadUtils;
import io.minio.MinioClient;
import io.minio.PutObjectArgs;
/**
* Minio 文件存储
*
* @author ruoyi
*/
@Service
public class MinioSysFileServiceImpl implements ISysFileService
{
@Autowired
private MinioConfig minioConfig;
@Autowired
private MinioClient client;
/**
* Minio文件上传接口
*
* @param file 上传的文件
* @return 访问地址
* @throws Exception
*/
@Override
public String uploadFile(MultipartFile file) throws Exception
{
String fileName = FileUploadUtils.extractFilename(file);
InputStream inputStream = file.getInputStream();
PutObjectArgs args = PutObjectArgs.builder()
.bucket(minioConfig.getBucketName())
.object(fileName)
.stream(inputStream, file.getSize(), -1)
.contentType(file.getContentType())
.build();
client.putObject(args);
IoUtils.closeQuietly(inputStream);
return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName;
}
}
//package com.bonus.zlpt.file.service;
//
//import java.io.InputStream;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.web.multipart.MultipartFile;
//import com.alibaba.nacos.common.utils.IoUtils;
//import com.bonus.zlpt.file.config.MinioConfig;
//import com.bonus.zlpt.file.utils.FileUploadUtils;
//import io.minio.MinioClient;
//import io.minio.PutObjectArgs;
//
///**
// * Minio 文件存储
// *
// * @author ruoyi
// */
//@Service
//public class MinioSysFileServiceImpl implements ISysFileService
//{
//// @Autowired
//// private MinioConfig minioConfig;
//
// @Autowired
// private MinioClient client;
//
// /**
// * Minio文件上传接口
// *
// * @param file 上传的文件
// * @return 访问地址
// * @throws Exception
// */
// @Override
// public String uploadFile(MultipartFile file) throws Exception
// {
// String fileName = FileUploadUtils.extractFilename(file);
// InputStream inputStream = file.getInputStream();
// PutObjectArgs args = PutObjectArgs.builder()
// .bucket(minioConfig.getBucketName())
// .object(fileName)
// .stream(inputStream, file.getSize(), -1)
// .contentType(file.getContentType())
// .build();
// client.putObject(args);
// IoUtils.closeQuietly(inputStream);
// 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.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -86,10 +87,12 @@ public class SmsComponent {
req.setPhoneNumberSet(phoneNumberSet);
req.setSignName(signName);
req.setTemplateId(templateId);
// 根据模板所需参数量选择
String[] templateParamSetOne = {code};
String[] templateParamSetTwo = {code,param2};
req.setTemplateParamSet(templateParamSetOne);
String[] templateParamSet = new String[2];
templateParamSet[0] = code;
if (templateId.equals("2014506")){
templateParamSet[1] = param2;
}
req.setTemplateParamSet(templateParamSet);
return req; // 返回请求参数内容
}

View File

@ -61,7 +61,7 @@ public class ISmsServiceImpl implements ISmsService {
String code = getSixBitCode(); // 生成新的验证码
//存储 phone -> code到Redis中
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;
}

View File

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