Browse Source

公司级报表部分代码

user5 3 years ago
parent
commit
c3d3170c30

+ 138 - 9
src/main/resources/mappings/modules/statement/StatementCompanyComprehensiveDao.xml

@@ -18,7 +18,9 @@
 		a.field3 as "field3",
 		a.field4 as "field4",
 		a.field5 as "field5",
-		a.field6 as "field6"
+		a.field6 as "field6",
+		a.field7 as "field7",
+		a.field8 as "field8"
 	</sql>
 
 	<select id="findList" resultType="RuralProjectRecords" >
@@ -67,7 +69,6 @@
 
 	<insert id="insert">
 		INSERT INTO statement_company_comprehensive_info(
-			id,
 			create_date,
 			year,
 			type,
@@ -80,9 +81,10 @@
 			field3,
 			field4,
 			field5,
-			field6
+			field6,
+			field7,
+			field8
 		) VALUES (
-			#{id},
 			#{createDate},
 			#{year},
 			#{type},
@@ -95,7 +97,9 @@
 			#{field3},
 			#{field4},
 			#{field5},
-			#{field6}
+			#{field6},
+			#{field7},
+			#{field8}
 
 		)
 	</insert>
@@ -114,7 +118,9 @@
 			field3 = #{field3},
 			field4 = #{field4},
 			field5 = #{field5},
-			field6 = #{field6}
+			field6 = #{field6},
+			field7 = #{field7},
+			field8 = #{field8}
 		WHERE id = #{id}
 	</update>
 
@@ -136,6 +142,7 @@
 		select count(1) from rural_project_records a
 		<where>
 			a.del_flag=0
+			and a.status = 5
 			and a.office_id in(select id  from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
 			and a.submit_money = #{grade}
 			and a.create_date >= #{beginDate}
@@ -159,6 +166,58 @@
 		</where>
 	</select>
 
+	<select id="getOverDueNotRecordProject" resultType="java.lang.String">
+		select id from rural_project_records a
+		<where>
+			a.del_flag=0
+			and a.record_state = 6
+			and a.over_record_status = 1
+			and a.office_id in(select id  from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
+		</where>
+	</select>
+
+	<select id="getOverDueRecordProject" resultType="java.lang.String">
+		select a.id from rural_project_records a
+		left join project_report_data prd on a.id = prd.project_id
+		left join rural_project_report_record rprr on prd.id = rprr.report_id
+		<where>
+			a.del_flag=0
+			and a.record_state = 7
+			and a.over_record_status = 1
+			and a.office_id in(select id  from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
+			and rprr.status = 5
+			and rprr.del_flag = 0
+			and rprr.accomplish_date >= #{beginDate}
+			and rprr.accomplish_date &lt;= #{endDate}
+		</where>
+	</select>
+
+	<select id="getOverDueNotReportedProject" resultType="java.lang.String">
+		select a.id from rural_project_records a
+		<where>
+			a.del_flag=0
+			and a.reported_state = 6
+			and a.over_due_status = 1
+			and a.office_id in(select id  from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
+		</where>
+	</select>
+
+	<select id="getOverDueReportedProject" resultType="java.lang.String">
+		select a.id from rural_project_records a
+		left join project_report_data prd on a.id = prd.project_id
+		left join rural_project_records_reported rprr on prd.id = rprr.id
+		<where>
+			a.del_flag=0
+			and a.reported_state = 7
+			and a.over_due_status = 1
+			and a.office_id in(select id  from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
+			and rprr.report_status = 5
+			and rprr.del_flag = 0
+			and rprr.accomplish_date >= #{beginDate}
+			and rprr.accomplish_date &lt;= #{endDate}
+		</where>
+	</select>
+
 	<select id="getProjectCountByReported" resultType="java.lang.Integer">
 		select count(1) from rural_project_records a
 		left join rural_project_records_reported rprr on a.id = rprr.id
@@ -188,7 +247,7 @@
 	</select>
 
 	<select id="getInsertInvoiceSumMoneyByOffice" resultType="java.lang.String">
-		select round(sum(money),2) from work_invoice a
+		select ifnull(round(sum(money),2),0) from work_invoice a
 		<where>
 			a.del_flag=0
 			and a.invoice_state = 5
@@ -213,7 +272,7 @@
 	</select>
 
 	<select id="getInsertInvoiceDetailsSumMoneyByOffice" resultType="java.lang.String">
-		select round(sum(a.total_money),2) from work_invoice_detail a
+		select ifnull(round(sum(a.total_money),2),0) from work_invoice_detail a
 		left join work_invoice wi on a.invoice_id = wi.id
 		<where>
 			wi.del_flag=0
@@ -238,7 +297,7 @@
 	</select>
 
 	<select id="getInsertReimbursementSumMoneyByOffice" resultType="java.lang.String">
-		select round(sum(a.money),2) from work_reimbursement a
+		select ifnull(round(sum(a.money),2),0) from work_reimbursement a
 		<where>
 			a.del_flag=0
 			and a.status = 5
@@ -259,5 +318,75 @@
 		</where>
 	</select>
 
+	<select id="getInsertContractRecordCountByOffice" resultType="java.lang.Integer">
+		select count(1) from work_contract_info a
+		<where>
+			and a.del_flag=0
+			and a.contract_state = 5
+			and a.contract_record_state = 5
+			and a.over_due_status = 0
+			and a.office_id in(select id  from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
+			and a.accomplish_date >= #{beginDate}
+			and a.accomplish_date &lt;= #{endDate}
+		</where>
+	</select>
+
+	<select id="getOverDueNotContractRecordCountByOffice" resultType="java.lang.String">
+		select a.id from work_contract_info a
+		<where>
+			and a.del_flag=0
+			and a.contract_state = 5
+			and a.contract_record_state = 6
+			and a.over_due_status = 1
+			and a.office_id in(select id  from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
+		</where>
+	</select>
+
+	<select id="getOverDueContractRecordCountByOffice" resultType="java.lang.String">
+		select a.id from work_contract_info a
+		<where>
+			and a.del_flag=0
+			and a.contract_state = 5
+			and a.contract_record_state = 7
+			and a.over_due_status = 1
+			and a.office_id in(select id  from sys_office where id = #{officeId} or parent_ids like concat('%',#{officeId},'%'))
+			and a.accomplish_date >= #{beginDate}
+			and a.accomplish_date &lt;= #{endDate}
+		</where>
+	</select>
 
+	<insert id="insertStatementDataInfo">
+		INSERT INTO statement_data_info
+		(
+		create_date
+		,year
+		,grade_type
+		,type
+		,big_date_type
+		,small_date_type
+		,statement_date
+		,office_id
+			,field1
+			,field2
+			,field3
+			,field4
+		)
+		VALUES
+		<foreach collection="dataList" item="data" separator=",">
+			(
+			now()
+			,#{data.year}
+			,#{data.gradeType}
+			,#{data.type}
+			,#{data.bigDateType}
+			,#{data.smallDateType}
+			,#{data.statementDate}
+			,#{data.officeId}
+				,#{data.field1}
+				,#{data.field2}
+				,#{data.field3}
+				,#{data.field4}
+			)
+		</foreach>
+	</insert>
 </mapper>