瀏覽代碼

异常管理添加退款金额以及过滤条件

yzc 1 年之前
父節點
當前提交
d384cea7c1

+ 5 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/entity/abnormal/dto/AbnormalInfoSelectDto.java

@@ -28,4 +28,9 @@ public class AbnormalInfoSelectDto extends BaseSelectDto {
      */
     private Long purchaseUserId;
 
+    /**
+     * 是否退款
+     */
+    private Integer isRefund;
+
 }

+ 7 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/entity/abnormal/vo/AbnormalInfoVo.java

@@ -4,6 +4,8 @@ import com.fjhx.victoriatourist.entity.abnormal.po.AbnormalInfo;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+
 /**
  * 异常记录列表查询返回值实体
  *
@@ -37,4 +39,9 @@ public class AbnormalInfoVo extends AbnormalInfo {
      */
     private String logisticsCode;
 
+    /**
+     * 退款金额
+     */
+    private BigDecimal refundAmount;
+
 }

+ 12 - 1
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/abnormal/impl/AbnormalInfoServiceImpl.java

@@ -20,6 +20,7 @@ import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Objects;
 import java.util.Set;
 
 
@@ -64,7 +65,17 @@ public class AbnormalInfoServiceImpl extends ServiceImpl<AbnormalInfoMapper, Abn
                         .like("de.ancestors", SecurityUtils.getDeptId()));
             }
         }
-        wrapper.groupBy("ai.id");
+
+        //是否退款
+        if (ObjectUtil.isNotEmpty(dto.getIsRefund())) {
+            if (Objects.equals(dto.getIsRefund(), 1)) {
+                wrapper.gt("ai.refundAmount", 0);
+            } else {
+                wrapper.eq("ai.refundAmount", 0);
+            }
+        }
+
+//        wrapper.groupBy("ai.id");
 
         wrapper.orderByDesc("ai", AbnormalInfo::getId);
         Assert.notEmpty(dto.getType(), "异常来源类型不能为空");

+ 33 - 22
hx-victoriatourist/src/main/resources/mapper/abnormal/AbnormalInfoMapper.xml

@@ -2,27 +2,38 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.victoriatourist.mapper.abnormal.AbnormalInfoMapper">
     <select id="getPage" resultType="com.fjhx.victoriatourist.entity.abnormal.vo.AbnormalInfoVo">
-        select
-            ai.id,
-            ai.type,
-            ai.link_id,
-            ai.link_code,
-            ai.title,
-            ai.status,
-            ai.handle_user,
-            ai.handle_time,
-            ai.remark,
-            ai.create_user,
-            ai.create_time,
-            ai.update_user,
-            ai.update_time,
-            ai.purchase_id,
-            li.code as logisticsCode
-            <if test="businessType eq 10 or businessType eq 50">
-                ,p.create_user purchaseUserId
-            </if>
-        from abnormal_info ai
-                <!-- 到货质检 待入库 来源 -->
+        SELECT
+        ai.*,
+        li.code as logisticsCode
+        <if test="businessType eq 10 or businessType eq 50">
+            ,p.create_user purchaseUserId
+        </if>
+        FROM
+        (
+            SELECT
+                ai.id,
+                ai.type,
+                ai.link_id,
+                ai.link_code,
+                ai.title,
+                ai.`status`,
+                ai.handle_user,
+                ai.handle_time,
+                ai.remark,
+                ai.create_user,
+                ai.create_time,
+                ai.update_user,
+                ai.update_time,
+                ai.purchase_id,
+                ai.logistics_infos_id,
+                IFNULL( sum( ad.refund_amount ), 0 ) AS refundAmount
+            FROM
+                abnormal_info ai
+            LEFT JOIN abnormal_details ad ON ad.abnormal_info_id = ai.id
+            GROUP BY
+                ai.id
+        ) ai
+        <!-- 到货质检 待入库 来源 -->
                 <if test="businessType eq 10 or businessType eq 50">
                         left JOIN bytesailing_purchase.purchase p ON ai.purchase_id = p.id
                         LEFT JOIN bytesailing_purchase.purchase_detail pd ON pd.purchase_id = p.id
@@ -40,7 +51,7 @@
                         left JOIN bytesailing_purchase.arrival_detail arrd ON arrd.arrival_id = arr.id and arr.del_flag = 0
                         LEFT JOIN bytesailing_item.product_info pi ON arrd.bussiness_id = pi.id
                 </if>
-                LEFT JOIN bytesailing_base.sys_dept de ON CAST(json_unquote(pi.victoriatourist_json -> '$.deptId') AS UNSIGNED) = de.dept_id
+                LEFT JOIN bytesailing_base.sys_dept de ON pi.deptIdWdly = de.dept_id
                 left join logistics_infos li on ai.logistics_infos_id = li.id
             ${ew.customSqlSegment}
     </select>