فهرست منبع

人员工时填报及时率修改 钉钉OA消息推送

yurk 2 سال پیش
والد
کامیت
2603190c8e

+ 4 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/CompanyDingdingService.java

@@ -1,10 +1,10 @@
 package com.management.platform.service;
 
-import com.management.platform.entity.CompanyDingding;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.management.platform.entity.WxCorpInfo;
+import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
+import com.management.platform.entity.CompanyDingding;
 
-import java.util.HashMap;
+import java.util.List;
 
 /**
  * <p>
@@ -31,7 +31,7 @@ public interface CompanyDingdingService extends IService<CompanyDingding> {
 
     public void sendFinishMileStoneMsg(CompanyDingding dingding, String useridList, String taskName, Integer projectId, String project, String finishDate);
 
-    public void sendOAMsg(CompanyDingding dingding, String useridList, HashMap map);
+    public void sendOAMsg(CompanyDingding dingding, String useridList,String titleText,String content, List<OapiMessageCorpconversationAsyncsendV2Request.Form> from);
 
     public void sendInnerLinkMsg(CompanyDingding dingding, String useridList, String title, String alertMsg);
 }

+ 203 - 139
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/CompanyDingdingServiceImpl.java

@@ -6,9 +6,9 @@ import com.aliyun.dingtalkoauth2_1_0.models.GetCorpAccessTokenResponse;
 import com.aliyun.tea.TeaException;
 import com.aliyun.teaopenapi.models.Config;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dingtalk.api.DefaultDingTalkClient;
 import com.dingtalk.api.DingTalkClient;
-import com.dingtalk.api.request.OapiGettokenRequest;
 import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
 import com.dingtalk.api.request.OapiMessageCorpconversationSendbytemplateRequest;
 import com.dingtalk.api.request.OapiServiceGetSuiteTokenRequest;
@@ -20,14 +20,14 @@ import com.management.platform.entity.SysConfig;
 import com.management.platform.mapper.CompanyDingdingMapper;
 import com.management.platform.mapper.SysConfigMapper;
 import com.management.platform.service.CompanyDingdingService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.taobao.api.ApiException;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
-import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * <p>
@@ -58,6 +58,8 @@ public class CompanyDingdingServiceImpl extends ServiceImpl<CompanyDingdingMappe
 
     @Resource
     private SysConfigMapper sysConfigMapper;
+    @Resource
+    private CompanyDingdingMapper companyDingdingMapper;
     @Value("${dingding.appId}")
     private long appId;//钉钉第三方应用的appId
     @Value("${configEnv.isPrivateDeploy}")
@@ -66,14 +68,13 @@ public class CompanyDingdingServiceImpl extends ServiceImpl<CompanyDingdingMappe
 
     @Override
     public void sendFillReportAlertMsg(Integer companyId, Long agentId, String msg, String useridList) {
+        CompanyDingding dingding = getOne(new QueryWrapper<CompanyDingding>().eq("company_id", companyId));
         if (isPrivateDeploy) {
-
-
+            sendInnerLinkMsg(dingding,useridList,"日报漏填提醒",msg);
         } else {
             DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
             OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
             System.out.println("发送AlertMsg=="+msg+", agentId="+agentId);
-            CompanyDingding dingding = getOne(new QueryWrapper<CompanyDingding>().eq("company_id", companyId));
             req.setAgentId(agentId);
 //        req.setDeptIdList("421897262");
             req.setUseridList(useridList);
@@ -97,174 +98,236 @@ public class CompanyDingdingServiceImpl extends ServiceImpl<CompanyDingdingMappe
 
     @Override
     public void sendRejectReportMsg(Integer companyId, String date, String projectNames, String reason, String auditorName, String useridList) {
-        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
-        OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
         CompanyDingding dingding = getOne(new QueryWrapper<CompanyDingding>().eq("company_id", companyId));
-        req.setAgentId(dingding.getAgentId());
-        req.setUseridList(useridList);
-        req.setTemplateId(TEMPLATE_REJECT_REPORT);
-        JSONObject json = new JSONObject();
-        json.put("createDate", date);
-        json.put("project", projectNames);
-        json.put("reason", reason);
-        json.put("auditUser", auditorName);
-        json.put("APPID", ""+appId);
-        json.put("CORPID", dingding.getCorpid());
-        req.setData(json.toJSONString());
-        OapiMessageCorpconversationSendbytemplateResponse rsp = null;
-        try {
-            rsp = client.execute(req, getCorpAccessToken(dingding));
-        } catch (ApiException e) {
-            e.printStackTrace();
-        } catch (Exception exception) {
-            exception.printStackTrace();
+        if (isPrivateDeploy) {
+            List<OapiMessageCorpconversationAsyncsendV2Request.Form> form=new ArrayList<>();
+            OapiMessageCorpconversationAsyncsendV2Request.Form item=new OapiMessageCorpconversationAsyncsendV2Request.Form();
+            item.setKey("日报日期");
+            item.setValue(date);
+            form.add(item);
+            OapiMessageCorpconversationAsyncsendV2Request.Form item1=new OapiMessageCorpconversationAsyncsendV2Request.Form();
+            item1.setKey("所属项目");
+            item1.setValue(projectNames);
+            form.add(item1);
+            OapiMessageCorpconversationAsyncsendV2Request.Form item2=new OapiMessageCorpconversationAsyncsendV2Request.Form();
+            item2.setKey("驳回原因");
+            item2.setValue(reason);
+            form.add(item2);
+            OapiMessageCorpconversationAsyncsendV2Request.Form item3=new OapiMessageCorpconversationAsyncsendV2Request.Form();
+            item3.setKey("审批人");
+            item3.setValue(auditorName);
+            form.add(item3);
+            sendOAMsg(dingding,useridList,"日报驳回提醒","您的日报被驳回,请及时查看",form);
+        } else {
+            DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
+            OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
+            req.setAgentId(dingding.getAgentId());
+            req.setUseridList(useridList);
+            req.setTemplateId(TEMPLATE_REJECT_REPORT);
+            JSONObject json = new JSONObject();
+            json.put("createDate", date);
+            json.put("project", projectNames);
+            json.put("reason", reason);
+            json.put("auditUser", auditorName);
+            json.put("APPID", "" + appId);
+            json.put("CORPID", dingding.getCorpid());
+            req.setData(json.toJSONString());
+            OapiMessageCorpconversationSendbytemplateResponse rsp = null;
+            try {
+                rsp = client.execute(req, getCorpAccessToken(dingding));
+            } catch (ApiException e) {
+                e.printStackTrace();
+            } catch (Exception exception) {
+                exception.printStackTrace();
+            }
+            System.out.println(rsp.getBody());
         }
-        System.out.println(rsp.getBody());
     }
-
     @Override
     public void sendLeaveApplyAlertMsg(Integer companyId, Long agentId, String msg, String useridList) {
-        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
-        OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
-        System.out.println("发送 请假提交审批 =="+msg+", agentId="+agentId);
         CompanyDingding dingding = getOne(new QueryWrapper<CompanyDingding>().eq("company_id", companyId));
-        req.setAgentId(agentId);
+        if (isPrivateDeploy) {
+            sendInnerLinkMsg(dingding,useridList,"请假提交审批提醒",msg);
+        } else {
+            DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
+            OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
+            System.out.println("发送 请假提交审批 ==" + msg + ", agentId=" + agentId);
+
+            req.setAgentId(agentId);
 //        req.setDeptIdList("421897262");
-        req.setUseridList(useridList);
-        req.setTemplateId(TEMPLATE_LEAVE_APPLY);
-        JSONObject json = new JSONObject();
-        json.put("employeeName", "张辉");
-        json.put("deptName", "质量部");
-        json.put("date", "2022-03-29");
-        json.put("APPID", ""+appId);
-        json.put("CORPID", dingding.getCorpid());
-        req.setData(json.toJSONString());
-        OapiMessageCorpconversationSendbytemplateResponse rsp = null;
-        try {
-            rsp = client.execute(req, getCorpAccessToken(dingding));
-        } catch (ApiException e) {
-            e.printStackTrace();
-        } catch (Exception exception) {
-            exception.printStackTrace();
+            req.setUseridList(useridList);
+            req.setTemplateId(TEMPLATE_LEAVE_APPLY);
+            JSONObject json = new JSONObject();
+            json.put("employeeName", "张辉");
+            json.put("deptName", "质量部");
+            json.put("date", "2022-03-29");
+            json.put("APPID", "" + appId);
+            json.put("CORPID", dingding.getCorpid());
+            req.setData(json.toJSONString());
+            OapiMessageCorpconversationSendbytemplateResponse rsp = null;
+            try {
+                rsp = client.execute(req, getCorpAccessToken(dingding));
+            } catch (ApiException e) {
+                e.printStackTrace();
+            } catch (Exception exception) {
+                exception.printStackTrace();
+            }
+            System.out.println(rsp.getBody());
         }
-        System.out.println(rsp.getBody());
     }
-
     @Override
     public void sendReportWaitingApplyMsg(Integer companyId, Long agentId, Long auditNum, String useridList) {
-        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
-        OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
-        System.out.println("发送 待审批日报数量 =="+auditNum+", agentId="+agentId);
         CompanyDingding dingding = getOne(new QueryWrapper<CompanyDingding>().eq("company_id", companyId));
-        req.setAgentId(agentId);
-        req.setUseridList(useridList);
-        req.setTemplateId(TEMPLATE_REPORT_WAITING_APPLY);
-        JSONObject json = new JSONObject();
-        json.put("auditNum", ""+auditNum);
-        json.put("APPID", ""+appId);
-        json.put("CORPID", dingding.getCorpid());
-        req.setData(json.toJSONString());
-        OapiMessageCorpconversationSendbytemplateResponse rsp = null;
-        try {
-            rsp = client.execute(req, getCorpAccessToken(dingding));
-        } catch (ApiException e) {
-            e.printStackTrace();
-        } catch (Exception exception) {
-            exception.printStackTrace();
+        if (isPrivateDeploy) {
+            List<OapiMessageCorpconversationAsyncsendV2Request.Form> form=new ArrayList<>();
+            OapiMessageCorpconversationAsyncsendV2Request.Form item=new OapiMessageCorpconversationAsyncsendV2Request.Form();
+            item.setKey("待审核数量");
+            item.setValue(String.valueOf(auditNum));
+            form.add(item);
+            sendOAMsg(dingding,useridList,"您还有日报暂未审核","请及时审核",form);
+        } else {
+            DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
+            OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
+            System.out.println("发送 待审批日报数量 ==" + auditNum + ", agentId=" + agentId);
+            req.setAgentId(agentId);
+            req.setUseridList(useridList);
+            req.setTemplateId(TEMPLATE_REPORT_WAITING_APPLY);
+            JSONObject json = new JSONObject();
+            json.put("auditNum", "" + auditNum);
+            json.put("APPID", "" + appId);
+            json.put("CORPID", dingding.getCorpid());
+            req.setData(json.toJSONString());
+            OapiMessageCorpconversationSendbytemplateResponse rsp = null;
+            try {
+                rsp = client.execute(req, getCorpAccessToken(dingding));
+            } catch (ApiException e) {
+                e.printStackTrace();
+            } catch (Exception exception) {
+                exception.printStackTrace();
+            }
+            System.out.println(rsp.getBody());
         }
-        System.out.println(rsp.getBody());
     }
-
     @Override
     public void sendBusinessTripSettingMsg(Integer companyId, Long agentId, String useridList) {
-        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
-        OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
         CompanyDingding dingding = getOne(new QueryWrapper<CompanyDingding>().eq("company_id", companyId));
-        req.setAgentId(agentId);
-        req.setUseridList(useridList);
-        req.setTemplateId(TEMPLATE_BUSTRIP_SETTING);
-        JSONObject json = new JSONObject();
-        json.put("APPID", ""+appId);
-        json.put("CORPID", dingding.getCorpid());
-        req.setData(json.toJSONString());
-        OapiMessageCorpconversationSendbytemplateResponse rsp = null;
-        try {
-            rsp = client.execute(req, getCorpAccessToken(dingding));
-        } catch (ApiException e) {
-            e.printStackTrace();
-        } catch (Exception exception) {
-            exception.printStackTrace();
+        if (isPrivateDeploy) {
+            sendInnerLinkMsg(dingding,useridList,"关联出差提醒","您还有出差记录尚未关联到项目");
+        } else {
+            DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
+            OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
+            req.setAgentId(agentId);
+            req.setUseridList(useridList);
+            req.setTemplateId(TEMPLATE_BUSTRIP_SETTING);
+            JSONObject json = new JSONObject();
+            json.put("APPID", "" + appId);
+            json.put("CORPID", dingding.getCorpid());
+            req.setData(json.toJSONString());
+            OapiMessageCorpconversationSendbytemplateResponse rsp = null;
+            try {
+                rsp = client.execute(req, getCorpAccessToken(dingding));
+            } catch (ApiException e) {
+                e.printStackTrace();
+            } catch (Exception exception) {
+                exception.printStackTrace();
+            }
+            System.out.println(rsp.getBody());
         }
-        System.out.println(rsp.getBody());
     }
-
     @Override
     public void sendNewTaskMsg(CompanyDingding dingding, String ddUserid, String title, String endDate) {
-        //异步发送
-        new Thread(){
-            public void run() {
-                DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
-                OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
-                req.setAgentId(dingding.getAgentId());
-                req.setUseridList(ddUserid);
-                req.setTemplateId(TEMPLATE_NEW_TASK);
-                JSONObject json = new JSONObject();
-                json.put("name", ""+title);
-                json.put("endDate", ""+endDate);
-                json.put("APPID", ""+appId);
-                json.put("CORPID", dingding.getCorpid());
-                req.setData(json.toJSONString());
+        if (isPrivateDeploy) {
+            List<OapiMessageCorpconversationAsyncsendV2Request.Form> form=new ArrayList<>();
+            OapiMessageCorpconversationAsyncsendV2Request.Form item=new OapiMessageCorpconversationAsyncsendV2Request.Form();
+            item.setKey("任务标题");
+            item.setValue(title);
+            form.add(item);
+            OapiMessageCorpconversationAsyncsendV2Request.Form item1=new OapiMessageCorpconversationAsyncsendV2Request.Form();
+            item1.setKey("截至日期");
+            item1.setValue(endDate);
+            form.add(item1);
+            sendOAMsg(dingding,ddUserid,"新任务提醒","您有一条新的任务待执行,请关注",form);
+        } else {
+            //异步发送
+            new Thread() {
+                public void run() {
+                    DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
+                    OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
+                    req.setAgentId(dingding.getAgentId());
+                    req.setUseridList(ddUserid);
+                    req.setTemplateId(TEMPLATE_NEW_TASK);
+                    JSONObject json = new JSONObject();
+                    json.put("name", "" + title);
+                    json.put("endDate", "" + endDate);
+                    json.put("APPID", "" + appId);
+                    json.put("CORPID", dingding.getCorpid());
+                    req.setData(json.toJSONString());
 
-                OapiMessageCorpconversationSendbytemplateResponse rsp = null;
-                try {
-                    rsp = client.execute(req, getCorpAccessToken(dingding));
-                } catch (ApiException e) {
-                    e.printStackTrace();
-                } catch (Exception exception) {
-                    exception.printStackTrace();
+                    OapiMessageCorpconversationSendbytemplateResponse rsp = null;
+                    try {
+                        rsp = client.execute(req, getCorpAccessToken(dingding));
+                    } catch (ApiException e) {
+                        e.printStackTrace();
+                    } catch (Exception exception) {
+                        exception.printStackTrace();
+                    }
+                    System.out.println(rsp.getBody());
                 }
-                System.out.println(rsp.getBody());
-            }
-        }.start();
+            }.start();
+        }
     }
 
-
     @Override
     public void sendFinishMileStoneMsg(CompanyDingding dingding, String useridList, String taskName, Integer projectId, String project, String finishDate) {
-        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
-        OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
-        req.setAgentId(dingding.getAgentId());
-        req.setUseridList(useridList);
-        req.setTemplateId(TEMPLATE_FINISH_MILESTONE);
-        JSONObject json = new JSONObject();
-        json.put("taskName", taskName);
-        json.put("project", project);
-        json.put("PROJECTID", ""+projectId);
-        json.put("APPID", ""+appId);
-        json.put("CORPID", dingding.getCorpid());
-        json.put("finishDate", finishDate);
-        req.setData(json.toJSONString());
-        OapiMessageCorpconversationSendbytemplateResponse rsp = null;
-        try {
-            rsp = client.execute(req, getCorpAccessToken(dingding));
-        } catch (ApiException e) {
-            e.printStackTrace();
-        } catch (Exception exception) {
-            exception.printStackTrace();
+        if (isPrivateDeploy) {
+            List<OapiMessageCorpconversationAsyncsendV2Request.Form> form=new ArrayList<>();
+            OapiMessageCorpconversationAsyncsendV2Request.Form item=new OapiMessageCorpconversationAsyncsendV2Request.Form();
+            item.setKey("里程碑");
+            item.setValue(taskName);
+            form.add(item);
+            OapiMessageCorpconversationAsyncsendV2Request.Form item1=new OapiMessageCorpconversationAsyncsendV2Request.Form();
+            item1.setKey("所属项目");
+            item1.setValue(project);
+            form.add(item1);
+            OapiMessageCorpconversationAsyncsendV2Request.Form item2=new OapiMessageCorpconversationAsyncsendV2Request.Form();
+            item2.setKey("完成时间");
+            item2.setValue(finishDate);
+            form.add(item2);
+            sendOAMsg(dingding,useridList,"里程碑完成提醒","我们刚刚完成了以下里程碑,感谢大家的努力!",form);
+        } else {
+            DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
+            OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
+            req.setAgentId(dingding.getAgentId());
+            req.setUseridList(useridList);
+            req.setTemplateId(TEMPLATE_FINISH_MILESTONE);
+            JSONObject json = new JSONObject();
+            json.put("taskName", taskName);
+            json.put("project", project);
+            json.put("PROJECTID", "" + projectId);
+            json.put("APPID", "" + appId);
+            json.put("CORPID", dingding.getCorpid());
+            json.put("finishDate", finishDate);
+            req.setData(json.toJSONString());
+            OapiMessageCorpconversationSendbytemplateResponse rsp = null;
+            try {
+                rsp = client.execute(req, getCorpAccessToken(dingding));
+            } catch (ApiException e) {
+                e.printStackTrace();
+            } catch (Exception exception) {
+                exception.printStackTrace();
+            }
+            System.out.println(rsp.getBody());
         }
-        System.out.println(rsp.getBody());
     }
 
 
-
     @Override
-    public void sendOAMsg(CompanyDingding dingding, String useridList, HashMap map) {
+    public void sendOAMsg(CompanyDingding dingding, String useridList,String titleText,String content,List<OapiMessageCorpconversationAsyncsendV2Request.Form> from) {
         DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
         OapiMessageCorpconversationAsyncsendV2Request request = new OapiMessageCorpconversationAsyncsendV2Request();
         request.setAgentId(dingding.getAgentId());
         request.setUseridList(useridList);
         request.setToAllUser(false);
-
         OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
 //        msg.setMsgtype("text");
 //        msg.setText(new OapiMessageCorpconversationAsyncsendV2Request.Text());
@@ -297,9 +360,10 @@ public class CompanyDingdingServiceImpl extends ServiceImpl<CompanyDingdingMappe
 
         msg.setOa(new OapiMessageCorpconversationAsyncsendV2Request.OA());
         msg.getOa().setHead(new OapiMessageCorpconversationAsyncsendV2Request.Head());
-        msg.getOa().getHead().setText("这里是标题");
+        msg.getOa().getHead().setText(titleText);
         msg.getOa().setBody(new OapiMessageCorpconversationAsyncsendV2Request.Body());
-        msg.getOa().getBody().setContent("这里是内容");
+        msg.getOa().getBody().setContent(content);
+        msg.getOa().getBody().setForm(from);
         msg.setMsgtype("oa");
         msg.getOa().setMessageUrl("dingtalk://dingtalkclient/action/openapp?corpid=="+dingding.getCorpid()+"&container_type=work_platform&app_id="+appId+"&redirect_type=jump&redirect_url=https%3A%2F%2Fworktime.ttkuaiban.com%2F%3Fcorpid%3D%24CORPID%24");
         request.setMsg(msg);

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -3087,6 +3087,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     public HttpRespMsg getUserReportTimelinessRate(HttpServletRequest request, String startDate, String endDate, Integer departmentId, String userId,Integer pageIndex,Integer pageSize) {
         HttpRespMsg msg=new HttpRespMsg();
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        DecimalFormat dft =  new DecimalFormat("0%");
         LocalDateTime sDate = LocalDate.parse(startDate).atTime(LocalTime.now());
         LocalDateTime eDate = LocalDate.parse(endDate).atTime(LocalTime.now());
         Duration duration=Duration.between(sDate,eDate);
@@ -3122,6 +3123,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         for (User user : userList){
             TimelinessRateVO timelinessRateVO=new TimelinessRateVO();
             timelinessRateVO.setUserName(user.getName());
+            timelinessRateVO.setTimelinessRate(String.valueOf(dft.format(0)));
             Optional<Department> first = departmentList.stream().filter(dp -> dp.getDepartmentId().equals(user.getDepartmentId())).findFirst();
             if(first.isPresent()){
                 timelinessRateVO.setDepartmentName(first.get().getDepartmentName());
@@ -3153,7 +3155,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 }else{
                     divide=new BigDecimal(0);
                 }
-                DecimalFormat dft =  new DecimalFormat("0%");
                 String number = dft.format(divide);
                 timelinessRateVO.setTimelinessRate(String.valueOf(number));
             }