|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.util.StringUtil;
|
|
|
import com.management.platform.entity.*;
|
|
|
import com.management.platform.entity.bo.QueryTaskChargePage;
|
|
|
+import com.management.platform.entity.vo.OtherTaskFileInfoVO;
|
|
|
import com.management.platform.entity.vo.TaskFileChargePageVO;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.*;
|
|
@@ -16,6 +17,7 @@ import com.management.platform.util.ExcelUtil;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
import com.management.platform.util.MessageUtils;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
@@ -987,6 +989,90 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg getOtherTaskChargePage(QueryTaskChargePage queryBO, HttpServletRequest request) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ String userId = request.getHeader("Token");
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
+ queryBO.setUserId(userId);
|
|
|
+ queryBO.setCompanyId(companyId);
|
|
|
+ queryBO.setPageIndex((queryBO.getPageIndex()-1)*queryBO.getPageSize());
|
|
|
+
|
|
|
+ List<Integer> branchDepartment=null;
|
|
|
+ if(queryBO.getDeptId()!=null){
|
|
|
+ List<Department> departmentList=departmentService.list(new QueryWrapper<Department>().eq("company_id",companyId));
|
|
|
+ branchDepartment= getBranchDepartment(queryBO.getDeptId(), departmentList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<OtherTaskFileInfoVO> list = taskMapper.getOtherTaskChargePage(queryBO,branchDepartment);
|
|
|
+ List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, user.getCompanyId())
|
|
|
+ .eq(User::getIsActive, 1)
|
|
|
+ );
|
|
|
+
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
|
|
|
+ CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(list)){
|
|
|
+ Map<String, User> userMap = users.stream().collect(Collectors.toMap(User::getId, t -> t));
|
|
|
+ for (OtherTaskFileInfoVO otherTaskFileInfoVO : list) {
|
|
|
+ User createrUser = userMap.get(otherTaskFileInfoVO.getCreatorId());
|
|
|
+ User finalChargeUser = userMap.get(otherTaskFileInfoVO.getFinalChargeId());
|
|
|
+ String createrUserWxId = "";
|
|
|
+ String chargeUserWxId = "";
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ createrUserWxId = createrUser.getCorpwxRealUserid();
|
|
|
+ chargeUserWxId = finalChargeUser.getCorpwxRealUserid();
|
|
|
+ }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
+ createrUserWxId = createrUser.getDingdingUserid();
|
|
|
+ chargeUserWxId = finalChargeUser.getDingdingUserid();
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(createrUserWxId)){
|
|
|
+ otherTaskFileInfoVO.setCreatorName("$userName=" + createrUserWxId + "$");
|
|
|
+ }else{
|
|
|
+ otherTaskFileInfoVO.setCreatorName(createrUser.getName());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(chargeUserWxId)){
|
|
|
+ otherTaskFileInfoVO.setFinalChargeName("$userName=" + chargeUserWxId + "$");
|
|
|
+ }else{
|
|
|
+ otherTaskFileInfoVO.setFinalChargeName(finalChargeUser.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int total = taskMapper.getOtherTaskChargePageTotal(queryBO,branchDepartment);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("records", list);
|
|
|
+ map.put("total", total);
|
|
|
+ msg.data = map;
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg sendMsgToChargers(String ids, HttpServletRequest request) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ String userId = request.getHeader("Token");
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
+
|
|
|
+ String[] split = ids.split(",");
|
|
|
+ if(0 == split.length){
|
|
|
+ msg.setError("审核文件不能为空");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> list = Arrays.asList(split);
|
|
|
+ List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getId, list));
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
+
|
|
|
+ String collect = users.stream().map(User::getCorpwxUserid).distinct().collect(Collectors.joining(","));
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(users)){
|
|
|
+ wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,collect,"请尽快完成任务文件的审核",null
|
|
|
+ , WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_CHECK);
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
private List<Integer> getBranchDepartment(Integer departmentId, List<Department> departmentList) {
|
|
|
List<Integer> list = new ArrayList<>();
|
|
|
list.add(departmentId);
|