This commit is contained in:
Vinjor 2024-10-11 10:32:58 +08:00
commit 274e764e22
15 changed files with 134 additions and 23 deletions

View File

@ -0,0 +1,51 @@
package cn.iocoder.yudao.common;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.common.dto.MessageDTO;
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
/**
* 用于发送消息
*
* @author 小李
* @date 17:15 2024/10/9
**/
@Component
public class MessageSend {
@Resource
private NotifyMessageSendApi messageSendApi;
/**
* 通用消息发送
*
* @param messageDTO 消息对象
* @author 小李
* @date 9:58 2024/10/10
**/
public void send(MessageDTO messageDTO) {
// 设置参数
Map<String, Object> map = new HashMap<>();
for (int i = 1; i <= messageDTO.getParamList().size(); i++) {
map.put("key" + i, messageDTO.getParamList().get(i - 1));
}
if (CollectionUtil.isEmpty(messageDTO.getUserIds())){
throw exception0(500, "没有接收人");
}
messageDTO.getUserIds().forEach(id -> {
messageSendApi.sendSingleMessageToAdmin(
new NotifySendSingleToUserReqDTO()
.setUserId(id)
.setTemplateCode(messageDTO.getTemplateCode())
.setTemplateParams(map));
});
}
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.common.dto;
import lombok.Data;
import java.util.List;
/**
* 用于发消息
*
* @author 小李
* @date 17:34 2024/10/9
**/
@Data
public class MessageDTO {
/** 接收方ids 来自system_users */
private List<Long> userIds;
/** 模板枚举 */
private String templateCode;
/** 参数列表 */
private List<Object> paramList;
}

View File

@ -106,4 +106,9 @@ public class CustomerMain extends TenantBaseDO {
*/ */
private String memberLevelId; private String memberLevelId;
} /**
* 是否挂账
*/
private String isHangAccount;
}

View File

@ -75,7 +75,7 @@ public class DlBaseNoticeController {
return CommonResult.ok(); return CommonResult.ok();
} }
@GetMapping("get") @GetMapping("/get")
@Operation(summary = "平台通用信息公告 查询 按服务") @Operation(summary = "平台通用信息公告 查询 按服务")
public CommonResult<?> getNoticeById(@RequestParam("id") String id) { public CommonResult<?> getNoticeById(@RequestParam("id") String id) {
return success(dlBaseNoticeService.getById(id)); return success(dlBaseNoticeService.getById(id));

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.notice.entity; package cn.iocoder.yudao.module.notice.entity;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@ -16,7 +17,7 @@ import lombok.EqualsAndHashCode;
@TableName(value ="dl_base_notice") @TableName(value ="dl_base_notice")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class DlBaseNotice extends TenantBaseDO { public class DlBaseNotice extends BaseDO {
/** /**
* 公告ID * 公告ID
*/ */

View File

@ -34,6 +34,7 @@
main.near_do_time AS nearDoTime, main.near_do_time AS nearDoTime,
main.near_do_content AS nearDoContent, main.near_do_content AS nearDoContent,
main.inviter AS inviter, main.inviter AS inviter,
main.is_hang_account AS isHangAccount,
main.inviter_type AS inviterType, main.inviter_type AS inviterType,
main.status AS status, main.status AS status,
group_concat(item.ser_content) AS serContents, group_concat(item.ser_content) AS serContents,
@ -102,6 +103,8 @@
main.near_do_content AS nearDoContent, main.near_do_content AS nearDoContent,
main.inviter AS inviter, main.inviter AS inviter,
main.inviter_type AS inviterType, main.inviter_type AS inviterType,
main.member_level_id AS memberLevelId,
main.is_hang_account AS isHangAccount,
main.STATUS AS STATUS, main.STATUS AS STATUS,
group_concat( item.ser_content ) AS serContents, group_concat( item.ser_content ) AS serContents,
memberLevel.NAME AS levelName, memberLevel.NAME AS levelName,
@ -131,4 +134,4 @@
where bcc.deleted = '0' where bcc.deleted = '0'
and bcc.car_id = #{carId} and bcc.car_id = #{carId}
</select> </select>
</mapper> </mapper>

View File

@ -61,7 +61,7 @@ public class RepairRecordsController {
/** /**
* 维修工查询维修记录 * 维修工查询维修记录
* @param pageReqVO 维修工分页查询条件 * @param pageReqVO
* *
*/ */
@GetMapping("/page") @GetMapping("/page")

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 维修工人 Mapper * 维修工人 Mapper
* *
@ -26,4 +28,11 @@ public interface RepairWorkerMapper extends BaseMapper<RepairWorker> {
**/ **/
IPage<RepairWorkerRespVO> queryListPage(@Param("entity") RepairWorkerPageReqVO entity, Page<RepairWorkerRespVO> page); IPage<RepairWorkerRespVO> queryListPage(@Param("entity") RepairWorkerPageReqVO entity, Page<RepairWorkerRespVO> page);
} /**
* 获取所有维修工人的id
* @return List<Long> 维修工人id列表
* @author lzt
* @date 2024年10月10日
**/
List<Long> getAllWorkerIds();
}

View File

@ -57,4 +57,6 @@ public interface RepairRecordsService extends IService<RepairRecords> {
*/ */
List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO); List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO);
} }

View File

@ -62,7 +62,7 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
* @apiNote lzt * @apiNote lzt
* @param pageReqVO 查询条件 * @param pageReqVO 查询条件
* @return queryAllRepairRecords 所有维修记录 * @return queryAllRepairRecords 所有维修记录
* @date * @date 2024年10月9日
*/ */
@Override @Override
public List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO) { public List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO) {

View File

@ -36,20 +36,28 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
* 批量创建维修工人 * 批量创建维修工人
* *
* @param userList 选中用户集合 * @param userList 选中用户集合
* @author PQZ * @author lzt
* @date 18:33 2024/10/9 * @date 2024年10月10日
**/ **/
@Override @Override
public void saveWorkers(List<UserDTO> userList) { public void saveWorkers(List<UserDTO> userList) {
if (CollectionUtil.isNotEmpty(userList)){ if (CollectionUtil.isNotEmpty(userList)){
//获取已有的维修工人ID列表
List<Long> existingWorkerIds = workerMapper.getAllWorkerIds();
List<RepairWorker> saveList = new ArrayList<>(); List<RepairWorker> saveList = new ArrayList<>();
userList.forEach(item -> { userList.forEach(item -> {
RepairWorker worker = new RepairWorker(); if (!existingWorkerIds.contains(item.getId())) {
worker.setUserId(item.getId()); RepairWorker worker = new RepairWorker();
worker.setUserName(item.getNickname()); worker.setUserId(item.getId());
saveList.add(worker); worker.setUserName(item.getNickname());
saveList.add(worker);
}
}); });
saveBatch(saveList);
if (!saveList.isEmpty()) {
saveBatch(saveList);
}
} }
} }
@ -84,4 +92,4 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
return workerMapper.queryListPage(pageReqVO,page); return workerMapper.queryListPage(pageReqVO,page);
} }
} }

View File

@ -28,4 +28,15 @@
order by main.create_time desc order by main.create_time desc
</select> </select>
</mapper>
<select id="getAllWorkerIds" resultType="java.lang.Long">
SELECT
main.user_id
FROM
dl_repair_worker main
WHERE
main.deleted = 0
</select>
</mapper>

View File

@ -1,18 +1,13 @@
package cn.iocoder.yudao.module.rescue.utils; package cn.iocoder.yudao.module.rescue.utils;
import cn.hutool.extra.spring.SpringUtil;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement; import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement;
import cn.iocoder.yudao.module.appBase.service.ISysAnnouncementService; import cn.iocoder.yudao.module.appBase.service.ISysAnnouncementService;
import cn.iocoder.yudao.module.constant.UserConstants; import cn.iocoder.yudao.module.constant.UserConstants;
import cn.iocoder.yudao.module.rescue.dto.TaskDto; import cn.iocoder.yudao.module.rescue.dto.TaskDto;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi; import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@ -296,6 +296,7 @@ yudao:
- /admin-api/rescue/driverLogin - /admin-api/rescue/driverLogin
- /admin-api/rescuePayApi/payNotify - /admin-api/rescuePayApi/payNotify
- /admin-api/payApi/payNotify - /admin-api/payApi/payNotify
- /admin-api/base/notice/**
ignore-tables: ignore-tables:
- system_tenant - system_tenant
@ -342,6 +343,7 @@ yudao:
- tmp_report_data_1 - tmp_report_data_1
- tmp_report_data_income - tmp_report_data_income
- system_users - system_users
- dl_base_notice
ignore-caches: ignore-caches:
- permission_menu_ids - permission_menu_ids
- oauth_client - oauth_client

View File

@ -4,7 +4,7 @@
"avatar": "", "avatar": "",
"version": "4.9.2", "version": "4.9.2",
"createdTime": "2024-10-9 10:34:15", "createdTime": "2024-10-9 10:34:15",
"updatedTime": "2024-10-9 17:32:50", "updatedTime": "2024-10-10 10:48:48",
"dbConns": [], "dbConns": [],
"profile": { "profile": {
"default": { "default": {
@ -683,7 +683,7 @@
"optionsFetcher": "" "optionsFetcher": ""
} }
}, },
"menuWidth": "266px" "menuWidth": "298px"
}, },
"entities": [ "entities": [
{ {