user5 пре 1 година
родитељ
комит
5ca7477513

+ 5 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectRecordsService.java

@@ -4712,6 +4712,11 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 		Office office = officeService.get(officeId);
 		//如果访问的是2023年4月份之后的月报信息,则获取新的office信息
 		if(StringUtils.isBlank(isThisMonth) || !"1".equals(isThisMonth)){
+			if(null != office && StringUtils.isNotBlank(office.getName()) && office.getName().equals("工程五部")){
+				statementCompanyComprehensiveInfo.setOfficeType("gcwb");
+			}else{
+				statementCompanyComprehensiveInfo.setOfficeType("other");
+			}
 			projectRecords.getSqlMap().put("officeId", "or parent_ids like concat('%',#{statementCompanyComprehensiveInfo.officeId},'%')");
 		}else{
 			if(null != office && StringUtils.isNotBlank(office.getName()) && office.getName().equals("工程五部")){

+ 7 - 0
src/main/java/com/jeeplus/modules/statement/dao/StatementCompanyComprehensiveDao.java

@@ -574,6 +574,13 @@ public interface StatementCompanyComprehensiveDao  extends CrudDao<StatementComp
      */
     List<StatementCompanyComprehensiveInfo> selectAllByTypeByYear(StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo);
 
+    /**
+     * 按照类型查询公司级所有报表信息 年度(五部)
+     * @param statementCompanyComprehensiveInfo
+     * @return
+     */
+    StatementCompanyComprehensiveInfo selectAllWbByTypeByYear(StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo);
+
 
     /**
      * 根据类型查询公司及所有报表信息 已年级

+ 9 - 0
src/main/java/com/jeeplus/modules/statement/entity/StatementCompanyComprehensiveInfo.java

@@ -38,6 +38,7 @@ public class StatementCompanyComprehensiveInfo extends DataEntity<StatementCompa
     private String field15;          //可变字段15(项目:B类批量归档 超期未归档)
     private String field16;          //可变字段16(项目:B类批量归档 超期归档)
     private String userName;        //用户名称
+    private String officeType;        //部门类型(用于区分是否是工程五部的限制条件)
 
     public String getYear() {
         return year;
@@ -302,4 +303,12 @@ public class StatementCompanyComprehensiveInfo extends DataEntity<StatementCompa
     public void setUserName(String userName) {
         this.userName = userName;
     }
+
+    public String getOfficeType() {
+        return officeType;
+    }
+
+    public void setOfficeType(String officeType) {
+        this.officeType = officeType;
+    }
 }

+ 75 - 6
src/main/java/com/jeeplus/modules/statement/service/StatementCompanyComprehensiveService.java

@@ -136,6 +136,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
         //公司级:开票报表
         //类型(1:项目;2:开票;3:报销;4:合同)
         statementCompanyComprehensiveInfo.setType("2");
+        statementCompanyComprehensiveInfo.setOfficeIdList(new ArrayList<>());
         List<StatementCompanyComprehensiveInfo> reportFormList2 = this.selectAllByType(statementCompanyComprehensiveInfo);
         //各列合计
         String kpnum1 = "0";
@@ -161,6 +162,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
         //公司级:报销报表
         //类型(1:项目;2:开票;3:报销;4:合同)
         statementCompanyComprehensiveInfo.setType("3");
+        statementCompanyComprehensiveInfo.setOfficeIdList(new ArrayList<>());
         List<StatementCompanyComprehensiveInfo> reportFormList3 = this.selectAllByType(statementCompanyComprehensiveInfo);
         //合计
         String bxnum1 = "0";
@@ -180,6 +182,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
         //公司级:合同报表
         //类型(1:项目;2:开票;3:报销;4:合同)
         statementCompanyComprehensiveInfo.setType("4");
+        statementCompanyComprehensiveInfo.setOfficeIdList(new ArrayList<>());
         List<StatementCompanyComprehensiveInfo> reportFormList4= this.selectAllByType(statementCompanyComprehensiveInfo);
         //合计
         String htnum1 = "0";
@@ -205,6 +208,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
         //公司级:项目报表总览 年度级
         //type:类型(1:项目;2:开票;3:报销;4:合同)
         statementCompanyComprehensiveInfo.setType("1");
+        statementCompanyComprehensiveInfo.setOfficeIdList(new ArrayList<>());
         List<StatementCompanyComprehensiveInfo> reportFormList5 = this.selectAllByTypeInYearReport(statementCompanyComprehensiveInfo);
         //项目表 各列合计
         String xmnumyear1 = "0";
@@ -266,6 +270,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
         //公司级:开票报表开始
         //类型(1:项目;2:开票;3:报销;4:合同)
         statementCompanyComprehensiveInfo.setType("2");
+        statementCompanyComprehensiveInfo.setOfficeIdList(new ArrayList<>());
         List<StatementCompanyComprehensiveInfo> reportFormList6 = this.selectAllByTypeInYearReport(statementCompanyComprehensiveInfo);
         //各列合计
         String kpyearnum1 = "0";
@@ -291,6 +296,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
     //公司级:报销报表
         //类型(1:项目;2:开票;3:报销;4:合同)
         statementCompanyComprehensiveInfo.setType("3");
+        statementCompanyComprehensiveInfo.setOfficeIdList(new ArrayList<>());
         List<StatementCompanyComprehensiveInfo> reportFormList7 = this.selectAllByTypeInYearReport(statementCompanyComprehensiveInfo);
         //合计
         String bxyearnum1 = "0";
@@ -310,6 +316,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
         //公司级:合同报表
         //类型(1:项目;2:开票;3:报销;4:合同)
         statementCompanyComprehensiveInfo.setType("4");
+        statementCompanyComprehensiveInfo.setOfficeIdList(new ArrayList<>());
         List<StatementCompanyComprehensiveInfo> reportFormList8= this.selectAllByTypeInYearReport(statementCompanyComprehensiveInfo);
         //合计
         String htyearnum1 = "0";
@@ -3670,7 +3677,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
     public List<StatementCompanyComprehensiveInfo> selectAllByType(StatementCompanyComprehensiveInfo info){
         //对五部数据单独处理
         //查询五部的所有部门
-        if("1".equalsIgnoreCase(info.getType())){
+        /*if("1".equalsIgnoreCase(info.getType())){
             List<Office> officeList = dao.getAllWBChildrenOfficeListInfo("工程五部");
 
             List<String> officeId = Lists.newArrayList();
@@ -3679,19 +3686,71 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
                 officeId.add(officeInfo.getId());
                 info.setOfficeIdList(officeId);
             }
+        }*/
+
+        List<Office> officeList = dao.getAllWBChildrenOfficeListInfo("工程五部");
+
+        List<String> officeId = Lists.newArrayList();
+        //获取所有子集节点,并遍历子集节点计算出所有数据信息
+        for (Office officeInfo : officeList) {
+            officeId.add(officeInfo.getId());
+            info.setOfficeIdList(officeId);
         }
         List<StatementCompanyComprehensiveInfo> list = Lists.newArrayList();
 
         if("0".equals(info.getBigDateType())){
 
             list =  dao.selectAllByTypeByYear(info);
+
+            Boolean flag = true;
+            String statementDate = "";
+            for (StatementCompanyComprehensiveInfo comprehensiveInfo : list) {
+                statementDate = comprehensiveInfo.getStatementDate();
+                if("工程五部".equals(comprehensiveInfo.getOfficeName()) /*&& "1".equals(info.getType())*/){
+                    flag = false;
+                    StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo = dao.selectAllWbByTypeByYear(comprehensiveInfo);
+                    statementCompanyComprehensiveInfo.setYear(info.getYear());
+                    statementCompanyComprehensiveInfo.setType(info.getType());
+                    statementCompanyComprehensiveInfo.setBigDateType(info.getBigDateType());
+                    statementCompanyComprehensiveInfo.setSmallDateType(info.getSmallDateType());
+                    statementCompanyComprehensiveInfo.setStatementDate(info.getStatementDate());
+                    statementCompanyComprehensiveInfo.setOfficeId(info.getOfficeId());
+
+                    list.add(statementCompanyComprehensiveInfo);
+                }
+            }
+            if(flag /*&& "1".equals(info.getType())*/){
+                StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo = dao.selectAllWbByTypeByYear(info);
+                statementCompanyComprehensiveInfo.setYear(info.getYear());
+                statementCompanyComprehensiveInfo.setType(info.getType());
+                statementCompanyComprehensiveInfo.setBigDateType(info.getBigDateType());
+                statementCompanyComprehensiveInfo.setSmallDateType(info.getSmallDateType());
+                statementCompanyComprehensiveInfo.setStatementDate(statementDate);
+                Office office = officeService.getByName("工程五部");
+                statementCompanyComprehensiveInfo.setOfficeId(office.getId());
+                statementCompanyComprehensiveInfo.setOfficeName(office.getName());
+
+                Boolean insertFlag = true;
+                for(int i= 0;i< list.size(); i++){
+                    StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo1 = list.get(i);
+                    if("工程四部".equals(statementCompanyComprehensiveInfo1.getOfficeName())){
+                        list.add(i+1,statementCompanyComprehensiveInfo);
+                        insertFlag = false;
+                    }
+                }
+                if(insertFlag){
+                    list.add(statementCompanyComprehensiveInfo);
+                }
+            }
+
+
         }else{
             list = dao.selectAllByType(info);
             Boolean flag = true;
             String statementDate = "";
             for (StatementCompanyComprehensiveInfo comprehensiveInfo : list) {
                 statementDate = comprehensiveInfo.getStatementDate();
-                if("工程五部".equals(comprehensiveInfo.getOfficeName()) && "1".equals(info.getType())){
+                if("工程五部".equals(comprehensiveInfo.getOfficeName()) /*&& "1".equals(info.getType())*/){
                     flag = false;
                     StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo = dao.selectAllWbByType(comprehensiveInfo);
                     statementCompanyComprehensiveInfo.setYear(info.getYear());
@@ -3704,7 +3763,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
                     list.add(statementCompanyComprehensiveInfo);
                 }
             }
-            if(flag && "1".equals(info.getType())){
+            if(flag /*&& "1".equals(info.getType())*/){
                 StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo = dao.selectAllWbByType(info);
                 statementCompanyComprehensiveInfo.setYear(info.getYear());
                 statementCompanyComprehensiveInfo.setType(info.getType());
@@ -3715,7 +3774,17 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
                 statementCompanyComprehensiveInfo.setOfficeId(office.getId());
                 statementCompanyComprehensiveInfo.setOfficeName(office.getName());
 
-                list.add(statementCompanyComprehensiveInfo);
+                Boolean insertFlag = true;
+                for(int i= 0;i< list.size(); i++){
+                    StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo1 = list.get(i);
+                    if("工程四部".equals(statementCompanyComprehensiveInfo1.getOfficeName())){
+                        list.add(i+1,statementCompanyComprehensiveInfo);
+                        insertFlag = false;
+                    }
+                }
+                if(insertFlag){
+                    list.add(statementCompanyComprehensiveInfo);
+                }
             }
         }
         return list;
@@ -3726,7 +3795,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
         info.setBigDateType("0");
         //对五部数据单独处理
         //查询五部的所有部门
-        if("1".equalsIgnoreCase(info.getType())){
+        /*if("1".equalsIgnoreCase(info.getType())){
             List<Office> officeList = dao.getAllWBChildrenOfficeListInfo("工程五部");
 
             List<String> officeId = Lists.newArrayList();
@@ -3735,7 +3804,7 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
                 officeId.add(officeInfo.getId());
                 info.setOfficeIdList(officeId);
             }
-        }
+        }*/
         List<StatementCompanyComprehensiveInfo> list = dao.selectAllByTypeByYear(info);
 
         StatementCompanyComprehensiveInfo childrenInfo = dao.selectAllByTypeByYearAndOfficeId(info);

+ 6 - 2
src/main/resources/mappings/modules/ruralprojectrecords/RuralProjectRecordsDao.xml

@@ -3459,7 +3459,9 @@
 			</if>
 
 			<if test="statementCompanyComprehensiveInfo.officeId != null and statementCompanyComprehensiveInfo.officeId !=''">
-				and sdi.office_id = #{statementCompanyComprehensiveInfo.officeId}
+				<if test="statementCompanyComprehensiveInfo.officeType != null and statementCompanyComprehensiveInfo.officeType !='gcwb'">
+					and sdi.office_id = #{statementCompanyComprehensiveInfo.officeId}
+				</if>
 			</if>
 			<if test="statementCompanyComprehensiveInfo.field5 == '5'.toString() ">
 				and pmdr.id is null
@@ -3680,7 +3682,9 @@
 			</if>
 
 			<if test="statementCompanyComprehensiveInfo.officeId != null and statementCompanyComprehensiveInfo.officeId !=''">
-				and sdi.office_id = #{statementCompanyComprehensiveInfo.officeId}
+				<if test="statementCompanyComprehensiveInfo.officeType != null and statementCompanyComprehensiveInfo.officeType !='gcwb'">
+					and sdi.office_id = #{statementCompanyComprehensiveInfo.officeId}
+				</if>
 			</if>
 			<if test="statementCompanyComprehensiveInfo.field5 == '5'.toString() ">
 				and pmdr.id is null

+ 35 - 0
src/main/resources/mappings/modules/statement/StatementCompanyComprehensiveDao.xml

@@ -1689,6 +1689,41 @@
 		</where>
 	</select>
 
+	<select id="selectAllWbByTypeByYear" parameterType="StatementCompanyComprehensiveInfo" resultType="StatementCompanyComprehensiveInfo">
+		select
+		sum(a.field1) as "field1",
+		sum(a.field2) as "field2",
+		sum(a.field3) as "field3",
+		sum(a.field4) as "field4",
+		sum(a.field5) as "field5",
+		sum(a.field6) as "field6",
+		sum(a.field7) as "field7",
+		sum(a.field8) as "field8",
+		sum(a.field9) as "field9",
+		sum(a.field10) as "field10",
+		sum(a.field11) as "field11",
+		sum(a.field12) as "field12",
+		sum(a.field13) as "field13",
+		sum(a.field14) as "field14",
+		sum(a.field15) as "field15",
+		sum(a.field16) as "field16"
+		from statement_company_comprehensive_info2 a
+		<where>
+			a.type = #{type}
+			and a.del_flag = 0
+			and a.big_date_type = #{bigDateType}
+			and a.year = #{year}
+			and a.small_date_type = #{smallDateType}
+
+			<if test="officeIdList!=null and officeIdList.size!=0">
+				and a.office_id in
+				<foreach collection="officeIdList" item="officeId" separator="," open="(" close=")">
+					#{officeId}
+				</foreach>
+			</if>
+		</where>
+	</select>
+
 
 
 	<select id="selectAllByTypeInYearReport" parameterType="StatementCompanyComprehensiveInfo" resultType="StatementCompanyComprehensiveInfo">