| | |
| | | import java.io.BufferedReader;
|
| | | import java.io.IOException;
|
| | | import java.security.SignatureException;
|
| | | import java.util.Map;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.crypto.Mac;
|
| | |
| | | msg = "[语音]";
|
| | | String customizedId = json.optJSONObject("customizedData").optString("设备标识");
|
| | | msgDeviceReadStateService.addUnreadDeviceMsg(MsgDeviceReadState.TYPE_KEFU, customizedId,
|
| | | "android".equalsIgnoreCase(deviceOS) ? 1 : 2, 1, msg);
|
| | | "android".equalsIgnoreCase(deviceOS) ? 1 : 2, 1, msg,new Date());
|
| | | }
|
| | |
|
| | | LogHelper.test("美洽:body----" + sb.toString());
|
| | |
| | | vo.setRead(false);
|
| | | else
|
| | | vo.setRead(true);
|
| | |
|
| | | if (kefuState.getLatestContentTime() != null)
|
| | | vo.setTime(kefuState.getLatestContentTime());
|
| | |
|
| | | } else
|
| | | vo.setRead(true);
|
| | |
|
| | |
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 上传最近的客服消息
|
| | | * |
| | | * @param acceptData
|
| | | * @param content
|
| | | * @param time
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "uploadLatestKeFuMsg", method = RequestMethod.POST)
|
| | | public void uploadLatestKeFuMsg(AcceptData acceptData, String content, Long time, PrintWriter out) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(content) || time == null) {
|
| | | out.print(JsonUtil.loadFalseResult("参数不完整"));
|
| | | return;
|
| | | }
|
| | | msgDeviceReadStateService.addUnreadDeviceMsg(MsgDeviceReadState.TYPE_KEFU, acceptData.getDevice(),
|
| | | "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, 0, content, new Date(time));
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Column(name = "mdrs_unread_count")
|
| | | private Integer unReadCount;
|
| | | @Column(name = "mdrs_latest_content")
|
| | | private String latestContent;//最近的未读消息
|
| | | private String latestContent;// 最近的未读消息
|
| | | @Column(name = "mdrs_latest_content_time")
|
| | | private Date latestContentTime;// 最近的未读消息
|
| | | @Column(name = "mdrs_createtime")
|
| | | private Date createTime;
|
| | | @Column(name = "mdrs_update_time")
|
| | |
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | |
| | |
|
| | | public String getLatestContent() {
|
| | | return latestContent;
|
| | | }
|
| | |
| | | public void setLatestContent(String latestContent) {
|
| | | this.latestContent = latestContent;
|
| | | }
|
| | |
|
| | | public Date getLatestContentTime() {
|
| | | return latestContentTime;
|
| | | }
|
| | |
|
| | | public void setLatestContentTime(Date latestContentTime) {
|
| | | this.latestContentTime = latestContentTime;
|
| | | }
|
| | | }
|
| | |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="mdrs_latest_content" property="latestContent" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="mdrs_latest_content_time" property="latestContentTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">mdrs_id,mdrs_device,mdrs_platform,mdrs_type,mdrs_read_time,mdrs_unread_count,mdrs_create_time,mdrs_update_time,mdrs_latest_content |
| | | <sql id="Base_Column_List">mdrs_id,mdrs_device,mdrs_platform,mdrs_type,mdrs_read_time,mdrs_unread_count,mdrs_create_time,mdrs_update_time,mdrs_latest_content,mdrs_latest_content_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_msg_device_read_state |
| | | (mdrs_id,mdrs_device,mdrs_platform,mdrs_type,mdrs_read_time,mdrs_unread_count,mdrs_create_time,mdrs_update_time,mdrs_latest_content) |
| | | (mdrs_id,mdrs_device,mdrs_platform,mdrs_type,mdrs_read_time,mdrs_unread_count,mdrs_create_time,mdrs_update_time,mdrs_latest_content,mdrs_latest_content_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{platform,jdbcType=INTEGER},#{type,jdbcType=VARCHAR},#{readTime,jdbcType=TIMESTAMP},#{unReadCount,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{latestContent,jdbcType=VARCHAR}) |
| | | (#{id,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{platform,jdbcType=INTEGER},#{type,jdbcType=VARCHAR},#{readTime,jdbcType=TIMESTAMP},#{unReadCount,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{latestContent,jdbcType=VARCHAR},#{latestContentTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="createTime != null">mdrs_create_time,</if> |
| | | <if test="updateTime != null">mdrs_update_time,</if> |
| | | <if test="latestContent != null">mdrs_latest_content,</if> |
| | | <if test="latestContentTime != null">mdrs_latest_content_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="latestContent != null">#{latestContent,jdbcType=VARCHAR}</if> |
| | | <if test="latestContentTime != null">#{latestContentTime,jdbcType=TIMESTAMP}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState">update |
| | |
| | | #{unReadCount,jdbcType=INTEGER},mdrs_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},mdrs_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,mdrs_latest_content |
| | | =#{latestContent,jdbcType=VARCHAR} where mdrs_id = |
| | | #{id,jdbcType=BIGINT}</update> |
| | | =#{latestContent,jdbcType=VARCHAR},mdrs_latest_content_time |
| | | =#{latestContentTime,jdbcType=TIMESTAMP} where mdrs_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState"> |
| | | update yeshi_ec_msg_device_read_state |
| | | <set> |
| | |
| | | <if test="id !=null">mdrs_id =#{id,jdbcType=BIGINT},</if> |
| | | <if test="latestContent !=null">mdrs_latest_content =#{latestContent,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="latestContentTime !=null">mdrs_latest_content_time =#{latestContentTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where mdrs_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="setAllMsgRead">update yeshi_ec_msg_device_read_state set |
| | | mdrs_read_time=now(),mdrs_unread_count=0,mdrs_update_time=now() where |
| | | mdrs_device=#{device} and mdrs_platform=#{platform}</update> |
| | | mdrs_device=#{device} and mdrs_platform=#{platform} |
| | | </update> |
| | | </mapper> |
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void addUnreadDeviceMsg(String type, String device, int platform, int msgCount, String msg) {
|
| | | public void addUnreadDeviceMsg(String type, String device, int platform, int msgCount, String msg,Date msgTime) {
|
| | | MsgDeviceReadState state = msgDeviceReadStateMapper.selectByDeviceAndPlatformAndType(device, platform, type);
|
| | | if (state != null) {
|
| | | MsgDeviceReadState update = new MsgDeviceReadState();
|
| | |
| | | update.setUnReadCount(state.getUnReadCount() + msgCount);
|
| | | update.setUpdateTime(new Date());
|
| | | update.setLatestContent(msg);
|
| | | update.setLatestContentTime(msgTime);
|
| | | msgDeviceReadStateMapper.updateByPrimaryKeySelective(update);
|
| | | } else {
|
| | | state = new MsgDeviceReadState();
|
| | |
| | | state.setUnReadCount(msgCount);
|
| | | state.setUpdateTime(new Date());
|
| | | state.setLatestContent(msg);
|
| | | state.setLatestContentTime(msgTime);
|
| | | msgDeviceReadStateMapper.insertSelective(state);
|
| | | }
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.msg;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | public void setDeviceMsgRead(String type, String device, int platform);
|
| | |
|
| | |
|
| | | /**
|
| | | * 添加设备未读消息
|
| | | * |
| | | * @param type
|
| | | * @param device
|
| | | * @param platform
|
| | | * @param msgCount
|
| | | * @param msg
|
| | | * @param msgTime -消息发生时间
|
| | | */
|
| | | public void addUnreadDeviceMsg(String type, String device, int platform, int msgCount, String msg);
|
| | | public void addUnreadDeviceMsg(String type, String device, int platform, int msgCount, String msg,Date msgTime);
|
| | |
|
| | | /**
|
| | | * 设置所有消息已读
|
| | |
| | | tg.setSalesType(1);
|
| | | // 测试使用
|
| | | // tg.setSalesType(Math.random() > 0.5 ? tg.getSalesType() : 3);
|
| | | if(Constant.IS_TEST)
|
| | | {
|
| | | List<ClientTextStyleVO> labels = new ArrayList<>();
|
| | | labels.add(new ClientTextStyleVO("标签内容", "#F14242"));
|
| | | labels.add(new ClientTextStyleVO("标签内容", "#00FF00"));
|
| | | tg.setLabels(labels);
|
| | | }
|
| | | return tg;
|
| | | }
|
| | |
|