Antiloveg 8 years ago
parent
commit
00cd445183

+ 8 - 2
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -203,13 +203,19 @@ public class AdminApiController extends CertifyApiController {
 	 * 统计专利、软著及科技项目申报业务情况
 	 */
 	@RequestMapping(value = "/getBusinessCount", method = RequestMethod.GET)
-	public Result countBusiness(String uid) {
+	public Result countBusiness(String uid, Integer year) {
 		Result res = new Result();
 		if (StringUtils.isBlank(uid)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户ID"));
 			return res;
 		}
-		res.setData(orgCognizanceService.countBusiness(uid));
+
+		if (null != year) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
+			return res;
+		}
+
+		res.setData(orgCognizanceService.countBusiness(uid, year));
 		return res;
 	}
 

+ 1 - 1
src/main/java/com/goafanti/cognizance/service/OrgCognizanceService.java

@@ -52,7 +52,7 @@ public interface OrgCognizanceService {
 
 	Integer selectLatelyRecordYear(String uid);
 
-	BusinessCountBo countBusiness(String uid);
+	BusinessCountBo countBusiness(String uid, Integer year);
 
 	OrgCognizance saveCognizance(OrgCognizance oc, String salesman);
 

+ 7 - 7
src/main/java/com/goafanti/cognizance/service/impl/OrgCognizanceServiceImpl.java

@@ -348,15 +348,15 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
 	}
 
 	@Override
-	public BusinessCountBo countBusiness(String uid) {
+	public BusinessCountBo countBusiness(String uid, Integer year) {
 		BusinessCountBo bcb = new BusinessCountBo();
 		bcb.setUid(uid);
-		bcb.setCopyrightDone(copyrightInfoMapper.countCopyrightDone(uid));
-		bcb.setCopyrightUndone(copyrightInfoMapper.countCopyrightUnDone(uid));
-		bcb.setPatentDone(patentInfoMapper.countPatentDone(uid));
-		bcb.setPatentUndone(patentInfoMapper.countPatentUndone(uid));
-		bcb.setTechProjectDone(techProjectMapper.countTechProjectDone(uid));
-		bcb.setTechProjectUndone(techProjectMapper.countTechProjectUndone(uid));
+		bcb.setCopyrightDone(copyrightInfoMapper.countCopyrightDone(uid, year));
+		bcb.setCopyrightUndone(copyrightInfoMapper.countCopyrightUnDone(uid, year));
+		bcb.setPatentDone(patentInfoMapper.countPatentDone(uid, year));
+		bcb.setPatentUndone(patentInfoMapper.countPatentUndone(uid, year));
+		bcb.setTechProjectDone(techProjectMapper.countTechProjectDone(uid, year));
+		bcb.setTechProjectUndone(techProjectMapper.countTechProjectUndone(uid, year));
 		return bcb;
 	}
 

+ 4 - 2
src/main/java/com/goafanti/common/dao/CopyrightInfoMapper.java

@@ -3,6 +3,8 @@ package com.goafanti.common.dao;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ibatis.annotations.Param;
+
 import com.goafanti.common.model.CopyrightInfo;
 import com.goafanti.copyright.bo.CopyrightContractListBo;
 import com.goafanti.copyright.bo.CopyrightInfoDetail;
@@ -31,7 +33,7 @@ public interface CopyrightInfoMapper {
 
 	List<CopyrightInfo> selectByPrimaryKeys(List<String> asList);
 
-	Integer countCopyrightDone(String uid);
+	Integer countCopyrightDone(@Param("uid")String uid, @Param("year")Integer year);
 
 	List<CopyrightContractListBo> listContractCopyrightByContractId(String contractId);
 
@@ -41,5 +43,5 @@ public interface CopyrightInfoMapper {
 
 	Integer findCopyrightInfoNumByUid(String uid);
 
-	Integer countCopyrightUnDone(String uid);
+	Integer countCopyrightUnDone(@Param("uid")String uid, @Param("year")Integer year);
 }

+ 4 - 2
src/main/java/com/goafanti/common/dao/PatentInfoMapper.java

@@ -3,6 +3,8 @@ package com.goafanti.common.dao;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ibatis.annotations.Param;
+
 import com.goafanti.common.model.PatentInfo;
 import com.goafanti.patent.bo.PatentAnnualFeeTaskBo;
 import com.goafanti.patent.bo.PatentContractListBo;
@@ -37,9 +39,9 @@ public interface PatentInfoMapper {
 
 	List<PatentInfo> selectByPrimaryKeys(List<String> id);
 
-	Integer countPatentDone(String uid);
+	Integer countPatentDone(@Param("uid")String uid, @Param("year")Integer year);
 
-	Integer countPatentUndone(String uid);
+	Integer countPatentUndone(@Param("uid")String uid, @Param("year")Integer year);
 
 	List<PatentExpireBo> selectExpireRecord();
 

+ 4 - 2
src/main/java/com/goafanti/common/dao/TechProjectMapper.java

@@ -2,6 +2,8 @@ package com.goafanti.common.dao;
 
 import java.util.List;
 
+import org.apache.ibatis.annotations.Param;
+
 import com.goafanti.common.model.TechProject;
 import com.goafanti.techproject.bo.TechProjectContractListBo;
 import com.goafanti.techproject.bo.TechProjectDetailBo;
@@ -24,9 +26,9 @@ public interface TechProjectMapper {
 
 	int batchDeleteByPrimaryKey(List<String> id);
 
-	Integer countTechProjectDone(String uid);
+	Integer countTechProjectDone(@Param("uid")String uid, @Param("year")Integer year);
 
-	Integer countTechProjectUndone(String uid);
+	Integer countTechProjectUndone(@Param("uid")String uid, @Param("year")Integer year);
 
 	List<OrgUnitNames> selectWebsiteUnitNames(String principal);
 

+ 29 - 3
src/main/java/com/goafanti/common/mapper/CopyrightInfoMapper.xml

@@ -436,15 +436,41 @@
   </select>
   
   <select id="countCopyrightDone" parameterType="java.lang.String" resultType="java.lang.Integer">
-   select count(1) from copyright_info 
+   select 
+   		count(1) 
+   from copyright_info 
    where uid = #{uid,jdbcType=VARCHAR}
    and delete_sign = 0 and status in (8,9) 
+   and authorized_date >= 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
+						)
+   and authorized_date  <![CDATA[ < ]]> 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
+						)
+   
   </select>
   
   <select id="countCopyrightUndone" parameterType="java.lang.String" resultType="java.lang.Integer">
-   select count(1) from copyright_info 
+   select 
+   		count(1) 
+   from copyright_info 
    where uid = #{uid,jdbcType=VARCHAR}
-   and delete_sign = 0 and status <![CDATA[ < ]]> 8 
+   and delete_sign = 0 
+   and status <![CDATA[ < ]]> 8 
+   and authorized_date >= 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
+						)
+   and authorized_date  <![CDATA[ < ]]> 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
+						)
   </select>
   
   <select id="listContractCopyrightByContractId" parameterType="java.lang.String" resultType="com.goafanti.copyright.bo.CopyrightContractListBo">

+ 5 - 5
src/main/java/com/goafanti/common/mapper/OrgCognizanceMapper.xml

@@ -454,12 +454,12 @@
 					and authorization_date >= 
 						(
 							select  
-								str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H')
+								str_to_date(CONCAT(#{0}-3,'-01-01'), '%Y-%m-%d %H')
 						)
 					and authorization_date  <![CDATA[ < ]]> 
 						(
 							select  
-								str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H')
+								str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H')
 						)
 					and deleted_sign = 0
 					GROUP BY uid
@@ -476,12 +476,12 @@
 					and authorization_date >= 
 						(
 							select  
-								str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H')
+								str_to_date(CONCAT(#{0}-3,'-01-01'), '%Y-%m-%d %H')
 						)
 					and authorization_date  <![CDATA[ < ]]> 
 						(
 							select  
-								str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H')
+								str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H')
 						)
 					GROUP BY uid
 				) b on b.uid = u.id
@@ -516,7 +516,7 @@
 		from org_tech_product 
 		where 
 			uid = #{1}
-			and year = #{0} 
+			and year = #{0}-1 
 			and deleted_sign = 0
   </select>
 	

+ 32 - 6
src/main/java/com/goafanti/common/mapper/PatentInfoMapper.xml

@@ -984,15 +984,41 @@
 	</select>
 	
   <select id="countPatentDone" parameterType="java.lang.String" resultType="java.lang.Integer">
-	   select count(1) from patent_info 
-	   where uid = #{uid,jdbcType=VARCHAR}
-	   and deleted_sign = 0 and patent_state in (12,13) 
+	 select 
+	  	 count(1) from patent_info 
+	 where uid = #{uid,jdbcType=VARCHAR}
+	 and deleted_sign = 0 
+	 and patent_state in (12,13) 
+	 and authorized_date >= 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
+						)
+     and authorized_date  <![CDATA[ < ]]> 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
+						)
+	 
   </select>
   
   <select id="countPatentUndone" parameterType="java.lang.String" resultType="java.lang.Integer">
-	   select count(1) from patent_info 
-	   where uid = #{uid,jdbcType=VARCHAR}
-	   and deleted_sign = 0 and patent_state <![CDATA[ < ]]> 12 
+    select 
+    	count(1) 
+    from patent_info 
+	where uid = #{uid,jdbcType=VARCHAR}
+	and deleted_sign = 0 
+	and patent_state <![CDATA[ < ]]> 12
+	and authorized_date >= 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
+						)
+    and authorized_date  <![CDATA[ < ]]> 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
+						)
   </select>
   
   <select id="selectExpireRecord"  resultType="com.goafanti.patent.bo.PatentExpireBo">	

+ 31 - 4
src/main/java/com/goafanti/common/mapper/TechProjectMapper.xml

@@ -462,15 +462,42 @@
   </update>
   
   <select id="countTechProjectDone" parameterType="java.lang.String" resultType="java.lang.Integer">
-	   select count(1) from tech_project 
+	   select 
+	   		count(1) 
+	   from tech_project 
 	   where uid = #{uid,jdbcType=VARCHAR}
-	   and deleted_sign = 0 and state in (6,8) 
+	   and 
+	   deleted_sign = 0 
+	   and state in (6,8) 
+	   and approved_date >= 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
+						)
+   	   and approved_date  <![CDATA[ < ]]> 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
+						)
   </select>
   
   <select id="countTechProjectUndone" parameterType="java.lang.String" resultType="java.lang.Integer">
-	   select count(1) from tech_project 
+	   select 
+	   		count(1) 
+	   from tech_project 
 	   where uid = #{uid,jdbcType=VARCHAR}
-	   and deleted_sign = 0 and state in (1,2,3,4,5,7)
+	   and deleted_sign = 0 
+	   and state in (1,2,3,4,5,7)
+	   and approved_date >= 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
+						)
+   	   and approved_date  <![CDATA[ < ]]> 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
+						) 
   </select>
   
   <select id="selectWebsiteUnitNames" parameterType="java.lang.String" resultType="com.goafanti.user.bo.OrgUnitNames">