Antiloveg лет назад: 8
Родитель
Сommit
664e7485a2

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

@@ -45,6 +45,7 @@ import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.OrgCognizance;
 import com.goafanti.common.model.OrgCognizanceLog;
 import com.goafanti.common.model.OrgCognizanceProportion;
+import com.goafanti.common.model.OrgHumanResource;
 import com.goafanti.common.model.OrganizationIdentity;
 import com.goafanti.common.model.User;
 import com.goafanti.core.mybatis.BaseMybatisDao;
@@ -166,15 +167,22 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
 			cog.setGrossProfit3(
 					null == manageCost.getGrossProfit3() ? new BigDecimal(0) : manageCost.getGrossProfit3());
 		}
+		Integer firstCatagory = orgCognizanceMapper.findFirstCatagory(year, uid);
+		Integer secondCatagory = orgCognizanceMapper.findSecondCatagory(year, uid);
+		OrgHumanResource ohr = orgCognizanceMapper.findFirmAndTechTotal(year, uid);
+		BigDecimal totalRevenue = orgCognizanceMapper.findTotalRevenue(year, uid);
+		/*
+		 * CognizanceCatagoryBo catagory =
+		 * orgCognizanceMapper.selectCognizanceCatagoryBoByUidAndYear(year,
+		 * uid); if (null != catagory) {
+		 */
+		cog.setFirstCatagory(null == firstCatagory ? 0 : firstCatagory);
+		cog.setSecondCatagory(null == secondCatagory ? 0 : secondCatagory);
+		cog.setFirmTotal(null == ohr.getFirmTotal() ? 0 : ohr.getFirmTotal());
+		cog.setTechTotal(null == ohr.getTechTotal() ? 0 : ohr.getTechTotal());
+		cog.setTotalRevenue(null == totalRevenue ? new BigDecimal(0) : totalRevenue);
+		// }
 
-		CognizanceCatagoryBo catagory = orgCognizanceMapper.selectCognizanceCatagoryBoByUidAndYear(year, uid);
-		if (null != catagory) {
-			cog.setFirstCatagory(null == catagory.getFirstCatagory() ? 0 : catagory.getFirstCatagory());
-			cog.setSecondCatagory(null == catagory.getSecondCatagory() ? 0 : catagory.getSecondCatagory());
-			cog.setFirmTotal(null == catagory.getFirmTotal() ? 0 : catagory.getFirmTotal());
-			cog.setTechTotal(null == catagory.getTechTotal() ? 0 : catagory.getTechTotal());
-			cog.setTotalRevenue(null == catagory.getTotalRevenue() ? new BigDecimal(0) : catagory.getTotalRevenue());
-		}
 		BigDecimal revenue = orgCognizanceMapper.selectLastYearRevenueByUidAndYear(year, uid); // 上年度销售收入
 		cog.setLastYearRevenue(null == revenue ? new BigDecimal(0) : revenue);
 		return cog;
@@ -234,7 +242,8 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
 				cog.setAcceptDate(recordTime);
 			} else if (OrgCognizanceStatus.getStatus(cog.getState()) == OrgCognizanceStatus.ISSUING) {
 				cog.setIssuingDate(recordTime);
-				o.setCertificateNumber(StringUtils.isBlank(cog.getCertificateNumber()) ? "" : cog.getCertificateNumber());
+				o.setCertificateNumber(
+						StringUtils.isBlank(cog.getCertificateNumber()) ? "" : cog.getCertificateNumber());
 				o.setIssuingDate(recordTime);
 				o.setCogContacts(null == cog.getContacts() ? null : cog.getContacts());
 				organizationIdentityMapper.updateByPrimaryKeySelective(o);

+ 11 - 0
src/main/java/com/goafanti/common/dao/OrgCognizanceMapper.java

@@ -3,12 +3,15 @@ package com.goafanti.common.dao;
 import java.math.BigDecimal;
 import java.util.List;
 
+import org.apache.ibatis.annotations.Param;
+
 import com.goafanti.cognizance.bo.CognizanceCatagoryBo;
 import com.goafanti.cognizance.bo.CognizanceContractBo;
 import com.goafanti.cognizance.bo.CognizanceManageCostBo;
 import com.goafanti.cognizance.bo.CognizanceOrgInfoBo;
 import com.goafanti.cognizance.bo.CognizanceResearchCostBo;
 import com.goafanti.common.model.OrgCognizance;
+import com.goafanti.common.model.OrgHumanResource;
 
 public interface OrgCognizanceMapper {
     int deleteByPrimaryKey(String id);
@@ -43,4 +46,12 @@ public interface OrgCognizanceMapper {
 
 	int batchDeleteByContractId(List<String> id);
 
+	Integer findFirstCatagory(@Param("year")Integer year, @Param("uid")String uid);
+
+	Integer findSecondCatagory(@Param("year")Integer year, @Param("uid")String uid);
+
+	OrgHumanResource findFirmAndTechTotal(@Param("year")Integer year, @Param("uid")String uid);
+
+	BigDecimal findTotalRevenue(@Param("year")Integer year, @Param("uid")String uid);
+
 }

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

@@ -610,4 +610,67 @@
 		#{item}
 	</foreach>
   </update>
+  
+  <select id="findFirstCatagory" resultType="java.lang.Integer">
+  		select 
+			count(1) as firstCatagory 
+			from org_intellectual_property 
+					where uid = #{uid,jdbcType=VARCHAR}
+					and evaluation_category= 0 
+					and deleted_sign = 0 
+					and authorization_date >= 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
+						)
+					and authorization_date  <![CDATA[ < ]]> 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
+						)
+					and deleted_sign = 0
+					GROUP BY uid
+  </select>
+  
+  <select id="findSecondCatagory" resultType="java.lang.Integer">
+  	select 
+						count(1) as secondCatagory 
+					from org_intellectual_property 
+					where uid = #{uid,jdbcType=VARCHAR}
+					and evaluation_category = 1 
+					and deleted_sign = 0 
+					and authorization_date >= 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
+						)
+					and authorization_date  <![CDATA[ < ]]> 
+						(
+							select  
+								str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
+						)
+					GROUP BY uid
+  </select>
+  
+  <select id="findFirmAndTechTotal" resultType="com.goafanti.common.model.OrgHumanResource">
+					select 
+						uid, 
+						firm_total as firmTotal, 
+						tech_total as techTotal 
+					from org_human_resource 
+					where 
+						uid = #{uid,jdbcType=VARCHAR} 
+						and year = #{year,jdbcType=INTEGER}-1   
+						and deleted_sign = 0
+  </select>
+  
+  <select id="findTotalRevenue" resultType="java.math.BigDecimal">
+  SELECT 
+						(operating_income + non_operating_income - non_taxable_income) as totalRevenue
+					from org_ratepay 
+					where 
+						uid = #{uid,jdbcType=VARCHAR} 
+						and year = #{year,jdbcType=INTEGER}-1  
+						and deleted_sign = 0
+  </select>
 </mapper>