Browse Source

ljx:修改:分类编辑报错bug;新增:招商辅助当某年数据为空时,除数年份-1

ljx 1 month ago
parent
commit
230f6cccf3

+ 0 - 3
enteprise-admin/src/main/java/com/enteprise/attract_inv/controller/AttractInvController.java

@@ -5,8 +5,6 @@ import com.enteprise.attract_inv.domain.dto.AttractInvReturnDto;
 import com.enteprise.attract_inv.service.IAttractInvService;
 import com.enteprise.common.core.controller.BaseController;
 import com.enteprise.common.core.page.TableDataInfo;
-import com.enteprise.growthRate.domain.GrowthRate;
-import com.enteprise.growthRate.domain.dto.GrowthRateDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -16,7 +14,6 @@ import org.springframework.web.bind.annotation.RestController;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.List;
 
 @RestController
 @RequestMapping("/attractInv/attractInv")

+ 16 - 6
enteprise-admin/src/main/java/com/enteprise/attract_inv/service/impl/AttractInvServiceImpl.java

@@ -66,8 +66,8 @@ public class AttractInvServiceImpl implements IAttractInvService {
             }
         }
         //计算基准值
-        attractInvReturnDto.setStandardA(averageAnnualOutputValue/3*1.5);
-        attractInvReturnDto.setStandardB(averageAnnualTaxPaid/3*1.5);
+        attractInvReturnDto.setStandardA(averageAnnualOutputValue / aList.size() * 1.5);
+        attractInvReturnDto.setStandardB(averageAnnualTaxPaid / bList.size() * 1.5);
 
 
         //筛选企业
@@ -87,18 +87,28 @@ public class AttractInvServiceImpl implements IAttractInvService {
             double areaSum = 0;
             double taxSum = 0;
             double industrialSum = 0;
+            int divisorA = 0;
+            int divisorB = 0;
             for (int i = 1; i<4; i++) {
                 EnterpriseBaseDataYear dataYear = new EnterpriseBaseDataYear();
                 dataYear.setYear(String.valueOf(year - i));
                 dataYear.setEnterpriseName(enterpriseName);
                 List<EnterpriseBaseDataYear> yearList = enterpriseBaseDataYearMapper.selectEnterpriseBaseDataYearList(dataYear);
                 areaSum += yearList.get(0).getLandArea();
-                taxSum += yearList.get(0).getPaidTax();
-                industrialSum += yearList.get(0).getTotalIndustrialValue();
+                Long tax = yearList.get(0).getPaidTax();
+                taxSum += tax;
+                Long industrialValue = yearList.get(0).getTotalIndustrialValue();
+                industrialSum += industrialValue;
+                if (tax != 0){
+                    divisorA += 1;
+                }
+                if (industrialValue != 0){
+                    divisorB +=1;
+                }
             }
             //计算该企业近三年的用地、年均产值、年均实缴税金
-            attractInvDto.setAverageAnnualOutputValue(industrialSum/3);
-            attractInvDto.setAverageAnnualTaxPaid(taxSum/3);
+            attractInvDto.setAverageAnnualOutputValue(industrialSum/divisorB);
+            attractInvDto.setAverageAnnualTaxPaid(taxSum/divisorA);
             attractInvDto.setLandUsedInRecentThreeYears(areaSum);
             //添加到返回list
             attractInvDtos.add(attractInvDto);

+ 2 - 1
enteprise-admin/src/main/resources/mapper/etype/EnterpriseTypeMapper.xml

@@ -15,7 +15,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <sql id="selectEnterpriseTypeVo">
         select id, number, name from enterprise_type
-        order by number
     </sql>
 
     <select id="selectEnterpriseTypeList" parameterType="EnterpriseType" resultMap="EnterpriseTypeResult">
@@ -24,11 +23,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="number != null "> and number = #{number}</if>
             <if test="name != null "> and name like concat('%', #{name}, '%')</if>
         </where>
+        order by number
     </select>
     
     <select id="selectEnterpriseTypeByNumber" parameterType="String" resultMap="EnterpriseTypeResult">
         <include refid="selectEnterpriseTypeVo"/>
         where number = #{number}
+        order by number
     </select>
 
     <insert id="insertEnterpriseType" parameterType="EnterpriseType">