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 isHangAccount;
}

View File

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

View File

@ -1,5 +1,6 @@
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 com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
@ -16,7 +17,7 @@ import lombok.EqualsAndHashCode;
@TableName(value ="dl_base_notice")
@Data
@EqualsAndHashCode(callSuper = true)
public class DlBaseNotice extends TenantBaseDO {
public class DlBaseNotice extends BaseDO {
/**
* 公告ID
*/

View File

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

View File

@ -61,7 +61,7 @@ public class RepairRecordsController {
/**
* 维修工查询维修记录
* @param pageReqVO 维修工分页查询条件
* @param pageReqVO
*
*/
@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.Param;
import java.util.List;
/**
* 维修工人 Mapper
*
@ -26,4 +28,11 @@ public interface RepairWorkerMapper extends BaseMapper<RepairWorker> {
**/
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);
}

View File

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

View File

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

View File

@ -28,4 +28,15 @@
order by main.create_time desc
</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;
import cn.hutool.extra.spring.SpringUtil;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement;
import cn.iocoder.yudao.module.appBase.service.ISysAnnouncementService;
import cn.iocoder.yudao.module.constant.UserConstants;
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.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.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

View File

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

View File

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