Commit 7a7db8b2 by danmo

修复回调方法报错问题

1 parent c479784a
package com.linkwechat.framework.handler;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
......@@ -28,10 +29,9 @@ public class WeMetaObjectHandler implements MetaObjectHandler {
this.setFieldValByName(CREATE_TIME, new Date(), metaObject);
this.setFieldValByName(UPDATE_TIME, new Date(), metaObject);
//创建人
if (StringUtils.isNotEmpty(SecurityUtils.getUsername())) {
this.setFieldValByName(CREATE_BY, SecurityUtils.getUsername(), metaObject);
this.setFieldValByName(UPDATE_BY, SecurityUtils.getUsername(), metaObject);
}
String userName = getUserName();
this.setFieldValByName(CREATE_BY, userName, metaObject);
this.setFieldValByName(UPDATE_BY, userName, metaObject);
}
@Override
......@@ -39,8 +39,16 @@ public class WeMetaObjectHandler implements MetaObjectHandler {
//更新时间
this.setFieldValByName(UPDATE_TIME, new Date(), metaObject);
//更新人
if (StringUtils.isNotEmpty(SecurityUtils.getUsername())) {
this.setFieldValByName(UPDATE_BY, SecurityUtils.getUsername(), metaObject);
this.setFieldValByName(UPDATE_BY, getUserName(), metaObject);
}
private String getUserName() {
String userName;
try {
userName = SecurityUtils.getUsername();
} catch (CustomException e){
userName = "admin";
}
return userName;
}
}
package com.linkwechat.wecom.factory.impl.customer;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.config.CosConfig;
......@@ -166,7 +167,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
// 新客拉群创建的员工活码欢迎语图片(群活码图片)
String codeUrl = weGroupCodeService.selectGroupCodeUrlByEmplCodeState(state);
if (StringUtils.isNotNull(codeUrl)) {
buildWelcomeMsgImg(weWelcomeMsgBuilder, codeUrl, codeUrl.replaceAll(cosConfig.getCosImgUrlPrefix(), ""));
buildWelcomeMsgImg(weWelcomeMsgBuilder, codeUrl, FileUtil.getName(codeUrl));
}
// 普通员工活码欢迎语图片
else if (StringUtils.isNotEmpty(messageMap.getCategoryId())) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!