Selaa lähdekoodia

积分订单 和积分记录问题优化

xgb 6 päivää sitten
vanhempi
commit
12edf174c9

+ 4 - 30
fs-admin/src/main/java/com/fs/his/controller/FsIntegralOrderController.java

@@ -6,8 +6,6 @@ import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
-import com.fs.common.core.domain.entity.SysRole;
-import com.fs.common.core.domain.entity.SysUser;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.CloudHostUtils;
@@ -27,7 +25,6 @@ import com.fs.his.param.BatchSetErpOrderParam;
 import com.fs.his.vo.*;
 import com.fs.his.param.FsIntegralOrderParam;
 import com.fs.his.service.*;
-import com.fs.system.service.ISysRoleService;
 import com.fs.utils.OrderContextHolder;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -121,34 +118,12 @@ public class FsIntegralOrderController extends BaseController
         } else {
             list = fsIntegralOrderService.selectFsIntegralOrderListVO(fsIntegralOrder);
         }
-        SysRole sysRole = isCheckPermission();
-        if (sysRole != null && !(sysRole.getIsCheckPhone()==1)) {
-            for (FsIntegralOrderListVO vo : list) {
-                vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
-            }
+        for (FsIntegralOrderListVO vo : list) {
+            vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
         }
         return getDataTable(list);
     }
 
-    @Autowired
-    private ISysRoleService sysRoleService;
-    private SysRole isCheckPermission() {
-        SysRole sysRole = new SysRole();
-        SysUser user = getLoginUser().getUser();
-        boolean flag = user.isAdmin();
-        if (flag) {
-            sysRole.setIsCheckPhone(1);
-            sysRole.setIsCheckAddress(1);
-        } else {
-            List<SysRole> roles = user.getRoles();
-            if (roles != null && !roles.isEmpty()) {
-                Long[] roleIds = roles.stream().map(SysRole::getRoleId).toArray(Long[]::new);
-                return sysRoleService.getIsCheckPermission(roleIds);
-            }
-        }
-        return sysRole;
-    }
-
     /**
      * 导出积分商品订单列表
      */
@@ -168,12 +143,11 @@ public class FsIntegralOrderController extends BaseController
         } else {
             list = fsIntegralOrderService.selectFsIntegralOrderListVO(fsIntegralOrder);
         }
-        SysRole sysRole = isCheckPermission();
         for (FsIntegralOrderListVO vo : list) {
             fillCompanyUserName(vo);
             parseItemJson(vo);
-            if (sysRole == null || sysRole.getIsCheckPhone() != 1) {
-                vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
+            if (vo.getUserPhone() != null && vo.getUserPhone().length() > 11) {
+                vo.setUserPhone(decryptPhone(vo.getUserPhone()));
             }
         }
         ExcelUtil<FsIntegralOrderListVO> util = new ExcelUtil<>(FsIntegralOrderListVO.class);

+ 0 - 25
fs-service/src/main/java/com/fs/his/mapper/FsIntegralOrderMapper.java

@@ -68,31 +68,6 @@ public interface FsIntegralOrderMapper extends BaseMapper<FsIntegralOrder>
      * @return 结果
      */
     public int deleteFsIntegralOrderByOrderIds(Long[] orderIds);
-    @Select({"<script> select order_id, order_code, user_id, user_name, user_phone, user_address, item_json, integral,pay_money,is_pay,pay_time,pay_type, status, delivery_code, delivery_name, delivery_sn, delivery_time, create_time,qw_user_id,company_user_id,company_id, remark from fs_integral_order " +
-            "<where>  \n" +
-            "            <if test=\"orderCode != null  and orderCode != ''\"> and order_code = #{orderCode}</if>\n" +
-            "            <if test=\"orderCodes != null and orderCodes.size > 0\"> " +
-            "                and order_code in " +
-            "                <foreach collection='orderCodes' item='orderCode' open='(' close=')' separator=','> " +
-            "                    #{orderCode} " +
-            "                </foreach> " +
-            "            </if>\n" +
-            "            <if test=\"userName != null  and userName != ''\"> and user_name like concat('%', #{userName}, '%')</if>\n" +
-            "            <if test=\"userPhone != null  and userPhone != ''\"> and user_phone = #{userPhone}</if>\n" +
-            "            <if test=\"integral != null  and integral != ''\"> and integral = #{integral}</if>\n" +
-            "            <if test=\"payMoney != null  and payMoney != ''\"> and pay_money = #{payMoney}</if>\n" +
-            "            <if test=\"isPay != null  and isPay != ''\"> and is_pay = #{isPay}</if>\n" +
-            "            <if test=\"payTime != null  and payTime != ''\"> and pay_time = #{payTime}</if>\n" +
-            "            <if test=\"payType != null  and payType != ''\"> and pay_type = #{payType}</if>\n" +
-            "            <if test=\"status != null  and status != ''\"> and status = #{status}</if>\n" +
-            "            <if test=\"deliverySn != null  and deliverySn != ''\"> and delivery_sn like concat('%', #{deliverySn}, '%')</if>\n" +
-            "            <if test=\"qwUserId != null  and qwUserId != ''\"> and qw_user_id = #{qwUserId}</if>\n" +
-            "            <if test=\"companyUserId != null  and companyUserId != ''\"> and company_user_id = #{companyUserId}</if>\n" +
-            "            <if test=\"companyId != null  and companyId != ''\"> and company_id = #{companyId}</if>\n" +
-            "            <if test=\"sTime != null \">  and DATE(create_time) &gt;= DATE(#{sTime})</if>\n" +
-            "            <if test=\"eTime != null \">  and DATE(create_time) &lt;= DATE(#{eTime})</if>\n" +
-            "        </where> order by order_id desc"+
-            "</script>"})
     List<FsIntegralOrderListVO> selectFsIntegralOrderListVO(FsIntegralOrderParam fsIntegralOrder);
     @Select({"<script> " +
             "select o.*  from fs_integral_order o  " +

+ 18 - 15
fs-service/src/main/java/com/fs/his/vo/FsIntegralOrderListVO.java

@@ -2,10 +2,8 @@ package com.fs.his.vo;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
-import com.fs.common.utils.BigDecimalUtil;
 import lombok.Data;
 
-import java.math.BigDecimal;
 import java.util.Date;
 
 @Data
@@ -17,14 +15,14 @@ public class FsIntegralOrderListVO {
     @Excel(name = "订单编号")
     private String orderCode;
 
-    /** 用户id */
-    @Excel(name = "用户id")
-    private Long userId;
-
     /** 用户名称 */
     @Excel(name = "用户名称")
     private String userName;
 
+    /** 用户id */
+    @Excel(name = "用户ID")
+    private Long userId;
+
     /** 用户电话 */
     @Excel(name = "用户电话")
     private String userPhone;
@@ -48,8 +46,20 @@ public class FsIntegralOrderListVO {
     @Excel(name = "支付积分")
     private String integral;
 
-    /** 1:待发货;2:待收货;3:已完成 */
-    @Excel(name = "1:待发货;2:待收货;3:已完成")
+    /** 用户剩余积分 */
+    @Excel(name = "用户剩余积分")
+    private Long userIntegral;
+
+    /** 是否完课过 */
+    @Excel(name = "是否完课过")
+    private String isCompleteCourse;
+
+    /** 用户状态 */
+    @Excel(name = "用户状态")
+    private String userStatus;
+
+    /** 订单状态 */
+    @Excel(name = "订单状态", dictType = "sys_integral_order_status")
     private String status;
 
     /** 快递公司编号 */
@@ -91,11 +101,4 @@ public class FsIntegralOrderListVO {
      * 销售公司ID
      * **/
     private Long companyId;
-
-    private BigDecimal payMoney;
-
-    private String erpPhone;
-
-    private String loginAccount;
-
 }

+ 73 - 6
fs-service/src/main/resources/mapper/his/FsIntegralOrderMapper.xml

@@ -63,6 +63,75 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{orderId}
         </foreach>
     </select>
+    <select id="selectFsIntegralOrderListVO" resultType="com.fs.his.vo.FsIntegralOrderListVO">
+        SELECT
+        fio.order_id,
+        fio.order_code,
+        fio.user_id,
+        fio.user_name,
+        fio.user_phone,
+        fio.user_address,
+        fio.item_json,
+        fio.integral,
+        fio.is_pay,
+        fio.pay_time,
+        fio.pay_type,
+        fio.`STATUS`,
+        fio.delivery_code,
+        fio.delivery_name,
+        fio.delivery_sn,
+        fio.delivery_time,
+        fio.create_time,
+        fio.qw_user_id,
+        fio.company_user_id,
+        fio.company_id,
+        fio.remark,
+        fu.integral as user_integral,
+        case when fu.status = 1 then '正常' else '禁用' end as user_status,
+        case when exists (select 1 from fs_course_watch_log fcwl where fcwl.user_id = fio.user_id and fcwl.log_type = 2 limit 1) then '是' else '否' end as is_complete_course
+        FROM
+        fs_integral_order fio
+        LEFT JOIN fs_user fu ON fu.user_id = fio.user_id
+        WHERE
+        1 = 1
+        <!-- 订单编码精确查询 -->
+        <if test="orderCode != null and orderCode != ''"> AND fio.order_code = #{orderCode} </if>
+        <if test="orderCodes != null and orderCodes.size >0">
+            AND fio.order_code in
+            <foreach collection="orderCodes" item="orderCode" open="(" close=")" separator=",">
+                #{orderCode}
+            </foreach>
+        </if>
+        <!-- 用户名模糊查询 -->
+        <if test="userName != null and userName != ''"> AND fio.user_name LIKE CONCAT('%', #{userName}, '%') </if>
+        <!-- 用户手机号精确查询 -->
+        <if test="userPhone != null and userPhone != ''"> AND fio.user_phone = #{userPhone} </if>
+        <!-- 积分精确查询 -->
+        <if test="integral != null and integral != ''"> AND fio.integral = #{integral} </if>
+        <!-- 支付状态精确查询 -->
+        <if test="isPay != null and isPay != ''"> AND fio.is_pay = #{isPay} </if>
+        <!-- 支付时间精确查询 -->
+        <if test="payTime != null and payTime != ''"> AND fio.pay_time = #{payTime} </if>
+        <!-- 支付类型精确查询 -->
+        <if test="payType != null and payType != ''"> AND fio.pay_type = #{payType} </if>
+        <!-- 订单状态精确查询 -->
+        <if test="status != null and status != ''"> AND fio.status = #{status} </if>
+        <!-- 快递单号模糊查询 -->
+        <if test="deliverySn != null and deliverySn != ''"> AND fio.delivery_sn LIKE CONCAT('%', #{deliverySn}, '%') </if>
+        <!-- 企微用户ID精确查询 -->
+        <if test="qwUserId != null and qwUserId != ''"> AND fio.qw_user_id = #{qwUserId} </if>
+        <!-- 公司用户ID精确查询 -->
+        <if test="companyUserId != null and companyUserId != ''"> AND fio.company_user_id = #{companyUserId} </if>
+        <!-- 公司ID精确查询 -->
+        <if test="companyId != null and companyId != ''"> AND fio.company_id = #{companyId} </if>
+        <!-- 创建时间范围查询(开始时间) -->
+        <if test="sTime != null"> AND DATE(fio.create_time) &gt;= DATE(#{sTime}) </if>
+        <!-- 创建时间范围查询(结束时间) -->
+        <if test="eTime != null"> AND DATE(fio.create_time) &lt;= DATE(#{eTime}) </if>
+        ORDER BY
+        fio.order_id DESC
+    </select>
+
     <select id="selectFsIntegralOrderListJn" resultType="com.fs.his.vo.FsIntegralOrderListVO">
         SELECT
         fio.order_id,
@@ -73,7 +142,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         fio.user_address,
         fio.item_json,
         fio.integral,
-        fio.pay_money,
         fio.is_pay,
         fio.pay_time,
         fio.pay_type,
@@ -87,12 +155,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         fio.company_user_id,
         fio.company_id,
         fio.remark,
-        fio.login_account,
-        fiod.erp_phone
+        fu.integral as user_integral,
+        case when fu.status = 1 then '正常' else '禁用' end as user_status,
+        case when exists (select 1 from fs_course_watch_log fcwl where fcwl.user_id = fio.user_id and fcwl.log_type = 2 limit 1) then '是' else '否' end as is_complete_course
         FROM
         fs_integral_order fio
-        LEFT JOIN fs_integral_order_df fiod
-        ON fiod.order_id = fio.order_id
+        LEFT JOIN fs_user fu ON fu.user_id = fio.user_id
         WHERE
         1 = 1
         <!-- 订单编码精确查询 -->
@@ -132,7 +200,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <!-- 创建时间范围查询(结束时间) -->
         <if test="eTime != null"> AND DATE(fio.create_time) &lt;= DATE(#{eTime}) </if>
         <if test="loginAccount != null and loginAccount !=''"> AND fio.login_account = #{loginAccount} </if>
-        <if test="isPush != null"> AND COALESCE(fiod.is_push, 0) = 0 </if>
         ORDER BY
         fio.order_id DESC
     </select>