|
@@ -14,6 +14,7 @@ import com.management.platform.entity.vo.SysRichFunction;
|
|
|
import com.management.platform.entity.vo.WorktimeItem;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.*;
|
|
|
+import com.management.platform.service.impl.WxCorpInfoServiceImpl;
|
|
|
import com.management.platform.util.*;
|
|
|
import okhttp3.OkHttpClient;
|
|
|
import okhttp3.Request;
|
|
@@ -104,6 +105,8 @@ public class ReportController {
|
|
|
@Resource
|
|
|
private UserFvTimeService userFvTimeService;
|
|
|
@Resource
|
|
|
+ private WxCorpInfoService wxCorpInfoService;
|
|
|
+ @Resource
|
|
|
private LeaveSheetService leaveSheetService;
|
|
|
@Resource
|
|
|
private EstimateTimeSettingMapper estimateTimeSettingMapper;
|
|
@@ -1274,6 +1277,7 @@ public class ReportController {
|
|
|
BigDecimal hasReport = new BigDecimal(sum).add(new BigDecimal(nowReport));
|
|
|
BigDecimal multiply = new BigDecimal(first.get().getManDay()).multiply(new BigDecimal(comTimeType.getAllday()));
|
|
|
if(hasReport.doubleValue()>multiply.doubleValue()){
|
|
|
+ sendReportTimeWarningMsg(company, first.get(), null, null);
|
|
|
if (estimateTimeSetting.getProjectFronzeOnLack() == 1) {
|
|
|
httpRespMsg.setError("超过当前项目["+first.get().getProjectName()+"]预算工时,无法继续提交工时");
|
|
|
return httpRespMsg;
|
|
@@ -1285,6 +1289,7 @@ public class ReportController {
|
|
|
//检查是否超过预设的提醒百分比;设置的数值是剩余的百分比
|
|
|
if (hasReport.divide(multiply, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).compareTo(new BigDecimal(100-estimateTimeSetting.getProjectWarningPercent()))>0) {
|
|
|
warningPercentProjects += first.get().getProjectName() + ",";
|
|
|
+ sendReportTimeWarningMsg(company, first.get(), null, null);
|
|
|
}
|
|
|
//检查分组工时
|
|
|
Integer targetGpId = report.getGroupId();
|
|
@@ -1302,6 +1307,7 @@ public class ReportController {
|
|
|
if (tgp != null && tgp.getManDay() != null && tgp.getManDay() > 0) {
|
|
|
multiply = new BigDecimal(tgp.getManDay()).multiply(new BigDecimal(comTimeType.getAllday()));
|
|
|
if (hasReport.doubleValue() > multiply.doubleValue()) {
|
|
|
+ sendReportTimeWarningMsg(company, null, first.get().getProjectName(), tgp);
|
|
|
if (estimateTimeSetting.getGroupFronzeOnLack() == 1) {
|
|
|
httpRespMsg.setError("超过当前项目["+first.get().getProjectName()+"]分组["+tgp.getName()+"]预算工时,无法继续提交工时");
|
|
|
return httpRespMsg;
|
|
@@ -1313,6 +1319,7 @@ public class ReportController {
|
|
|
//检查是否超过预设的提醒百分比;设置的数值是剩余的百分比
|
|
|
if (hasReport.divide(multiply, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).compareTo(new BigDecimal(100 - estimateTimeSetting.getGroupWarningPercent())) > 0) {
|
|
|
warningGroupPercent += (tgp.getTaskGroupCode() != null?tgp.getTaskGroupCode():"")+"-"+tgp.getName() + ",";
|
|
|
+ sendReportTimeWarningMsg(company, null, first.get().getProjectName(), tgp);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2895,5 +2902,28 @@ public class ReportController {
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ //发送消息提醒日报工时填报触发警告
|
|
|
+ private void sendReportTimeWarningMsg(Company company, Project project, String projectName, TaskGroup taskGroup) {
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", company.getId()));
|
|
|
+ if (wxCorpInfo != null) {
|
|
|
+ //给项目经理和任务分组负责人发送消息
|
|
|
+ if (project != null) {
|
|
|
+ User incharger = userMapper.selectById(project.getInchargerId());
|
|
|
+ if (incharger != null) {
|
|
|
+ String msg = "项目["+project.getProjectName()+"]预估工时不足,请及时调整";
|
|
|
+ System.out.println(msg);
|
|
|
+ wxCorpInfoService.sendWXCorpMsg(wxCorpInfo, incharger.getCorpwxUserid(), msg, null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_EXCEED_LIMIT);
|
|
|
+ }
|
|
|
+ } else if (taskGroup != null && projectName != null) {
|
|
|
+ String msg = "项目["+projectName+"]下的分组["+taskGroup.getName()+"]预估工时不足,请及时调整";
|
|
|
+ System.out.println(msg);
|
|
|
+ User groupIncharger = userMapper.selectById(taskGroup.getInchargerId());
|
|
|
+ if (groupIncharger != null) {
|
|
|
+ wxCorpInfoService.sendWXCorpMsg(wxCorpInfo, groupIncharger.getCorpwxUserid(), msg, null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_EXCEED_LIMIT);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //TODO: 针对钉钉和微信公众号进行推送
|
|
|
+ }
|
|
|
}
|
|
|
|