更新0723

This commit is contained in:
xyc 2025-07-23 15:57:49 +08:00
parent 7951168bb8
commit 0eb106be5b
30 changed files with 1409 additions and 5 deletions

View File

@ -72,4 +72,34 @@ public class SendSmsUtil {
}
}
public static void sendMsgCommonByPhoneNums(String[] templateParamSet,String[] phoneNums,String sdkAppId,String signName,String templateId){
try{
Credential cred = new Credential("AKIDQlz4xdAaypV0MYkv1AMRRKSdw350qW2x", "oRv221ymOsBMOMBwAHF4f2GJC6tX6Wnv");
// 实例化一个http选项可选的没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("sms.tencentcloudapi.com");
// 实例化一个client选项可选的没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
SendSmsRequest req = new SendSmsRequest();
req.setPhoneNumberSet(phoneNums);
req.setSmsSdkAppId(sdkAppId);
req.setSignName(signName);
req.setTemplateId(templateId);
req.setTemplateParamSet(templateParamSet);
// 返回的resp是一个SendSmsResponse的实例与请求对象对应
SendSmsResponse resp = client.SendSms(req);
// 输出json格式的字符串回包
System.out.println(SendSmsResponse.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}

View File

@ -1,5 +1,7 @@
package cn.iocoder.yudao.common.service;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
public interface InspectionNoticeService {
/**
@ -16,5 +18,6 @@ public interface InspectionNoticeService {
* @param userId 用户id
* @param text 消息通知内容
**/
void sentMessage(Long userId, String text, Long tenantId);
@TenantIgnore
void sentMessageToMember(Long userId, String text, Long tenantId);
}

View File

@ -46,13 +46,13 @@ public class InspectionNoticeServiceImpl implements InspectionNoticeService {
* @param text 消息通知内容
**/
@Override
public void sentMessage(Long userId, String text, Long tenantId) {
public void sentMessageToMember(Long userId, String text, Long tenantId) {
// 准备发送参数
Map<String, Object> templateParams = new HashMap<>();
// 发送模版内容
templateParams.put("text", text);
// 发送站内信
sendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
sendApi.sendSingleMessageToMember(new NotifySendSingleToUserReqDTO()
.setUserId(userId)
.setTemplateCode(TICKET_EMPLOY)
.setSystemCode(SystemEnum.INSPECTION.getCode())

View File

@ -112,6 +112,31 @@ public class InspectionConstants {
*/
public static final String INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_UNQUALIFIED = "%s的工单不合格详细信息请前往列表查看";
/**
* 检测站内信模板-提示经办人 用户车辆年审即将到期
*/
public static final String INSPECTION_NOTICE_TEMPLATE_USER_CAR_YEAR_EXPIRE = "用户车辆%s年审将与%s到期 用户联系方式:%s";
/**
* 检测站内信模板-提示经办人 用户车辆保险即将到期
*/
public static final String INSPECTION_NOTICE_TEMPLATE_USER_CAR_INSURANCE_EXPIRE = "用户车辆%s保险将于%s到期 用户联系方式:%s";
/**
* 检测站内信模板-提示用户 用户车辆保险即将到期
*/
public static final String INSPECTION_NOTICE_TEMPLATE_USER_CAR_INSURANCE_EXPIRE_USER = "您的车辆%s保险将于%s到期";
/**
* 检测站内信模板-提示用户 车辆年审即将到期
*/
public static final String INSPECTION_NOTICE_TEMPLATE_USER_CAR_YEAR_EXPIRE_USER = "您的车辆%s年审将于%s到期";
/**
* 检测站内信模板-提示用户 上传的资料即将到期
*/
public static final String INSPECTION_NOTICE_TEMPLATE_USER_FILE_EXPIRE = "您上传的资料%s即将到期";
// =======================================打印模板=======================================
/**
* 检测打印模板-订单结算
@ -255,4 +280,6 @@ public class InspectionConstants {
" </tr>\n" +
" </tbody>\n" +
"</table>";
public static final String INSPECTION_CUSTOMER_FILE_FOLDER = "small_inspection_member_folder";
public static final String INSPECTION_CUSTOMER_FILE_FOLDER_NAME = "检测客户资料夹";
}

View File

@ -13,7 +13,9 @@ public enum InspectionFileEnum {
FOLDER("staff", "员工文件夹"),
FILE("equipment", "设备文件夹"),
COACH("coach", "驾校员工文件夹"),
student("student","驾校学员文件夹");
student("student","驾校学员文件夹"),
INSPECTION_CUSTOMER("small_inspection_member_folder", "检测客户资料夹"),
;
private final String type;

View File

@ -0,0 +1,230 @@
package cn.iocoder.yudao.module.inspection.controller.app;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.SystemEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.constant.InspectionConstants;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.entity.InspectionFile;
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
import cn.iocoder.yudao.module.inspection.vo.AssignAuthorityVo;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
import cn.iocoder.yudao.module.system.service.permission.PermissionServiceImpl;
import cn.iocoder.yudao.util.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* inspectionFileController
*
* @author zcy
* @date 2023-10-13
*/
@RestController
@RequestMapping("/inspectionFile")
public class SmallInspectionFileController extends BaseController {
@Autowired
private IInspectionFileService inspectionFileService;
@Autowired
private AppInspectionPartnerService partnerService;
@Autowired
private PermissionServiceImpl roleService;
@Resource
private DictDataApi dictDataApi;
@Resource
private PermissionApi permissionApi;
/**
* 获取检测资料夹
*
* @return inspectionFile
*/
@GetMapping("/getFirstFolder")
public CommonResult<?> getFirstFolder() {
// 查询检测 并且 文件夹 是检测客户资料夹的文件夹
InspectionFile folder = inspectionFileService.getOne(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getType, InspectionConstants.INSPECTION_FOLDER)
.eq(InspectionFile::getServicePackageId, SystemEnum.INSPECTION.getCode())
.eq(InspectionFile::getDefaultKey, InspectionConstants.INSPECTION_CUSTOMER_FILE_FOLDER));
if (folder == null) {
// 新增一个这个文件夹
folder = new InspectionFile();
folder.setFileName(InspectionConstants.INSPECTION_CUSTOMER_FILE_FOLDER_NAME);
folder.setServicePackageId(SystemEnum.INSPECTION.getCode());
folder.setDefaultKey(InspectionConstants.INSPECTION_CUSTOMER_FILE_FOLDER);
folder.setType(InspectionConstants.INSPECTION_FOLDER);
folder.setTenantId(180L);
inspectionFileService.insertInspectionFile(folder);
}
return success(folder);
}
/**
* 查询inspectionFile列表
*/
@GetMapping("/list")
@TenantIgnore
public CommonResult list( InspectionFile inspectionFile) throws Exception {
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
inspectionFile.setCreator(String.valueOf(loginUserId));
if (ObjectUtil.isEmpty(inspectionFile.getFatherId())) {
// 查询检测 并且 文件夹 是检测客户资料夹的文件夹
InspectionFile folder = inspectionFileService.getOne(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getType, InspectionConstants.INSPECTION_FOLDER)
.eq(InspectionFile::getServicePackageId, SystemEnum.INSPECTION.getCode())
.eq(InspectionFile::getDefaultKey, InspectionConstants.INSPECTION_CUSTOMER_FILE_FOLDER));
if (folder == null) {
// 新增一个这个文件夹
folder = new InspectionFile();
folder.setFileName(InspectionConstants.INSPECTION_CUSTOMER_FILE_FOLDER_NAME);
folder.setServicePackageId(SystemEnum.INSPECTION.getCode());
folder.setDefaultKey(InspectionConstants.INSPECTION_CUSTOMER_FILE_FOLDER);
folder.setType(InspectionConstants.INSPECTION_FOLDER);
folder.setTenantId(180L);
inspectionFileService.insertInspectionFile(folder);
}
inspectionFile.setFatherId(folder.getId());
}
List<InspectionFile> list = inspectionFileService.selectInspectionFileList(inspectionFile);
return success(list);
}
/**
* 获取inspectionFile详细信息
*/
@GetMapping(value = "/{id}")
@TenantIgnore
public CommonResult getInfo(@PathVariable("id") Long id) {
return success(inspectionFileService.selectInspectionFileById(id));
}
/**
* 新增inspectionFile
*/
@PostMapping("/add")
@TenantIgnore
public CommonResult add(@RequestBody InspectionFile inspectionFile) throws Exception {
inspectionFile.setTenantId(180L);
return success(inspectionFileService.insertInspectionFile(inspectionFile));
}
/**
* 修改inspectionFile
*/
@PostMapping("/edit")
@TenantIgnore
public CommonResult edit(@RequestBody InspectionFile inspectionFile) throws Exception {
// if (!partners.getPartnerId().equals(file.getPartnerId())) {
// return null;
// }
return toAjax(inspectionFileService.updateInspectionFile(inspectionFile));
}
/**
* 删除inspectionFile
*/
@PostMapping("/del/{id}")
@TenantIgnore
public CommonResult remove(@PathVariable Long id) throws Exception {
// ShopMallPartners partners = partnerService.shopInfo();
// InspectionFile file = inspectionFileService.selectInspectionFileById(id);
// if (!partners.getPartnerId().equals(file.getPartnerId())) {
// return null;
// }
return toAjax(inspectionFileService.deleteInspectionFileById(id));
}
/**
* 根据id统计数量
*
* @param ids ids
* @author 小李
* @date 14:30 2024/12/14
**/
@GetMapping("/getCountByIds")
public CommonResult<?> getCountByIds(@RequestParam(value = "ids", required = false) List<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return null;
}
return success(inspectionFileService.getCountByIds(ids));
}
/**
* 得到使用说明
*
* @author 小李
* @date 12:31 2024/12/17
**/
@GetMapping("/getPresent")
public CommonResult<?> getPresent() {
List<InspectionFile> files = inspectionFileService.list(new LambdaQueryWrapper<InspectionFile>().eq(InspectionFile::getFileName, "使用说明"));
if (CollUtil.isEmpty(files)) {
return null;
}
InspectionFile inspectionFile = files.get(0);
return success(inspectionFile);
}
/**
* 分配权限
*
* @param assignAuthorityVo
* @return
*/
@PostMapping("/assignAuthority")
public CommonResult assignAuthority(@RequestBody AssignAuthorityVo assignAuthorityVo) {
return success(inspectionFileService.assignAuthority(assignAuthorityVo.getUserIds(), assignAuthorityVo.getFileId()));
}
/**
* 根据文件id获取有权限的用户id
*
* @param fileId
* @return
*/
@GetMapping("/getUserIdsByFileId")
public CommonResult getUserIdsByFileId(Integer fileId) {
List<Long> userIds = inspectionFileService.getUserIdsByFileId(fileId);
return success(userIds);
}
/**
* 查询文件夹树
*
* @return
*/
@GetMapping("/queryTreeFolder")
public CommonResult<?> queryTreeFolder() {
return success(inspectionFileService.queryTreeFolder());
}
/**
* 查询文件夹树
*
* @return
*/
@GetMapping("/queryTreeFolderForJx")
public CommonResult<?> queryTreeFolderForJx() {
return success(inspectionFileService.queryTreeFolderForJx());
}
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.inspection.controller.app;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.entity.InspectionFileRecord;
import cn.iocoder.yudao.module.inspection.service.InspectionFileRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Description: 文档记录
* @Author: 86187
* @Date: 2025/02/08 13:53
* @Version: 1.0
*/
@RestController
@RequestMapping("/system/fileRecord")
public class SmallInspectionFileRecordController extends BaseController {
@Autowired
private InspectionFileRecordService inspectionFileRecordService;
/**
* 根据文件id查询修改记录
*
* @param id
* @return
*/
@GetMapping("/get/{id}")
public CommonResult<?> getByFileId(@PathVariable Long id) {
List<InspectionFileRecord> list = inspectionFileRecordService.getRecordList(id);
return CommonResult.success(list);
}
}

View File

@ -0,0 +1,321 @@
package cn.iocoder.yudao.module.inspection.controller.app;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.entity.InspectionNews;
import cn.iocoder.yudao.module.inspection.entity.InspectionNewsComment;
import cn.iocoder.yudao.module.inspection.service.IInspectionNewsCommentService;
import cn.iocoder.yudao.module.inspection.service.IInspectionNewsService;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import cn.iocoder.yudao.module.shop.service.IShopMallPartnersService;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/appInspection/news")
public class SmallNewsController extends BaseController {
@Autowired
private IInspectionNewsService inspectionNewsService;
@Autowired
private IInspectionNewsCommentService commentService;
@Autowired
private AdminUserApi sysUserService;
@Autowired
private DeptApi deptService;
@Autowired
private IShopMallPartnersService partnersService;
@Autowired
private DictDataService dictTypeService;
@Resource
private RoleService roleService;
@Resource
private PermissionApi permissionApi;
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/editType")
public CommonResult editType()
{
List<DictDataDO> data = dictTypeService.getDictDataListByDictType("inspection_hygg");
if (StringUtils.isNull(data))
{
data = new ArrayList<DictDataDO>();
}
//获取当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
List<Long> roleIds = permissionApi.getRoleIdsByUserId(loginUser.getId());
List<RoleDO> roleList = roleService.getRoleList(roleIds);
List<String> roleKeys = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
if (roleKeys.contains("jcgf")){
data = data.stream().filter(it->{
return it.getValue().equals("zflm")||it.getValue().equals("jcztz");
}).collect(Collectors.toList());
}else if (roleKeys.contains("jcshop")){
data = data.stream().filter(it->{
return it.getValue().equals("jczgg");
}).collect(Collectors.toList());
}
return success(data);
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/listType")
public CommonResult listType()
{
List<DictDataDO> data = dictTypeService.getDictDataListByDictType("inspection_hygg");
if (StringUtils.isNull(data))
{
data = new ArrayList<DictDataDO>();
}
data = data.stream().filter(it->{
return !it.getValue().equals("jcztz");
}).collect(Collectors.toList());
return success(data);
}
@GetMapping("/listGfClass")
public CommonResult listGfClass()
{
List<String> list = inspectionNewsService.listGfClass("zflm");
return success(list);
}
@GetMapping("/list")
public CommonResult list(InspectionNews inspectionNews,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
Page<InspectionNews> page = new Page<>(pageNum, pageSize);
IPage<InspectionNews> list = inspectionNewsService.selectInspectionNewsList(page,inspectionNews);
return success(list);
}
@GetMapping("/ownList")
public CommonResult ownList(InspectionNews inspectionNews,@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize)
{
//当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
inspectionNews.setCreator(loginUser.getId().toString());
Page<InspectionNews> page = new Page<>(pageNum, pageSize);
IPage<InspectionNews> list = inspectionNewsService.selectInspectionNewsList(page,inspectionNews);
return success(list);
}
@PostMapping("/add")
public CommonResult add(@RequestBody InspectionNews inspectionNews) throws Exception {
//获取当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// AdminUserRespDTO user = sysUserService.getUser(loginUser.getId());
List<Long> roleIds = permissionApi.getRoleIdsByUserId(loginUser.getId());
List<RoleDO> roleList = roleService.getRoleList(roleIds);
List<String> roleKeys = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
if (roleKeys.contains("jcgf")) {
if (StringUtils.isEmpty(inspectionNews.getCategory())) {
//检测官方
inspectionNews.setCategory("zflm");
} else {
if (!inspectionNews.getCategory().equals("zflm") && !inspectionNews.getCategory().equals("jcztz")) {
throw new Exception("权限不足");
}
}
//根据部门获取发布单位
AdminUserRespDTO user = sysUserService.getUser(loginUser.getId());
DeptRespDTO sysDept = deptService.getDept(user.getDeptId());
inspectionNews.setPublishUnit(ObjectUtil.isEmpty(sysDept) ? "检测官方" : sysDept.getName());
// if (inspectionNews.getCategory().equals("jcztz")){
// //如果是内部通知 进行websocket通知
// try {
// msgSocket.sendToAll("newMsg");
// }catch (Exception e){
// logger.error(e.getMessage());
// }
//
// }
} else if (roleKeys.contains("jcshop")) {
//检测站
inspectionNews.setCategory("jczgg");
ShopMallPartners partners = partnersService.selectShopMallPartnersByUserId(loginUser.getId(), "jc");
inspectionNews.setPublishUnit(partners.getPartnerName());
}
if (ObjectUtil.isEmpty(inspectionNews.getType()) || inspectionNews.getType().equals("null")){
if (ObjectUtil.isNotEmpty(inspectionNews.getIfShow())){
inspectionNews.setType(inspectionNews.getIfShow().equals("01") ? "staff" : "user");
}
}
//判断是否为当前登录用户创建的
return toAjax(inspectionNewsService.insertInspectionNews(inspectionNews));
}
@PostMapping("/edit")
public CommonResult edit(@RequestBody InspectionNews inspectionNews)
{
//判断是否为当前登录用户创建的
//当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
InspectionNews inspectionNews1 = inspectionNewsService.selectInspectionNewsById(inspectionNews.getId());
if (!inspectionNews1.getCreator().equals(loginUser.getId().toString())){
return error("禁止编辑");
}
inspectionNews.setPublishUnit(null);
inspectionNews.setCategory(null);
return toAjax(inspectionNewsService.updateInspectionNews(inspectionNews));
}
/**
* 删除请填写功能名称
*/
@PostMapping("/del")
public CommonResult remove(@RequestParam("id") Long id)
{
//判断是否为当前登录用户创建的
//当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
InspectionNews inspectionNews1 = inspectionNewsService.selectInspectionNewsById(id);
if (!inspectionNews1.getCreator().equals(loginUser.getId().toString())){
return error("禁止删除");
}
return toAjax(inspectionNewsService.deleteInspectionNewsById(id));
}
//获取 详细信息
@GetMapping("/getDetail")
public CommonResult getDetail(Long newsId)
{
return success(inspectionNewsService.getDetail(newsId));
}
/**
* 新增阅读数量
* @param newsId
* @return
*/
@PostMapping("/addReadNum")
public CommonResult addReadNum(@RequestParam("newsId") Long newsId,Long objectId)
{
inspectionNewsService.addReadNum(newsId,objectId);
return CommonResult.ok();
}
/**
* 点赞/收藏
* @param newsId
* @param type
* @return
*/
@PostMapping("/likeOrCollect")
public CommonResult likeOrCollect(@RequestParam("newsId") Long newsId,@RequestParam("type") String type)
{
inspectionNewsService.likeOrCollect(newsId,type);
return CommonResult.ok();
}
/**
* 新增评论
* @param inspectionNewsComment
* @return
*/
@PostMapping("/addInspectionNewsComment")
public CommonResult addInspectionNewsComment(@RequestBody InspectionNewsComment inspectionNewsComment)
{
inspectionNewsService.addInspectionNewsComment(inspectionNewsComment);
return CommonResult.ok();
}
/**
* 删除评论
* @param commentId
* @return
*/
@PostMapping("/delNewsComment")
public CommonResult delNewsComment(Long commentId)
{
//判断是否为当前登录用户创建的
//当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
InspectionNewsComment comment = commentService.getById(commentId);
if (!comment.getCreator().equals(loginUser.getId().toString())){
return error("禁止删除");
}
return toAjax(commentService.removeById(commentId));
}
/**
* 获取评论列表
* @return
*/
@GetMapping("/getCommentList")
public CommonResult getCommentList(Long newsId,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
Page<InspectionNewsComment> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<InspectionNewsComment> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(InspectionNewsComment::getNewsId,newsId).orderByDesc(TenantBaseDO::getCreateTime);
IPage<InspectionNewsComment> commentList = commentService.page(page,queryWrapper);
return success(commentList);
}
/**
* 我的收藏
* @return
*/
@GetMapping("/collectionNews")
public CommonResult collectionNews(String newsName,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
Page<InspectionNews> page = new Page<>(pageNum, pageSize);
IPage<InspectionNews> newsList = inspectionNewsService.collectionNews(page,newsName);
return success(newsList);
}
/**
* 获取未读消息数量
* @return
*/
@GetMapping("/newMsgNum")
public CommonResult newMsgNum(Long partnerId)
{
return success(inspectionNewsService.newMsgNum(partnerId));
}
/**
* 获取未读消息列表
* @return
*/
@GetMapping("/msgList")
public CommonResult msgList(Long partnerId,
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
{
Page<InspectionNews> page = new Page<>(pageNum, pageSize);
IPage<InspectionNews> news = inspectionNewsService.msgList(page,partnerId);
return success(news);
}
}

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -103,4 +104,8 @@ public interface InspectionInfoMapper extends BaseMapper<InspectionInfo>
List<InspectionInfo> selectMeetCarList(@Param("datetimeRange") List<String> datetimeRange);
Map<String, Object> workOrderDataNew(@Param("query") OrderTableQuery query);
List<InspectionInfo> selectLatestByCarNums(@Param("carNos") Collection<String> carNos);
Map<Long, Long> selectBuyUserIdsByInfoIds(Collection<Long> ids);
}

View File

@ -123,4 +123,9 @@ public interface IInspectionFileService extends IService<InspectionFile> {
*/
List<TreeCommonResult> queryTreeFolder();
List<TreeCommonResult> queryTreeFolderForJx();
/**
* 文件提醒
*/
void warnReminder();
}

View File

@ -11,8 +11,10 @@ import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 请填写功能名称Service接口
@ -180,4 +182,8 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
Map<String, Long> getBusinessCountByType(Integer partnerId);
List<InspectionInfo> selectMeetCarList(List<String> datetimeRange);
List<InspectionInfo> selectLatestByCarNums(Collection<String> carNos);
Map<Long, Long> selectBuyUserIdsByInfoIds(Collection<Long> ids);
}

View File

@ -249,7 +249,7 @@ public class InspectionAppointmentServiceImpl extends ServiceImpl<InspectionAppo
redisDelayedQueueService.addToQueue(message, triggerTimeMillis);
// 发送站内信
noticeService.sentMessage(userListByCode.getId(), msg, appointment.getTenantId());
noticeService.sentMessageToMember(userListByCode.getId(), msg, appointment.getTenantId());
}

View File

@ -344,6 +344,9 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
if (ObjectUtil.isNotEmpty(inspectionFile.getFileName())) {
queryWrapper.like(InspectionFile::getFileName, inspectionFile.getFileName());
}
if (ObjectUtil.isNotEmpty(inspectionFile.getCreator())) {
queryWrapper.eq(InspectionFile::getCreator, inspectionFile.getCreator());
}
queryWrapper.orderBy(false, false, InspectionFile::getCreateTime);
List<InspectionFile> fileList = this.list(queryWrapper);
//判断文件是否是图片
@ -586,6 +589,27 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
return buildTree(inspectionFiles);
}
/**
* 文件提醒
*/
@Override
public void warnReminder() {
// 查询出检测小程序的资料文件夹
InspectionFile inspectionFile = baseMapper.selectOne(new LambdaQueryWrapper<InspectionFile>().eq(InspectionFile::getDefaultKey, InspectionFileEnum.INSPECTION_CUSTOMER.getType()));
if (inspectionFile != null) {
// 查询出code中所有带这个文件夹id的文件
List<InspectionFile> inspectionFiles = baseMapper.selectList(new LambdaQueryWrapper<InspectionFile>().like(InspectionFile::getFileCode, inspectionFile.getId()).eq(InspectionFile::getFileType, InspectionConstants.INSPECTION_FILE));
// 判断获取提醒时间判断是否有过期的
inspectionFiles.forEach(file -> {
if (file.getWarnTime() != null && file.getWarnTime().before(new Date())) {
String message = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_USER_FILE_EXPIRE, file.getFileName());
// 提醒
noticeService.sentMessage(Long.valueOf(file.getCreator()), message);
}
});
}
}
/**
* 构建树形结构
*

View File

@ -1095,6 +1095,24 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
return baseMapper.selectMeetCarList(datetimeRange);
}
/**
* @param carNos
* @return
*/
@Override
public List<InspectionInfo> selectLatestByCarNums(Collection<String> carNos) {
return baseMapper.selectLatestByCarNums(carNos);
}
/**
* @param ids
* @return
*/
@Override
public Map<Long, Long> selectBuyUserIdsByInfoIds(Collection<Long> ids) {
return baseMapper.selectBuyUserIdsByInfoIds(ids);
}
/**
* 保存引车员记录
*

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.job.job;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.infra.service.job.JobLogService;
import cn.iocoder.yudao.module.reminder.service.IInspectionReminderConfigService;
import cn.iocoder.yudao.module.shop.service.IShopUserCarService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 定时执行提醒
*
* @author j-sentinel
*/
@Slf4j
@Component
public class ExpirationReminderJob implements JobHandler {
@Resource
private IInspectionReminderConfigService inspectionReminderConfigService;
@Override
@TenantJob
public String execute(String param) {
inspectionReminderConfigService.expireInspectionReminder();
log.info("定时提醒开启");
return String.format("定时执行清理定时任务日志数量 %s 个");
}
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.job.job;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@RequiredArgsConstructor
public class FileWarnJob implements JobHandler {
private final IInspectionFileService inspectionFileService;
/**
* 执行任务
*
* @param param 参数
* @return 结果
* @throws Exception 异常
*/
@Override
@TenantJob
public String execute(String param) throws Exception {
inspectionFileService.warnReminder();
log.info("执行了文件提醒");
return String.format("定时执行清理定时任务日志数量 %s 个");
}
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.reminder.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.reminder.entity.InspectionReminderConfig;
import cn.iocoder.yudao.module.reminder.service.IInspectionReminderConfigService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 年审和年检提醒配置表 前端控制器
* </p>
*
* @author lighting
* @since 2025-07-21
*/
@RestController
@RequestMapping("/inspection-reminder-config")
@RequiredArgsConstructor
public class InspectionReminderConfigController {
private final IInspectionReminderConfigService inspectionReminderConfigService;
/**
* 年审和年检提醒
*/
@RequestMapping("/expireInspectionReminder")
public void expireInspectionReminder() {
inspectionReminderConfigService.expireInspectionReminder();
}
/**
* 获取信息
*
* @return InspectionReminderConfig
*/
@GetMapping
public CommonResult<?> getInfo() {
return CommonResult.success(inspectionReminderConfigService.getOne(Wrappers.<InspectionReminderConfig>lambdaQuery()));
}
/**
* 添加信息
*
* @param inspectionReminderConfig
* @return InspectionReminderConfig
*/
@PostMapping
public CommonResult<?> addInfo(@RequestBody InspectionReminderConfig inspectionReminderConfig) {
return CommonResult.success(inspectionReminderConfigService.save(inspectionReminderConfig));
}
/**
* 修改信息
*
* @param inspectionReminderConfig
* @return InspectionReminderConfig
*/
@PutMapping
public CommonResult<?> updateInfo(@RequestBody InspectionReminderConfig inspectionReminderConfig) {
return CommonResult.success(inspectionReminderConfigService.updateById(inspectionReminderConfig));
}
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.reminder.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 年审和年检提醒配置表
* </p>
*
* @author lighting
* @since 2025-07-21
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("inspection_reminder_config")
public class InspectionReminderConfig extends TenantBaseDO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 年审提前 天数提醒
*/
private Integer annualEviewDay;
/**
* 保险提前申请天数
*/
private Integer insuranceDay;
/**
* 状态0-正常1-开启
*/
private Integer status;
/**
* 提醒对象0-车主 1-经办人 2-都提醒
*/
private Integer reminderPeople;
/**
* 短信appid
*/
private String sdkAppId;
/**
* 短信模板ID
*/
private String templateId;
/**
* 签名
*/
private String signName;
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.reminder.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 车辆提醒记录表
* </p>
*
* @author lighting
* @since 2025-07-22
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("inspection_reminder_record")
public class InspectionReminderRecord implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 车牌号
*/
private String carNum;
/**
* 提醒类型0-年审1-保险
*/
private Integer reminderType;
/**
* 提醒日期
*/
private Date remindDate;
/**
* 当时记录的到期日
*/
private Date actualDueDate;
}

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.reminder.mapper;
import cn.iocoder.yudao.module.reminder.entity.InspectionReminderConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 年审和年检提醒配置表 Mapper 接口
* </p>
*
* @author lighting
* @since 2025-07-21
*/
@Mapper
public interface InspectionReminderConfigMapper extends BaseMapper<InspectionReminderConfig> {
}

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.reminder.mapper;
import cn.iocoder.yudao.module.reminder.entity.InspectionReminderRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 车辆提醒记录表 Mapper 接口
* </p>
*
* @author lighting
* @since 2025-07-22
*/
@Mapper
public interface InspectionReminderRecordMapper extends BaseMapper<InspectionReminderRecord> {
}

View File

@ -0,0 +1,17 @@
package cn.iocoder.yudao.module.reminder.service;
import cn.iocoder.yudao.module.reminder.entity.InspectionReminderConfig;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 年审和年检提醒配置表 服务类
* </p>
*
* @author lighting
* @since 2025-07-21
*/
public interface IInspectionReminderConfigService extends IService<InspectionReminderConfig> {
void expireInspectionReminder();
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.reminder.service;
import cn.iocoder.yudao.module.reminder.entity.InspectionReminderRecord;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 车辆提醒记录表 服务类
* </p>
*
* @author lighting
* @since 2025-07-22
*/
public interface IInspectionReminderRecordService extends IService<InspectionReminderRecord> {
}

View File

@ -0,0 +1,252 @@
package cn.iocoder.yudao.module.reminder.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.service.InspectionNoticeService;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.module.constant.InspectionConstants;
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
import cn.iocoder.yudao.module.inspection.service.IInspectionInfoService;
import cn.iocoder.yudao.module.reminder.entity.InspectionReminderConfig;
import cn.iocoder.yudao.module.reminder.entity.InspectionReminderRecord;
import cn.iocoder.yudao.module.reminder.mapper.InspectionReminderConfigMapper;
import cn.iocoder.yudao.module.reminder.service.IInspectionReminderConfigService;
import cn.iocoder.yudao.module.reminder.service.IInspectionReminderRecordService;
import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
import cn.iocoder.yudao.module.shop.service.IShopUserCarService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.SendSmsUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.omg.PortableInterceptor.USER_EXCEPTION;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* <p>
* 年审和年检提醒配置表 服务实现类
* </p>
*
* @author lighting
* @since 2025-07-21
*/
@Service
@RequiredArgsConstructor
public class InspectionReminderConfigServiceImpl extends ServiceImpl<InspectionReminderConfigMapper, InspectionReminderConfig> implements IInspectionReminderConfigService {
private final IShopUserCarService shopUserCarService;
private final IInspectionInfoService inspectionInfoService;
private final InspectionNoticeService inspectionNoticeService;
private final AdminUserService adminUserService;
private final IInspectionReminderRecordService reminderRecordService;
@Override
public void expireInspectionReminder() {
// TODO 有可能每天都会给同一辆车发送信息 只需要发送一次
InspectionReminderConfig config = this.getOne(Wrappers.<InspectionReminderConfig>lambdaQuery());
if (ObjectUtil.isNotEmpty(config) && config.getStatus() == 0) {
DateTime now = DateUtil.date();
reminderNextInspection(config.getAnnualEviewDay(), now, config);
reminderInsurance(config.getInsuranceDay(), now, config);
}
}
private void reminderInsurance(Integer insuranceDay, DateTime now, InspectionReminderConfig config) {
DateTime insuranceTime = DateUtil.offsetDay(now, insuranceDay);
List<ShopUserCar> insuranceReminders = shopUserCarService.list(Wrappers.<ShopUserCar>lambdaQuery()
.between(ShopUserCar::getInsuranceDate, DateUtil.beginOfDay(now), DateUtil.endOfDay(insuranceTime))
.or()
.between(ShopUserCar::getVehicleInsuranceExpiryDate, DateUtil.beginOfDay(now), DateUtil.endOfDay(insuranceTime)));
Set<String> carNos = insuranceReminders.stream().map(ShopUserCar::getCarNo).collect(Collectors.toSet());
if (carNos.isEmpty()) return;
List<InspectionInfo> inspectionInfos = inspectionInfoService.selectLatestByCarNums(carNos);
Map<String, Long> othersInfo = getOthersInfo(config, inspectionInfos);
List<String> ownerPhones = inspectionInfos.stream()
.map(InspectionInfo::getBuyPhone)
.filter(ObjectUtil::isNotEmpty)
.collect(Collectors.toList());
// 发送站内信
for (InspectionInfo inspectionInfo : inspectionInfos) {
Date minDate = Stream.of(inspectionInfo.getInsuranceExpiryDate(), inspectionInfo.getVehicleInsuranceExpiryDate())
.filter(Objects::nonNull)
.min(Date::compareTo)
.orElse(null);
String formattedDate = DateUtil.format(minDate, "yyyy年MM月dd日");
// 查询是否已有提醒记录
Long count = reminderRecordService.count(Wrappers.<InspectionReminderRecord>lambdaQuery()
.eq(InspectionReminderRecord::getCarNum, inspectionInfo.getCarNum())
.eq(InspectionReminderRecord::getReminderType, 1) // 1表示保险
.eq(InspectionReminderRecord::getActualDueDate, DateUtil.beginOfDay(minDate)));
if (count != null && count > 0) {
ownerPhones.remove(inspectionInfo.getBuyPhone());
continue; // 已提醒过跳过
}
// 添加提醒记录
InspectionReminderRecord record = new InspectionReminderRecord();
record.setCarNum(inspectionInfo.getCarNum());
record.setReminderType(1); // 保险
record.setActualDueDate(minDate);
record.setRemindDate(now);
reminderRecordService.save(record);
switch (config.getReminderPeople()) {
case 0:
String msgOwner = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_USER_CAR_INSURANCE_EXPIRE_USER, inspectionInfo.getCarNum(), formattedDate);
inspectionNoticeService.sentMessageToMember(inspectionInfo.getUserId(), msgOwner, null);
break;
case 1:
Long otherUserId = othersInfo.get(inspectionInfo.getOtherPhone());
if (otherUserId != null) {
String msgAgent = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_USER_CAR_INSURANCE_EXPIRE, inspectionInfo.getCarNum(), formattedDate, inspectionInfo.getBuyPhone());
sentMessage(otherUserId, msgAgent);
}
break;
case 2:
inspectionNoticeService.sentMessageToMember(inspectionInfo.getUserId(),
String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_USER_CAR_INSURANCE_EXPIRE_USER, inspectionInfo.getCarNum(), formattedDate), null);
Long otherId = othersInfo.get(inspectionInfo.getOtherPhone());
if (otherId != null) {
String msgBoth = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_USER_CAR_INSURANCE_EXPIRE, inspectionInfo.getCarNum(), formattedDate, inspectionInfo.getBuyPhone());
sentMessage(otherId, msgBoth);
}
break;
}
}
// 发送短信
sendSmsByConfig(config, ownerPhones);
}
private void reminderNextInspection(Integer annualEviewDay, DateTime now, InspectionReminderConfig config) {
DateTime annualEviewTime = DateUtil.offsetDay(now, annualEviewDay);
List<ShopUserCar> nextInspections = shopUserCarService.list(Wrappers.<ShopUserCar>lambdaQuery()
.between(ShopUserCar::getNextInspectionDate, DateUtil.beginOfDay(now), DateUtil.endOfDay(annualEviewTime)));
Set<String> carNos = nextInspections.stream().map(ShopUserCar::getCarNo).collect(Collectors.toSet());
if (carNos.isEmpty()) return;
List<InspectionInfo> inspectionInfos = inspectionInfoService.selectLatestByCarNums(carNos);
Map<String, Long> othersInfo = getOthersInfo(config, inspectionInfos);
List<String> ownerPhones = inspectionInfos.stream()
.map(InspectionInfo::getBuyPhone)
.filter(ObjectUtil::isNotEmpty)
.collect(Collectors.toList());
for (InspectionInfo inspectionInfo : inspectionInfos) {
String formattedDate = DateUtil.format(inspectionInfo.getNextInspectionDate(), "yyyy年MM月dd日");
// 查询是否已有提醒记录
Long count = reminderRecordService.count(Wrappers.<InspectionReminderRecord>lambdaQuery()
.eq(InspectionReminderRecord::getCarNum, inspectionInfo.getCarNum())
.eq(InspectionReminderRecord::getReminderType, 1) // 1表示保险
.eq(InspectionReminderRecord::getActualDueDate, inspectionInfo.getNextInspectionDate()));
if (count != null && count > 0) {
ownerPhones.remove(inspectionInfo.getBuyPhone());
continue; // 已提醒过跳过
}
// 添加提醒记录
InspectionReminderRecord record = new InspectionReminderRecord();
record.setCarNum(inspectionInfo.getCarNum());
record.setReminderType(1); // 保险
record.setActualDueDate(inspectionInfo.getNextInspectionDate());
record.setRemindDate(now);
reminderRecordService.save(record);
switch (config.getReminderPeople()) {
case 0:
String msgOwner = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_USER_CAR_YEAR_EXPIRE_USER, inspectionInfo.getCarNum(), formattedDate);
inspectionNoticeService.sentMessageToMember(inspectionInfo.getUserId(), msgOwner, null);
break;
case 1:
Long otherUserId = othersInfo.get(inspectionInfo.getOtherPhone());
if (otherUserId != null) {
String msgAgent = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_USER_CAR_YEAR_EXPIRE, inspectionInfo.getCarNum(), formattedDate, inspectionInfo.getBuyPhone());
sentMessage(otherUserId, msgAgent);
}
break;
case 2:
inspectionNoticeService.sentMessageToMember(inspectionInfo.getUserId(),
String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_USER_CAR_YEAR_EXPIRE_USER, inspectionInfo.getCarNum(), formattedDate), null);
Long otherId = othersInfo.get(inspectionInfo.getOtherPhone());
if (otherId != null) {
String msgBoth = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_USER_CAR_YEAR_EXPIRE, inspectionInfo.getCarNum(), formattedDate, inspectionInfo.getBuyPhone());
sentMessage(otherId, msgBoth);
}
break;
}
}
sendSmsByConfig(config, ownerPhones);
}
/**
* 根据配置和inspectionInfos获取经办人ID映射手机号 -> userId
*/
private Map<String, Long> getOthersInfo(InspectionReminderConfig config, List<InspectionInfo> inspectionInfos) {
if (config.getReminderPeople() != 1 && config.getReminderPeople() != 2) {
return Collections.emptyMap();
}
Set<String> phones = inspectionInfos.stream()
.map(InspectionInfo::getOtherPhone)
.filter(ObjectUtil::isNotEmpty)
.collect(Collectors.toSet());
if (phones.isEmpty()) {
return Collections.emptyMap();
}
List<AdminUserDO> others = adminUserService.list(Wrappers.<AdminUserDO>lambdaQuery()
.in(AdminUserDO::getUsername, phones)
.ne(AdminUserDO::getUserType, "02"));
return others.stream().collect(Collectors.toMap(AdminUserDO::getUsername, AdminUserDO::getId));
}
/**
* 发送短信根据 config.reminderPeople 判断发送给谁
*/
private void sendSmsByConfig(InspectionReminderConfig config, List<String> phoneNums) {
if (CollUtil.isEmpty(phoneNums)) return;
// String[] phoneArray = phoneNums.toArray(new String[0]);
String[] phoneArray = {"19392873837"};
switch (config.getReminderPeople()) {
case 0: // 车主
SendSmsUtil.sendMsgCommonByPhoneNums(null, phoneArray, config.getSdkAppId(), config.getSignName(), config.getTemplateId());
break;
case 1: // 经办人
// TODO: 这里如果需要给经办人发送短信需要传入经办人手机号
break;
case 2: // 车主和经办人
SendSmsUtil.sendMsgCommonByPhoneNums(null, phoneArray, config.getSdkAppId(), config.getSignName(), config.getTemplateId());
// TODO: 经办人手机号发送逻辑
break;
}
}
private void sentMessage(Long userId, String content) {
inspectionNoticeService.sentMessage(userId, content);
}
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.reminder.service.impl;
import cn.iocoder.yudao.module.reminder.entity.InspectionReminderRecord;
import cn.iocoder.yudao.module.reminder.mapper.InspectionReminderRecordMapper;
import cn.iocoder.yudao.module.reminder.service.IInspectionReminderRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 车辆提醒记录表 服务实现类
* </p>
*
* @author lighting
* @since 2025-07-22
*/
@Service
public class InspectionReminderRecordServiceImpl extends ServiceImpl<InspectionReminderRecordMapper, InspectionReminderRecord> implements IInspectionReminderRecordService {
}

View File

@ -72,4 +72,33 @@ public class SendSmsUtil {
}
}
public static void sendMsgCommonByPhoneNums(String[] templateParamSet,String[] phoneNums,String sdkAppId,String signName,String templateId){
try{
Credential cred = new Credential("AKIDQlz4xdAaypV0MYkv1AMRRKSdw350qW2x", "oRv221ymOsBMOMBwAHF4f2GJC6tX6Wnv");
// 实例化一个http选项可选的没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("sms.tencentcloudapi.com");
// 实例化一个client选项可选的没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
SendSmsRequest req = new SendSmsRequest();
req.setPhoneNumberSet(phoneNums);
req.setSmsSdkAppId(sdkAppId);
req.setSignName(signName);
req.setTemplateId(templateId);
req.setTemplateParamSet(templateParamSet);
// 返回的resp是一个SendSmsResponse的实例与请求对象对应
SendSmsResponse resp = client.SendSms(req);
// 输出json格式的字符串回包
System.out.println(SendSmsResponse.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.reminder.mapper.InspectionReminderConfigMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.reminder.mapper.InspectionReminderRecordMapper">
</mapper>

View File

@ -803,4 +803,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ins.start_time between #{query.startTime} and #{query.endTime}
</if>
</select>
<select id="selectLatestByCarNums" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT ii.*,car.*
FROM inspection_info ii
JOIN (
SELECT car_num, MAX(start_time) AS max_start_time
FROM inspection_info
WHERE car_num IN
<foreach collection="carNos" item="carNo" open="(" separator="," close=")">
#{carNo}
</foreach>
GROUP BY car_num
) latest
ON ii.car_num = latest.car_num AND ii.start_time = latest.max_start_time
LEFT JOIN shop_user_car car on car.car_no = ii.car_num
</select>
<select id="selectBuyUserIdsByInfoIds" resultType="java.util.Map">
SELECT
info.id AS "key",
system_users.id AS "value"
FROM inspection_info info
INNER JOIN system_users ON info.other_phone = system_users.username
WHERE info.id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.infra.controller.app.cos;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.infra.cos.CosStsService;
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.Map;
/**
* @Description: sts
* @Author: 86187
* @Date: 2025/03/20 16:34
* @Version: 1.0
*/
@RestController
@RequestMapping("/cos")
public class AppCosStsController {
@Autowired
CosStsService cosStsService;
@GetMapping("/sts")
@PermitAll
@TenantIgnore
public Map<String, Object> getCosSts() {
Map<String, Object> result = cosStsService.getTempKeys();
return result;
}
}