فهرست منبع

修改bug,新增农技知识管理

zmj 5 ماه پیش
والد
کامیت
7caa1d9d2b
46فایلهای تغییر یافته به همراه1805 افزوده شده و 218 حذف شده
  1. 3 3
      ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteUserService.java
  2. 3 1
      ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserFallbackFactory.java
  3. 31 13
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/AgriculturalTasksController.java
  4. 21 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/DeviceController.java
  5. 105 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/KnowledgeContentController.java
  6. 36 4
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/MachineWorkRecordsController.java
  7. 13 1
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/MallController.java
  8. 12 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/ProductInfoController.java
  9. 61 32
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/AgriculturalTasks.java
  10. 252 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/KnowledgeContent.java
  11. 1 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/MachineWorkRecords.java
  12. 37 12
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/Mall.java
  13. 40 29
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/ProductInfo.java
  14. 22 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/dto/AgriculturalTasksDay.java
  15. 1 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/mapper/AgriculturalMachinesMapper.java
  16. 27 8
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/mapper/AgriculturalTasksMapper.java
  17. 61 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/mapper/KnowledgeContentMapper.java
  18. 11 8
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/mapper/MallMapper.java
  19. 7 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/mapper/ProductInfoMapper.java
  20. 1 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IAgriculturalMachinesService.java
  21. 20 8
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IAgriculturalTasksService.java
  22. 10 8
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IDeviceService.java
  23. 61 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IKnowledgeContentService.java
  24. 11 8
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IMallService.java
  25. 3 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IProductInfoService.java
  26. 1 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/AgriculturalMachinesServiceImpl.java
  27. 140 9
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/AgriculturalTasksServiceImpl.java
  28. 214 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/DeviceServiceImpl.java
  29. 96 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/KnowledgeContentServiceImpl.java
  30. 25 8
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/MallServiceImpl.java
  31. 10 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/ProductInfoServiceImpl.java
  32. 18 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/vo/AgriculturalTasksListDay.java
  33. 27 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/vo/AgriculturalTasksStatistics.java
  34. 18 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/vo/MallCountVo.java
  35. 20 0
      ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/vo/ProductInfoCountVo.java
  36. 1 0
      ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/AgriculturalMachinesMapper.xml
  37. 178 40
      ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/AgriculturalTasksMapper.xml
  38. 129 0
      ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/KnowledgeContentMapper.xml
  39. 7 3
      ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/MachineWorkRecordsMapper.xml
  40. 34 12
      ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/MallMapper.xml
  41. 20 1
      ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/ProductInfoMapper.xml
  42. 4 4
      ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java
  43. 1 1
      ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
  44. 1 1
      ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
  45. 3 3
      ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  46. 8 1
      ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

+ 3 - 3
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteUserService.java

@@ -69,10 +69,10 @@ public interface RemoteUserService
     /**
      * 通过部门id查询岗位为农机驾驶员用户信息
      *
-     * @param farmId 部门id
+     * @param sysUser 用户信息
      * @param source 请求来源
      * @return 结果
      */
-    @GetMapping("/user/infoPost/{farmId}")
-    R<List<SysUser>> getUserByFarmId(@PathVariable("farmId") Long farmId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
+    @PostMapping("/user/getUserByFarmId")
+    R<List<SysUser>> getUserByFarmId(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 }

+ 3 - 1
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserFallbackFactory.java

@@ -51,9 +51,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
             }
 
             @Override
-            public R<List<SysUser>> getUserByFarmId(Long farmId, String source) {
+            public R<List<SysUser>> getUserByFarmId(SysUser sysUser, String source) {
                 return R.fail("获取用户失败:" + throwable.getMessage());
             }
+
+
         };
     }
 }

+ 31 - 13
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/AgriculturalTasksController.java

@@ -32,7 +32,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
 
 /**
  * 农事任务Controller
- * 
+ *
  * @author ruoyi
  * @date 2025-07-22
  */
@@ -58,6 +58,24 @@ public class AgriculturalTasksController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 查询农事任务统计
+     */
+    @GetMapping("/listStatistics")
+    public AjaxResult listStatistics(AgriculturalTasks agriculturalTasks)
+    {
+
+        return success(agriculturalTasksService.selectAgriculturalTaskStatistics(agriculturalTasks));
+    }
+
+
+    @GetMapping("/listTasksTodoData")
+    public AjaxResult todoData()
+    {
+
+        return success(agriculturalTasksService.selectAgriculturalTasksListDay());
+    }
+
     /**
      * 导出农事任务列表
      */
@@ -119,7 +137,7 @@ public class AgriculturalTasksController extends BaseController
 
         return R.ok(agriculturalTasksService.countStatusTypeTasks(agriculturalTasks));
     }
-    
+
     /**
      * 上传农事任务相关图片
      */
@@ -129,31 +147,31 @@ public class AgriculturalTasksController extends BaseController
         if (file == null || file.isEmpty()) {
             return AjaxResult.error("上传文件不能为空");
         }
-        
+
         // 校验文件大小(限制为5MB)
         long maxSize = 5 * 1024 * 1024; // 5MB
         if (file.getSize() > maxSize) {
             return AjaxResult.error("文件大小不能超过5MB");
         }
-        
+
         // 校验文件类型
         String originalFilename = file.getOriginalFilename();
         String fileExtension = "";
         if (originalFilename != null && originalFilename.contains(".")) {
             fileExtension = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase();
         }
-        
+
         // 只允许图片格式
-        if (!".jpg".equals(fileExtension) && !".jpeg".equals(fileExtension) 
+        if (!".jpg".equals(fileExtension) && !".jpeg".equals(fileExtension)
             && !".png".equals(fileExtension) && !".gif".equals(fileExtension)) {
             return AjaxResult.error("只能上传JPG、JPEG、PNG、GIF格式的图片");
         }
-        
+
         // 设置默认目录,如果未指定
         if (directory == null || directory.trim().isEmpty()) {
             directory = uploadDir; // 默认目录
         }
-        
+
         // 检查目标目录是否存在,不存在则创建
         File targetDir = new File(directory);
         if (!targetDir.exists()) {
@@ -161,25 +179,25 @@ public class AgriculturalTasksController extends BaseController
                 return AjaxResult.error("无法创建目录:" + directory);
             }
         }
-        
+
         // 生成唯一文件名避免冲突
         String newFileName = UUID.randomUUID().toString().replace("-", "") + fileExtension;
         File targetFile = new File(directory, newFileName);
-        
+
         try {
             // 保存文件
             file.transferTo(targetFile);
-            
+
             // 构造访问URL(这里需要根据实际项目配置的静态资源访问路径来设置)
             String baseUrl = "/profile/"; // 静态资源访问基础路径,根据实际情况修改
             String accessUrl = baseUrl + newFileName;
-            
+
             // 返回结果
             Map<String, String> result = new HashMap<>();
             result.put("url", accessUrl);
             result.put("fileName", newFileName);
             result.put("originalFileName", originalFilename);
-            
+
             return AjaxResult.success("上传成功", result);
         } catch (IOException e) {
             e.printStackTrace();

+ 21 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/DeviceController.java

@@ -75,6 +75,27 @@ public class DeviceController extends BaseController
     }
 
 
+    /**
+     * 开始点播
+     */
+    @GetMapping(value = "/playback")
+    public AjaxResult playback(Device device)
+    {
+        return success(deviceService.videoPlayback(device));
+    }
+
+    /**
+     * 停止点播
+     */
+    @GetMapping(value = "/stopPlaying")
+    public AjaxResult stopPlaying(Device device)
+    {
+        deviceService.videoStopPlaying(device);
+        return success();
+    }
+
+
+
 
 
 

+ 105 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/KnowledgeContentController.java

@@ -0,0 +1,105 @@
+package com.ruoyi.base.controller;
+
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.log.annotation.Log;
+import com.ruoyi.common.log.enums.BusinessType;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.base.domain.KnowledgeContent;
+import com.ruoyi.base.service.IKnowledgeContentService;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.common.core.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.web.page.TableDataInfo;
+
+/**
+ * 农技知识管理Controller
+ *
+ * @author zmj
+ * @date 2025-08-18
+ */
+@RestController
+@RequestMapping("/knowledgeContent")
+public class KnowledgeContentController extends BaseController
+{
+    @Autowired
+    private IKnowledgeContentService knowledgeContentService;
+
+    /**
+     * 查询农技知识管理列表
+     */
+    @RequiresPermissions("base:knowledgeContent:list")
+    @GetMapping("/list")
+    public TableDataInfo list(KnowledgeContent knowledgeContent)
+    {
+        startPage();
+        List<KnowledgeContent> list = knowledgeContentService.selectKnowledgeContentList(knowledgeContent);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出农技知识管理列表
+     */
+    @RequiresPermissions("base:knowledgeContent:export")
+    @Log(title = "农技知识管理", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, KnowledgeContent knowledgeContent)
+    {
+        List<KnowledgeContent> list = knowledgeContentService.selectKnowledgeContentList(knowledgeContent);
+        ExcelUtil<KnowledgeContent> util = new ExcelUtil<KnowledgeContent>(KnowledgeContent.class);
+        util.exportExcel(response, list, "农技知识管理数据");
+    }
+
+    /**
+     * 获取农技知识管理详细信息
+     */
+    @RequiresPermissions("base:knowledgeContent:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(knowledgeContentService.selectKnowledgeContentById(id));
+    }
+
+    /**
+     * 新增农技知识管理
+     */
+    @RequiresPermissions("base:knowledgeContent:add")
+    @Log(title = "农技知识管理", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody KnowledgeContent knowledgeContent)
+    {
+        return toAjax(knowledgeContentService.insertKnowledgeContent(knowledgeContent));
+    }
+
+    /**
+     * 修改农技知识管理
+     */
+    @RequiresPermissions("base:knowledgeContent:edit")
+    @Log(title = "农技知识管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody KnowledgeContent knowledgeContent)
+    {
+        return toAjax(knowledgeContentService.updateKnowledgeContent(knowledgeContent));
+    }
+
+    /**
+     * 删除农技知识管理
+     */
+    @RequiresPermissions("base:knowledgeContent:remove")
+    @Log(title = "农技知识管理", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(knowledgeContentService.deleteKnowledgeContentByIds(ids));
+    }
+}

+ 36 - 4
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/MachineWorkRecordsController.java

@@ -98,17 +98,17 @@ public class MachineWorkRecordsController extends BaseController
     /**
      * 获取农机作业记录详细信息
      */
-    @GetMapping(value = "/MachineNameFieldUser/{farmId}")
-    public AjaxResult queryMachineNameFieldUser(@PathVariable("farmId") Long farmId)
+    @PostMapping(value = "/MachineNameFieldUser")
+    public AjaxResult queryMachineNameFieldUser(@RequestBody SysUser sysUser)
     {
         MachineNameFieldUserVo machineNameFieldUserVo = new MachineNameFieldUserVo();
         List<String> deptIds = new ArrayList<>();
-        deptIds.add(farmId.toString());
+        deptIds.add(sysUser.getDeptId().toString());
         AgriculturalMachines agriculturalMachines = new AgriculturalMachines();
         agriculturalMachines.setDeptIdList(deptIds);
         Field field = new Field();
         field.setDeptIdList(deptIds);
-        R<List<SysUser>> userResult = remoteUserService.getUserByFarmId(farmId, SecurityConstants.INNER);
+        R<List<SysUser>> userResult = remoteUserService.getUserByFarmId(sysUser, SecurityConstants.INNER);
 
         if (R.FAIL == userResult.getCode())
         {
@@ -116,6 +116,38 @@ public class MachineWorkRecordsController extends BaseController
         }
         List<SysUser> users = userResult.getData();
 
+
+
+        List<AgriculturalMachines> machinesList = agriculturalMachinesService.selectAgriculturalMachinesList(agriculturalMachines);
+        List<Field> fields = fieldService.selectFieldList(field);
+
+        machineNameFieldUserVo.setMachinesList(machinesList);
+        machineNameFieldUserVo.setFields(fields);
+        machineNameFieldUserVo.setUsers(users);
+        return success(machineNameFieldUserVo);
+
+    }
+
+    @PostMapping(value = "/MachineNameFieldUserText")
+    public AjaxResult MachineNameFieldUserText(@RequestBody SysUser sysUser)
+    {
+        MachineNameFieldUserVo machineNameFieldUserVo = new MachineNameFieldUserVo();
+        List<String> deptIds = new ArrayList<>();
+        deptIds.add(sysUser.getDeptId().toString());
+        AgriculturalMachines agriculturalMachines = new AgriculturalMachines();
+        agriculturalMachines.setDeptIdList(deptIds);
+        Field field = new Field();
+        field.setDeptIdList(deptIds);
+        R<List<SysUser>> userResult = remoteUserService.getUserByFarmId(sysUser, SecurityConstants.INNER);
+
+        if (R.FAIL == userResult.getCode())
+        {
+            throw new ServiceException(userResult.getMsg());
+        }
+        List<SysUser> users = userResult.getData();
+
+
+
         List<AgriculturalMachines> machinesList = agriculturalMachinesService.selectAgriculturalMachinesList(agriculturalMachines);
         List<Field> fields = fieldService.selectFieldList(field);
 

+ 13 - 1
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/MallController.java

@@ -17,7 +17,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
 
 /**
  * 农资商城Controller
- * 
+ *
  * @author ruoyi
  * @date 2025-08-15
  */
@@ -71,9 +71,20 @@ public class MallController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody Mall mall)
     {
+        mall.convertFeaturesTextToFeatures();
         return toAjax(mallService.insertMall(mall));
     }
 
+
+    /**
+     * 统计农资商城
+     */
+    @PostMapping("/getCount")
+    public AjaxResult getCount(@RequestBody Mall mall)
+    {
+        return success(mallService.selectMallCount(mall));
+    }
+
     /**
      * 修改农资商城
      */
@@ -82,6 +93,7 @@ public class MallController extends BaseController
     @PutMapping
     public AjaxResult edit(@RequestBody Mall mall)
     {
+        mall.convertFeaturesTextToFeatures();
         return toAjax(mallService.updateMall(mall));
     }
 

+ 12 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/controller/ProductInfoController.java

@@ -3,6 +3,8 @@ package com.ruoyi.base.controller;
 import java.util.List;
 import java.io.IOException;
 import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.base.domain.Mall;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -47,6 +49,16 @@ public class ProductInfoController extends BaseController
         return getDataTable(list);
     }
 
+
+    /**
+     * 统计农资商城
+     */
+    @PostMapping("/getCount")
+    public AjaxResult getCount(@RequestBody ProductInfo productInfo)
+    {
+        return success(productInfoService.selectProductInfoCount(productInfo));
+    }
+
     /**
      * 导出交易信息列表
      */

+ 61 - 32
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/AgriculturalTasks.java

@@ -1,6 +1,8 @@
 package com.ruoyi.base.domain;
 
 import java.util.Date;
+import java.util.List;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.AllArgsConstructor;
 import lombok.Data;
@@ -12,7 +14,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
 
 /**
  * 农事任务对象 agricultural_tasks
- * 
+ *
  * @author ruoyi
  * @date 2025-07-22
  */
@@ -26,60 +28,87 @@ public class AgriculturalTasks extends BaseEntity
     /** $column.columnComment */
     private Long id;
 
-    /** 关联地块ID */
-    @Excel(name = "关联地块ID")
-    private Long plotId;
+    /** 任务名称 */
+    @Excel(name = "任务名称")
+    private String taskName;
 
-    /** 所属农场ID */
-    @Excel(name = "所属农场ID")
-    private Long farmId;
 
-    /** 地块名称 */
-    @Excel(name = "地块名称")
-    private String fieldName;
+    /** 任务类型名称:施肥、灌溉、打药等 */
+    @Excel(name = "任务类型", readConverterExp = "0=施肥,1=灌溉,2=打药,3=采摘,4=巡检,5=除草,6=其他")
+    private String typeName;
 
     /** 作物名称 */
     @Excel(name = "作物名称")
     private String growCrops;
 
-    /** 任务名称 */
-    @Excel(name = "任务名称")
-    private String taskName;
+    /** 地块名称 */
+    @Excel(name = "所属地块")
+    private String fieldName;
 
-    /** 任务图片URL */
-    @Excel(name = "任务图片URL")
-    private String taskImages;
+    @Excel(name = "所属农场")
+    private String deptName;
 
-    /** 任务类型名称:施肥、灌溉、打药等 */
-    @Excel(name = "任务类型名称:施肥、灌溉、打药等")
-    private String typeName;
+    /*
+     * 负责人名称
+     * */
+    @Excel(name = "执行人")
+    private String assigneeName;
 
-    /** 任务状态 */
-    @Excel(name = "任务状态")
-    private String taskStatus;
 
     /** 计划执行时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
-    @Excel(name = "计划执行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
+    @Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
     private Date executeTime;
+    /** 计划完成时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    private Date plannedCompletetime;
 
-    /** 负责人名称 */
-    @Excel(name = "负责人ID")
-    private Long assigneeId;
 
-    /*
-    * 负责人名称
-    * */
-    @Excel(name = "负责人名称")
-    private String assigneeName;
 
+
+    /** 任务状态 */
+    @Excel(name = "任务状态", readConverterExp = "0=待完成,1=已完成")
+    private String taskStatus;
+
+
+    /** 备注 */
+    @Excel(name = "任务说明")
+    private String remark;
+
+
+    /** 实际开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    private Date practicalBegintime;
     /** 实际完成时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
-    @Excel(name = "实际完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
+    @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
     private Date completionTime;
 
     /** 完成说明 */
     @Excel(name = "完成说明")
     private String completionDesc;
 
+    @Excel(name = "附件")
+    private String imageCount;
+
+    /** 关联地块ID */
+    private Long plotId;
+
+    /** 所属农场ID */
+    private Long farmId;
+
+    /** 任务图片URL */
+    private String taskImages;
+
+
+    /** 负责人名称 */
+    private Long assigneeId;
+
+    /** 所属机构id集合-查询条件 */
+    private List<String> deptIdList;
+
+    /** 所属机构id集合-查询条件 */
+    private List<String> fieldIdList;
+
+
 }

+ 252 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/KnowledgeContent.java

@@ -0,0 +1,252 @@
+package com.ruoyi.base.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.core.annotation.Excel;
+import com.ruoyi.common.core.web.domain.BaseEntity;
+
+/**
+ * 农技知识管理对象 knowledge_content
+ *
+ * @author zmj
+ * @date 2025-08-18
+ */
+public class KnowledgeContent extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 标题 */
+    @Excel(name = "标题")
+    private String title;
+
+    /** 描述 */
+    @Excel(name = "描述")
+    private String description;
+
+    /** 内容类型:文章或视频 */
+    @Excel(name = "内容类型:文章或视频")
+    private String contentType;
+
+    /** 内容分类:农技知识或政策解读 */
+    @Excel(name = "内容分类:农技知识或政策解读")
+    private String contentCategory;
+
+    /** 封面图片 */
+    @Excel(name = "封面图片")
+    private String imageUrl;
+
+    /** 来源 */
+    @Excel(name = "来源")
+    private String source;
+
+    /** 阅读量 */
+    @Excel(name = "阅读量")
+    private Long viewCount;
+
+    /** 视频链接,仅当类型为视频时有值 */
+    @Excel(name = "视频链接,仅当类型为视频时有值")
+    private String videoUrl;
+
+    /** 视频时长,格式:MM:SS,仅当类型为视频时有值 */
+    @Excel(name = "视频时长,格式:MM:SS,仅当类型为视频时有值")
+    private String duration;
+
+    /** 文章内容,仅当类型为文章时有值 */
+    @Excel(name = "文章内容,仅当类型为文章时有值")
+    private String articleContent;
+
+    /** 作者 */
+    @Excel(name = "作者")
+    private String author;
+
+    /** 标签,JSON数组格式 */
+    @Excel(name = "标签,JSON数组格式")
+    private String tags;
+
+    /** 发布时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date publishDate;
+
+    /** 状态:1启用,0禁用 */
+    @Excel(name = "状态:1启用,0禁用")
+    private Integer status;
+
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+
+    public String getTitle()
+    {
+        return title;
+    }
+
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setContentType(String contentType)
+    {
+        this.contentType = contentType;
+    }
+
+    public String getContentType()
+    {
+        return contentType;
+    }
+
+    public void setContentCategory(String contentCategory)
+    {
+        this.contentCategory = contentCategory;
+    }
+
+    public String getContentCategory()
+    {
+        return contentCategory;
+    }
+
+    public void setImageUrl(String imageUrl)
+    {
+        this.imageUrl = imageUrl;
+    }
+
+    public String getImageUrl()
+    {
+        return imageUrl;
+    }
+
+    public void setSource(String source)
+    {
+        this.source = source;
+    }
+
+    public String getSource()
+    {
+        return source;
+    }
+
+    public void setViewCount(Long viewCount)
+    {
+        this.viewCount = viewCount;
+    }
+
+    public Long getViewCount()
+    {
+        return viewCount;
+    }
+
+    public void setVideoUrl(String videoUrl)
+    {
+        this.videoUrl = videoUrl;
+    }
+
+    public String getVideoUrl()
+    {
+        return videoUrl;
+    }
+
+    public void setDuration(String duration)
+    {
+        this.duration = duration;
+    }
+
+    public String getDuration()
+    {
+        return duration;
+    }
+
+    public void setArticleContent(String articleContent)
+    {
+        this.articleContent = articleContent;
+    }
+
+    public String getArticleContent()
+    {
+        return articleContent;
+    }
+
+    public void setAuthor(String author)
+    {
+        this.author = author;
+    }
+
+    public String getAuthor()
+    {
+        return author;
+    }
+
+    public void setTags(String tags)
+    {
+        this.tags = tags;
+    }
+
+    public String getTags()
+    {
+        return tags;
+    }
+
+    public void setPublishDate(Date publishDate)
+    {
+        this.publishDate = publishDate;
+    }
+
+    public Date getPublishDate()
+    {
+        return publishDate;
+    }
+
+    public void setStatus(Integer status)
+    {
+        this.status = status;
+    }
+
+    public Integer getStatus()
+    {
+        return status;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("title", getTitle())
+            .append("description", getDescription())
+            .append("contentType", getContentType())
+            .append("contentCategory", getContentCategory())
+            .append("imageUrl", getImageUrl())
+            .append("source", getSource())
+            .append("viewCount", getViewCount())
+            .append("videoUrl", getVideoUrl())
+            .append("duration", getDuration())
+            .append("articleContent", getArticleContent())
+            .append("author", getAuthor())
+            .append("tags", getTags())
+            .append("publishDate", getPublishDate())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .append("status", getStatus())
+            .toString();
+    }
+}

+ 1 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/MachineWorkRecords.java

@@ -105,6 +105,7 @@ public class MachineWorkRecords extends BaseEntity
 
     /** 操作员ID */
     private Long operatorId;
+    private Long farmId;
 
 
 

+ 37 - 12
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/Mall.java

@@ -1,8 +1,12 @@
 package com.ruoyi.base.domain;
 
 import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -13,7 +17,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
 
 /**
  * 农资商城对象 mall
- * 
+ *
  * @author ruoyi
  * @date 2025-08-15
  */
@@ -28,7 +32,8 @@ public class Mall extends BaseEntity
     private String id;
 
     /** 商品分类;0:推荐,1:种子,2:肥料,3:农药,4:农膜,5:农技配件 */
-    @Excel(name = "商品分类;0:推荐,1:种子,2:肥料,3:农药,4:农膜,5:农技配件")
+
+    @Excel(name = "商品分类", readConverterExp = "0=推荐,1=种子,2=肥料,3=农药,4=农膜,5=农技配件")
     private Long productCategory;
 
     /** 商品标题 */
@@ -39,13 +44,15 @@ public class Mall extends BaseEntity
     @Excel(name = "商品描述")
     private String description;
 
+    /** 原价 */
+    @Excel(name = "价格")
+    private BigDecimal originalPrice;
+
+
     /** 当前价格 */
-    @Excel(name = "当前价格")
+    @Excel(name = "优惠价格")
     private String price;
 
-    /** 原价 */
-    @Excel(name = "原价")
-    private BigDecimal originalPrice;
 
     /** 单位:元/斤、元/袋等等 */
     @Excel(name = "单位")
@@ -56,30 +63,48 @@ public class Mall extends BaseEntity
     private String specifications;
 
     /** 产品特点(JSON数组) */
-    @Excel(name = "产品特点(JSON数组)")
     private List<String> features;
 
     /** 使用说明 */
-    @Excel(name = "使用说明")
     private String usageGuide;
 
     /** 轮播图URL数组 */
-    @Excel(name = "轮播图URL数组")
     private String swiperImages;
 
     /** 详情图URL数组 */
-    @Excel(name = "详情图URL数组")
     private String detailImages;
 
     /** 状态 (1上架, 0下架) */
-    @Excel(name = "状态 (1上架, 0下架)")
+    @Excel(name = "上架状态", readConverterExp = "1=上架,0=下架,2=待上架")
     private Integer status;
 
     /** 是否推荐 () */
-    @Excel(name = "状态 (0-否,1-是)")
     private Integer isRecommended;
 
     /*小程序搜索条件*/
     private String searchKeyword;
+    private String featuresText;
+
+
+    private Double originalPriceMin;
+    private Double originalPriceMax;
+    private Double priceMin;
+    private Double priceMax;
+
+    public void convertFeaturesTextToFeatures() {
+        if (this.featuresText != null && !this.featuresText.isEmpty()) {
+            String[] featureArray = this.featuresText.split(";");
+            try {
+                com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
+                this.featuresText = mapper.writeValueAsString(java.util.Arrays.asList(featureArray));
+
+            } catch (Exception e) {
+                throw new RuntimeException("转换产品特点失败", e);
+            }
+        }
+    }
+
+
+
 
 }

+ 40 - 29
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/ProductInfo.java

@@ -27,54 +27,47 @@ public class ProductInfo extends BaseEntity
     /**  */
     private String id;
 
-    /** 发布者ID */
-    @Excel(name = "发布者ID")
-    private String userId;
+    /** 标题 */
+    @Excel(name = "农品标题")
+    private String title;
+
+    /** 创建者 */
+    @Excel(name = "发布人")
+    private String createBy;
+
 
     /** 农品分类:0-未知,1-水果,2-蔬菜,3-粮食,4-畜产品,5-水产品,6-中药材 */
-    @Excel(name = "农品分类:0-未知,1-水果,2-蔬菜,3-粮食,4-畜产品,5-水产品,6-中药材")
+    @Excel(name = "农品分类", readConverterExp = "0=未知,1=水果,2=蔬菜,3=粮食,4=畜产品,5=水产品,6=中药材")
     private String categoryId;
 
+
     /** 类型:0-销售, 1-收购 */
-    @Excel(name = "类型:0-销售, 1-收购")
+    @Excel(name = "交易类型", readConverterExp ="0=销售, 1=收购")
     private Long type;
 
-    /** 标题 */
-    @Excel(name = "标题")
-    private String title;
-
     /** 产品详细描述/补充说明 */
-    @Excel(name = "产品详细描述/补充说明")
+    @Excel(name = "详细说明")
     private String description;
 
-    /** 价格/预算 */
-    @Excel(name = "价格/预算")
-    private String price;
 
     /** 数量 */
     @Excel(name = "数量")
     private BigDecimal quantity;
 
+
+    /** 价格/预算 */
+    @Excel(name = "单价")
+    private String price;
+
     /** 单位:0-斤,1-公斤,2-吨,3-只,4-头,5-尾 */
-    @Excel(name = "单位:0-斤,1-公斤,2-吨,3-只,4-头,5-尾")
+    @Excel(name = "单位", readConverterExp = "0=斤,1=公斤,2=吨,3=只,4=头,5=尾")
     private Long unit;
 
-    /** 所在地 */
-    @Excel(name = "所在地")
-    private String location;
-
-    /** 图片URL */
-    @Excel(name = "图片URL")
-    private String imageUrl;
 
     /** 状态:0-未知,1-审核中,2-已上架,3-已下架 */
-    @Excel(name = "状态:0-未知,1-审核中,2-已上架,3-已下架")
+    @Excel(name = "状态", readConverterExp = "0=未知,1=审核中,2=已上架,3=已下架,4=未通过")
     private Long status;
 
-    /** 联系人ID */
-    @Excel(name = "联系人ID")
-    private String contactId;
-
     /** 联系人 */
     @Excel(name = "联系人")
     private String contactName;
@@ -83,15 +76,33 @@ public class ProductInfo extends BaseEntity
     @Excel(name = "联系电话")
     private String contactPhone;
 
-    /** 省市区信息 */
-    @Excel(name = "省市区信息")
-    private String cityInfo;
 
     /** 发布时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date publishTime;
 
+    /** 所在地 */
+    private String location;
+
+    /** 发布者ID */
+    private String userId;
+
+    /** 图片URL */
+    private String imageUrl;
+
+    /** 联系人ID */
+    private String contactId;
+
+    /** 省市区信息 */
+    private String cityInfo;
+
+
     /*小程序搜索条件*/
     private String searchKeyword;
+    private String publishTimeStart;
+    private String publishTimeEnd;
+
+    private Double minPrice;
+    private Double maxPrice;
 }

+ 22 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/domain/dto/AgriculturalTasksDay.java

@@ -0,0 +1,22 @@
+package com.ruoyi.base.domain.dto;
+
+import com.ruoyi.common.core.annotation.Excel;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ *  农事任务到期逾期返回值
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class AgriculturalTasksDay {
+    private Long id;
+    private String taskName;
+    private String plotName;
+    private String executor;
+    private String deadline;
+
+
+}

+ 1 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/mapper/AgriculturalMachinesMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.base.mapper;
 
 import java.util.List;
 import com.ruoyi.base.domain.AgriculturalMachines;
+import com.ruoyi.system.api.domain.SysUser;
 
 /**
  * 农机管理列表Mapper接口

+ 27 - 8
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/mapper/AgriculturalTasksMapper.java

@@ -1,19 +1,22 @@
 package com.ruoyi.base.mapper;
 
 import java.util.List;
+import java.util.Map;
+
 import com.ruoyi.base.domain.AgriculturalTasks;
+import com.ruoyi.base.vo.AgriculturalTasksStatistics;
 
 /**
  * 农事任务Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2025-07-22
  */
-public interface AgriculturalTasksMapper 
+public interface AgriculturalTasksMapper
 {
     /**
      * 查询农事任务
-     * 
+     *
      * @param id 农事任务主键
      * @return 农事任务
      */
@@ -21,15 +24,31 @@ public interface AgriculturalTasksMapper
 
     /**
      * 查询农事任务列表
-     * 
+     *
      * @param agriculturalTasks 农事任务
      * @return 农事任务集合
      */
     public List<AgriculturalTasks> selectAgriculturalTasksList(AgriculturalTasks agriculturalTasks);
 
+    /**
+     * 根据创建时间查询任务
+     * @return
+     */
+    List<Map<String, Object>> selectAgriculturalTasksByCreateTime(AgriculturalTasks agriculturalTasks);
+
+    /**
+     * 查询农事任务到期逾期列表
+
+     * @return 农事任务集合
+     */
+    public List<AgriculturalTasks> selectAgriculturalTasksOverdueList();
+
+
+    public AgriculturalTasksStatistics selectAgriculturalTaskStatistics(AgriculturalTasks agriculturalTasks);
+
     /**
      * 新增农事任务
-     * 
+     *
      * @param agriculturalTasks 农事任务
      * @return 结果
      */
@@ -37,7 +56,7 @@ public interface AgriculturalTasksMapper
 
     /**
      * 修改农事任务
-     * 
+     *
      * @param agriculturalTasks 农事任务
      * @return 结果
      */
@@ -45,7 +64,7 @@ public interface AgriculturalTasksMapper
 
     /**
      * 删除农事任务
-     * 
+     *
      * @param id 农事任务主键
      * @return 结果
      */
@@ -53,7 +72,7 @@ public interface AgriculturalTasksMapper
 
     /**
      * 批量删除农事任务
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */

+ 61 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/mapper/KnowledgeContentMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.base.mapper;
+
+import java.util.List;
+import com.ruoyi.base.domain.KnowledgeContent;
+
+/**
+ * 农技知识管理Mapper接口
+ *
+ * @author zmj
+ * @date 2025-08-18
+ */
+public interface KnowledgeContentMapper
+{
+    /**
+     * 查询农技知识管理
+     *
+     * @param id 农技知识管理主键
+     * @return 农技知识管理
+     */
+    public KnowledgeContent selectKnowledgeContentById(Long id);
+
+    /**
+     * 查询农技知识管理列表
+     *
+     * @param knowledgeContent 农技知识管理
+     * @return 农技知识管理集合
+     */
+    public List<KnowledgeContent> selectKnowledgeContentList(KnowledgeContent knowledgeContent);
+
+    /**
+     * 新增农技知识管理
+     *
+     * @param knowledgeContent 农技知识管理
+     * @return 结果
+     */
+    public int insertKnowledgeContent(KnowledgeContent knowledgeContent);
+
+    /**
+     * 修改农技知识管理
+     *
+     * @param knowledgeContent 农技知识管理
+     * @return 结果
+     */
+    public int updateKnowledgeContent(KnowledgeContent knowledgeContent);
+
+    /**
+     * 删除农技知识管理
+     *
+     * @param id 农技知识管理主键
+     * @return 结果
+     */
+    public int deleteKnowledgeContentById(Long id);
+
+    /**
+     * 批量删除农技知识管理
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKnowledgeContentByIds(Long[] ids);
+}

+ 11 - 8
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/mapper/MallMapper.java

@@ -1,20 +1,21 @@
 package com.ruoyi.base.mapper;
 
 import com.ruoyi.base.domain.Mall;
+import com.ruoyi.base.vo.MallCountVo;
 
 import java.util.List;
 
 /**
  * 农资商城Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2025-08-15
  */
-public interface MallMapper 
+public interface MallMapper
 {
     /**
      * 查询农资商城
-     * 
+     *
      * @param id 农资商城主键
      * @return 农资商城
      */
@@ -22,7 +23,7 @@ public interface MallMapper
 
     /**
      * 查询农资商城列表
-     * 
+     *
      * @param mall 农资商城
      * @return 农资商城集合
      */
@@ -30,7 +31,7 @@ public interface MallMapper
 
     /**
      * 新增农资商城
-     * 
+     *
      * @param mall 农资商城
      * @return 结果
      */
@@ -38,7 +39,7 @@ public interface MallMapper
 
     /**
      * 修改农资商城
-     * 
+     *
      * @param mall 农资商城
      * @return 结果
      */
@@ -46,7 +47,7 @@ public interface MallMapper
 
     /**
      * 删除农资商城
-     * 
+     *
      * @param id 农资商城主键
      * @return 结果
      */
@@ -54,9 +55,11 @@ public interface MallMapper
 
     /**
      * 批量删除农资商城
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteMallByIds(String[] ids);
+
+    MallCountVo selectMallCount(Mall mall);
 }

+ 7 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/mapper/ProductInfoMapper.java

@@ -1,7 +1,11 @@
 package com.ruoyi.base.mapper;
 
 import java.util.List;
+
+import com.ruoyi.base.domain.Mall;
 import com.ruoyi.base.domain.ProductInfo;
+import com.ruoyi.base.vo.MallCountVo;
+import com.ruoyi.base.vo.ProductInfoCountVo;
 
 /**
  * 交易信息Mapper接口
@@ -58,4 +62,7 @@ public interface ProductInfoMapper
      * @return 结果
      */
     public int deleteProductInfoByIds(String[] ids);
+
+
+    ProductInfoCountVo  selectProductInfoCount(ProductInfo productInfo);
 }

+ 1 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IAgriculturalMachinesService.java

@@ -2,6 +2,7 @@ package com.ruoyi.base.service;
 
 import java.util.List;
 import com.ruoyi.base.domain.AgriculturalMachines;
+import com.ruoyi.system.api.domain.SysUser;
 
 /**
  * 农机管理列表Service接口

+ 20 - 8
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IAgriculturalTasksService.java

@@ -2,18 +2,20 @@ package com.ruoyi.base.service;
 
 import java.util.List;
 import com.ruoyi.base.domain.AgriculturalTasks;
+import com.ruoyi.base.vo.AgriculturalTasksListDay;
+import com.ruoyi.base.vo.AgriculturalTasksStatistics;
 
 /**
  * 农事任务Service接口
- * 
+ *
  * @author ruoyi
  * @date 2025-07-22
  */
-public interface IAgriculturalTasksService 
+public interface IAgriculturalTasksService
 {
     /**
      * 查询农事任务
-     * 
+     *
      * @param id 农事任务主键
      * @return 农事任务
      */
@@ -21,15 +23,25 @@ public interface IAgriculturalTasksService
 
     /**
      * 查询农事任务列表
-     * 
+     *
      * @param agriculturalTasks 农事任务
      * @return 农事任务集合
      */
     public List<AgriculturalTasks> selectAgriculturalTasksList(AgriculturalTasks agriculturalTasks);
 
+    public AgriculturalTasksListDay selectAgriculturalTasksListDay();
+
+    /**
+     * 查询农事任务统计汇总
+     *
+     * @param agriculturalTasks 农事任务
+     * @return 农事任务集合
+     */
+    public AgriculturalTasksStatistics selectAgriculturalTaskStatistics(AgriculturalTasks agriculturalTasks);
+
     /**
      * 新增农事任务
-     * 
+     *
      * @param agriculturalTasks 农事任务
      * @return 结果
      */
@@ -37,7 +49,7 @@ public interface IAgriculturalTasksService
 
     /**
      * 修改农事任务
-     * 
+     *
      * @param agriculturalTasks 农事任务
      * @return 结果
      */
@@ -45,7 +57,7 @@ public interface IAgriculturalTasksService
 
     /**
      * 批量删除农事任务
-     * 
+     *
      * @param ids 需要删除的农事任务主键集合
      * @return 结果
      */
@@ -53,7 +65,7 @@ public interface IAgriculturalTasksService
 
     /**
      * 删除农事任务信息
-     * 
+     *
      * @param id 农事任务主键
      * @return 结果
      */

+ 10 - 8
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IDeviceService.java

@@ -9,15 +9,15 @@ import java.util.List;
 
 /**
  * 设备Service接口
- * 
+ *
  * @author zmj
  * @date 2025-05-29
  */
-public interface IDeviceService 
+public interface IDeviceService
 {
     /**
      * 查询设备
-     * 
+     *
      * @param id 设备主键
      * @return 设备
      */
@@ -27,15 +27,17 @@ public interface IDeviceService
 
     /**
      * 查询设备列表
-     * 
+     *
      * @param device 设备
      * @return 设备集合
      */
     public List<Device> selectDeviceList(Device device);
 
+    String videoPlayback(Device device);
+    void videoStopPlaying(Device device);
     /**
      * 新增设备
-     * 
+     *
      * @param device 设备
      * @return 结果
      */
@@ -43,7 +45,7 @@ public interface IDeviceService
 
     /**
      * 修改设备
-     * 
+     *
      * @param device 设备
      * @return 结果
      */
@@ -51,7 +53,7 @@ public interface IDeviceService
 
     /**
      * 批量删除设备
-     * 
+     *
      * @param ids 需要删除的设备主键集合
      * @return 结果
      */
@@ -59,7 +61,7 @@ public interface IDeviceService
 
     /**
      * 删除设备信息
-     * 
+     *
      * @param id 设备主键
      * @return 结果
      */

+ 61 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IKnowledgeContentService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.base.service;
+
+import java.util.List;
+import com.ruoyi.base.domain.KnowledgeContent;
+
+/**
+ * 农技知识管理Service接口
+ *
+ * @author zmj
+ * @date 2025-08-18
+ */
+public interface IKnowledgeContentService
+{
+    /**
+     * 查询农技知识管理
+     *
+     * @param id 农技知识管理主键
+     * @return 农技知识管理
+     */
+    public KnowledgeContent selectKnowledgeContentById(Long id);
+
+    /**
+     * 查询农技知识管理列表
+     *
+     * @param knowledgeContent 农技知识管理
+     * @return 农技知识管理集合
+     */
+    public List<KnowledgeContent> selectKnowledgeContentList(KnowledgeContent knowledgeContent);
+
+    /**
+     * 新增农技知识管理
+     *
+     * @param knowledgeContent 农技知识管理
+     * @return 结果
+     */
+    public int insertKnowledgeContent(KnowledgeContent knowledgeContent);
+
+    /**
+     * 修改农技知识管理
+     *
+     * @param knowledgeContent 农技知识管理
+     * @return 结果
+     */
+    public int updateKnowledgeContent(KnowledgeContent knowledgeContent);
+
+    /**
+     * 批量删除农技知识管理
+     *
+     * @param ids 需要删除的农技知识管理主键集合
+     * @return 结果
+     */
+    public int deleteKnowledgeContentByIds(Long[] ids);
+
+    /**
+     * 删除农技知识管理信息
+     *
+     * @param id 农技知识管理主键
+     * @return 结果
+     */
+    public int deleteKnowledgeContentById(Long id);
+}

+ 11 - 8
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IMallService.java

@@ -1,28 +1,31 @@
 package com.ruoyi.base.service;
 
 import com.ruoyi.base.domain.Mall;
+import com.ruoyi.base.vo.MallCountVo;
 
 import java.util.List;
 
 /**
  * 农资商城Service接口
- * 
+ *
  * @author ruoyi
  * @date 2025-08-15
  */
-public interface IMallService 
+public interface IMallService
 {
     /**
      * 查询农资商城
-     * 
+     *
      * @param id 农资商城主键
      * @return 农资商城
      */
     public Mall selectMallById(String id);
 
+    public MallCountVo selectMallCount(Mall mall);
+
     /**
      * 查询农资商城列表
-     * 
+     *
      * @param mall 农资商城
      * @return 农资商城集合
      */
@@ -30,7 +33,7 @@ public interface IMallService
 
     /**
      * 新增农资商城
-     * 
+     *
      * @param mall 农资商城
      * @return 结果
      */
@@ -38,7 +41,7 @@ public interface IMallService
 
     /**
      * 修改农资商城
-     * 
+     *
      * @param mall 农资商城
      * @return 结果
      */
@@ -46,7 +49,7 @@ public interface IMallService
 
     /**
      * 批量删除农资商城
-     * 
+     *
      * @param ids 需要删除的农资商城主键集合
      * @return 结果
      */
@@ -54,7 +57,7 @@ public interface IMallService
 
     /**
      * 删除农资商城信息
-     * 
+     *
      * @param id 农资商城主键
      * @return 结果
      */

+ 3 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/IProductInfoService.java

@@ -2,6 +2,7 @@ package com.ruoyi.base.service;
 
 import java.util.List;
 import com.ruoyi.base.domain.ProductInfo;
+import com.ruoyi.base.vo.ProductInfoCountVo;
 
 /**
  * 交易信息Service接口
@@ -58,4 +59,6 @@ public interface IProductInfoService
      * @return 结果
      */
     public int deleteProductInfoById(String id);
+
+    ProductInfoCountVo selectProductInfoCount(ProductInfo productInfo);
 }

+ 1 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/AgriculturalMachinesServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.base.service.impl;
 import java.util.List;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.datascope.annotation.DataScope;
+import com.ruoyi.system.api.domain.SysUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.base.mapper.AgriculturalMachinesMapper;

+ 140 - 9
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/AgriculturalTasksServiceImpl.java

@@ -1,6 +1,21 @@
 package com.ruoyi.base.service.impl;
 
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import com.ruoyi.base.domain.dto.AgriculturalTasksDay;
+import com.ruoyi.base.mapper.FieldMapper;
+import com.ruoyi.base.vo.AgriculturalTasksListDay;
+import com.ruoyi.base.vo.AgriculturalTasksStatistics;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -11,19 +26,22 @@ import com.ruoyi.base.service.IAgriculturalTasksService;
 
 /**
  * 农事任务Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2025-07-22
  */
 @Service
-public class AgriculturalTasksServiceImpl implements IAgriculturalTasksService 
+public class AgriculturalTasksServiceImpl implements IAgriculturalTasksService
 {
     @Autowired
     private AgriculturalTasksMapper agriculturalTasksMapper;
 
+    @Autowired
+    private FieldMapper fieldMapper;
+
     /**
      * 查询农事任务
-     * 
+     *
      * @param id 农事任务主键
      * @return 农事任务
      */
@@ -35,19 +53,132 @@ public class AgriculturalTasksServiceImpl implements IAgriculturalTasksService
 
     /**
      * 查询农事任务列表
-     * 
+     *
      * @param agriculturalTasks 农事任务
      * @return 农事任务
      */
     @Override
     public List<AgriculturalTasks> selectAgriculturalTasksList(AgriculturalTasks agriculturalTasks)
     {
-        return agriculturalTasksMapper.selectAgriculturalTasksList(agriculturalTasks);
+        List<AgriculturalTasks> agriculturalTasks1 = agriculturalTasksMapper.selectAgriculturalTasksList(agriculturalTasks);
+        Map<String, Object> map = new HashMap<>();
+        map.put("beginCreateTime", "2025-10-28");
+        map.put("endCreateTime", "2025-11-27");
+        agriculturalTasks.setParams(map);
+        List<Map<String, Object>> maps = agriculturalTasksMapper.selectAgriculturalTasksByCreateTime(agriculturalTasks);
+        System.out.println(maps);
+        return agriculturalTasks1;
+    }
+
+    @Override
+    public AgriculturalTasksListDay selectAgriculturalTasksListDay() {
+
+        AgriculturalTasksListDay agriculturalTasksListDay = new AgriculturalTasksListDay();
+
+        LocalDateTime now = LocalDateTime.now();
+        LocalDateTime endOfDay = now.toLocalDate().atTime(LocalTime.MAX);
+        LocalDateTime endOfThreeDays = now.plusDays(3).toLocalDate().atTime(LocalTime.MAX);
+
+        //查询今日到期
+        AgriculturalTasks agriculturalTasksDay = new AgriculturalTasks();
+        Map<String, Object> map = new HashMap<>();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        String formattedNow = now.format(formatter);
+        String formattedEndOfDay = endOfDay.format(formatter);
+        map.put("beginPlannedCompleteTime", formattedNow);
+        map.put("endPlannedCompleteTime", formattedEndOfDay);
+        agriculturalTasksDay.setParams(map);
+        agriculturalTasksDay.setTaskStatus("0");
+        List<AgriculturalTasks> agriculturalTasksDayList = agriculturalTasksMapper.selectAgriculturalTasksList(agriculturalTasksDay);
+        // 查询未来三天内到期的任务
+        AgriculturalTasks agriculturalTasksThreeDays = new AgriculturalTasks();
+        Map<String, Object> mapThreeDays = new HashMap<>();
+        DateTimeFormatter formatterThreeDays = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        String formattedNowThreeDays = now.format(formatterThreeDays);
+        String formattedEndOfThreeDays = endOfThreeDays.format(formatterThreeDays);
+        mapThreeDays.put("beginPlannedCompleteTime", formattedNowThreeDays);
+        mapThreeDays.put("endPlannedCompleteTime", formattedEndOfThreeDays);
+        agriculturalTasksThreeDays.setParams(mapThreeDays);
+        agriculturalTasksThreeDays.setTaskStatus("0");
+        List<AgriculturalTasks> agriculturalTasksThreeDayList = agriculturalTasksMapper.selectAgriculturalTasksList(agriculturalTasksThreeDays);
+
+        List<AgriculturalTasks> agriculturalTasksOverdue = agriculturalTasksMapper.selectAgriculturalTasksOverdueList();
+
+
+        List<AgriculturalTasksDay> agriculturalTasksDayListVo = agriculturalTasksDayList.stream()
+                .map(task -> {
+                    AgriculturalTasksDay dayTask = new AgriculturalTasksDay();
+                    dayTask.setId(task.getId());
+                    dayTask.setTaskName(task.getTaskName());
+                    dayTask.setPlotName(task.getFieldName()); // plotName 对应 fieldName
+                    dayTask.setExecutor(task.getAssigneeName()); // executor 对应 assigneeName
+                    LocalTime time = task.getPlannedCompletetime().toInstant()
+                            .atZone(ZoneId.systemDefault())
+                            .toLocalTime();
+                    DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm");
+                    dayTask.setDeadline(time.format(timeFormatter));
+                    return dayTask;
+                })
+                .collect(Collectors.toList());
+
+
+        List<AgriculturalTasksDay> agriculturalTasksThreeDayListVo = agriculturalTasksThreeDayList.stream()
+                .map(task -> {
+                    AgriculturalTasksDay dayTask = new AgriculturalTasksDay();
+                    dayTask.setId(task.getId());
+                    dayTask.setTaskName(task.getTaskName());
+                    dayTask.setPlotName(task.getFieldName()); // plotName 对应 fieldName
+                    dayTask.setExecutor(task.getAssigneeName()); // executor 对应 assigneeName
+                    LocalDate plannedDate = task.getPlannedCompletetime().toInstant()
+                            .atZone(ZoneId.systemDefault())
+                            .toLocalDate();
+                    LocalDate currentDate = LocalDate.now();
+                    long daysUntilDeadline = ChronoUnit.DAYS.between(currentDate, plannedDate);
+                    dayTask.setDeadline(daysUntilDeadline + "天后");
+                    return dayTask;
+                })
+                .collect(Collectors.toList());
+
+
+        List<AgriculturalTasksDay> agriculturalTasksOverdueListVo = agriculturalTasksOverdue.stream()
+                .map(task -> {
+                    AgriculturalTasksDay dayTask = new AgriculturalTasksDay();
+                    dayTask.setId(task.getId());
+                    dayTask.setTaskName(task.getTaskName());
+                    dayTask.setPlotName(task.getFieldName()); // plotName 对应 fieldName
+                    dayTask.setExecutor(task.getAssigneeName()); // executor 对应 assigneeName
+
+                    // 计算逾期天数(当前时间减去 plannedCompletetime)
+                    LocalDate plannedDate = task.getPlannedCompletetime().toInstant()
+                            .atZone(ZoneId.systemDefault())
+                            .toLocalDate();
+                    LocalDate currentDate = LocalDate.now();
+                    long overdueDays = ChronoUnit.DAYS.between(plannedDate, currentDate);
+                    dayTask.setDeadline("逾期" + overdueDays + "天");
+
+                    return dayTask;
+                })
+                .collect(Collectors.toList());
+        agriculturalTasksListDay.setToday(agriculturalTasksDayListVo);
+        agriculturalTasksListDay.setNext3Days(agriculturalTasksThreeDayListVo);
+        agriculturalTasksListDay.setOverdue(agriculturalTasksOverdueListVo);
+
+
+
+
+
+
+        return agriculturalTasksListDay;
+    }
+
+    @Override
+    public AgriculturalTasksStatistics selectAgriculturalTaskStatistics(AgriculturalTasks agriculturalTasks) {
+        return agriculturalTasksMapper.selectAgriculturalTaskStatistics(agriculturalTasks);
     }
 
     /**
      * 新增农事任务
-     * 
+     *
      * @param agriculturalTasks 农事任务
      * @return 结果
      */
@@ -61,7 +192,7 @@ public class AgriculturalTasksServiceImpl implements IAgriculturalTasksService
 
     /**
      * 修改农事任务
-     * 
+     *
      * @param agriculturalTasks 农事任务
      * @return 结果
      */
@@ -75,7 +206,7 @@ public class AgriculturalTasksServiceImpl implements IAgriculturalTasksService
 
     /**
      * 批量删除农事任务
-     * 
+     *
      * @param ids 需要删除的农事任务主键
      * @return 结果
      */
@@ -87,7 +218,7 @@ public class AgriculturalTasksServiceImpl implements IAgriculturalTasksService
 
     /**
      * 删除农事任务信息
-     * 
+     *
      * @param id 农事任务主键
      * @return 结果
      */

+ 214 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/DeviceServiceImpl.java

@@ -1,5 +1,8 @@
 package com.ruoyi.base.service.impl;
 
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.base.domain.AlertRecord;
 import com.ruoyi.base.domain.Device;
 import com.ruoyi.base.domain.WeatherRealtimeData;
@@ -12,6 +15,10 @@ import com.ruoyi.base.mapper.WeatherRealtimeDataMapper;
 import com.ruoyi.base.service.IDeviceService;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.datascope.annotation.DataScope;
+import com.ruoyi.system.api.factory.RemoteFileFallbackFactory;
+import okhttp3.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -39,6 +46,8 @@ public class DeviceServiceImpl implements IDeviceService
     @Autowired
     private AlertRecordMapper alertRecordMapper;
 
+    private static final Logger log = LoggerFactory.getLogger(DeviceServiceImpl.class);
+
     /**
      * 查询设备
      *
@@ -64,6 +73,211 @@ public class DeviceServiceImpl implements IDeviceService
         return deviceMapper.selectDeviceList(device);
     }
 
+    @Override
+    public String videoPlayback(Device device) {
+        OkHttpClient client = new OkHttpClient();
+        String accessToken = null;
+        final String BASE_URL = "http://121.4.16.100:28080";
+        final String USERNAME = "admin";
+        final String PASSWORD = "af7b951b3a30e898e2684ffe8d20a961";
+
+        try {
+            // 登录获取access token
+            String loginUrl = BASE_URL + "/api/user/login?username=" + USERNAME + "&password=" + PASSWORD;
+            Request loginRequest = new Request.Builder()
+                    .url(loginUrl)
+                    .method("GET", null)
+                    .addHeader("Content-Type", "application/json")
+                    .build();
+
+            try (Response response = client.newCall(loginRequest).execute()) {
+                if (!response.isSuccessful() || response.body() == null) {
+                    log.error("登录失败,状态码: " + response.code());
+                    return "";
+                }
+
+                JSONObject resultJson = JSONObject.parseObject(response.body().string());
+                JSONObject data = resultJson.getJSONObject("data");
+                if (data == null) {
+                    log.error("登录响应中无数据");
+                    return "";
+                }
+
+                accessToken = data.getString("accessToken");
+                if (accessToken == null) {
+                    log.error("未能获取有效的访问令牌");
+                    return "";
+                }
+            }
+
+            // 查询设备通道信息
+            String deviceId = device.getDeviceId();
+            String channelsUrl = BASE_URL + "/api/device/query/devices/" + deviceId + "/channels" +
+                    "?deviceId=" + deviceId +
+                    "&page=" + 1 +
+                    "&count=" + 10;
+
+            Request channelsRequest = new Request.Builder()
+                    .url(channelsUrl)
+                    .method("GET", null)
+                    .addHeader("access-token", accessToken)
+                    .build();
+
+            try (Response response = client.newCall(channelsRequest).execute()) {
+                if (!response.isSuccessful() || response.body() == null) {
+                    log.error("请求通道列表失败,状态码: " + response.code());
+                    return "";
+                }
+
+                JSONObject resultJson = JSONObject.parseObject(response.body().string());
+                JSONObject data = resultJson.getJSONObject("data");
+                if (data == null) {
+                    log.error("通道列表响应中无数据");
+                    return "";
+                }
+
+                JSONArray list = data.getJSONArray("list");
+                if (list == null || list.isEmpty()) {
+                    log.error("通道列表为空");
+                    return "";
+                }
+
+                JSONObject firstChannel = list.getJSONObject(0);
+                String channelId = firstChannel.getString("deviceId");
+                if (channelId == null) {
+                    log.error("未能获取有效的通道ID");
+                    return "";
+                }
+
+                // 启动视频播放
+                String playUrl = BASE_URL + "/api/play/start/" + deviceId + "/" + channelId;
+                Request playRequest = new Request.Builder()
+                        .url(playUrl)
+                        .method("GET", null)
+                        .addHeader("access-token", accessToken)
+                        .build();
+
+                try (Response playResponse = client.newCall(playRequest).execute()) {
+                    if (!playResponse.isSuccessful() || playResponse.body() == null) {
+                        log.error("启动播放失败,状态码: " + playResponse.code());
+                        return "";
+                    }
+
+                    JSONObject playResult = JSONObject.parseObject(playResponse.body().string());
+                    JSONObject playData = playResult.getJSONObject("data");
+                    if (playData == null) {
+                        log.error("播放响应中无数据");
+                        return "";
+                    }
+
+                    Object wsFlv = playData.get("ws_flv");
+                    if (wsFlv == null) {
+                        log.error("未能获取有效的播放地址");
+                        return "";
+                    }
+
+                    log.info("日志打印 By File start! 响应数据:" + playResult.toJSONString());
+                    return wsFlv.toString();
+                }
+            }
+        } catch (Exception e) {
+            log.error("日志打印异常! 错误信息:" + e.getMessage(), e);
+            return "";
+        }
+    }
+
+
+
+
+    @Override
+    public void videoStopPlaying(Device device) {
+        //1、登录
+        OkHttpClient client = new OkHttpClient().newBuilder()
+                .build();
+        String accessToken = null;
+
+        try {
+            // 修改URL为指定的登录接口地址
+            String loginUrl = "http://121.4.16.100:28080/api/user/login?username=admin&password=af7b951b3a30e898e2684ffe8d20a961";
+            Request request = new Request.Builder()
+                    .url(loginUrl)
+                    .method("GET", null) // 登录请求通常使用GET方法
+                    .addHeader("Content-Type", "application/json")
+                    .build();
+
+            try (Response response = client.newCall(request).execute()) {
+                if (response.isSuccessful() && response.body() != null) {
+                    JSONObject resultJson = JSONObject.parseObject(response.body().string());
+                    JSONObject data = resultJson.getJSONObject("data");
+                    if (data != null) {
+                        accessToken = data.getString("accessToken");
+                    }
+                }
+            }
+
+            // 检查accessToken是否获取成功
+            if (accessToken == null) {
+                log.error("获取访问令牌失败");
+                return;
+            }
+
+            // 构建带查询参数的URL
+            String deviceId = "34020000001110000001";
+            String url = "http://121.4.16.100:28080/api/device/query/devices/" + deviceId + "/channels" +
+                    "?deviceId=" + deviceId +
+                    "&page=" + 1 +
+                    "&count=" + 10;
+
+            // 构建GET请求
+            okhttp3.Request channelRequest = new okhttp3.Request.Builder()
+                    .url(url)
+                    .method("GET", null)
+                    .addHeader("access-token", accessToken)
+                    .build();
+
+            // 发送请求
+            try (Response response1 = client.newCall(channelRequest).execute()) {
+                // 解析响应
+                if (response1.isSuccessful() && response1.body() != null) {
+                    String responseBody = response1.body().string();
+                    JSONObject resultJson1 = JSONObject.parseObject(responseBody);
+
+                    // 获取data中的list数组的第一个元素
+                    JSONObject data1 = resultJson1.getJSONObject("data");
+                    if (data1 != null) {
+                        JSONArray list = data1.getJSONArray("list");
+                        if (list != null && !list.isEmpty()) {
+                            JSONObject firstElement = list.getJSONObject(0);
+                            String channelId = firstElement.getString("deviceId");
+                            if (channelId != null) {
+                                String urldb = "http://121.4.16.100:28080/api/play/stop/" + deviceId + "/" + channelId;
+                                okhttp3.Request channelRequestdb = new okhttp3.Request.Builder()
+                                        .url(urldb)
+                                        .method("GET", null)
+                                        .addHeader("access-token", accessToken)
+                                        .build();
+
+                                try (Response response1db = client.newCall(channelRequestdb).execute()) {
+                                    if (response1db.isSuccessful() && response1db.body() != null) {
+                                        String responseBodydb = response1db.body().string();
+                                        JSONObject resultJsondb = JSONObject.parseObject(responseBodydb);
+                                        log.info("日志打印 By File start! 响应数据:" + resultJsondb.toJSONString());
+                                    } else {
+                                        log.error("停止播放失败,状态码: " + response1db.code());
+                                    }
+                                }
+                            }
+                        }
+                    }
+                } else {
+                    log.error("请求通道列表失败,状态码: " + response1.code());
+                }
+            }
+        } catch (Exception e) {
+            log.error("日志打印异常! 错误信息:" + e.getMessage());
+            e.printStackTrace(); // 更详细的错误信息
+        }
+    }
     /**
      * 新增设备
      *

+ 96 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/KnowledgeContentServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.base.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.core.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.base.mapper.KnowledgeContentMapper;
+import com.ruoyi.base.domain.KnowledgeContent;
+import com.ruoyi.base.service.IKnowledgeContentService;
+
+/**
+ * 农技知识管理Service业务层处理
+ *
+ * @author zmj
+ * @date 2025-08-18
+ */
+@Service
+public class KnowledgeContentServiceImpl implements IKnowledgeContentService
+{
+    @Autowired
+    private KnowledgeContentMapper knowledgeContentMapper;
+
+    /**
+     * 查询农技知识管理
+     *
+     * @param id 农技知识管理主键
+     * @return 农技知识管理
+     */
+    @Override
+    public KnowledgeContent selectKnowledgeContentById(Long id)
+    {
+        return knowledgeContentMapper.selectKnowledgeContentById(id);
+    }
+
+    /**
+     * 查询农技知识管理列表
+     *
+     * @param knowledgeContent 农技知识管理
+     * @return 农技知识管理
+     */
+    @Override
+    public List<KnowledgeContent> selectKnowledgeContentList(KnowledgeContent knowledgeContent)
+    {
+        return knowledgeContentMapper.selectKnowledgeContentList(knowledgeContent);
+    }
+
+    /**
+     * 新增农技知识管理
+     *
+     * @param knowledgeContent 农技知识管理
+     * @return 结果
+     */
+    @Override
+    public int insertKnowledgeContent(KnowledgeContent knowledgeContent)
+    {
+        knowledgeContent.setCreateTime(DateUtils.getNowDate());
+        return knowledgeContentMapper.insertKnowledgeContent(knowledgeContent);
+    }
+
+    /**
+     * 修改农技知识管理
+     *
+     * @param knowledgeContent 农技知识管理
+     * @return 结果
+     */
+    @Override
+    public int updateKnowledgeContent(KnowledgeContent knowledgeContent)
+    {
+        knowledgeContent.setUpdateTime(DateUtils.getNowDate());
+        return knowledgeContentMapper.updateKnowledgeContent(knowledgeContent);
+    }
+
+    /**
+     * 批量删除农技知识管理
+     *
+     * @param ids 需要删除的农技知识管理主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKnowledgeContentByIds(Long[] ids)
+    {
+        return knowledgeContentMapper.deleteKnowledgeContentByIds(ids);
+    }
+
+    /**
+     * 删除农技知识管理信息
+     *
+     * @param id 农技知识管理主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKnowledgeContentById(Long id)
+    {
+        return knowledgeContentMapper.deleteKnowledgeContentById(id);
+    }
+}

+ 25 - 8
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/MallServiceImpl.java

@@ -5,13 +5,14 @@ import java.util.List;
 import com.ruoyi.base.domain.Mall;
 import com.ruoyi.base.mapper.MallMapper;
 import com.ruoyi.base.service.IMallService;
+import com.ruoyi.base.vo.MallCountVo;
 import com.ruoyi.common.core.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
  * 农资商城Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2025-08-15
  */
@@ -23,19 +24,34 @@ public class MallServiceImpl implements IMallService
 
     /**
      * 查询农资商城
-     * 
+     *
      * @param id 农资商城主键
      * @return 农资商城
      */
     @Override
     public Mall selectMallById(String id)
     {
-        return mallMapper.selectMallById(id);
+        Mall mall = mallMapper.selectMallById(id);
+        List<String> features = mall.getFeatures();
+        StringBuilder featuresTextBuilder = new StringBuilder();
+        for (String feature : features) {
+            if (featuresTextBuilder.length() > 0) {
+                featuresTextBuilder.append(";");
+            }
+            featuresTextBuilder.append(feature);
+        }
+        mall.setFeaturesText(featuresTextBuilder.toString());
+        return mall;
+    }
+
+    @Override
+    public MallCountVo selectMallCount(Mall mall) {
+        return mallMapper.selectMallCount(mall);
     }
 
     /**
      * 查询农资商城列表
-     * 
+     *
      * @param mall 农资商城
      * @return 农资商城
      */
@@ -47,7 +63,7 @@ public class MallServiceImpl implements IMallService
 
     /**
      * 新增农资商城
-     * 
+     *
      * @param mall 农资商城
      * @return 结果
      */
@@ -55,12 +71,13 @@ public class MallServiceImpl implements IMallService
     public int insertMall(Mall mall)
     {
         mall.setCreateTime(DateUtils.getNowDate());
+        System.out.println( mall);
         return mallMapper.insertMall(mall);
     }
 
     /**
      * 修改农资商城
-     * 
+     *
      * @param mall 农资商城
      * @return 结果
      */
@@ -73,7 +90,7 @@ public class MallServiceImpl implements IMallService
 
     /**
      * 批量删除农资商城
-     * 
+     *
      * @param ids 需要删除的农资商城主键
      * @return 结果
      */
@@ -85,7 +102,7 @@ public class MallServiceImpl implements IMallService
 
     /**
      * 删除农资商城信息
-     * 
+     *
      * @param id 农资商城主键
      * @return 结果
      */

+ 10 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/service/impl/ProductInfoServiceImpl.java

@@ -1,6 +1,8 @@
 package com.ruoyi.base.service.impl;
 
 import java.util.List;
+
+import com.ruoyi.base.vo.ProductInfoCountVo;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -55,7 +57,10 @@ public class ProductInfoServiceImpl implements IProductInfoService
     public int insertProductInfo(ProductInfo productInfo)
     {
         productInfo.setCreateTime(DateUtils.getNowDate());
+        productInfo.setPublishTime(DateUtils.getNowDate());
+        productInfo.setStatus(1L);
         productInfo.setCreateBy(SecurityUtils.getUsername());
+        productInfo.setUserId(SecurityUtils.getUserId().toString());
         return productInfoMapper.insertProductInfo(productInfo);
     }
 
@@ -96,4 +101,9 @@ public class ProductInfoServiceImpl implements IProductInfoService
     {
         return productInfoMapper.deleteProductInfoById(id);
     }
+
+    @Override
+    public ProductInfoCountVo selectProductInfoCount(ProductInfo productInfo) {
+        return productInfoMapper.selectProductInfoCount(productInfo);
+    }
 }

+ 18 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/vo/AgriculturalTasksListDay.java

@@ -0,0 +1,18 @@
+package com.ruoyi.base.vo;
+
+import com.ruoyi.base.domain.dto.AgriculturalTasksDay;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class AgriculturalTasksListDay {
+
+    private List<AgriculturalTasksDay> today;
+    private List<AgriculturalTasksDay> next3Days;
+    private List<AgriculturalTasksDay> overdue;
+}

+ 27 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/vo/AgriculturalTasksStatistics.java

@@ -0,0 +1,27 @@
+package com.ruoyi.base.vo;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class AgriculturalTasksStatistics {
+
+    //任务总数
+    private Integer taskCount;
+    //已完成任务数
+    private Integer completedCount;
+    //待完成任务数
+    private Integer pendingCount;
+    //逾期数
+    private Integer overdueCount;
+    //完成率
+    private Double completionRate;
+    //准时率
+    private Double onTimeRate;
+    //平均完成时长
+    private Double avgCompletionDuration;
+}

+ 18 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/vo/MallCountVo.java

@@ -0,0 +1,18 @@
+package com.ruoyi.base.vo;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class MallCountVo {
+
+    private Integer totalCount;
+    private Integer onSaleCount;
+    private Integer pendingCount;
+    private Integer offSaleCount;
+    private Integer recommendedCount;
+}

+ 20 - 0
ruoyi-modules/ruoyi-base/src/main/java/com/ruoyi/base/vo/ProductInfoCountVo.java

@@ -0,0 +1,20 @@
+package com.ruoyi.base.vo;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class ProductInfoCountVo {
+
+    private Integer totalCount;
+    private Integer pendingCount;
+    private Integer onSaleCount;
+    private Integer offSaleCount;
+    private Integer rejectedCount;
+    private Integer saleCount;
+    private Integer purchaseCount;
+}

+ 1 - 0
ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/AgriculturalMachinesMapper.xml

@@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="managerName"  column="manager_name"   />
     </resultMap>
 
+
     <sql id="selectAgriculturalMachinesVo">
         select id, machine_code, machine_name, machine_type, manufacturer, model, farm_id, field_area, manager_id, purchase_date, manufacture_date, online_status, current_task, current_field, maintenance_status, location_status, alarm_count, description, image_url, status, create_by, create_time, update_by, update_time, remark from agricultural_machines
     </sql>

+ 178 - 40
ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/AgriculturalTasksMapper.xml

@@ -3,27 +3,42 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.base.mapper.AgriculturalTasksMapper">
-    
+
     <resultMap type="AgriculturalTasks" id="AgriculturalTasksResult">
-        <result property="id"    column="id"    />
-        <result property="plotId"    column="plot_id"    />
-        <result property="farmId"    column="farm_id"    />
-        <result property="fieldName"    column="field_name"    />
-        <result property="growCrops"    column="grow_crops"    />
-        <result property="taskName"    column="task_name"    />
-        <result property="taskImages"    column="task_images"    />
-        <result property="typeName"    column="type_name"    />
-        <result property="taskStatus"    column="task_status"    />
-        <result property="executeTime"    column="execute_time"    />
-        <result property="assigneeId"    column="assignee_id"    />
-        <result property="assigneeName"    column="assignee_name"    />
-        <result property="remark"    column="remark"    />
-        <result property="completionTime"    column="completion_time"    />
-        <result property="completionDesc"    column="completion_desc"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="updateBy"    column="update_by"    />
+        <result property="id" column="id"/>
+        <result property="plotId" column="plot_id"/>
+        <result property="farmId" column="farm_id"/>
+        <result property="taskName" column="task_name"/>
+        <result property="taskImages" column="task_images"/>
+        <result property="typeName" column="type_name"/>
+        <result property="taskStatus" column="task_status"/>
+        <result property="executeTime" column="execute_time"/>
+        <result property="assigneeId" column="assignee_id"/>
+        <result property="assigneeName" column="assignee_name"/>
+        <result property="remark" column="remark"/>
+        <result property="practicalBegintime" column="practical_begintime"/>
+        <result property="completionTime" column="completion_time"/>
+        <result property="completionDesc" column="completion_desc"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="fieldName" column="field_name"/>
+        <result property="growCrops" column="grow_crops"/>
+        <result property="imageCount" column="image_count"/>
+        <result property="plannedCompletetime" column="planned_completetime"/>
+    </resultMap>
+
+    <resultMap type="AgriculturalTasksStatistics" id="AgriculturalTasksStatisticsResult">
+        <result property="taskCount" column="task_count"/>
+        <result property="completedCount" column="completed_count"/>
+        <result property="pendingCount" column="pending_count"/>
+        <result property="overdueCount" column="overdue_count"/>
+        <result property="completionRate" column="completion_rate"/>
+        <result property="onTimeRate" column="on_time_rate"/>
+        <result property="avgCompletionDuration" column="avg_completion_duration"/>
+
     </resultMap>
 
     <sql id="selectAgriculturalTasksVo">
@@ -31,28 +46,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectAgriculturalTasksList" parameterType="AgriculturalTasks" resultMap="AgriculturalTasksResult">
-        <include refid="selectAgriculturalTasksVo"/>
-        <where>  
-            <if test="plotId != null "> and plot_id = #{plotId}</if>
-            <if test="farmId != null "> and farm_id = #{farmId}</if>
-            <if test="fieldName != null  and fieldName != ''"> and field_name like concat('%', #{fieldName}, '%')</if>
-            <if test="growCrops != null  and growCrops != ''"> and grow_crops = #{growCrops}</if>
-            <if test="taskName != null  and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
-            <if test="taskImages != null  and taskImages != ''"> and task_images = #{taskImages}</if>
-            <if test="typeName != null  and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
-            <if test="taskStatus != null  and taskStatus != ''"> and task_status = #{taskStatus}</if>
-            <if test="executeTime != null "> and execute_time = #{executeTime}</if>
-            <if test="assigneeId != null "> and assignee_id = #{assigneeId}</if>
-            <if test="completionTime != null "> and completion_time = #{completionTime}</if>
-            <if test="completionDesc != null  and completionDesc != ''"> and completion_desc = #{completionDesc}</if>
-            <if test="createBy != null "> and create_by = #{createBy}</if>
+        select at1.*,sd.dept_name,su.nick_name,
+        CASE
+        WHEN task_images = '' THEN 0
+        ELSE LENGTH(task_images) - LENGTH(REPLACE(task_images, ',', '')) + 1
+        END AS image_count
+        from agricultural_tasks at1
+        left join sys_dept sd on at1.farm_id = sd.dept_id
+        left join sys_user su on at1.assignee_id = su.user_id
+
+
+        <where>
+            <if test="plotId != null ">and at1.plot_id = #{plotId}</if>
+            <if test="taskName != null  and taskName != ''">and at1.task_name like concat('%', #{taskName}, '%')</if>
+            <if test="assigneeName != null  and assigneeName != ''">and at1.assignee_name like concat('%',
+                #{assigneeName}, '%')
+            </if>
+            <if test="taskImages != null  and taskImages != ''">and at1.task_images = #{taskImages}</if>
+            <if test="typeName != null  and typeName != ''">and at1.type_name = #{typeName}</if>
+            <if test="taskStatus != null  and taskStatus != ''">and at1.task_status = #{taskStatus}</if>
+            <if test="executeTime != null ">and at1.execute_time = #{executeTime}</if>
+            <if test="assigneeId != null ">and at1.assignee_id = #{assigneeId}</if>
+            <if test="completionTime != null ">and at1.completion_time = #{completionTime}</if>
+            <if test="completionDesc != null  and completionDesc != ''">and at1.completion_desc = #{completionDesc}</if>
+            <if test="createBy != null ">and at1.create_by = #{createBy}</if>
+            <if test="deptIdList != null  and deptIdList.size() != 0">and at1.farm_id in (<foreach
+                    collection="deptIdList" item="deptId" separator=",">#{deptId}</foreach>)
+            </if>
+            <if test="fieldIdList != null  and fieldIdList.size() != 0">and at1.plot_id in (<foreach
+                    collection="fieldIdList" item="deptId" separator=",">#{deptId}</foreach>)
+            </if>
+            <if test="params.beginExecuteTime != null and params.beginExecuteTime != '' and params.endExecuteTime != null and params.endExecuteTime != ''">
+                and at1.execute_time between #{params.beginExecuteTime} and #{params.endExecuteTime}
+            </if>
+            <if test="params.beginCompletionTime != null and params.beginCompletionTime != '' and params.endCompletionTime != null and params.endCompletionTime != ''">
+                    and at1.completion_time between #{params.beginCompletionTime} and #{params.endCompletionTime}
+            </if>
+
+            <if test="params.beginPlannedCompleteTime != null and params.beginPlannedCompleteTime != '' and params.endPlannedCompleteTime != null and params.endPlannedCompleteTime != ''">
+                and at1.planned_completetime between #{params.beginPlannedCompleteTime} and #{params.endPlannedCompleteTime}
+            </if>
+
         </where>
         ORDER BY create_time DESC
     </select>
-    
+
     <select id="selectAgriculturalTasksById" parameterType="Long" resultMap="AgriculturalTasksResult">
-        <include refid="selectAgriculturalTasksVo"/>
-        where id = #{id}
+        select at1.*,sd.dept_name
+        from agricultural_tasks at1
+                 left join sys_dept sd on at1.farm_id = sd.dept_id
+        where at1.id = #{id}
     </select>
     <select id="countStatusTypeTasks" resultType="java.lang.Integer" parameterType="AgriculturalTasks">
         select count(*) from agricultural_tasks
@@ -62,6 +105,97 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="assigneeId != null "> and assignee_id = #{assigneeId}</if>
         </where>
     </select>
+    <select id="selectAgriculturalTaskStatistics" resultMap="AgriculturalTasksStatisticsResult">
+
+        SELECT
+
+        COUNT(*) AS task_count,
+
+        SUM(CASE WHEN task_status = 1 THEN 1 ELSE 0 END) AS completed_count,
+
+        SUM(CASE WHEN task_status = 0 THEN 1 ELSE 0 END) AS pending_count,
+
+        SUM(
+        CASE
+        WHEN (task_status = 1 AND completion_time > planned_completetime)
+        OR (task_status = 0 AND planned_completetime &lt; NOW())
+        THEN 1
+        ELSE 0
+        END
+        ) AS overdue_count,
+
+        IFNULL(
+        SUM(CASE WHEN task_status = 1 THEN 1 ELSE 0 END) /
+        NULLIF(COUNT(*), 0),
+        0
+        ) AS completion_rate,
+
+        IFNULL(
+        SUM(CASE WHEN task_status = 1 AND completion_time &lt;= planned_completetime THEN 1 ELSE 0 END) /
+        NULLIF(SUM(CASE WHEN task_status = 1 AND planned_completetime IS NOT NULL THEN 1 ELSE 0 END), 0),
+        0
+        ) AS on_time_rate,
+
+        ROUND(
+        AVG(
+        CASE
+        WHEN practical_begintime IS NOT NULL THEN TIMESTAMPDIFF(DAY, practical_begintime, completion_time)
+        WHEN planned_completetime IS NOT NULL THEN TIMESTAMPDIFF(DAY, execute_time, completion_time)
+        ELSE NULL
+        END
+        ),
+        1
+        ) AS avg_completion_duration
+        FROM agricultural_tasks
+        <where>
+            <if test="deptIdList != null  and deptIdList.size() != 0">and farm_id in (<foreach
+                    collection="deptIdList" item="deptId" separator=",">#{deptId}</foreach>)
+            </if>
+            <if test="fieldIdList != null  and fieldIdList.size() != 0">and plot_id in (<foreach
+                    collection="fieldIdList" item="deptId" separator=",">#{deptId}</foreach>)
+            </if>
+            <if test="growCrops != null and growCrops != ''">grow_crops= #{growCrops}</if>
+            <if test="typeName != null  and typeName != ''">and type_name = #{typeName}</if>
+            <if test="assigneeName != null  and assigneeName != ''">and assignee_name like concat('%',
+                #{assigneeName}, '%')
+            </if>
+            <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
+                and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
+            </if>
+        </where>
+
+    </select>
+    <select id="selectAgriculturalTasksOverdueList" resultMap="AgriculturalTasksResult">
+        SELECT *
+        FROM agricultural_tasks
+        WHERE
+
+        (task_status = 0 AND planned_completetime &lt; NOW()) -- 逾期未完成
+        AND planned_completetime IS NOT NULL;
+
+    </select>
+    <select id="selectAgriculturalTasksByCreateTime" parameterType="AgriculturalTasks" resultType="java.util.Map">
+        WITH RECURSIVE date_series AS (
+            SELECT #{params.beginCreateTime} AS date
+        UNION ALL
+        SELECT DATE_ADD(date, INTERVAL 1 DAY)
+        FROM date_series
+        WHERE date &lt; #{params.endCreateTime}
+            )
+        SELECT
+            ds.date,
+            COALESCE(task_counts.value, 0) AS value
+        FROM date_series ds
+            LEFT JOIN (
+            SELECT
+            DATE_FORMAT(create_time, '%Y-%m-%d') AS date,
+            COUNT(*) AS value
+            FROM agricultural_tasks
+            WHERE create_time BETWEEN #{params.beginCreateTime} AND #{params.endCreateTime}
+            GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d')
+            ) task_counts ON ds.date = task_counts.date
+        ORDER BY ds.date
+    </select>
 
     <insert id="insertAgriculturalTasks" parameterType="AgriculturalTasks" useGeneratedKeys="true" keyProperty="id">
         insert into agricultural_tasks
@@ -75,10 +209,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="typeName != null and typeName != ''">type_name,</if>
             <if test="taskStatus != null">task_status,</if>
             <if test="executeTime != null">execute_time,</if>
+            <if test="plannedCompletetime != null">planned_completetime,</if>
             <if test="assigneeId != null">assignee_id,</if>
             <if test="assigneeName != null">assignee_name,</if>
             <if test="remark != null">remark,</if>
             <if test="completionTime != null">completion_time,</if>
+            <if test="practicalBegintime != null">practical_begintime,</if>
             <if test="completionDesc != null">completion_desc,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
@@ -95,10 +231,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="typeName != null and typeName != ''">#{typeName},</if>
             <if test="taskStatus != null">#{taskStatus},</if>
             <if test="executeTime != null">#{executeTime},</if>
+            <if test="plannedCompletetime != null">#{plannedCompletetime},</if>
             <if test="assigneeId != null">#{assigneeId},</if>
             <if test="assigneeName != null">#{assigneeName},</if>
             <if test="remark != null">#{remark},</if>
             <if test="completionTime != null">#{completionTime},</if>
+            <if test="practicalBegintime != null">#{practicalBegintime},</if>
             <if test="completionDesc != null">#{completionDesc},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -137,9 +275,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteAgriculturalTasksByIds" parameterType="String">
-        delete from agricultural_tasks where id in 
+        delete from agricultural_tasks where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 129 - 0
ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/KnowledgeContentMapper.xml

@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.base.mapper.KnowledgeContentMapper">
+
+    <resultMap type="KnowledgeContent" id="KnowledgeContentResult">
+        <result property="id"    column="id"    />
+        <result property="title"    column="title"    />
+        <result property="description"    column="description"    />
+        <result property="contentType"    column="content_type"    />
+        <result property="contentCategory"    column="content_category"    />
+        <result property="imageUrl"    column="image_url"    />
+        <result property="source"    column="source"    />
+        <result property="viewCount"    column="view_count"    />
+        <result property="videoUrl"    column="video_url"    />
+        <result property="duration"    column="duration"    />
+        <result property="articleContent"    column="article_content"    />
+        <result property="author"    column="author"    />
+        <result property="tags"    column="tags"    />
+        <result property="publishDate"    column="publish_date"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="status"    column="status"    />
+    </resultMap>
+
+    <sql id="selectKnowledgeContentVo">
+        select id, title, description, content_type, content_category, image_url, source, view_count, video_url, duration, article_content, author, tags, publish_date, create_time, update_time, status from knowledge_content
+    </sql>
+
+    <select id="selectKnowledgeContentList" parameterType="KnowledgeContent" resultMap="KnowledgeContentResult">
+        <include refid="selectKnowledgeContentVo"/>
+        <where>
+            <if test="title != null  and title != ''"> and title = #{title}</if>
+            <if test="description != null  and description != ''"> and description = #{description}</if>
+            <if test="contentType != null  and contentType != ''"> and content_type = #{contentType}</if>
+            <if test="contentCategory != null  and contentCategory != ''"> and content_category = #{contentCategory}</if>
+            <if test="imageUrl != null  and imageUrl != ''"> and image_url = #{imageUrl}</if>
+            <if test="source != null  and source != ''"> and source = #{source}</if>
+            <if test="viewCount != null "> and view_count = #{viewCount}</if>
+            <if test="videoUrl != null  and videoUrl != ''"> and video_url = #{videoUrl}</if>
+            <if test="duration != null  and duration != ''"> and duration = #{duration}</if>
+            <if test="articleContent != null  and articleContent != ''"> and article_content = #{articleContent}</if>
+            <if test="author != null  and author != ''"> and author = #{author}</if>
+            <if test="tags != null  and tags != ''"> and tags = #{tags}</if>
+            <if test="publishDate != null "> and publish_date = #{publishDate}</if>
+            <if test="status != null "> and status = #{status}</if>
+        </where>
+    </select>
+
+    <select id="selectKnowledgeContentById" parameterType="Long" resultMap="KnowledgeContentResult">
+        <include refid="selectKnowledgeContentVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertKnowledgeContent" parameterType="KnowledgeContent" useGeneratedKeys="true" keyProperty="id">
+        insert into knowledge_content
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="title != null and title != ''">title,</if>
+            <if test="description != null">description,</if>
+            <if test="contentType != null and contentType != ''">content_type,</if>
+            <if test="contentCategory != null and contentCategory != ''">content_category,</if>
+            <if test="imageUrl != null and imageUrl != ''">image_url,</if>
+            <if test="source != null">source,</if>
+            <if test="viewCount != null">view_count,</if>
+            <if test="videoUrl != null">video_url,</if>
+            <if test="duration != null">duration,</if>
+            <if test="articleContent != null">article_content,</if>
+            <if test="author != null">author,</if>
+            <if test="tags != null">tags,</if>
+            <if test="publishDate != null">publish_date,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="status != null">status,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="title != null and title != ''">#{title},</if>
+            <if test="description != null">#{description},</if>
+            <if test="contentType != null and contentType != ''">#{contentType},</if>
+            <if test="contentCategory != null and contentCategory != ''">#{contentCategory},</if>
+            <if test="imageUrl != null and imageUrl != ''">#{imageUrl},</if>
+            <if test="source != null">#{source},</if>
+            <if test="viewCount != null">#{viewCount},</if>
+            <if test="videoUrl != null">#{videoUrl},</if>
+            <if test="duration != null">#{duration},</if>
+            <if test="articleContent != null">#{articleContent},</if>
+            <if test="author != null">#{author},</if>
+            <if test="tags != null">#{tags},</if>
+            <if test="publishDate != null">#{publishDate},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="status != null">#{status},</if>
+         </trim>
+    </insert>
+
+    <update id="updateKnowledgeContent" parameterType="KnowledgeContent">
+        update knowledge_content
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="title != null and title != ''">title = #{title},</if>
+            <if test="description != null">description = #{description},</if>
+            <if test="contentType != null and contentType != ''">content_type = #{contentType},</if>
+            <if test="contentCategory != null and contentCategory != ''">content_category = #{contentCategory},</if>
+            <if test="imageUrl != null and imageUrl != ''">image_url = #{imageUrl},</if>
+            <if test="source != null">source = #{source},</if>
+            <if test="viewCount != null">view_count = #{viewCount},</if>
+            <if test="videoUrl != null">video_url = #{videoUrl},</if>
+            <if test="duration != null">duration = #{duration},</if>
+            <if test="articleContent != null">article_content = #{articleContent},</if>
+            <if test="author != null">author = #{author},</if>
+            <if test="tags != null">tags = #{tags},</if>
+            <if test="publishDate != null">publish_date = #{publishDate},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="status != null">status = #{status},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteKnowledgeContentById" parameterType="Long">
+        delete from knowledge_content where id = #{id}
+    </delete>
+
+    <delete id="deleteKnowledgeContentByIds" parameterType="String">
+        delete from knowledge_content where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 7 - 3
ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/MachineWorkRecordsMapper.xml

@@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="fieldName"  column="field_name"   />
         <result property="userName"  column="user_name"   />
         <result property="workHours"  column="work_hours"   />
+        <result property="farmId"  column="farm_id"   />
     </resultMap>
 
     <sql id="selectMachineWorkRecordsVo">
@@ -35,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectMachineWorkRecordsList" parameterType="MachineWorkRecords" resultMap="MachineWorkRecordsResult">
-        select mwr.*,am.machine_code,am.machine_name,am.machine_type,sd.dept_name,f.field_name,su.user_name,ROUND(TIMESTAMPDIFF(SECOND, start_time, end_time) / 3600, 2) AS work_hours
+        select mwr.*,am.machine_code,am.machine_name,am.machine_type,sd.dept_name,f.field_name,su.user_name,ROUND(TIMESTAMPDIFF(SECOND, start_time, end_time) / 3600, 2) AS work_hours,am.farm_id
         from machine_work_records mwr
         left join agricultural_machines am on mwr.machine_id = am.id
         left join sys_dept sd on am.farm_id = sd.dept_id
@@ -69,8 +70,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectMachineWorkRecordsById" parameterType="Long" resultMap="MachineWorkRecordsResult">
-        <include refid="selectMachineWorkRecordsVo"/>
-        where id = #{id}
+        select mwr.*,am.farm_id
+        from machine_work_records mwr
+                 left join agricultural_machines am on mwr.machine_id = am.id
+
+        where mwr.id = #{id}
     </select>
 
     <insert id="insertMachineWorkRecords" parameterType="MachineWorkRecords" useGeneratedKeys="true" keyProperty="id">

+ 34 - 12
ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/MallMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.base.mapper.MallMapper">
-    
+
     <resultMap type="Mall" id="MallResult">
         <result property="id"    column="id"    />
         <result property="productCategory"    column="product_category"    />
@@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectMallList" parameterType="Mall" resultMap="MallResult">
         <include refid="selectMallVo"/>
-        <where>  
+        <where>
             <if test="productCategory != null "> and product_category = #{productCategory}</if>
             <if test="title != null  and title != ''"> and title = #{title}</if>
             <if test="description != null  and description != ''"> and description = #{description}</if>
@@ -47,13 +47,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null "> and status = #{status}</if>
             <if test="isRecommended != null">and is_recommended = #{isRecommended}</if>
             <if test="searchKeyword != null and searchKeyword != '' "> and title LIKE CONCAT('%', #{searchKeyword}, '%')</if>
+
+            <if test="originalPriceMin != null  and originalPriceMax != null ">
+                and original_price between #{originalPriceMin} and #{originalPriceMax}
+            </if>
+            <if test="priceMin != null  and priceMax != null ">
+                and price between #{priceMin} and #{priceMax}
+            </if>
         </where>
     </select>
-    
+
     <select id="selectMallById" parameterType="String" resultMap="MallResult">
         <include refid="selectMallVo"/>
         where id = #{id}
     </select>
+    <select id="selectMallCount" resultType="com.ruoyi.base.vo.MallCountVo">
+        SELECT
+            COUNT(*) AS totalCount, -- 商品总数
+            SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) AS onSaleCount, -- 已上架数量
+            SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) AS pendingCount, -- 待上架数量
+            SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) AS offSaleCount, -- 已下架数量
+            SUM(CASE WHEN is_recommended = 1 THEN 1 ELSE 0 END) AS recommendedCount -- 已下架数量
+        FROM
+            mall;
+
+
+    </select>
 
     <insert id="insertMall" parameterType="Mall" useGeneratedKeys="true" keyProperty="id">
         insert into mall
@@ -61,30 +80,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="productCategory != null">product_category,</if>
             <if test="title != null and title != ''">title,</if>
             <if test="description != null and description != ''">description,</if>
-            <if test="price != null">price,</if>
-            <if test="unit != null and unit != ''">unit,</if>
+            <if test="price != null and price != ''">price,</if>
             <if test="originalPrice != null">original_price,</if>
+            <if test="unit != null and unit != ''">unit,</if>
             <if test="specifications != null and specifications != ''">specifications,</if>
             <if test="features != null and features != ''">features,</if>
+            <if test="featuresText != null and featuresText != ''">features,</if>
             <if test="usageGuide != null and usageGuide != ''">usage_guide,</if>
             <if test="swiperImages != null and swiperImages != ''">swiper_images,</if>
             <if test="detailImages != null">detail_images,</if>
             <if test="status != null">status,</if>
-            <if test="isRecommended != null">#{is_recommended},</if>
+            <if test="isRecommended != null">is_recommended,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="productCategory != null">#{productCategory},</if>
             <if test="title != null and title != ''">#{title},</if>
             <if test="description != null and description != ''">#{description},</if>
-            <if test="unit != null and unit != ''">#{unit},</if>
-            <if test="price != null">#{price},</if>
+            <if test="price != null and price != ''">#{price},</if>
             <if test="originalPrice != null">#{originalPrice},</if>
+            <if test="unit != null and unit != ''">#{unit},</if>
             <if test="specifications != null and specifications != ''">#{specifications},</if>
             <if test="features != null and features != ''">#{features},</if>
+            <if test="featuresText != null and featuresText != ''">#{featuresText},</if>
             <if test="usageGuide != null and usageGuide != ''">#{usageGuide},</if>
             <if test="swiperImages != null and swiperImages != ''">#{swiperImages},</if>
             <if test="detailImages != null">#{detailImages},</if>
@@ -94,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateMall" parameterType="Mall">
@@ -108,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="originalPrice != null">original_price = #{originalPrice},</if>
             <if test="specifications != null and specifications != ''">specifications = #{specifications},</if>
             <if test="features != null and features != ''">features = #{features},</if>
+            <if test="featuresText != null and featuresText != ''">features = #{featuresText},</if>
             <if test="usageGuide != null and usageGuide != ''">usage_guide = #{usageGuide},</if>
             <if test="swiperImages != null and swiperImages != ''">swiper_images = #{swiperImages},</if>
             <if test="detailImages != null">detail_images = #{detailImages},</if>
@@ -126,9 +148,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteMallByIds" parameterType="String">
-        delete from mall where id in 
+        delete from mall where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 20 - 1
ruoyi-modules/ruoyi-base/src/main/resources/mapper/base/ProductInfoMapper.xml

@@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="remark"    column="remark"    />
+        <result property="nickName"     column="nick_name"    />
     </resultMap>
 
     <sql id="selectProductInfoVo">
@@ -41,7 +42,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="type != null "> and type = #{type}</if>
             <if test="title != null  and title != ''"> and title = #{title}</if>
             <if test="description != null  and description != ''"> and description = #{description}</if>
-            <if test="price != null  and price != ''"> and price = #{price}</if>
             <if test="quantity != null "> and quantity = #{quantity}</if>
             <if test="unit != null "> and unit = #{unit}</if>
             <if test="location != null  and location != ''"> and location = #{location}</if>
@@ -54,6 +54,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="publishTime != null "> and publish_time = #{publishTime}</if>
             <if test="searchKeyword != null and searchKeyword != '' "> and title LIKE CONCAT('%', #{searchKeyword}, '%')</if>
             <if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
+            <if test="publishTimeStart != null and publishTimeStart != '' and publishTimeEnd != null and publishTimeEnd != ''">
+                and publish_time between #{publishTimeStart} and #{publishTimeEnd}
+            </if>
+            <if test="minPrice != null  and maxPrice != null ">
+                and price between #{minPrice} and #{maxPrice}
+            </if>
         </where>
         ORDER BY publish_time DESC
     </select>
@@ -62,6 +68,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectProductInfoVo"/>
         where id = #{id}
     </select>
+    <select id="selectProductInfoCount" resultType="com.ruoyi.base.vo.ProductInfoCountVo">
+        SELECT
+            COUNT(*) AS totalCount,
+            SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) AS pendingCount,
+            SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) AS onSaleCount,
+            SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) AS offSaleCount,
+            SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) AS rejectedCount,
+            SUM(CASE WHEN type = 0 THEN 1 ELSE 0 END) AS saleCount,
+            SUM(CASE WHEN type = 1 THEN 1 ELSE 0 END) AS purchaseCount
+
+        FROM
+            product_info;
+    </select>
 
     <insert id="insertProductInfo" parameterType="ProductInfo" useGeneratedKeys="true" keyProperty="id">
         insert into product_info

+ 4 - 4
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java

@@ -164,12 +164,12 @@ public class SysUserController extends BaseController
      * 根据岗位和部门获取当前用户信息
      */
     @InnerAuth
-    @GetMapping("/infoPost/{farmId}")
-    public R<List<SysUser>> infoPost(@PathVariable("farmId") Long farmId)
+    @PostMapping("/getUserByFarmId")
+    public R<List<SysUser>> infoPost(@RequestBody SysUser sysUser)
     {
-        List<SysUser> sysUser = userService.selectUserByPostName(farmId);
+        List<SysUser> sysUsers = userService.selectUserByPostName(sysUser);
 
-        return R.ok(sysUser);
+        return R.ok(sysUsers);
     }
 
     /**

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java

@@ -128,5 +128,5 @@ public interface SysUserMapper
 
     SysUser selectUserByPhoneNumber(String phoneNumber);
 
-    List<SysUser> selectUserByPostName(Long farmId);
+    List<SysUser> selectUserByPostName(SysUser sysUser);
 }

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java

@@ -64,7 +64,7 @@ public interface ISysUserService
      * @param farmId 部门
      * @return 用户对象信息
      */
-    List<SysUser> selectUserByPostName(Long farmId);
+    List<SysUser> selectUserByPostName(SysUser sysUser);
 
     /**
      * 通过用户ID查询用户

+ 3 - 3
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -140,12 +140,12 @@ public class SysUserServiceImpl implements ISysUserService
     /**
      * 根据岗位和部门获取当前用户信息
      *
-     * @param farmId 部门
+     * @param sysUser 部门
      * @return 用户对象信息
      */
     @Override
-    public List<SysUser> selectUserByPostName(Long farmId) {
-        return userMapper.selectUserByPostName(farmId);
+    public List<SysUser> selectUserByPostName(SysUser sysUser) {
+        return userMapper.selectUserByPostName(sysUser);
     }
 
     /**

+ 8 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -163,7 +163,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		from sys_user su
 				 left join sys_user_post sup on su.user_id = sup.user_id
 				 left join sys_post sp on sup.post_id = sp.post_id
-		where su.dept_id = #{farmId} and sp.post_code = 'AgriculturalMachineryDriver';
+		<where>
+			<if test="deptId != null and deptId != ''">
+				AND su.dept_id = #{deptId}
+			</if>
+			<if test="params.postCode != null and params.postCode != ''">
+				sp.post_code = 'AgriculturalMachineryDriver'
+			</if>
+		</where>
 
 	</select>