智慧农业后台管理
zhongrj
2022-07-29 4dff39db1e80e2c2dff1cf70f5ba9b199b5ebdc7
溯源码详情查询修改
7 files modified
40 ■■■■■ changed files
src/main/java/org/springblade/modules/farm/controller/FarmPaperController.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farm/mapper/FarmPaperMapper.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farm/mapper/FarmPaperMapper.xml 5 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farm/service/FarmPaperService.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farm/service/impl/FarmPaperServiceImpl.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/recovery/mapper/RecoveryMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/traceability/service/impl/TraceabilityServiceImpl.java 12 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farm/controller/FarmPaperController.java
@@ -32,6 +32,7 @@
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Date;
/**
 * 农场检测报告/证书控制器
@@ -85,6 +86,7 @@
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入farmPaper")
    public R save(@Valid @RequestBody FarmPaper farmPaper) {
        farmPaper.setCreateTime(new Date());
        return R.status(farmPaperService.save(farmPaper));
    }
src/main/java/org/springblade/modules/farm/mapper/FarmPaperMapper.java
@@ -26,8 +26,9 @@
    /**
     * 查询相关检测信息
     * @param deptId
     * @param farmId 农场id
     * @param farmPlantId 种植记录id
     * @return
     */
    List<FarmPaperVO> getFarmPaperList(@Param("deptId")String deptId);
    List<FarmPaperVO> getFarmPaperList(@Param("farmId") String farmId,@Param("farmPlantId") Integer farmPlantId);
}
src/main/java/org/springblade/modules/farm/mapper/FarmPaperMapper.xml
@@ -21,7 +21,10 @@
    <!--查询相关检测信息-->
    <select id="getFarmPaperList" resultType="org.springblade.modules.farm.vo.FarmPaperVO">
        select * from sys_farm_paper sfp where dept_id = #{deptId}
        select * from sys_farm_paper
        where 1=1
        and (farm_id = #{farmId} and type != 3)
        or (farm_id = #{farmPlantId} and type = 3)
    </select>
</mapper>
src/main/java/org/springblade/modules/farm/service/FarmPaperService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.farm.entity.FarmPaper;
import org.springblade.modules.farm.vo.FarmPaperVO;
@@ -27,8 +28,9 @@
    /**
     * 查询相关检测信息
     * @param deptId
     * @param farmId 农场id
     * @param farmPlantId 种植记录id
     * @return
     */
    List<FarmPaperVO> getFarmPaperList(String deptId);
    List<FarmPaperVO> getFarmPaperList(String farmId,Integer farmPlantId);
}
src/main/java/org/springblade/modules/farm/service/impl/FarmPaperServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.farm.entity.FarmPaper;
import org.springblade.modules.farm.mapper.FarmPaperMapper;
import org.springblade.modules.farm.vo.FarmPaperVO;
@@ -31,11 +32,12 @@
    /**
     * 查询相关检测信息
     * @param deptId
     * @param farmId 农场id
     * @param farmPlantId 种植记录id
     * @return
     */
    @Override
    public List<FarmPaperVO> getFarmPaperList(String deptId) {
        return baseMapper.getFarmPaperList(deptId);
    public List<FarmPaperVO> getFarmPaperList(String farmId,Integer farmPlantId) {
        return baseMapper.getFarmPaperList(farmId,farmPlantId);
    }
}
src/main/java/org/springblade/modules/recovery/mapper/RecoveryMapper.xml
@@ -43,7 +43,7 @@
    <!--查询农产品采收记录信息-->
    <select id="getRecoveryDetail" resultType="org.springblade.modules.recovery.vo.RecoveryVO">
        select sr.id,sr.strain_id strainId,sr.land_id landId,sr.time,ss.strain_name strainName,ss.url,
        select sr.id,sr.strain_id strainId,sr.land_id landId,sr.time,ss.strain_name strainName,ss.url,sr.farm_plant_id farmPlantId,
        case
           when sfp.plant = '0' then '有机'
           when sfp.plant = 1 then '绿色'
src/main/java/org/springblade/modules/traceability/service/impl/TraceabilityServiceImpl.java
@@ -29,6 +29,7 @@
import org.springblade.modules.traceability.vo.TraceabilityVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sun.misc.BASE64Encoder;
import javax.sound.midi.Receiver;
@@ -138,7 +139,7 @@
        //1. 查询农产品采收记录信息
        RecoveryVO recoveryVO = recoveryService.getRecoveryDetail(traceability1.getRecoveryId());
        //2. 查询相关检测信息
        List<FarmPaperVO> farmPaperList = farmPaperService.getFarmPaperList(traceability1.getDeptId());
        List<FarmPaperVO> farmPaperList = farmPaperService.getFarmPaperList(recoveryVO.getFarmId(),recoveryVO.getFarmPlantId());
        //3. 查询产地(地块)信息
        LandVO land = new LandVO();
        land.setId(Long.parseLong(recoveryVO.getLandId()));
@@ -190,6 +191,7 @@
     * @return
     */
    @Override
    @Transactional
    public TraceabilityDetailDTO getTraceabilityDetailInfos(Traceability traceability) {
        TraceabilityDetailDTO dto = new TraceabilityDetailDTO();
        int count = 0;
@@ -205,7 +207,7 @@
        //1. 查询农产品采收记录信息
        RecoveryVO recoveryVO = recoveryService.getRecoveryDetail(traceability1.getRecoveryId());
        //2. 查询相关检测信息
        List<FarmPaperVO> farmPaperList = farmPaperService.getFarmPaperList(traceability1.getDeptId());
        List<FarmPaperVO> farmPaperList = farmPaperService.getFarmPaperList(recoveryVO.getFarmId(),recoveryVO.getFarmPlantId());
        //3. 查询产地(地块)信息
        LandVO land = new LandVO();
        land.setId(Long.parseLong(recoveryVO.getLandId()));
@@ -213,12 +215,10 @@
        //4. 查询农事记录信息(种植开始起)
        List<FarmingRecordVO> farmingRecordVOList = farmingRecordService.getFarmingRecordByFarmPlantId(recoveryVO);
        //5. 查询企业信息
        Farm farm = new Farm();
        farm.setDeptId(traceability1.getDeptId());
        Farm farmVO = farmService.getOne(new QueryWrapper<>(farm));
        Farm farm = farmService.getById(recoveryVO.getFarmId());
        //6. 数据封装
        dto.setRecoveryVO(recoveryVO);
        dto.setFarm(farmVO);
        dto.setFarm(farm);
        dto.setRecordVOList(farmingRecordVOList);
        dto.setPaperVOList(farmPaperList);
        dto.setLandVO(landInfo);