小程序端

This commit is contained in:
Vinjor 2024-10-21 17:44:44 +08:00
parent 374a82a78d
commit c40a8f7017
10 changed files with 178 additions and 9 deletions

View File

@ -1,6 +1,5 @@
package cn.iocoder.yudao.module.order.vo;
import cn.iocoder.yudao.module.company.entity.Company;
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
@ -11,9 +10,15 @@ import lombok.Data;
@ExcelIgnoreUnannotated
public class RepairOrderInfoRespVO extends RepairOrderInfo {
/** 订单状态(工单的状态) */
/** 订单状态(工单的维修子状态) */
private String status;
/** 订单状态(工单的主状态) */
private String mainStatus;
//订单描述
private String description;
/** 查询订单类型(null-所有 |working-维修中|waitingPay-待支付|waitingComment-待评价) */
private String selectType;
}

View File

@ -21,7 +21,8 @@
type,
status,
parent_server,
server
server,
create_time
from dl_base_notice dbn
where dbn.deleted = '0'
</sql>

View File

@ -39,7 +39,9 @@
</select>
<select id="getOrderPageByStatus" resultType="cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO">
select roi.*,drt.tickets_work_status as status from repair_order_info roi left join dl_repair_tickets drt on
select roi.*,drt.tickets_work_status as status,drt.tickets_status as mainStatus
from repair_order_info roi
left join dl_repair_tickets drt on
roi.goods_id = drt.id
where roi.deleted = '0'
<if test="map.userId != null and map.userId != ''">
@ -51,6 +53,22 @@
<if test="map.orderStatus != null and map.orderStatus != ''">
and roi.order_status = #{map.orderStatus}
</if>
<if test="map.selectType != null and map.selectType != ''">
<choose>
<when test="map.selectType == 'working'">
-- 维修中的订单 --
and (drt.tickets_status = '04' OR drt.tickets_status = '05' )
</when>
<when test="map.selectType == 'waitingPay'">
-- 待支付的订单 --
and (roi.pay_type is not null AND roi.order_status='0' )
</when>
<when test="map.selectType == 'waitingComment'">
-- 待评价的订单 --
and (roi.comment_star is null AND roi.order_status='1' )
</when>
</choose>
</if>
<if test="map.status != null and map.status != ''">
<choose>
<when test="map.status != '00'">

View File

@ -112,7 +112,7 @@ public class RedissonDelayQueue {
offerTask(task, UserConstants.RESCUE_TIME);
} catch (Exception e) {
// 记录并打印异常信息
log.error("发生错误", e);
// log.error("发生错误", e);
}
}
});

View File

@ -16,7 +16,6 @@ public class NotifyTemplateSendReqVO {
private Long userId;
@Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "用户类型不能为空")
private Integer userType;
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "01")

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.system.controller.app.notify;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageMyPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
import cn.iocoder.yudao.module.system.service.notify.NotifyMessageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "小程序-站内消息")
@RestController
@RequestMapping("/system/notify-message")
@Validated
public class ApiNotifyMessageController {
@Resource
private NotifyMessageService notifyMessageService;
// ========== 管理所有的站内信 ==========
@GetMapping("/get")
@Operation(summary = "获得站内信")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<NotifyMessageRespVO> getNotifyMessage(@RequestParam("id") Long id) {
NotifyMessageDO message = notifyMessageService.getNotifyMessage(id);
return success(BeanUtils.toBean(message, NotifyMessageRespVO.class));
}
// ========== 查看自己的站内信 ==========
@GetMapping("/my-page")
@Operation(summary = "获得我的站内信分页")
public CommonResult<PageResult<NotifyMessageRespVO>> getMyMyNotifyMessagePage(@Valid NotifyMessageMyPageReqVO pageVO) {
PageResult<NotifyMessageDO> pageResult = notifyMessageService.getWxMyNotifyMessagePage(pageVO,getLoginUserId());
return success(BeanUtils.toBean(pageResult, NotifyMessageRespVO.class));
}
@PutMapping("/update-read")
@Operation(summary = "标记站内信为已读")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
public CommonResult<Boolean> updateNotifyMessageRead(@RequestParam("ids") List<Long> ids) {
notifyMessageService.updateWXNotifyMessageRead(ids, getLoginUserId());
return success(Boolean.TRUE);
}
@PutMapping("/update-all-read")
@Operation(summary = "标记所有站内信为已读")
public CommonResult<Boolean> updateAllNotifyMessageRead() {
notifyMessageService.updateWXAllNotifyMessageRead(getLoginUserId());
return success(Boolean.TRUE);
}
@GetMapping("/get-unread-list")
@Operation(summary = "获取当前用户的最新站内信列表,默认 10 条")
@Parameter(name = "size", description = "10")
public CommonResult<List<NotifyMessageRespVO>> getUnreadNotifyMessageList(
@RequestParam(name = "size", defaultValue = "10") Integer size) {
List<NotifyMessageDO> list = notifyMessageService.getUnreadNotifyMessageList(
getLoginUserId(), UserTypeEnum.ADMIN.getValue(), size);
return success(BeanUtils.toBean(list, NotifyMessageRespVO.class));
}
@GetMapping("/get-unread-count")
@Operation(summary = "获得当前用户的未读站内信数量")
@ApiAccessLog(enable = false) // 由于前端会不断轮询该接口记录日志没有意义
public CommonResult<Long> getUnreadNotifyMessageCount() {
return success(notifyMessageService.getWXUnreadNotifyMessageCount(getLoginUserId()));
}
}

View File

@ -35,12 +35,20 @@ public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> {
.orderByDesc(NotifyMessageDO::getId));
}
default PageResult<NotifyMessageDO> selectWxPage(NotifyMessageMyPageReqVO reqVO, Long userId) {
return selectPage(reqVO, new LambdaQueryWrapperX<NotifyMessageDO>()
.eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus())
.betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime())
.eq(NotifyMessageDO::getUserId, userId)
.orderByDesc(NotifyMessageDO::getId));
}
default int updateListRead(Collection<Long> ids, Long userId, Integer userType) {
return update(new NotifyMessageDO().setReadStatus(true).setReadTime(LocalDateTime.now()),
new LambdaQueryWrapperX<NotifyMessageDO>()
.in(NotifyMessageDO::getId, ids)
.eq(NotifyMessageDO::getUserId, userId)
.eq(NotifyMessageDO::getUserType, userType)
.eqIfPresent(NotifyMessageDO::getUserType, userType)
.eq(NotifyMessageDO::getReadStatus, false));
}
@ -48,7 +56,7 @@ public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> {
return update(new NotifyMessageDO().setReadStatus(true).setReadTime(LocalDateTime.now()),
new LambdaQueryWrapperX<NotifyMessageDO>()
.eq(NotifyMessageDO::getUserId, userId)
.eq(NotifyMessageDO::getUserType, userType)
.eqIfPresent(NotifyMessageDO::getUserType, userType)
.eq(NotifyMessageDO::getReadStatus, false));
}
@ -64,7 +72,7 @@ public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> {
return selectCount(new LambdaQueryWrapperX<NotifyMessageDO>()
.eq(NotifyMessageDO::getReadStatus, false)
.eq(NotifyMessageDO::getUserId, userId)
.eq(NotifyMessageDO::getUserType, userType));
.eqIfPresent(NotifyMessageDO::getUserType, userType));
}
}

View File

@ -48,6 +48,15 @@ public interface NotifyMessageService {
*/
PageResult<NotifyMessageDO> getMyMyNotifyMessagePage(NotifyMessageMyPageReqVO pageReqVO, Long userId, Integer userType);
/**
* 获得我的站内信分页---小程序使用
*
* @param pageReqVO 分页查询
* @param userId 用户编号
* @return 站内信分页
*/
PageResult<NotifyMessageDO> getWxMyNotifyMessagePage(NotifyMessageMyPageReqVO pageReqVO, Long userId);
/**
* 获得站内信
*
@ -74,6 +83,13 @@ public interface NotifyMessageService {
* @return 返回未读站内信条数
*/
Long getUnreadNotifyMessageCount(Long userId, Integer userType);
/**
* 统计用户未读站内信条数--微信小程序
*
* @param userId 用户编号
* @return 返回未读站内信条数
*/
Long getWXUnreadNotifyMessageCount(Long userId);
/**
* 标记站内信为已读
@ -84,6 +100,14 @@ public interface NotifyMessageService {
* @return 更新到的条数
*/
int updateNotifyMessageRead(Collection<Long> ids, Long userId, Integer userType);
/**
* 标记站内信为已读 --微信小程序
*
* @param ids 站内信编号集合
* @param userId 用户编号
* @return 更新到的条数
*/
int updateWXNotifyMessageRead(Collection<Long> ids, Long userId);
/**
* 标记所有站内信为已读
@ -94,4 +118,12 @@ public interface NotifyMessageService {
*/
int updateAllNotifyMessageRead(Long userId, Integer userType);
/**
* 标记所有站内信为已读---微信小程序
*
* @param userId 用户编号
* @return 更新到的条数
*/
int updateWXAllNotifyMessageRead(Long userId);
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.system.service.notify;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageMyPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
@ -46,6 +47,11 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
public PageResult<NotifyMessageDO> getMyMyNotifyMessagePage(NotifyMessageMyPageReqVO pageReqVO, Long userId, Integer userType) {
return notifyMessageMapper.selectPage(pageReqVO, userId, userType);
}
@Override
@TenantIgnore
public PageResult<NotifyMessageDO> getWxMyNotifyMessagePage(NotifyMessageMyPageReqVO pageReqVO, Long userId) {
return notifyMessageMapper.selectWxPage(pageReqVO, userId);
}
@Override
public NotifyMessageDO getNotifyMessage(Long id) {
@ -61,15 +67,30 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
public Long getUnreadNotifyMessageCount(Long userId, Integer userType) {
return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, userType);
}
@Override
@TenantIgnore
public Long getWXUnreadNotifyMessageCount(Long userId) {
return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, null);
}
@Override
public int updateNotifyMessageRead(Collection<Long> ids, Long userId, Integer userType) {
return notifyMessageMapper.updateListRead(ids, userId, userType);
}
@Override
@TenantIgnore
public int updateWXNotifyMessageRead(Collection<Long> ids, Long userId) {
return notifyMessageMapper.updateListRead(ids, userId, null);
}
@Override
public int updateAllNotifyMessageRead(Long userId, Integer userType) {
return notifyMessageMapper.updateListRead(userId, userType);
}
@Override
@TenantIgnore
public int updateWXAllNotifyMessageRead(Long userId) {
return notifyMessageMapper.updateListRead(userId, null);
}
}

View File

@ -179,6 +179,7 @@ logging:
cn.iocoder.yudao.module.company.mapper: debug #
cn.iocoder.yudao.module.staff.mapper: debug #
cn.iocoder.yudao.module.property.mapper: debug #
cn.iocoder.yudao.module.tickets.mapper: debug #
debug: false