From 269ff4fbac22ae08107ee47ef500bd9574ccccce Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 09 四月 2026 11:25:59 +0800
Subject: [PATCH] feat:1.groupBy 2.appVersion添加

---
 src/main/resources/mapper/account/AccountExpenseMapper.xml                     |    2 
 src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml |    3 
 src/main/resources/mapper/account/AccountIncomeMapper.xml                      |    2 
 src/main/java/com/ruoyi/common/enums/FileNameType.java                         |   10 +-
 src/main/java/com/ruoyi/other/pojo/TempFile.java                               |    3 
 src/main/resources/mapper/staff/PersonalShiftMapper.xml                        |   14 +-
 src/main/java/com/ruoyi/other/service/PdaVersionService.java                   |   13 +++
 src/main/java/com/ruoyi/other/service/impl/PdaVersionServiceImpl.java          |   60 +++++++++++++++
 src/main/java/com/ruoyi/other/pojo/PdaVersion.java                             |   57 ++++++++++++++
 src/main/java/com/ruoyi/other/controller/PdaVersionController.java             |   31 +++++++
 src/main/java/com/ruoyi/other/mapper/PdaVersionMapper.java                     |    9 ++
 src/main/resources/mapper/sales/SalesLedgerProductMapper.xml                   |    4 
 src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml               |   14 +-
 13 files changed, 194 insertions(+), 28 deletions(-)

diff --git a/src/main/java/com/ruoyi/common/enums/FileNameType.java b/src/main/java/com/ruoyi/common/enums/FileNameType.java
index 7afc045..2deb5d6 100644
--- a/src/main/java/com/ruoyi/common/enums/FileNameType.java
+++ b/src/main/java/com/ruoyi/common/enums/FileNameType.java
@@ -1,6 +1,8 @@
 package com.ruoyi.common.enums;
 
+import lombok.Getter;
 
+@Getter
 public enum FileNameType {
 
     SALE(1),      // 閿�鍞�
@@ -14,17 +16,13 @@
     SHIP(9),//鍙戣揣鍙拌处
     INSPECTION_PRODUCTION_BEFORE(10),
     INSPECTION_PRODUCTION_AFTER(11),
-    INSPECTION(12);//宸℃ 鐢熶骇鍓�
+    INSPECTION(12),//宸℃ 鐢熶骇鍓�
+    APP(13);
 
     private final int value;
 
     FileNameType(int value) {
         this.value = value;
-    }
-
-    public int getValue() {
-        return value;
-
     }
 
     // 鏍规嵁鏁存暟鍊艰幏鍙栧搴旂殑鏋氫妇鍊�
diff --git a/src/main/java/com/ruoyi/other/controller/PdaVersionController.java b/src/main/java/com/ruoyi/other/controller/PdaVersionController.java
new file mode 100644
index 0000000..831da33
--- /dev/null
+++ b/src/main/java/com/ruoyi/other/controller/PdaVersionController.java
@@ -0,0 +1,31 @@
+package com.ruoyi.other.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.other.pojo.PdaVersion;
+import com.ruoyi.other.service.PdaVersionService;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+@RestController
+@RequestMapping("/app")
+@AllArgsConstructor
+public class PdaVersionController {
+
+    private PdaVersionService pdaVersionService;
+
+    @ApiOperation("鏌ヨ鎵�鏈夌増鏈�")
+    @GetMapping("/getAllVersion")
+    public R getAllVersion(Page<PdaVersion> page, PdaVersion pdaVersion) {
+        return R.ok(pdaVersionService.getAllVersion(page, pdaVersion));
+    }
+
+    @ApiOperation("涓婁紶apk")
+    @PostMapping("/uploadApk")
+    public R uploadApk(@RequestParam("file") MultipartFile file, String name, String version) {
+        return R.ok(pdaVersionService.uploadApk(file, name, version));
+    }
+
+}
diff --git a/src/main/java/com/ruoyi/other/mapper/PdaVersionMapper.java b/src/main/java/com/ruoyi/other/mapper/PdaVersionMapper.java
new file mode 100644
index 0000000..d688651
--- /dev/null
+++ b/src/main/java/com/ruoyi/other/mapper/PdaVersionMapper.java
@@ -0,0 +1,9 @@
+package com.ruoyi.other.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.other.pojo.PdaVersion;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface PdaVersionMapper extends BaseMapper<PdaVersion> {
+}
diff --git a/src/main/java/com/ruoyi/other/pojo/PdaVersion.java b/src/main/java/com/ruoyi/other/pojo/PdaVersion.java
new file mode 100644
index 0000000..5f15416
--- /dev/null
+++ b/src/main/java/com/ruoyi/other/pojo/PdaVersion.java
@@ -0,0 +1,57 @@
+package com.ruoyi.other.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.sales.pojo.CommonFile;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Data
+@TableName("pda_version")
+@ApiModel(value = "PdaVersion", description = "PDA鐗堟湰淇℃伅琛�")
+public class PdaVersion implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("涓婚敭ID")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty("鍚嶇О")
+    private String name;
+
+    @ApiModelProperty("鐗堟湰鍙�")
+    private String version;
+
+    @ApiModelProperty("鍒涘缓鏃堕棿")
+    @TableField(fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime createTime;
+
+    @ApiModelProperty("鏇存柊鏃堕棿")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime updateTime;
+
+    @ApiModelProperty("鍒涘缓浜�")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer createUser;
+
+    @ApiModelProperty("鏇存柊浜�")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Integer updateUser;
+
+    @ApiModelProperty("绉熸埛ID")
+    @TableField(fill = FieldFill.INSERT)
+    private Long tenantId;
+
+    @TableField(exist = false)
+    private List<CommonFile> commonFileList;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/other/pojo/TempFile.java b/src/main/java/com/ruoyi/other/pojo/TempFile.java
index bff7805..e314d84 100644
--- a/src/main/java/com/ruoyi/other/pojo/TempFile.java
+++ b/src/main/java/com/ruoyi/other/pojo/TempFile.java
@@ -4,11 +4,12 @@
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
+import java.io.Serializable;
 import java.time.LocalDateTime;
 
 @Data
 @TableName("temp_file")
-public class TempFile {
+public class TempFile implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @TableId
diff --git a/src/main/java/com/ruoyi/other/service/PdaVersionService.java b/src/main/java/com/ruoyi/other/service/PdaVersionService.java
new file mode 100644
index 0000000..39bc196
--- /dev/null
+++ b/src/main/java/com/ruoyi/other/service/PdaVersionService.java
@@ -0,0 +1,13 @@
+package com.ruoyi.other.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.other.pojo.PdaVersion;
+import org.springframework.web.multipart.MultipartFile;
+
+public interface PdaVersionService extends IService<PdaVersion> {
+    IPage<PdaVersion> getAllVersion(Page<PdaVersion> page, PdaVersion pdaVersion);
+
+    boolean uploadApk(MultipartFile file, String name, String version);
+}
diff --git a/src/main/java/com/ruoyi/other/service/impl/PdaVersionServiceImpl.java b/src/main/java/com/ruoyi/other/service/impl/PdaVersionServiceImpl.java
new file mode 100644
index 0000000..65b37e6
--- /dev/null
+++ b/src/main/java/com/ruoyi/other/service/impl/PdaVersionServiceImpl.java
@@ -0,0 +1,60 @@
+package com.ruoyi.other.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.enums.FileNameType;
+import com.ruoyi.other.mapper.PdaVersionMapper;
+import com.ruoyi.other.pojo.PdaVersion;
+import com.ruoyi.other.service.PdaVersionService;
+import com.ruoyi.other.service.TempFileService;
+import com.ruoyi.sales.service.impl.CommonFileServiceImpl;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.Assert;
+import org.springframework.web.multipart.MultipartFile;
+
+@Service
+@RequiredArgsConstructor
+@Transactional(rollbackFor = Exception.class)
+public class PdaVersionServiceImpl extends ServiceImpl<PdaVersionMapper, PdaVersion> implements PdaVersionService {
+
+    private final PdaVersionMapper pdaVersionMapper;
+
+    private final TempFileService tempFileService;
+
+    private final CommonFileServiceImpl commonFileService;
+
+    @Override
+    public IPage<PdaVersion> getAllVersion(Page<PdaVersion> page, PdaVersion pdaVersion) {
+        LambdaQueryWrapper<PdaVersion> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.orderByDesc(PdaVersion::getCreateTime);
+        Page<PdaVersion> pdaVersionPage = pdaVersionMapper.selectPage(page, queryWrapper);
+        pdaVersionPage.getRecords().forEach(item ->{
+            item.setCommonFileList(commonFileService.getFileListByBusinessId(item.getId(), FileNameType.APP.getValue()));
+        });
+        return pdaVersionPage;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean uploadApk(MultipartFile file, String name, String version) {
+        // 鍙傛暟鏍¢獙
+        Assert.notNull(file, "鏂囦欢涓嶈兘涓虹┖");
+        Assert.hasText(version, "鐗堟湰鍙蜂笉鑳戒负绌�");
+
+        try {
+            PdaVersion pdaVersion = new PdaVersion();
+            pdaVersion.setName(name);
+            pdaVersion.setVersion(version);
+            pdaVersionMapper.insert(pdaVersion);
+
+            tempFileService.uploadByCommon(file, FileNameType.APP.getValue(), pdaVersion.getId());
+            return true;
+        } catch (Exception e) {
+            throw new RuntimeException("涓婁紶APK澶辫触: " + e.getMessage());
+        }
+    }
+}
diff --git a/src/main/resources/mapper/account/AccountExpenseMapper.xml b/src/main/resources/mapper/account/AccountExpenseMapper.xml
index e954562..f4039c8 100644
--- a/src/main/resources/mapper/account/AccountExpenseMapper.xml
+++ b/src/main/resources/mapper/account/AccountExpenseMapper.xml
@@ -59,7 +59,7 @@
         <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
             AND expense_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
         </if>
-        group by expense_type
+        group by sdd.dict_label, ae.expense_type
     </select>
 
     <select id="report1" resultType="java.math.BigDecimal">
diff --git a/src/main/resources/mapper/account/AccountIncomeMapper.xml b/src/main/resources/mapper/account/AccountIncomeMapper.xml
index 56d254d..53c8cf3 100644
--- a/src/main/resources/mapper/account/AccountIncomeMapper.xml
+++ b/src/main/resources/mapper/account/AccountIncomeMapper.xml
@@ -61,7 +61,7 @@
         <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
             AND income_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
         </if>
-        group by income_type
+        GROUP BY sdd.dict_label, ai.income_type
     </select>
     <select id="report1" resultType="java.math.BigDecimal">
         SELECT
diff --git a/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml b/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
index d9ddde7..8a32b42 100644
--- a/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
+++ b/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
@@ -84,8 +84,7 @@
             </if>
 
         </where>
-        GROUP BY slpa.scheduling_user_name
-
+        GROUP BY slpa.scheduling_user_id, slpa.scheduling_user_name
     </select>
 
     <select id="selectDailyWagesStats" resultType="java.util.Map">
diff --git a/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml b/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
index c5c007e..8e01079 100644
--- a/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
+++ b/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
@@ -197,27 +197,27 @@
                 T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%')
             </if>
         </where>
-        GROUP BY T1.supplier_name
+        GROUP BY T1.supplier_id, T1.supplier_name
     </select>
 
     <select id="supplierNameListPageDetails" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
         SELECT
         T1.supplier_id,
         T1.supplier_name,
-        SUM(contract_amount) AS invoiceAmount,
-        IFNULL( SUM(T2.current_payment_amount) , 0 ) AS paymentAmount,
-        IFNULL((IFNULL(SUM(contract_amount),0)  - IFNULL(SUM(T2.current_payment_amount),0)),0) AS payableAmount,
         T1.purchase_contract_number,
-        T2.payment_date
+        T2.payment_date,
+        SUM(T1.contract_amount) AS invoiceAmount,
+        IFNULL(SUM(T2.current_payment_amount), 0) AS paymentAmount,
+        IFNULL((IFNULL(SUM(T1.contract_amount), 0) - IFNULL(SUM(T2.current_payment_amount), 0)), 0) AS payableAmount
         FROM purchase_ledger T1
         INNER JOIN payment_registration T2 ON T1.id = T2.purchase_ledger_id
         <where>
             T1.supplier_id = #{req.supplierId}
             <if test="req.supplierName != null and req.supplierName != '' ">
-                T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%')
+                AND T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%')
             </if>
         </where>
-        GROUP BY  T1.purchase_contract_number,T2.payment_date
+        GROUP BY T1.supplier_id, T1.supplier_name, T1.purchase_contract_number, T2.payment_date
     </select>
 
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 712124a..d19895b 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -131,9 +131,7 @@
         <if test="req.productCategory != null and req.productCategory != ''">
             AND slp.product_category = #{req.productCategory}
         </if>
-        <!-- 鎸変骇鍝佸ぇ绫诲垎缁勮仛鍚� -->
-        GROUP BY slp.product_category
-        <!-- 鎸変骇鍝佸ぇ绫绘帓搴� -->
+        GROUP BY slp.product_category, slp.specification_model, sl.supplier_name
         ORDER BY slp.product_category
     </select>
     <select id="selectProductBomStructure" resultType="com.ruoyi.sales.dto.LossProductModelDto">
diff --git a/src/main/resources/mapper/staff/PersonalShiftMapper.xml b/src/main/resources/mapper/staff/PersonalShiftMapper.xml
index d8ddb1d..69bcae3 100644
--- a/src/main/resources/mapper/staff/PersonalShiftMapper.xml
+++ b/src/main/resources/mapper/staff/PersonalShiftMapper.xml
@@ -12,26 +12,26 @@
         <result column="work_time" property="workTime" />
     </resultMap>
     <select id="performanceShiftPage" resultType="com.ruoyi.staff.dto.PerformanceShiftMapDto">
-         SELECT
+        SELECT
         u.staff_name name,
-        GROUP_CONCAT(s.work_time, '锛�', IFNULL(palc.shift, ''), '锛�', s.id order by s.work_time SEPARATOR ';') AS shift_time,
-                u.id user_id
+        GROUP_CONCAT(s.work_time, '锛�', IFNULL(palc.shift, ''), '锛�', s.id ORDER BY s.work_time SEPARATOR ';') AS shift_time,
+        u.id user_id
         FROM personal_shift s
         LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
         LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
         <where>
-             <if test="sysDeptId != null and sysDeptId != ''">
+            <if test="sysDeptId != null and sysDeptId != ''">
                 and u.sys_dept_id = #{sysDeptId}
             </if>
             <if test="time != null and time != ''">
-                and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' )
+                and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m')
             </if>
             <if test="userName != null and userName != ''">
                 and u.staff_name like concat('%', #{userName}, '%')
             </if>
         </where>
-        GROUP BY u.id
-        order by s.create_time
+        GROUP BY u.id, u.staff_name
+        ORDER BY MAX(s.create_time)
     </select>
    
     <select id="performanceShiftYear" resultType="java.util.Map">

--
Gitblit v1.9.3