Bläddra i källkod

第三方日报接口开发

yurk 2 år sedan
förälder
incheckning
6d4eb1b845

+ 8 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/ReportLog.java

@@ -1,19 +1,19 @@
 package com.management.platform.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
 /**
  * <p>
  * 
@@ -42,6 +42,8 @@ public class ReportLog extends Model<ReportLog> {
      * 日报所属日期
      */
     @TableField("create_date")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private LocalDate createDate;
 
     /**

+ 19 - 8
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -3934,15 +3934,26 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         if(thirdPartyInterfaceList.size()==0){
             msg.setError("token错误");
         }
-        for (ThirdPartyInterface thirdPartyInterface : thirdPartyInterfaceList){
-            if(LocalDateTime.now().isAfter(thirdPartyInterface.getExpireTime())){
-                msg.setError("token过期失效");
-                return msg;
-            }
-            if(token.equals(thirdPartyInterface.getToken())){
-                List<HashMap<String, Object>> allReportByDate = reportMapper.getAllReportByDate(startDate,thirdPartyInterface.getComapnyId(), null, endDate, null, null, null);
-                msg.data=allReportByDate;
+        ThirdPartyInterface thirdPartyInterface = thirdPartyInterfaceList.get(0);
+        List<ReportLog> reportLogList = reportLogMapper.selectList(new QueryWrapper<ReportLog>().eq("company_id", thirdPartyInterface.getComapnyId()).orderByAsc("operate_date"));
+        if(LocalDateTime.now().isAfter(thirdPartyInterface.getExpireTime())){
+            msg.setError("token过期失效");
+            return msg;
+        }
+        if(token.equals(thirdPartyInterface.getToken())){
+            List<HashMap<String, Object>> allReportByDate = reportMapper.getAllReportByDate(startDate,thirdPartyInterface.getComapnyId(), null, endDate, null, null, null);
+            for (HashMap<String, Object> map : allReportByDate) {
+                List<ReportLog> item=new ArrayList<>();
+                Integer reportId = (Integer) map.get("id");
+                for (ReportLog reportLog : reportLogList) {
+                    List<String> list = Arrays.asList(reportLog.getReportIds().split(","));
+                    if(list.contains(String.valueOf(reportId))&&!reportLog.getMsg().contains("提交")){
+                         item.add(reportLog);
+                    }
+                }
+                map.put("checkLog",item);
             }
+            msg.data=allReportByDate;
         }
         return msg;
     }

+ 5 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -56,12 +56,12 @@
 
     <!--根据日期获取全部报告信息-->
     <select id="getAllReportByDate" resultType="java.util.Map">
-        SELECT a.id, c.name,c.corpwx_userid as corpwxUserId, b.project_name AS project,b.category_name as categoryName, a.working_time AS duration, a.content, a.create_time AS time, a.create_date as createDate,
-        a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType, a.start_time as startTime,
-        a.end_time as endTime, d.name as subProjectName,a.task_id as taskId, task.name as taskName, a.is_overtime as isOvertime,a.progress as progress,
+        SELECT a.id, c.name,c.corpwx_userid as corpwxUserId, b.project_name AS project,b.category_name as categoryName, a.working_time AS duration, a.content, DATE_FORMAT(a.create_time,'%Y-%m-%d')   AS time,DATE_FORMAT(a.create_date,'%Y-%m-%d') as createDate,
+        a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType,DATE_FORMAT(a.start_time,'%Y-%m-%d')  as startTime,
+        DATE_FORMAT(a.end_time,'%Y-%m-%d')  as endTime, d.name as subProjectName,a.task_id as taskId, task.name as taskName, a.is_overtime as isOvertime,a.progress as progress,
         a.department_audit_state as departmentAuditState, a.stage, a.pic_str as picStr, multi_worktime as multiWorktime
-        , reject_reason as rejectReason, reject_username as rejectUsername, reject_userid as rejectUserid, degree_id as degree_id,report_extra_degree.name as degreeName,task_group.name as groupName,a.group_id as groupId, a.custom_data as customData
-        ,u.name as projectAuditorName, a.project_auditor_id as projectAuditorId, department.department_name as departmentName, a.overtime_hours as overtimeHours, a.custom_text as customText, a.project_audit_time as projectAuditTime,project_main.name as projectMainName
+        , reject_reason as rejectReason, reject_username as rejectUsername, reject_userid as rejectUserid, degree_id as degree_id,report_extra_degree.name as degreeName,task_group.name as groupName,a.group_id as groupId, DATE_FORMAT( a.custom_data,'%Y-%m-%d') as customData
+        ,u.name as projectAuditorName, a.project_auditor_id as projectAuditorId, department.department_name as departmentName, a.overtime_hours as overtimeHours, a.custom_text as customText,DATE_FORMAT( a.project_audit_time,'%Y-%m-%d')  as projectAuditTime,project_main.name as projectMainName
         FROM report AS a
         JOIN project AS b ON a.project_id=b.id
         LEFT JOIN user AS c ON a.creator_id=c.id