Commit 76ad0fb7 authored by fangxinjiang's avatar fangxinjiang

项目订单提醒实现

parent 89d28a83
...@@ -104,6 +104,7 @@ ...@@ -104,6 +104,7 @@
<module>yifu-order</module> <module>yifu-order</module>
<module>yifu-mail</module> <module>yifu-mail</module>
<module>yifu-business</module> <module>yifu-business</module>
<module>yifu-msg</module>
</modules> </modules>
<dependencyManagement> <dependencyManagement>
......
package com.yifu.cloud.plus.v1.msg.entity;
import cn.hutool.core.date.DateTime;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @Author fxj
* @Date 2023/5/30
* @Description
* @Version 1.0
*/
@Data
@TableName("msg_info")
@EqualsAndHashCode()
@Schema(description = "EKP消息提醒")
public class MsgInfo {
/**
* id
**/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 创建时间
**/
private DateTime createTime;
/**
* 订单ID
**/
private String orderId;
/**
* url
**/
private String url;
/**
* 订单号
**/
private String orderNo;
/**
* 通知类型: 0 接单 1 超时 2变更
**/
private String alertType;
/**
* 是否已读 0 是 1 否
**/
private String read;
/**
* 通知人
**/
private String alertUser;
}
package com.yifu.cloud.plus.v1.msg.vo;
import lombok.Data;
/**
* @Author fxj
* @Date 2023/5/30
* @Description
* @Version 1.0
*/
@Data
public class EkpAlertVo {
/**
* 类型 0 接单 1 超时 2变更
**/
private String type;
/**
* 订单号
**/
private String orderId;
/**
* 表单类型:0 项目订单
**/
private String item;
/**
* 提醒人
**/
private String alertUser;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.msg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.msg.entity.MsgInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author fxj
* @Description EKP 消息表
* @Date 16:20 2023/5/30
* @Param
* @return
**/
@Mapper
public interface MsgMapper extends BaseMapper<MsgInfo> {
IPage<MsgInfo> getmsgInfoPage(Page<MsgInfo> page, @Param("msgInfo") MsgInfo msgInfo);
MsgInfo getMsgByOrderId(@Param("orderId")String orderId);
}
package com.yifu.cloud.plus.v1.msg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.msg.entity.MsgInfo;
import com.yifu.cloud.plus.v1.msg.vo.EkpAlertVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
/**
* @Author fxj
* @Date 2023/5/30
* @Description
* @Version 1.0
*/
public interface MsgService extends IService<MsgInfo> {
R<Boolean> createMsg(List<EkpAlertVo> list);
}
package com.yifu.cloud.plus.v1.msg.service.impl;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.msg.constant.MesConstants;
import com.yifu.cloud.plus.v1.msg.entity.MsgInfo;
import com.yifu.cloud.plus.v1.msg.mapper.MsgMapper;
import com.yifu.cloud.plus.v1.msg.service.MsgService;
import com.yifu.cloud.plus.v1.msg.vo.EkpAlertVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author fxj
* @Date 2023/5/30
* @Description
* @Version 1.0
*/
@RequiredArgsConstructor
@Service
public class MsgImpl extends ServiceImpl<MsgMapper, MsgInfo> implements MsgService {
@Override
public R<Boolean> createMsg(List<EkpAlertVo> list) {
if (Common.isNotNull(list)){
EkpAlertVo vo = list.get(CommonConstants.ZERO_INT);
if (Common.isEmpty(vo.getItem())
|| Common.isEmpty(vo.getType())
|| Common.isEmpty(vo.getOrderId())
|| Common.isEmpty(vo.getAlertUser())){
return R.failed(CommonConstants.PARAM_INFO_ERROR);
}
MsgInfo save = null;
// 项目订单处理
if (CommonConstants.ZERO_STRING.equals(vo.getItem())){
// 接单提醒
if (CommonConstants.ZERO_STRING.equals(vo.getType())){
save = baseMapper.getMsgByOrderId(vo.getOrderId());
if (Common.isNotNull(save)){
save.setCreateTime(DateTime.now());
save.setUrl(MesConstants.ORDER_URL_PATH+vo.getOrderId());
baseMapper.insert(save);
}
}
// 变更提醒
if (CommonConstants.TWO_STRING.equals(vo.getType())){
save = baseMapper.getMsgByOrderId(vo.getOrderId());
if (Common.isNotNull(save)){
save.setCreateTime(DateTime.now());
save.setUrl(MesConstants.ORDER_URL_PATH+save.getOrderId());
save.setAlertType(CommonConstants.TWO_STRING);
baseMapper.insert(save);
}
}
}
}else {
return R.failed(CommonConstants.PARAM_INFO_ERROR);
}
return null;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.msg.mapper.MsgMapper">
<resultMap id="msgInfoMap" type="com.yifu.cloud.plus.v1.msg.entity.MsgInfo">
<id property="id" column="ID"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="orderId" column="ORDER_ID"/>
<result property="url" column="URL"/>
<result property="orderNo" column="ORDER_NO"/>
<result property="alertType" column="ALERT_TYPE"/>
<result property="read" column="READ"/>
<result property="alertUser" column="ALERT_USER"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.CREATE_TIME,
a.ORDER_ID,
a.URL,
a.ORDER_NO,
a.ALERT_TYPE,
a.READ,
a.ALERT_USER
</sql>
<sql id="msgInfo_where">
<if test="msgInfo != null">
<if test="msgInfo.id != null and msgInfo.id.trim() != ''">
AND a.ID = #{msgInfo.id}
</if>
<if test="msgInfo.orderId != null and msgInfo.orderId.trim() != ''">
AND a.ORDER_ID = #{msgInfo.orderId}
</if>
<if test="msgInfo.alertType != null and msgInfo.alertType.trim() != ''">
AND a.ALERT_TYPE = #{msgInfo.alertType}
</if>
<if test="msgInfo.read != null and msgInfo.read.trim() != ''">
AND a.READ = #{msgInfo.read}
</if>
<if test="msgInfo.alertUser != null and msgInfo.alertUser.trim() != ''">
AND a.ALERT_USER = #{msgInfo.alertUser}
</if>
</if>
</sql>
<!--msgInfo简单分页查询-->
<select id="getmsgInfoPage" resultMap="msgInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM msg_info a
<where>
1=1
<include refid="msgInfo_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<select id="getMsgByOrderId" resultType="com.yifu.cloud.plus.v1.msg.entity.MsgInfo">
SELECT
p.fd_name alertUser,
a.fd_3ac901c5184274 orderNo,
a.fd_id orderId,
'0' as alertType
FROM
ekp_ea33075576149bb8a4f5 a
LEFT JOIN sys_org_element p on a.fd_3b0aff6781fa86 = p.fd_id
WHERE
a.ORDER_ID = #{orderId} limit 1
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment