|
@@ -11,11 +11,14 @@ import com.management.platform.mapper.WxCorpInfoMapper;
|
|
|
import com.management.platform.service.InformationService;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
import com.management.platform.util.MessageUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -50,22 +53,30 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
|
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("company_id",user.getCompanyId()));
|
|
|
+ Map<String, User> companyUserMap = users.stream().collect(Collectors.toMap(User::getId, t -> t));
|
|
|
for (Information info : information) {
|
|
|
- if (info.getMsg() == null){
|
|
|
- continue;
|
|
|
- } else if (info.getMsg().contains("更新任务进展为")){
|
|
|
- String name = info.getMsg().substring(0, info.getMsg().indexOf("更新任务进展为"));
|
|
|
- String userWxId = "";
|
|
|
- for (User item : users) {
|
|
|
- if (name.equals(item.getName())){
|
|
|
- userWxId = item.getCorpwxRealUserid();
|
|
|
- break;
|
|
|
- }
|
|
|
+ if(StringUtils.isNotBlank(info.getMsg())){
|
|
|
+ User tmpUser = companyUserMap.get(info.getUserId());
|
|
|
+ if(null != tmpUser){
|
|
|
+ String replace = info.getMsg().replace(tmpUser.getName(), "$username=" + tmpUser.getCorpwxUserid() + "$");
|
|
|
+ info.setMsg(replace);
|
|
|
}
|
|
|
- String msg = info.getMsg();
|
|
|
- String newMsg = msg.replace(name, "$userName=" + userWxId + "$");
|
|
|
- info.setMsg(newMsg);
|
|
|
}
|
|
|
+// if (info.getMsg() == null){
|
|
|
+// continue;
|
|
|
+// } else if (info.getMsg().contains("更新任务进展为")){
|
|
|
+// String name = info.getMsg().substring(0, info.getMsg().indexOf("更新任务进展为"));
|
|
|
+// String userWxId = "";
|
|
|
+// for (User item : users) {
|
|
|
+// if (name.equals(item.getName())){
|
|
|
+// userWxId = item.getCorpwxRealUserid();
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// String msg = info.getMsg();
|
|
|
+// String newMsg = msg.replace(name, "$userName=" + userWxId + "$");
|
|
|
+// info.setMsg(newMsg);
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
|