Commit 0213a979 by 谢海旭

v5.6.0版本 策略中心:展业助手-全局提醒、优秀案例-列表、优秀案例-详情、查询任务型策略详情、更新业务策略推送消息

1 parent 465f7959
...@@ -22,6 +22,7 @@ public enum StrategyErrorEnum implements ErrorEnum { ...@@ -22,6 +22,7 @@ public enum StrategyErrorEnum implements ErrorEnum {
STRATEGY_NOT_EXISTS("11010001", "策略不存在"), STRATEGY_NOT_EXISTS("11010001", "策略不存在"),
STRATEGY_TYPE_NOT_SUPPORTED("11010002", "策略类型不支持"), STRATEGY_TYPE_NOT_SUPPORTED("11010002", "策略类型不支持"),
BUSINESS_EXCEPTION("11010003", "业务异常"),
; ;
......
...@@ -3,9 +3,9 @@ package cn.com.glsx.dj.strategy.model; ...@@ -3,9 +3,9 @@ package cn.com.glsx.dj.strategy.model;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.*;
/** /**
* 策略-人员-消息关联表 * 策略-人员-消息关联表
...@@ -13,6 +13,7 @@ import javax.persistence.*; ...@@ -13,6 +13,7 @@ import javax.persistence.*;
@Data @Data
@Table(name = "dj_car_life_strategy_staff_message") @Table(name = "dj_car_life_strategy_staff_message")
public class StrategyStaffMessage implements Serializable { public class StrategyStaffMessage implements Serializable {
/** /**
* 主键ID * 主键ID
*/ */
...@@ -23,100 +24,105 @@ public class StrategyStaffMessage implements Serializable { ...@@ -23,100 +24,105 @@ public class StrategyStaffMessage implements Serializable {
/** /**
* 策略ID,关联dj_car_life_strategy_info表 * 策略ID,关联dj_car_life_strategy_info表
*/ */
@ApiModelProperty(notes = "策略ID,关联dj_car_life_strategy_info表")
@Column(name = "strategy_id") @Column(name = "strategy_id")
@ApiModelProperty(notes = "策略ID,关联dj_car_life_strategy_info表")
private Integer strategyId; private Integer strategyId;
/** /**
* 人员UUID * 人员UUID
*/ */
@ApiModelProperty(notes = "人员UUID")
@Column(name = "uuid") @Column(name = "uuid")
@ApiModelProperty(notes = "人员UUID")
private String uuid; private String uuid;
/** /**
* 人员手机号 * 人员手机号
*/ */
@ApiModelProperty(notes = "人员手机号")
@Column(name = "phone") @Column(name = "phone")
@ApiModelProperty(notes = "人员手机号")
private String phone; private String phone;
/** /**
* 人员姓名 * 人员姓名
*/ */
@ApiModelProperty(notes = "人员姓名")
@Column(name = "staff_name") @Column(name = "staff_name")
@ApiModelProperty(notes = "人员姓名")
private String staffName; private String staffName;
/** /**
* 消息ID,关联pad_message_box表 * 消息ID,关联pad_message_box表
*/ */
@ApiModelProperty(notes = "消息ID,关联pad_message_box表")
@Column(name = "message_id") @Column(name = "message_id")
@ApiModelProperty(notes = "消息ID,关联pad_message_box表")
private Integer messageId; private Integer messageId;
/** /**
* 推送状态,0-推送失败,1-已推送 * 推送状态,0-推送失败,1-已推送
*/ */
@ApiModelProperty(notes = "推送状态,0-推送失败,1-已推送")
@Column(name = "push_status") @Column(name = "push_status")
@ApiModelProperty(notes = "推送状态,0-推送失败,1-已推送")
private Integer pushStatus; private Integer pushStatus;
/** /**
* 阅读状态,0-未读,1-已读 * 阅读状态,0-未读,1-已读
*/ */
@ApiModelProperty(notes = "阅读状态,0-未读,1-已读")
@Column(name = "read_status") @Column(name = "read_status")
@ApiModelProperty(notes = "阅读状态,0-未读,1-已读")
private Integer readStatus; private Integer readStatus;
/** /**
* 阅读时间 * 阅读时间
*/ */
@ApiModelProperty(notes = "阅读时间")
@Column(name = "read_time") @Column(name = "read_time")
@ApiModelProperty(notes = "阅读时间")
private Date readTime; private Date readTime;
/** /**
* 阅读次数 * 阅读次数
*/ */
@ApiModelProperty(notes = "阅读次数")
@Column(name = "read_count") @Column(name = "read_count")
@ApiModelProperty(notes = "阅读次数")
private Integer readCount; private Integer readCount;
/** /**
* 最新阅读时间 * 最新阅读时间
*/ */
@ApiModelProperty(notes = "最新阅读时间")
@Column(name = "latest_read_time") @Column(name = "latest_read_time")
@ApiModelProperty(notes = "最新阅读时间")
private Date latestReadTime; private Date latestReadTime;
/** /**
* 创建人 * 创建人
*/ */
@Column(name = "created_by") @Column(name = "created_by")
@ApiModelProperty(notes = "创建人")
private String createdBy; private String createdBy;
/** /**
* 创建时间 * 创建时间
*/ */
@Column(name = "created_date") @Column(name = "created_date")
@ApiModelProperty(notes = "创建时间")
private Date createdDate; private Date createdDate;
/** /**
* 修改人 * 修改人
*/ */
@Column(name = "updated_by") @Column(name = "updated_by")
@ApiModelProperty(notes = "修改人")
private String updatedBy; private String updatedBy;
/** /**
* 修改时间 * 修改时间
*/ */
@Column(name = "updated_date") @Column(name = "updated_date")
@ApiModelProperty(notes = "修改时间")
private Date updatedDate; private Date updatedDate;
/** /**
* 删除标识(D:已删除;N:未删除) * 删除标识(D:已删除;N:未删除)
*/ */
@Column(name = "deleted_flag") @Column(name = "deleted_flag")
@ApiModelProperty(notes = "删除标识(D:已删除;N:未删除)")
private String deletedFlag; private String deletedFlag;
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.strategy.remote;
import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiParam;
import cn.com.glsx.framework.core.annotation.ApiResponse;
import cn.com.glsx.framework.core.annotation.ApiService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
@ApiService(value = "策略人员消息关联服务", owner = "strategy")
public interface StrategyStaffMessageRemote {
@ApiMethod("根据消息盒子ID和手机号更新业务消息记录的已读状态")
@ApiParam(name = "messageId", notes = "消息盒子ID", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("是否更新成功")
RpcResponse<Boolean> updateReadStatusByMessageId(Integer messageId);
@ApiMethod("通过MessageId查询业务消息详情")
@ApiParam(name = "messageId", notes = "消息ID", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("业务消息详情对象")
RpcResponse<Object> getBusinessMessageDetailByMessageId(Integer messageId);
}
\ No newline at end of file \ No newline at end of file
...@@ -2,8 +2,16 @@ package cn.com.glsx.dj.strategy.mapper; ...@@ -2,8 +2,16 @@ package cn.com.glsx.dj.strategy.mapper;
import cn.com.glsx.dj.strategy.model.StrategyStaffMessage; import cn.com.glsx.dj.strategy.model.StrategyStaffMessage;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper @Mapper
public interface StrategyStaffMessageMapper extends OreMapper<StrategyStaffMessage> { public interface StrategyStaffMessageMapper extends OreMapper<StrategyStaffMessage> {
}
/**
* 根据消息ID和手机号更新阅读状态
* @param messageId 消息ID
* @return 更新记录数
*/
int updateReadStatusByMessageId(@Param("messageId") Integer messageId);
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.strategy.remote;
import cn.com.glsx.dj.strategy.enums.StrategyErrorEnum;
import cn.com.glsx.dj.strategy.service.StrategyStaffMessageService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@DubboService(protocol = "dubbo", version = "1.0.0", timeout = 30000)
public class StrategyStaffMessageRemoteImpl implements StrategyStaffMessageRemote {
@Autowired
private StrategyStaffMessageService strategyStaffMessageService;
@Override
public RpcResponse<Boolean> updateReadStatusByMessageId(Integer messageId) {
try {
Boolean result = strategyStaffMessageService.updateReadStatusByMessageId(messageId);
return RpcResponse.success(result);
} catch (Exception e) {
log.error("根据消息盒子ID和手机号更新业务消息记录的已读状态失败,messageId={}", messageId, e);
throw new RpcServiceException(StrategyErrorEnum.BUSINESS_EXCEPTION, "更新策略人员消息阅读状态失败");
}
}
@Override
public RpcResponse<Object> getBusinessMessageDetailByMessageId(Integer messageId) {
try {
Object result = strategyStaffMessageService.getBusinessMessageDetailByMessageId(messageId);
return RpcResponse.success(result);
} catch (Exception e) {
log.error("通过MessageId查询业务消息详情失败,messageId={}", messageId, e);
throw new RpcServiceException(StrategyErrorEnum.BUSINESS_EXCEPTION, "查询策略人员消息详情失败");
}
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.strategy.service;
import cn.com.glsx.dj.strategy.enums.StrategyTypeEnum;
import cn.com.glsx.dj.strategy.mapper.StrategyInfoMapper;
import cn.com.glsx.dj.strategy.mapper.StrategyStaffMessageMapper;
import cn.com.glsx.dj.strategy.model.StrategyInfo;
import cn.com.glsx.dj.strategy.model.StrategyStaffMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Slf4j
public class StrategyStaffMessageService {
@Autowired
private StrategyStaffMessageMapper strategyStaffMessageMapper;
@Autowired
private StrategyInfoMapper strategyInfoMapper;
/**
* 根据消息盒子ID和手机号更新业务消息记录的已读状态
* @param messageId 消息盒子ID
* @return 是否更新成功
*/
@Transactional
public Boolean updateReadStatusByMessageId(Integer messageId) {
int rowsAffected = strategyStaffMessageMapper.updateReadStatusByMessageId(messageId);
log.info("更新策略人员消息阅读状态,消息ID:{},影响行数:{}", messageId, rowsAffected);
return rowsAffected > 0;
}
/**
* 根据消息ID查询业务消息详情
* @param messageId 消息ID
* @return 业务消息详情
*/
public Object getBusinessMessageDetailByMessageId(Integer messageId) {
StrategyStaffMessage example = new StrategyStaffMessage();
example.setMessageId(messageId);
example.setDeletedFlag("N");
StrategyStaffMessage staffMessage = strategyStaffMessageMapper.selectOne(example);
if (staffMessage == null) {
log.warn("未找到对应的消息记录,messageId:{}", messageId);
return null;
}
Integer strategyId = staffMessage.getStrategyId();
StrategyInfo strategyInfo = strategyInfoMapper.selectByPrimaryKey(strategyId);
if (strategyInfo == null) {
log.warn("未找到对应的策略详情,strategyId:{}", strategyId);
return null;
}
if (StrategyTypeEnum.TASK.equals(strategyInfo.getStrategyType())) {
return strategyInfo;
} else {
// 其他类型,返回null TODO 待实现 0-学习类,1-优秀录音分享类,剩余类型暂时无推送消息
return null;
}
}
}
\ No newline at end of file \ No newline at end of file
...@@ -22,12 +22,23 @@ ...@@ -22,12 +22,23 @@
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, strategy_id, uuid, phone, staff_name, message_id, push_status, read_status, id, strategy_id, uuid, phone, staff_name, message_id, push_status, read_status, read_time,
read_time, read_count, latest_read_time, created_by, created_date, updated_by, read_count, latest_read_time, created_by, created_date, updated_by, updated_date, deleted_flag
updated_date, deleted_flag
</sql> </sql>
</mapper>
<update id="updateReadStatusByMessageId">
UPDATE dj_car_life_strategy_staff_message
SET read_status = 1,
read_time = NOW(),
latest_read_time = NOW(),
read_count = IFNULL(read_count, 0) + 1,
updated_date = NOW()
WHERE message_id = #{messageId,jdbcType=INTEGER}
AND deleted_flag = 'N'
</update>
</mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!