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

Commit bc85ccca authored by sunyuntian's avatar sunyuntian

添加时间

parent 312a77c3
......@@ -45,7 +45,10 @@ public class MaoDengImageHandler implements WxMpMessageHandler {
@Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> map, WxMpService wxMpService, WxSessionManager wxSessionManager) throws WxErrorException {
String fromUser = wxMessage.getFromUser();//用户id
String picUrl = wxMessage.getPicUrl();//图片url
String picUrl = wxMessage.getPicUrl().replace("http","https");//图片urlmao
log.debug("[openId] = " + wxMessage.getOpenId());
log.debug("[unionId] = " + wxMessage.getUnionId());
//猫登天空活动开启
if (StringUtil.isNotEmpty(redisUtils.getSweetMaoDengOpen(fromUser))) {
......
......@@ -12,6 +12,7 @@ import com.liquidnet.service.sweet.utils.QueueUtils;
import com.liquidnet.service.sweet.utils.WechatUsersRedisUtils;
import com.liquidnet.service.sweet.vo.SweetMaoDengVo;
import com.liquidnet.service.sweet.vo.SweetWechatUsersVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -19,6 +20,7 @@ import java.time.LocalDateTime;
import java.util.LinkedList;
@Service
@Slf4j
public class SweetWechatMaoDengServiceImpl {
@Autowired
......@@ -28,31 +30,39 @@ public class SweetWechatMaoDengServiceImpl {
@Autowired
WechatMaConfigure maConfigure;
public ResponseDto addBuilderImg(String userId,String imgUrl){
public ResponseDto addBuilderImg(String userId, String imgUrl) {
LocalDateTime localDateTime = DateUtil.asLocalDateTime(DateUtil.now()); //生成创建时间
try {
log.error("[userId] = {}", userId);
log.error("[imgUrl] = {}", imgUrl);
String maoId = IDGenerator.nextSnowId();
SweetWechatUsersVo wechatUsers = redisUtils.getSweetWechatUsersOfUnionId(userId, 1);
if (null == wechatUsers) {
return ResponseDto.failure("请求失败");
}
SweetMaoDengVo sweetMaoDeng = redisUtils.getSweetMaoDeng(wechatUsers.getOpenId());
if (sweetMaoDeng != null){
if (sweetMaoDeng != null) {
sweetMaoDeng.setImgUrl(imgUrl);
}
String textMsg = sweetMaoDeng.getTextMsg();
String picUrl = sweetMaoDeng.getPicUrl();
sweetMaoDeng.setCreatedAt(localDateTime);
redisUtils.setSweetMaoDeng(sweetMaoDeng);
if (StringUtil.isNotEmpty(textMsg) && StringUtil.isNotEmpty(picUrl)){
if (StringUtil.isNotEmpty(textMsg) && StringUtil.isNotEmpty(picUrl)) {
//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,localDateTime});
sqlsDataA.add(new Object[]{maoId, userId, textMsg, picUrl, imgUrl,localDateTime});
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_WECHAT_MAODENG_TEXT_INSERT.getKey(), SqlMapping.gets(sqls, sqlsDataA));
return ResponseDto.failure("请求成功");
}
return ResponseDto.failure("请求失败");
} catch (Exception e) {
e.printStackTrace();
log.error("[ERROR] = {}", e);
return ResponseDto.failure("请求失败");
}
}
}
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