|
@@ -3,8 +3,12 @@ package com.management.platform.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.management.platform.entity.Information;
|
|
import com.management.platform.entity.Information;
|
|
|
|
+import com.management.platform.entity.TaskComment;
|
|
|
|
+import com.management.platform.entity.User;
|
|
|
|
+import com.management.platform.entity.WxCorpInfo;
|
|
import com.management.platform.mapper.InformationMapper;
|
|
import com.management.platform.mapper.InformationMapper;
|
|
import com.management.platform.mapper.UserMapper;
|
|
import com.management.platform.mapper.UserMapper;
|
|
|
|
+import com.management.platform.mapper.WxCorpInfoMapper;
|
|
import com.management.platform.service.InformationService;
|
|
import com.management.platform.service.InformationService;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.MessageUtils;
|
|
import com.management.platform.util.MessageUtils;
|
|
@@ -12,6 +16,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -30,13 +35,37 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
|
|
@Resource
|
|
@Resource
|
|
private UserMapper userMapper;
|
|
private UserMapper userMapper;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private WxCorpInfoMapper wxCorpInfoMapper;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg getInformationList(HttpServletRequest request) {
|
|
public HttpRespMsg getInformationList(HttpServletRequest request) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
try {
|
|
try {
|
|
- String userId = userMapper.selectById(request.getHeader("Token")).getId();
|
|
|
|
- httpRespMsg.data = informationMapper.selectList(new QueryWrapper<Information>()
|
|
|
|
- .eq("user_id", userId).orderByDesc("time").last("LIMIT 10"));
|
|
|
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
|
+ List<Information> information = informationMapper.selectList(new QueryWrapper<Information>()
|
|
|
|
+ .eq("user_id", user.getId()).orderByDesc("time").last("LIMIT 10"));
|
|
|
|
+ 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()));
|
|
|
|
+ for (Information info : information) {
|
|
|
|
+ if (info.getMsg() == null){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String name = info.getMsg().substring(0, info.getMsg().indexOf("更新任务进展为"));
|
|
|
|
+ String userWxId = "";
|
|
|
|
+ for (User item : users) {
|
|
|
|
+ if (item.getName().equals(name)){
|
|
|
|
+ userWxId = item.getCorpwxRealUserid();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String msg = info.getMsg();
|
|
|
|
+ String newMsg = msg.replace(name, "$userName=" + userWxId + "$");
|
|
|
|
+ info.setMsg(newMsg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ httpRespMsg.data = information;
|
|
} catch (NullPointerException e) {
|
|
} catch (NullPointerException e) {
|
|
//httpRespMsg.setError("验证失败");
|
|
//httpRespMsg.setError("验证失败");
|
|
httpRespMsg.setError(MessageUtils.message("access.verificationError"));
|
|
httpRespMsg.setError(MessageUtils.message("access.verificationError"));
|