Browse Source

修改organizationId

zhouyy 6 tháng trước cách đây
mục cha
commit
b39cea37a5

+ 19 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ReportMapper.java

@@ -37,6 +37,25 @@ public interface ReportMapper extends BaseMapper<Report> {
                                                      @Param("stateKey") Integer stateKey,
                                                      @Param("branchDepartment")List<Integer> branchDepartment
     );
+
+    List<HashMap<String, Object>> getAllReportByDateNew(@Param("startDate") String startDate,
+                                                     @Param("companyId") Integer companyId,
+                                                     @Param("userId") String userId,
+                                                     @Param("endDate") String endDate,
+                                                     @Param("projectId") Integer projectId,
+                                                     @Param("stateKey") Integer stateKey,
+                                                     @Param("branchDepartment")List<Integer> branchDepartment,
+                                                     @Param("organizationId")Integer organizationId
+    );
+    List<HashMap<String, Object>> getAllReportByDateWithReportLogNew(@Param("startDate") String startDate,
+                                                                  @Param("companyId") Integer companyId,
+                                                                  @Param("userId") String userId,
+                                                                  @Param("endDate") String endDate,
+                                                                  @Param("projectId") Integer projectId,
+                                                                  @Param("stateKey") Integer stateKey,
+                                                                  @Param("branchDepartment")List<Integer> branchDepartment,
+                                                                  @Param("organizationId")Integer organizationId
+    );
     List<HashMap<String, Object>> getProjectMembReportByDate(@Param("startDate") String startDate,
                                                      @Param("companyId") Integer companyId,
                                                      @Param("leaderId") String leaderId,

+ 10 - 9
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -13,9 +13,6 @@ import com.management.platform.mapper.*;
 import com.management.platform.service.*;
 import com.management.platform.util.*;
 import com.management.platform.webservice.po.*;
-import com.management.platform.webservice.po.SapPeriod;
-import freemarker.template.SimpleDate;
-import jdk.nashorn.api.scripting.ScriptObjectMirror;
 import lombok.SneakyThrows;
 import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
 import me.chanjar.weixin.mp.api.WxMpService;
@@ -23,14 +20,12 @@ import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
 import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
 import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
 import org.apache.commons.io.FileUtils;
-import org.apache.logging.log4j.util.PropertySource;
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.*;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.core.task.AsyncTaskExecutor;
 import org.springframework.http.*;
 import org.springframework.http.client.ClientHttpResponse;
 import org.springframework.stereotype.Service;
@@ -9149,6 +9144,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             httpRespMsg.setError("The date range cannot be empty");
             return httpRespMsg;
         }
+        int organizationId = Integer.parseInt(String.valueOf(memberQueryQuery.get("organizationId")));
         String startDate = String.valueOf(memberQueryQuery.get("startDate"));
         String endDate = String.valueOf(memberQueryQuery.get("endDate"));
         DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -9174,7 +9170,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             if(department!=null){
                 departmentId = String.valueOf(department.getDepartmentId());
             }
-
         }
         if(memberQueryQuery.get("stateKey")!=null){
             stateKey = Integer.valueOf(String.valueOf(memberQueryQuery.get("stateKey")));
@@ -9195,10 +9190,16 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             branchDepartment = departmentService.getBranchDepartment(Integer.valueOf(departmentId),departments);
         }
         //看公司所有人的
+//        if (timeType.getShowFillauditTime() == 1) {
+//            allReportByDate = reportMapper.getAllReportByDateWithReportLog(startDate, companyId, userId, endDate, null,stateKey,branchDepartment);
+//        } else {
+//            allReportByDate = reportMapper.getAllReportByDate(startDate,companyId, userId, endDate, null,stateKey,branchDepartment);
+//        }
+
         if (timeType.getShowFillauditTime() == 1) {
-            allReportByDate = reportMapper.getAllReportByDateWithReportLog(startDate, companyId, userId, endDate, null,stateKey,branchDepartment);
+            allReportByDate = reportMapper.getAllReportByDateWithReportLogNew(startDate, companyId, userId, endDate, null,stateKey,branchDepartment,organizationId);
         } else {
-            allReportByDate = reportMapper.getAllReportByDate(startDate,companyId, userId, endDate, null,stateKey,branchDepartment);
+            allReportByDate = reportMapper.getAllReportByDateNew(startDate,companyId, userId, endDate, null,stateKey,branchDepartment,organizationId);
         }
         if (timeType.getMultiWorktime() == 1) {
             java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00");
@@ -9282,7 +9283,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             }
             item.put("userName",(String) map.get("realName"));
             item.put("departmentName",departmentService.getSupDepartment(dept,departments));
-            item.put("departmentId",dept.getCorpwxDeptid());
+            item.put("departmentId",null!=dept?dept.getCorpwxDeptid():"");
             item.put("projectCode",(String) map.get("projectCode"));
             item.put("projectName",(String) map.get("project"));
             item.put("categoryName",(String) map.get("categoryName"));

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

@@ -118,6 +118,63 @@
         ORDER BY a.creator_id, a.create_date desc
     </select>
 
+    <select id="getAllReportByDateNew" resultType="java.util.Map">
+        SELECT a.id, a.creator_id as creatorId, c.name,uwb.name as realName,c.job_number as jobNumber,c.corpwx_userid as corpwxUserId,c.corpwx_deptid as corpwxDeptId, b.project_name AS project,b.project_code as projectCode,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,u.job_number as jobNumber,
+        a.end_time  as endTime, d.name as subProjectName,d.code as subProjectCode,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,a.is_dept_audit as isDeptAudit,a.group_audit_state as groupAuditState,task_group.incharger_id as inchargerId,a.project_audit_state as projectAuditState,a.audit_dept_managerid as deptAuditorName
+        ,c.plate1 as plate1,c.plate2 as plate2,c.plate3 as plate3,c.plate4 as plate4,c.plate5 as plate5
+        , 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,u.corpwx_userid as projectAuditorCorpwxUserId, a.project_auditor_id as projectAuditorId, department.department_name as departmentName,dp2.department_name as buDepartmentName,department.department_id as departmentId, a.overtime_hours as overtimeHours, a.custom_text as customText,a.project_audit_time  as projectAuditTime,project_main.name as projectMainName,
+        a.extra_field1 as extraField1,a.extra_field2 as extraField2,a.extra_field3 as extraField3, a.batch_id as batchId,a.sap_service_id as sapServiceId,b.status as projectStatus,DATE_FORMAT(b.finish_date,'%Y-%m-%d') as finishDate,ps.project_category_sub as projectCategorySub
+        ,u2.name as projectManagerName,u2.corpwx_userid as projectManagerCorpwxUserId, multi_degr_id as multiDegrId,b.current_stage_name as stageName
+        FROM report AS a
+        JOIN project AS b ON a.project_id=b.id
+        LEFT JOIN project_separate AS ps on b.id=ps.id
+        LEFT JOIN user AS c ON a.creator_id=c.id
+        LEFT JOIN user_with_beisen AS uwb ON uwb.job_number=c.job_number and uwb.company_id=c.company_id
+        left join sub_project as d on d.id = a.sub_project_id
+        left join task on task.id = a.task_id
+        left join report_extra_degree on report_extra_degree.id = a.degree_id
+        left join task_group on task_group.id = a.group_id
+        left join user u on u.id = a.project_auditor_id
+        left join user u2 on u2.id = b.incharger_id
+        left join department on department.department_id = a.dept_id
+        left join department dp2 on dp2.department_id = b.bu_id
+        left join project_main on b.project_main_id=project_main.id
+        WHERE (<if test="stateKey == null or stateKey == 0">
+        a.state = 1
+    </if>
+        <if test="stateKey!=null">
+            <if test="stateKey==1">
+                (a.state = 1 or a.state = 0 or a.state = -1)
+            </if>
+            <if test="stateKey==2">
+                (a.state=0 or a.state = -1)
+            </if>
+        </if>)
+        <if test="startDate != null and startDate != ''">
+            AND a.create_date between #{startDate} and #{endDate}
+        </if>
+        <if test="projectId != null">
+            AND a.project_id = #{projectId}
+        </if>
+        <if test="companyId != null">
+            AND c.company_id = #{companyId}
+        </if>
+        <if test="userId != null">
+            AND a.creator_id = #{userId}
+        </if>
+        <if test="organizationId !=1 and branchDepartment != null and branchDepartment.size()>0">
+            AND department.department_id in
+            <foreach collection="branchDepartment" item="deptId" separator="," close=")" open="(" index="index">
+                #{deptId}
+            </foreach>
+        </if>
+
+        ORDER BY a.creator_id, a.create_date desc
+    </select>
+
     <select id="getAllReportByDateWithReportLog" resultType="java.util.Map">
         SELECT a.id, a.creator_id as creatorId, c.name,uwb.name as realName,c.job_number as jobNumber,c.corpwx_userid as corpwxUserId,c.corpwx_deptid as corpwxDeptId, b.project_name AS project,b.project_code as projectCode,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,u.job_number as jobNumber,
@@ -176,6 +233,64 @@
         ORDER BY a.creator_id, a.create_date desc
     </select>
 
+    <select id="getAllReportByDateWithReportLogNew" resultType="java.util.Map">
+        SELECT a.id, a.creator_id as creatorId, c.name,uwb.name as realName,c.job_number as jobNumber,c.corpwx_userid as corpwxUserId,c.corpwx_deptid as corpwxDeptId, b.project_name AS project,b.project_code as projectCode,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,u.job_number as jobNumber,
+        a.end_time  as endTime, d.name as subProjectName,d.code as subProjectCode,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,a.is_dept_audit as isDeptAudit,a.group_audit_state as groupAuditState,task_group.incharger_id as inchargerId,a.project_audit_state as projectAuditState,a.audit_dept_managerid as deptAuditorName
+        ,c.plate1 as plate1,c.plate2 as plate2,c.plate3 as plate3,c.plate4 as plate4,c.plate5 as plate5
+        , 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,u.corpwx_userid as projectAuditorCorpwxUserId, a.project_auditor_id as projectAuditorId, department.department_name as departmentName,dp2.department_name as buDepartmentName,department.department_id as departmentId, a.overtime_hours as overtimeHours, a.custom_text as customText,a.project_audit_time  as projectAuditTime,project_main.name as projectMainName,
+        GROUP_CONCAT(rlog.operator_id,'@', rlog.operate_date,'@', rlog.msg SEPARATOR '❤') AS logMsg,a.extra_field1 as extraField1,a.extra_field2 as extraField2,a.extra_field3 as extraField3,a.batch_id as batchId,a.sap_service_id as sapServiceId,b.status as projectStatus,DATE_FORMAT(b.finish_date,'%Y-%m-%d') as finishDate,ps.project_category_sub as projectCategorySub
+        ,u2.name as projectManagerName,u2.corpwx_userid as projectManagerCorpwxUserId, multi_degr_id as multiDegrId,b.current_stage_name as stageName
+        FROM report AS a
+        JOIN project AS b ON a.project_id=b.id
+        LEFT JOIN project_separate AS ps on b.id=ps.id
+        LEFT JOIN user AS c ON a.creator_id=c.id
+        LEFT JOIN user_with_beisen AS uwb ON uwb.job_number=c.job_number and uwb.company_id=c.company_id
+        left join sub_project as d on d.id = a.sub_project_id
+        left join task on task.id = a.task_id
+        left join report_extra_degree on report_extra_degree.id = a.degree_id
+        left join task_group on task_group.id = a.group_id
+        left join user u on u.id = a.project_auditor_id
+        left join user u2 on u2.id = b.incharger_id
+        left join department on department.department_id = a.dept_id
+        left join department dp2 on dp2.department_id = b.bu_id
+        left join project_main on b.project_main_id=project_main.id
+        left join report_log_detail rlog on rlog.report_id = a.id
+        WHERE (<if test="stateKey == null or stateKey == 0">
+        a.state = 1
+    </if>
+        <if test="stateKey!=null">
+            <if test="stateKey==1">
+                (a.state = 1 or a.state = 0 or a.state = -1)
+            </if>
+            <if test="stateKey==2">
+                (a.state=0 or a.state = -1)
+            </if>
+        </if>)
+        <if test="startDate != null and startDate != ''">
+            AND a.create_date between #{startDate} and #{endDate}
+        </if>
+        <if test="projectId != null">
+            AND a.project_id = #{projectId}
+        </if>
+        <if test="companyId != null">
+            AND c.company_id = #{companyId}
+        </if>
+        <if test="userId != null">
+            AND a.creator_id = #{userId}
+        </if>
+        <if test="organizationId != 1 and branchDepartment != null and branchDepartment.size()>0">
+            AND department.department_id in
+            <foreach collection="branchDepartment" item="deptId" separator="," close=")" open="(" index="index">
+                #{deptId}
+            </foreach>
+        </if>
+        group by a.id
+        ORDER BY a.creator_id, a.create_date desc
+    </select>
+
 
     <select id="geReportByProject" resultType="java.util.Map">
         SELECT project_main.name as projectMainName,project_main.code as projectMainCode,