智慧农业后台管理
guoshilong
2022-08-23 76d76f7ef21ce544ff68e98e712184c2246a2229
小程序、后台数据统计产量统计显示采收总量和加工总量
5 files modified
43 ■■■■ changed files
src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/lang/vo/LandVO.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/recovery/controller/RecoveryController.java 6 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/recovery/entity/Recovery.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/recovery/mapper/RecoveryMapper.xml 32 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
@@ -229,7 +229,7 @@
    </select>
    <select id="selectByStrainId" resultType="org.springblade.modules.lang.entity.Land">
        SELECT land.id,land.land_name,land.url,land.farm_id
        SELECT land.id,land.land_name,land.url,land.farm_id,
        FROM sys_land land
            LEFT JOIN sys_farm_product_stock fps ON fps.land_id = land.id
        WHERE fps.strain_id = #{strainId}
src/main/java/org/springblade/modules/lang/vo/LandVO.java
@@ -41,4 +41,5 @@
     */
    String sfpStatus;
    String sfpId;
    String detail;
}
src/main/java/org/springblade/modules/recovery/controller/RecoveryController.java
@@ -106,7 +106,7 @@
            record.setLandId(recovery.getLandId());
            record.setDeptId(recovery.getDeptId());
            record.setTenantId(recovery.getTenantId());
            record.setStrainId(recovery.getStrainId());
            record.setStrainId(Integer.parseInt(recovery.getStrainId()));
            record.setOperator(recovery.getOperator());
            Strain strain = strainService.getById(recovery.getStrainId());
            record.setContent("品种: " + strain.getStrainName() + ", 重量:" + recovery.getWeight());
@@ -116,7 +116,7 @@
            //库存
            //先查询是否有该农产品的库存(根据地块,农产品)
            FarmProductStock stock = new FarmProductStock();
            stock.setStrainId(recovery.getStrainId());
            stock.setStrainId(Integer.parseInt(recovery.getStrainId()));
            stock.setLandId(recovery.getLandId());
            FarmProductStock stock1 = farmProductStockService.getOne(new QueryWrapper<>(stock));
            if (null != stock1) {
@@ -140,7 +140,7 @@
                productStock.setLeaves(recovery.getLeaves());
                productStock.setOperator(recovery.getOperator());
                productStock.setTime(recovery.getTime());
                productStock.setStrainId(recovery.getStrainId());
                productStock.setStrainId(Integer.parseInt(recovery.getStrainId()));
                productStock.setWeight(recovery.getWeight());
                productStock.setRecovery(recovery.getWeight());
                productStock.setFarmPlantId(recovery.getFarmPlantId());
src/main/java/org/springblade/modules/recovery/entity/Recovery.java
@@ -35,7 +35,7 @@
    /**
     * 品种id
     */
    private Integer strainId;
    private String strainId;
    /**
     * 土地id
src/main/java/org/springblade/modules/recovery/mapper/RecoveryMapper.xml
@@ -71,6 +71,22 @@
            and DATE_FORMAT(sr.create_time,'%Y-%m-%d') &lt;= #{recovery.endTime}
        </if>
        GROUP BY sr.strain_id
        UNION
        SELECT p.process_id,SUM(p.process_num),l.farm_id,m.machining_type,m.machining_tp
        FROM sys_process p
        LEFT JOIN sys_machining m ON p.process_id = m.id
        LEFT JOIN sys_land l ON p.land_id = l.id
        WHERE 1=1
        <if test="recovery.deptId !=null and recovery.deptId !=''">
            AND l.farm_id = #{recovery.deptId}
        </if>
        <if test="recovery.startTime != null and recovery.startTime !=''">
            AND DATE_FORMAT(p.create_time,'%Y-%m-%d') &gt;= #{recovery.startTime}
        </if>
        <if test="recovery.endTime != null and recovery.endTime !=''">
            and DATE_FORMAT(p.create_time,'%Y-%m-%d') &lt;= #{recovery.endTime}
        </if>
        GROUP BY p.process_id,l.farm_id
    </select>
    <select id="recoveryStatisticsx" resultType="org.springblade.modules.recovery.vo.RecoveryVO">
        SELECT sr.strain_id,SUM(sr.weight) AS weight,sr.dept_id,strain.strain_name,strain.url
@@ -90,5 +106,21 @@
            AND strain.strain_type = #{recovery.strainType}
        </if>
        GROUP BY sr.strain_id
        UNION
        SELECT p.process_id,SUM(p.process_num),l.farm_id,m.machining_type,m.machining_tp
        FROM sys_process p
        LEFT JOIN sys_machining m ON p.process_id = m.id
        LEFT JOIN sys_land l ON p.land_id = l.id
        WHERE 1=1
        <if test="recovery.deptId !=null and recovery.deptId !=''">
            AND l.farm_id = #{recovery.deptId}
        </if>
        <if test="recovery.startTime != null and recovery.startTime !=''">
            AND DATE_FORMAT(p.create_time,'%Y-%m-%d') &gt;= #{recovery.startTime}
        </if>
        <if test="recovery.endTime != null and recovery.endTime !=''">
            and DATE_FORMAT(p.create_time,'%Y-%m-%d') &lt;= #{recovery.endTime}
        </if>
        GROUP BY p.process_id,l.farm_id
    </select>
</mapper>