|
@@ -3,6 +3,7 @@ package com.management.platform.service.impl;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.aliyun.dingtalkcontact_1_0.models.SearchUserResponse;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
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;
|
|
@@ -101,6 +102,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
@Resource
|
|
@Resource
|
|
private ReportLogDetailMapper reportLogDetailMapper;
|
|
private ReportLogDetailMapper reportLogDetailMapper;
|
|
@Resource
|
|
@Resource
|
|
|
|
+ private CompanyDingdingService companyDingdingService;
|
|
|
|
+ @Resource
|
|
private ReportBatchMapper reportBatchMapper;
|
|
private ReportBatchMapper reportBatchMapper;
|
|
@Resource
|
|
@Resource
|
|
private ReportLogDetailService reportLogDetailService;
|
|
private ReportLogDetailService reportLogDetailService;
|
|
@@ -159,8 +162,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
@Resource
|
|
@Resource
|
|
private SapProjectServiceMapper sapProjectServiceMapper;
|
|
private SapProjectServiceMapper sapProjectServiceMapper;
|
|
@Resource
|
|
@Resource
|
|
- private CompanyDingdingService companyDingdingService;
|
|
|
|
- @Resource
|
|
|
|
private InformationMapper informationMapper;
|
|
private InformationMapper informationMapper;
|
|
@Resource
|
|
@Resource
|
|
private TimeTypeMapper timeTypeMapper;
|
|
private TimeTypeMapper timeTypeMapper;
|
|
@@ -1043,8 +1044,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
public HttpRespMsg editReport(List<Report> reportList, String date, List<User> userList, BigDecimal hourCost, Integer companyId, String summary) {
|
|
public HttpRespMsg editReport(List<Report> reportList, String date, List<User> userList, BigDecimal hourCost, Integer companyId, String summary) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
|
+ if ("null".equals(summary)) {
|
|
|
|
+ summary = null;
|
|
|
|
+ }
|
|
//删除不在本次更新名单中的老记录
|
|
//删除不在本次更新名单中的老记录
|
|
List<Integer> idList = reportList.stream().filter(r->r.getId() != null).map(Report::getId).collect(Collectors.toList());
|
|
List<Integer> idList = reportList.stream().filter(r->r.getId() != null).map(Report::getId).collect(Collectors.toList());
|
|
|
|
+ List<Report> allDateReportList = reportList;
|
|
//只有填写日报的report才会有id, 前端会把全部状态的日报都传过来
|
|
//只有填写日报的report才会有id, 前端会把全部状态的日报都传过来
|
|
if (idList.size() > 0) {
|
|
if (idList.size() > 0) {
|
|
if (date != null && !date.contains("@")) {
|
|
if (date != null && !date.contains("@")) {
|
|
@@ -1100,8 +1105,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
reportService.saveOrUpdateBatch(reportList);
|
|
reportService.saveOrUpdateBatch(reportList);
|
|
//成都明夷电子,需要生成批量记录
|
|
//成都明夷电子,需要生成批量记录
|
|
Company company = companyMapper.selectById(companyId);
|
|
Company company = companyMapper.selectById(companyId);
|
|
- System.out.println(company.getCompanyName()+", date==="+date);
|
|
|
|
-
|
|
|
|
if (company.getCompanyName().equals("成都明夷电子科技有限公司") || timeType.getEnableNewWeeklyfill() == 1) {//物奇需要填写周总结
|
|
if (company.getCompanyName().equals("成都明夷电子科技有限公司") || timeType.getEnableNewWeeklyfill() == 1) {//物奇需要填写周总结
|
|
if (date.contains("@")) {
|
|
if (date.contains("@")) {
|
|
//批量填报
|
|
//批量填报
|
|
@@ -1119,7 +1122,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
batch.setEndDate(LocalDate.parse(endDate, dateTimeFormatter));
|
|
batch.setEndDate(LocalDate.parse(endDate, dateTimeFormatter));
|
|
batch.setTotalWorkTime(reportList.stream().mapToDouble(Report::getWorkingTime).sum());
|
|
batch.setTotalWorkTime(reportList.stream().mapToDouble(Report::getWorkingTime).sum());
|
|
reportBatchMapper.insert(batch);
|
|
reportBatchMapper.insert(batch);
|
|
- System.out.println("生成了批记录batchId==="+batch.getId());
|
|
|
|
//更新batchId
|
|
//更新batchId
|
|
reportList.forEach(r->r.setBatchId(batch.getId()));
|
|
reportList.forEach(r->r.setBatchId(batch.getId()));
|
|
List<Integer> collect = reportList.stream().map(Report::getId).collect(Collectors.toList());
|
|
List<Integer> collect = reportList.stream().map(Report::getId).collect(Collectors.toList());
|
|
@@ -1132,7 +1134,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
//按周填报,需要保存周总结
|
|
//按周填报,需要保存周总结
|
|
//获取本周开始和结束的日期
|
|
//获取本周开始和结束的日期
|
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
- HttpRespMsg retMsg = getWeeklyFillReportData(dtf.format(dateList.get(0)), request);
|
|
|
|
|
|
+ HttpRespMsg retMsg = getWeeklyFillReportData(date, request);
|
|
HashMap mapItem = (HashMap)retMsg.data;
|
|
HashMap mapItem = (HashMap)retMsg.data;
|
|
List<HashMap> dateRange = (List<HashMap>)mapItem.get("dateList");
|
|
List<HashMap> dateRange = (List<HashMap>)mapItem.get("dateList");
|
|
LocalDate minDate = LocalDate.parse((String)dateRange.get(0).get("date"), dtf);
|
|
LocalDate minDate = LocalDate.parse((String)dateRange.get(0).get("date"), dtf);
|
|
@@ -1147,11 +1149,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
batch.setEndDate(maxDate);
|
|
batch.setEndDate(maxDate);
|
|
//周总结
|
|
//周总结
|
|
batch.setSummary(summary);
|
|
batch.setSummary(summary);
|
|
- batch.setTotalWorkTime(reportList.stream().filter(item->item.getCreatorId().equals(creatorId)).mapToDouble(Report::getWorkingTime).sum());
|
|
|
|
|
|
+ batch.setTotalWorkTime(allDateReportList.stream().filter(item->item.getCreatorId().equals(creatorId)).mapToDouble(Report::getWorkingTime).sum());
|
|
reportBatchMapper.insert(batch);
|
|
reportBatchMapper.insert(batch);
|
|
//更新batchId
|
|
//更新batchId
|
|
- List<Integer> curDateReportIds = reportList.stream().map(Report::getId).collect(Collectors.toList());
|
|
|
|
- System.out.println("curDateReportIds=="+curDateReportIds.size());
|
|
|
|
|
|
+ List<Integer> curDateReportIds = allDateReportList.stream().map(Report::getId).collect(Collectors.toList());
|
|
reportMapper.update(new Report().setBatchId(batch.getId()), new QueryWrapper<Report>().in("id", curDateReportIds));
|
|
reportMapper.update(new Report().setBatchId(batch.getId()), new QueryWrapper<Report>().in("id", curDateReportIds));
|
|
} else {
|
|
} else {
|
|
for (LocalDate curDate : dateList) {
|
|
for (LocalDate curDate : dateList) {
|
|
@@ -4585,6 +4586,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
String token = request.getHeader("TOKEN");
|
|
String token = request.getHeader("TOKEN");
|
|
User user = userMapper.selectById(token);
|
|
User user = userMapper.selectById(token);
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
|
+ CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, companyId));
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
//对于存在预算成本的公司,暂不支持导入工时
|
|
//对于存在预算成本的公司,暂不支持导入工时
|
|
Company company = companyMapper.selectById(companyId);
|
|
Company company = companyMapper.selectById(companyId);
|
|
@@ -4662,15 +4664,35 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
int deptColumnExtra = (hasDept?1:0);
|
|
int deptColumnExtra = (hasDept?1:0);
|
|
//下标从0开始
|
|
//下标从0开始
|
|
int projectNameStartIndex = (withCheckIn==null?2:(6 + deptColumnExtra));
|
|
int projectNameStartIndex = (withCheckIn==null?2:(6 + deptColumnExtra));
|
|
|
|
+ List<User> targetUserList=new ArrayList<>();
|
|
HttpRespMsg respMsg=new HttpRespMsg();
|
|
HttpRespMsg respMsg=new HttpRespMsg();
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
|
|
|
|
+ System.out.println("参与搜素的人员列表"+userNameList + userNameList.size());
|
|
respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
|
|
respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
|
|
if(respMsg.code.equals("0")){
|
|
if(respMsg.code.equals("0")){
|
|
msg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请使用工号!");
|
|
msg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请使用工号!");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
+ targetUserList= (List<User>) respMsg.data;
|
|
|
|
+ }
|
|
|
|
+ if(dingding!=null&&dingding.getContactNeedTranslate()==1&&userNameList.size()>0){
|
|
|
|
+ System.out.println("参与搜素的人员列表"+userNameList + userNameList.size());
|
|
|
|
+ for (String name : userNameList) {
|
|
|
|
+ respMsg= companyDingdingService.getSearchUserInfo(dingding,name,1);
|
|
|
|
+ SearchUserResponse searchUserResponse = (SearchUserResponse) respMsg.data;
|
|
|
|
+ if(searchUserResponse.body.totalCount>1){
|
|
|
|
+ msg.setError("姓名为["+name+"]的人员存在重复,请使用工号!");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ if(searchUserResponse.body.list.size()>0){
|
|
|
|
+ User item=new User();
|
|
|
|
+ //为了修改代码 此处用企业微信同一个字段 setCorpwxUserid
|
|
|
|
+ item.setName(name);
|
|
|
|
+ item.setCorpwxUserid(searchUserResponse.body.list.get(0));
|
|
|
|
+ targetUserList.add(item);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- List<User> targetUserList= (List<User>) respMsg.data;
|
|
|
|
int dataCount = 0;
|
|
int dataCount = 0;
|
|
|
|
|
|
for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
|
|
for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
|
|
@@ -4745,9 +4767,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
String username = withCheckIn==null?row.getCell(1).getStringCellValue().trim():row.getCell(2).getStringCellValue().trim();
|
|
String username = withCheckIn==null?row.getCell(1).getStringCellValue().trim():row.getCell(2).getStringCellValue().trim();
|
|
//检查人员是否存在
|
|
//检查人员是否存在
|
|
Optional<User> any;
|
|
Optional<User> any;
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
|
|
+ if((wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1)||(dingding!=null&&dingding.getContactNeedTranslate()==1)){
|
|
Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(username)).findFirst();
|
|
Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(username)).findFirst();
|
|
- any = allUserList.stream().filter(u -> u.getName().equals(username)||(u.getJobNumber()!=null&&u.getJobNumber().equals(username))||(optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findAny();
|
|
|
|
|
|
+ any = allUserList.stream().filter(u -> u.getName().equals(username)||(u.getJobNumber()!=null&&u.getJobNumber().equals(username))||(optional.isPresent()&&((u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))||(u.getDingdingUserid()!=null&&u.getDingdingUserid().equals(optional.get().getCorpwxUserid()))))).findAny();
|
|
}else {
|
|
}else {
|
|
any = allUserList.stream().filter(u -> u.getName().equals(username)||(u.getJobNumber()!=null&&u.getJobNumber().equals(username))).findAny();
|
|
any = allUserList.stream().filter(u -> u.getName().equals(username)||(u.getJobNumber()!=null&&u.getJobNumber().equals(username))).findAny();
|
|
}
|
|
}
|
|
@@ -4916,6 +4938,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
String token = request.getHeader("TOKEN");
|
|
String token = request.getHeader("TOKEN");
|
|
User user = userMapper.selectById(token);
|
|
User user = userMapper.selectById(token);
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
|
+ CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, companyId));
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
//对于存在预算成本的公司,暂不支持导入工时
|
|
//对于存在预算成本的公司,暂不支持导入工时
|
|
Company company = companyMapper.selectById(companyId);
|
|
Company company = companyMapper.selectById(companyId);
|
|
@@ -4989,14 +5012,34 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
}
|
|
}
|
|
//下标从0开始
|
|
//下标从0开始
|
|
HttpRespMsg respMsg=new HttpRespMsg();
|
|
HttpRespMsg respMsg=new HttpRespMsg();
|
|
|
|
+ List<User> targetUserList=new ArrayList<>();
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
|
|
|
|
+ System.out.println("参与搜素的人员列表"+userNameList + userNameList.size());
|
|
respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
|
|
respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
|
|
if(respMsg.code.equals("0")){
|
|
if(respMsg.code.equals("0")){
|
|
msg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请使用工号!");
|
|
msg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请使用工号!");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
+ targetUserList= (List<User>) respMsg.data;
|
|
|
|
+ }
|
|
|
|
+ if(dingding!=null&&dingding.getContactNeedTranslate()==1&&userNameList.size()>0){
|
|
|
|
+ System.out.println("参与搜素的人员列表"+userNameList + userNameList.size());
|
|
|
|
+ for (String name : userNameList) {
|
|
|
|
+ respMsg= companyDingdingService.getSearchUserInfo(dingding,name,1);
|
|
|
|
+ SearchUserResponse searchUserResponse = (SearchUserResponse) respMsg.data;
|
|
|
|
+ if(searchUserResponse.body.totalCount>1){
|
|
|
|
+ msg.setError("姓名为["+name+"]的人员存在重复,请使用工号!");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ if(searchUserResponse.body.list.size()>0){
|
|
|
|
+ User item=new User();
|
|
|
|
+ //为了修改代码 此处用企业微信同一个字段 setCorpwxUserid
|
|
|
|
+ item.setName(name);
|
|
|
|
+ item.setCorpwxUserid(searchUserResponse.body.list.get(0));
|
|
|
|
+ targetUserList.add(item);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- List<User> targetUserList= (List<User>) respMsg.data;
|
|
|
|
int dataCount = 0;
|
|
int dataCount = 0;
|
|
|
|
|
|
for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
|
|
for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
|
|
@@ -5034,9 +5077,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
}
|
|
}
|
|
//检查人员是否存在
|
|
//检查人员是否存在
|
|
Optional<User> any;
|
|
Optional<User> any;
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
|
|
+ if((wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1)||(dingding!=null&&dingding.getContactNeedTranslate()==1)){
|
|
Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(username)).findFirst();
|
|
Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(username)).findFirst();
|
|
- any = allUserList.stream().filter(u -> u.getName().equals(username)||(u.getJobNumber()!=null&&u.getJobNumber().equals(username))||(optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findAny();
|
|
|
|
|
|
+ any = allUserList.stream().filter(u -> u.getName().equals(username)||(u.getJobNumber()!=null&&u.getJobNumber().equals(username))||(optional.isPresent()&&((u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))||(u.getDingdingUserid()!=null&&u.getDingdingUserid().equals(optional.get().getCorpwxUserid()))))).findAny();
|
|
}else {
|
|
}else {
|
|
any = allUserList.stream().filter(u -> u.getName().equals(username)||(u.getJobNumber()!=null&&u.getJobNumber().equals(username))).findAny();
|
|
any = allUserList.stream().filter(u -> u.getName().equals(username)||(u.getJobNumber()!=null&&u.getJobNumber().equals(username))).findAny();
|
|
}
|
|
}
|