记得上下班打卡 | git大法好,push需谨慎

Commit d7a061e5 authored by sunyuntian's avatar sunyuntian

修改bug

parent 2885bb49
...@@ -51,17 +51,26 @@ public class SweetWechatMaoDengController { ...@@ -51,17 +51,26 @@ public class SweetWechatMaoDengController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "userId", value = "userId"), @ApiImplicitParam(type = "query", dataType = "String", name = "userId", value = "userId"),
@ApiImplicitParam(type = "query", dataType = "String", name = "imgUrl", value = "imgUrl"), @ApiImplicitParam(type = "query", dataType = "String", name = "imgUrl", value = "imgUrl"),
@ApiImplicitParam(type = "query", dataType = "String", name = "maoId", value = "maoId"),
}) })
public ResponseDto addBuilderImg(@RequestParam(value = "userId",required = false) String userId, public ResponseDto addBuilderImg(@RequestParam(value = "userId",required = false) String userId,
@RequestParam(value = "imgUrl",required = false)String imgUrl, @RequestParam(value = "imgUrl",required = false)String imgUrl){
@RequestParam(value = "maoId",required = false)String maoId){
//redis队列入库 SweetMaoDengVo sweetMaoDeng = redisUtils.getSweetMaoDeng(userId);
LinkedList<String> sqls = CollectionUtil.linkedListString(); String textMsg = sweetMaoDeng.getTextMsg();
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr(); String picUrl = sweetMaoDeng.getPicUrl();
sqls.add(SqlMapping.get("sweet_wechat_maodeng.insert_img")); sweetMaoDeng.setImgUrl(imgUrl);
sqlsDataA.add(new Object[]{imgUrl,userId,maoId}); redisUtils.setSweetMaoDeng(sweetMaoDeng);
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_WECHAT_MAODENG_TEXT_INSERT.getKey(), SqlMapping.gets(sqls, sqlsDataA)); if (StringUtil.isNotEmpty(textMsg) && StringUtil.isNotEmpty(picUrl)){
String maoId = IDGenerator.nextSnowId();
//redis队列入库
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
sqls.add(SqlMapping.get("sweet_wechat_maodeng.insert"));
sqlsDataA.add(new Object[]{maoId, userId, textMsg, picUrl,imgUrl});
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_WECHAT_MAODENG_TEXT_INSERT.getKey(), SqlMapping.gets(sqls, sqlsDataA));
}
return ResponseDto.success(); return ResponseDto.success();
} }
......
package com.liquidnet.service.sweet.handler; package com.liquidnet.service.sweet.handler;
import com.liquidnet.common.third.shumei.util.ShumeiUtil; import com.liquidnet.common.third.shumei.util.ShumeiUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil; import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator; import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.StringUtil; import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.sweet.utils.QueueUtils; import com.liquidnet.service.sweet.utils.QueueUtils;
import com.liquidnet.service.sweet.utils.WechatUsersRedisUtils; import com.liquidnet.service.sweet.utils.WechatUsersRedisUtils;
import com.liquidnet.service.sweet.vo.SweetMaoDengVo; import com.liquidnet.service.sweet.vo.SweetMaoDengVo;
...@@ -21,7 +18,6 @@ import me.chanjar.weixin.mp.bean.message.WxMpXmlOutTextMessage; ...@@ -21,7 +18,6 @@ import me.chanjar.weixin.mp.bean.message.WxMpXmlOutTextMessage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.LinkedList;
import java.util.Map; import java.util.Map;
@Component @Component
...@@ -58,35 +54,14 @@ public class MaoDengImageHandler implements WxMpMessageHandler { ...@@ -58,35 +54,14 @@ public class MaoDengImageHandler implements WxMpMessageHandler {
if (StringUtil.isNotEmpty(i)){ if (StringUtil.isNotEmpty(i)){
//活动已开启 持久化 redis //活动已开启 持久化 redis
SweetMaoDengVo sweetMaoDeng = redisUtils.getSweetMaoDeng(fromUser); SweetMaoDengVo sweetMaoDeng = redisUtils.getSweetMaoDeng(fromUser);
String maoIdText =null;
if (sweetMaoDeng != null){
maoIdText= sweetMaoDeng.getMaoId();
}
if (StringUtil.isNotEmpty(maoIdText)){ if (sweetMaoDeng != null){
String textMsg = sweetMaoDeng.getTextMsg(); String textMsg = sweetMaoDeng.getTextMsg();
sweetMaoDengVo.setTextMsg(textMsg); sweetMaoDengVo.setTextMsg(textMsg);
maoId = sweetMaoDeng.getMaoId();
sweetMaoDengVo.setMaoId(maoId);
//更新mysql
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
sqls.add(SqlMapping.get("sweet_wechat_maodeng.img.update"));
sqlsDataA.add(new Object[]{picUrl,fromUser,maoId});
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_WECHAT_MAODENG_TEXT_INSERT.getKey(), SqlMapping.gets(sqls, sqlsDataA));
}else {
sweetMaoDengVo.setMaoId(maoId);
//redis队列入库
sweetMaoDengVo.setMaoId(maoId);
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
sqls.add(SqlMapping.get("sweet_wechat_maodeng.insert"));
sqlsDataA.add(new Object[]{maoId, fromUser, null, picUrl,null});
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_WECHAT_MAODENG_TEXT_INSERT.getKey(), SqlMapping.gets(sqls, sqlsDataA));
} }
redisUtils.setSweetMaoDeng(sweetMaoDengVo); redisUtils.setSweetMaoDeng(sweetMaoDengVo);
return null;
} }
return null; return null;
} }
} }
...@@ -78,32 +78,13 @@ public class TextMsgHandler implements WxMpMessageHandler { ...@@ -78,32 +78,13 @@ public class TextMsgHandler implements WxMpMessageHandler {
if (StringUtil.isNotEmpty(i)) { if (StringUtil.isNotEmpty(i)) {
SweetMaoDengVo sweetMaoDeng = redisUtils.getSweetMaoDeng(fromUser); SweetMaoDengVo sweetMaoDeng = redisUtils.getSweetMaoDeng(fromUser);
String maoIdText =null; if (sweetMaoDeng != null) {
if (sweetMaoDeng != null){
maoIdText= sweetMaoDeng.getMaoId();
}
if (StringUtil.isNotEmpty(maoIdText)) {
String picUrl = sweetMaoDeng.getPicUrl(); String picUrl = sweetMaoDeng.getPicUrl();
sweetMaoDengVo.setPicUrl(picUrl); sweetMaoDengVo.setPicUrl(picUrl);
maoId=sweetMaoDeng.getMaoId();
sweetMaoDengVo.setMaoId(maoId);
//更新mysql
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
sqls.add(SqlMapping.get("sweet_wechat_maodeng.text.update"));
sqlsDataA.add(new Object[]{fromUser, maoContent,maoId});
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_WECHAT_MAODENG_TEXT_INSERT.getKey(), SqlMapping.gets(sqls, sqlsDataA));
}else {
sweetMaoDengVo.setMaoId(maoId);
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
sqls.add(SqlMapping.get("sweet_wechat_maodeng.insert"));
sqlsDataA.add(new Object[]{maoId, fromUser, maoContent, null,null});
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_WECHAT_MAODENG_TEXT_INSERT.getKey(), SqlMapping.gets(sqls, sqlsDataA));
} }
redisUtils.setSweetMaoDeng(sweetMaoDengVo); redisUtils.setSweetMaoDeng(sweetMaoDengVo);
return null;
} }
......
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