소스 검색

Merge branch '红德堂-test' into 红德堂

wangxy 2 주 전
부모
커밋
86b76008ae

+ 30 - 0
fs-company/src/main/java/com/fs/company/controller/store/FsStoreOrderController.java

@@ -38,7 +38,9 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static com.fs.his.utils.PhoneUtil.decryptPhone;
 import static com.fs.his.utils.PhoneUtil.encryptPhone;
@@ -79,6 +81,24 @@ public class FsStoreOrderController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 订单审核列表
+     * @param fsStoreOrder
+     * @return
+     */
+    @GetMapping("/auditList")
+    public  TableDataInfo auditList(FsStoreOrderParam fsStoreOrder)
+    {
+        startPage();
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        fsStoreOrder.setCompanyId(loginUser.getCompany().getCompanyId());
+        if(fsStoreOrder.getUserPhoneMk()!=null&&fsStoreOrder.getUserPhoneMk()!=""){
+            fsStoreOrder.setUserPhone(encryptPhone(fsStoreOrder.getUserPhoneMk()));
+        }
+        List<FsStoreOrderListVO> list = fsStoreOrderService.auditOrderList(fsStoreOrder);
+        return getDataTable(list);
+    }
+
     @GetMapping("/myList")
     @PreAuthorize("@ss.hasPermi('his:storeOrder:myList')")
     public TableDataInfo myList(FsStoreOrderParam fsStoreOrder)
@@ -412,6 +432,16 @@ public class FsStoreOrderController extends BaseController
         return toAjax(fsStoreOrderService.getGoods(fsStoreOrder.getOrderId(),nickName));
     }
 
+    /**
+     * 订单审核
+     */
+    @Log(title = "订单财务审核", businessType = BusinessType.INSERT)
+    @PreAuthorize("@ss.hasPermi('his:storeOrder:approveOrder')")
+    @PostMapping("/approveOrder")
+    public AjaxResult approveOrder(@RequestBody List<Long> orderIds)
+    {
+        return toAjax(fsStoreOrderService.approveOrder(orderIds));
+    }
     /**
      * 改价
      */

+ 14 - 14
fs-service/src/main/java/com/fs/course/param/FsUserCourseVideoAddKfUParam.java

@@ -11,35 +11,35 @@ import java.io.Serializable;
 public class FsUserCourseVideoAddKfUParam implements Serializable {
 
     /**
-    * 企微员工 id
-    */
+     * 企微员工 id
+     */
     private String qwUserId;
 
     /**
-    * 视频小节id
-    */
+     * 视频小节id
+     */
     @NotNull(message = "视频参数不能为空")
     private Long videoId;
 
 
     /**
-    * 登录的小程序id
-    */
+     * 登录的小程序id
+     */
     private Long userId;
 
     /**
-    * 公司id
-    */
+     * 公司id
+     */
     private String corpId;
 
     /**
-    *   companyUserId
-    */
+     * companyUserId
+     */
     @NotNull(message = "客服参数不能为空")
     private Long companyUserId;
     /**
-    * 公司id
-    */
+     * 公司id
+     */
     @NotNull(message = "经销商参数参数不能为空")
     private Long companyId;
 
@@ -50,8 +50,8 @@ public class FsUserCourseVideoAddKfUParam implements Serializable {
     private Long courseId;
 
     /**
-    * 外部联系的id
-    */
+     * 外部联系的id
+     */
 //    @NotNull(message = "客户参数不能为空")
     private Long qwExternalId;
 

+ 2 - 0
fs-service/src/main/java/com/fs/his/mapper/FsStoreOrderMapper.java

@@ -138,6 +138,8 @@ public interface FsStoreOrderMapper
 //            "</script>"})
     List<FsStoreOrderListVO> selectFsStoreOrderListVO(@Param("maps")FsStoreOrderParam fsStoreOrder);
 
+    List<FsStoreOrderListVO> selectFsStoreOrderListVOCount(@Param("maps")FsStoreOrderParam fsStoreOrder);
+
     @Select({"<script> " +
             "select so.*,st.store_name,us.nick_name,us.phone,p.patient_age,p.patient_gender,p.patient_descs,p.patient_name,d.doctor_name,fp.prescribe_code FROM fs_store_order so LEFT JOIN fs_store st ON so.store_id =st.store_id LEFT JOIN fs_user us ON us.user_id=so.user_id LEFT JOIN fs_prescribe p ON p.prescribe_id =so.prescribe_id LEFT JOIN fs_doctor d ON p.doctor_id= d.doctor_id LEFT JOIN fs_prescribe fp on fp.prescribe_id=so.prescribe_id WHERE so.is_del=0 "+
             " <if test=\"storeId != null \"> and so.store_id = #{storeId}</if>\n" +

+ 14 - 0
fs-service/src/main/java/com/fs/his/service/IFsStoreOrderService.java

@@ -87,6 +87,13 @@ public interface IFsStoreOrderService
 
     List<FsStoreOrderListVO> selectFsStoreOrderListVO(FsStoreOrderParam param);
 
+    /**
+     * 订单审核列表
+     * @param param
+     * @return
+     */
+    List<FsStoreOrderListVO> auditOrderList(FsStoreOrderParam param);
+
     List<FsStoreOrderItem> selectFsStoreOrderItemList(String orderId);
 
     List<FsStoreOrderLogs> selectFsStoreOrderLogsList(String orderId);
@@ -284,4 +291,11 @@ public interface IFsStoreOrderService
     FsStoreOrder confirmOrder(FsPackageOrder packageOrder,Long doctorId);
 
     List<FsStoreOrder> selectOutTimeOrderList(Integer unPayTime);
+
+    /**
+     * 订单审核
+     * @param orderId
+     * @return
+     */
+    int approveOrder(List<Long> orderId);
 }

+ 21 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -588,6 +588,11 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         return fsStoreOrderMapper.selectFsStoreOrderListVO(param);
     }
 
+    @Override
+    public List<FsStoreOrderListVO> auditOrderList(FsStoreOrderParam param) {
+      return fsStoreOrderMapper.selectFsStoreOrderListVOCount( param);
+    }
+
 
     @Override
     public List<FsStoreOrderItem> selectFsStoreOrderItemList(String orderId) {
@@ -4599,4 +4604,20 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         return fsStoreOrderMapper.selectOutTimeOrderList(unPayTime);
     }
 
+    @Override
+    public int approveOrder(List<Long> orderId) {
+        if (CollectionUtils.isEmpty(orderId)){
+            throw new CustomException("订单id不能为空");
+        }
+        int i=0;
+        for (Long id : orderId) {
+            FsStoreOrder order=new FsStoreOrder();
+            order.setOrderId(id);
+            //手动设置为已完成
+            order.setStatus(4);
+            i = fsStoreOrderMapper.updateFsStoreOrder(order);
+        }
+        return i;
+    }
+
 }

+ 19 - 13
fs-service/src/main/resources/mapper/course/FsCourseTrafficLogMapper.xml

@@ -269,43 +269,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </insert>
 
     <select id="selectTrafficNew" resultType="com.fs.course.vo.FsCourseTrafficLogListVO">
-        select company_id,project,course_id,SUM(internet_traffic) AS total_internet_traffic
-        ,DATE_FORMAT(create_time, '%Y-%m-%d') AS `month` from fs_course_traffic_log
+        select log.company_id,
+        uc.project,
+        log.course_id,
+        SUM( log.internet_traffic ) AS total_internet_traffic,
+        DATE_FORMAT( log.create_time, '%Y-%m-%d' ) AS `month`
+        FROM
+        fs_course_traffic_log log
+        LEFT JOIN fs_user_course uc on log.course_id=uc.course_id
         <where>
             <if test="startDate != null and endDate != null">
-                and DATE_FORMAT(create_time, '%Y-%m-%d') between #{startDate} AND #{endDate}
+                and DATE_FORMAT(log.create_time, '%Y-%m-%d') between #{startDate} AND #{endDate}
             </if>
             <if test='companyId !=null'>
-                and company_id = #{companyId}
+                and log.company_id = #{companyId}
             </if>
             <if test="courseId != null">
-                and course_id = ${courseId}
+                and log.course_id = ${courseId}
             </if>
             <if test="project != null">
-                and project = ${project}
+                and uc.project = ${project}
             </if>
             <if test="common == null">
-                AND company_id IS not NULL
+                AND log.company_id IS not NULL
             </if>
             <if test="common != null ">
-                AND company_id IS NULL
+                AND log.company_id IS NULL
             </if>
             <if test="companyUserId != null">
-                and company_user_id = #{companyUserId}
+                and log.company_user_id = #{companyUserId}
             </if>
         </where>
 
         <if test="tabType==null or tabType==''">
-            group by company_id,`month`,course_id,project
+            group by log.company_id,`month`,log.course_id,uc.project
         </if>
         <if test="tabType!=null and tabType=='project'">
-            group by company_id,project,`month`
+            group by log.company_id,uc.project,`month`
         </if>
         <if test="tabType!=null and tabType=='course'">
-            group by company_id,course_id,`month`
+            group by log.company_id,log.course_id,`month`
         </if>
         <if test="tabType!=null and tabType=='common'">
-            group by course_id,`month`
+            group by log.company_id,log.course_id,`month`
         </if>
     </select>
 

+ 222 - 0
fs-service/src/main/resources/mapper/his/FsStoreOrderMapper.xml

@@ -917,6 +917,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
                 and so.erp_phone like concat(#{maps.erpPhoneNumber},'%')
             </if>
+            <if test="maps.isPay != null">
+                and so.is_pay = #{maps.isPay}
+            </if>
 
         </where>
         ${maps.params.dataScope}
@@ -2137,5 +2140,224 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFsStoreOrderVo"/>
         where is_del = 0 and status = 1 and NOW() &gt; DATE_ADD(create_time, INTERVAL ${unPayTime} MINUTE)
     </select>
+    <select id="selectFsStoreOrderListVOCount" resultType="com.fs.his.vo.FsStoreOrderListVO">
+        select so.*,st.store_name,us.nick_name,us.phone,d.doctor_name,p.patient_name,p.prescribe_code,c.company_name,
+        cu.nick_name company_user_name , csc.name miniProgramName
+        FROM fs_store_order so LEFT JOIN fs_store st ON so.store_id =st.store_id
+        LEFT JOIN fs_user us ON us.user_id=so.user_id
+        LEFT JOIN fs_prescribe p ON p.prescribe_id =so.prescribe_id
+        LEFT JOIN fs_doctor d ON so.doctor_id= d.doctor_id
+        LEFT JOIN company c on c.company_id =so.company_id
+        LEFT JOIN company_user cu on cu.user_id=so.company_user_id
+        LEFT JOIN (
+        SELECT
+        sp.*,
+        ROW_NUMBER() OVER (PARTITION BY sp.business_code ORDER BY sp.create_time DESC) as rn
+        FROM fs_store_payment sp
+        WHERE sp.business_code IS NOT NULL
+        ) sp_latest ON sp_latest.business_code = so.order_code AND sp_latest.rn = 1
+        LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
+        <where>
+            <if test="maps.packageSecondName != null and maps.packageSecondName != ''">
+                and so.package_second_name like concat('%', #{maps.packageSecondName}, '%')
+            </if>
+            <if test="maps.storeId != null">
+                and so.store_id = #{maps.storeId}
+            </if>
+            <if test="maps.coursePlaySourceConfigId != null">
+                and csc.id = #{maps.coursePlaySourceConfigId}
+            </if>
+            <if test="maps.orderCodes != null  and maps.orderCodes.size > 0">
+                and so.order_code in
+                <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
+                    #{orderCode}
+                </foreach>
+            </if>
+            <if test="maps.orderCode != null  and maps.orderCode != ''">
+                and so.order_code = #{maps.orderCode}
+            </if>
+            <if test="maps.prescribeCode != null  and maps.prescribeCode != ''">
+                and p.prescribe_code = #{maps.prescribeCode}
+            </if>
+            <if test="maps.userName != null  and maps.userName != ''">
+                and so.user_name like concat('%', #{maps.userName}, '%')
+            </if>
+            <if test="maps.userPhone != null  and maps.userPhone != ''">
+                and so.user_phone = #{maps.userPhone}
+            </if>
+            <if test="maps.userId != null ">
+                and so.user_id = #{maps.userId}
+            </if>
+            <if test="maps.isFirst != null">
+                and so.is_first = #{maps.isFirst}
+            </if>
+            <if test="maps.status != null and maps.status != 6">
+                and so.status = #{maps.status}
+            </if>
+            <if test="maps.status == 6">
+                and so.`status`= 2
+                and (
+                so.store_id in (select store_id from fs_store where delivery_type=2 or delivery_type=1)
+                )
+                and  (so.extend_order_id is null or  so.extend_order_id like '')
+            </if>
+            <if test="maps.source != null">
+                and so.source = #{maps.source}
+            </if>
+            <if test="maps.deliverySn != null  and maps.deliverySn != ''">
+                and so.delivery_sn = #{maps.deliverySn}
+            </if>
+            <if test="maps.prescribeId != null">
+                and so.prescribe_id = #{maps.prescribeId}
+            </if>
+            <if test="maps.companyUserId != null">
+                and so.company_user_id = #{maps.companyUserId}
+            </if>
+            <if test="maps.sTime != null">
+                and DATE(so.create_time) &gt;= DATE(#{maps.sTime})
+            </if>
+            <if test="maps.eTime != null">
+                and DATE(so.create_time) &lt;= DATE(#{maps.eTime})
+            </if>
+            <if test="maps.paysTime != null">
+                and DATE(so.pay_time) &gt;= DATE(#{maps.paysTime})
+            </if>
+            <if test="maps.payeTime != null">
+                and DATE(so.pay_time) &lt;= DATE(#{maps.payeTime})
+            </if>
+            <if test="maps.orderCreateType != null">
+                and so.order_create_type = #{maps.orderCreateType}
+            </if>
+            <if test="maps.patientName != null">
+                and p.patient_name like concat('%', #{maps.patientName}, '%')
+            </if>
+            <if test="maps.doctorName != null">
+                and d.doctor_name like concat('%', #{maps.doctorName}, '%')
+            </if>
+            <if test="maps.orderType != null">
+                and so.order_type = #{maps.orderType}
+            </if>
+            <if test="maps.deliverySendsTime != null">
+                and DATE(so.delivery_send_time) &gt;= DATE(#{maps.deliverySendsTime})
+            </if>
+            <if test="maps.deliverySendeTime != null">
+                and DATE(so.delivery_send_time) &lt;= DATE(#{maps.deliverySendeTime})
+            </if>
+            <if test="maps.deliveryImportsTime != null">
+                and DATE(so.delivery_import_time) &gt;= DATE(#{maps.deliveryImportsTime})
+            </if>
+            <if test="maps.deliveryImporteTime != null">
+                and DATE(so.delivery_import_time) &lt;= DATE(#{maps.deliveryImporteTime})
+            </if>
+            <if test="maps.tuisTime != null">
+                and DATE(so.tui_money_time) &gt;= DATE(#{maps.tuisTime})
+            </if>
+            <if test="maps.tuieTime != null">
+                and DATE(so.tui_money_time) &lt;= DATE(#{maps.tuieTime})
+            </if>
+            <if test="maps.companyUserNickName != null and  maps.companyUserNickName !=''">
+                and cu.nick_name like concat( #{maps.companyUserNickName}, '%')
+            </if>
+            <if test="maps.companyIds != null and  maps.companyIds.size >0">
+                and so.company_id in
+                <foreach collection="maps.companyIds" item="companyId" open="(" close=")" separator=",">
+                    #{companyId}
+                </foreach>
+            </if>
+            <if test="maps.companyId != null and  maps.companyId != -1">
+                and so.company_id =#{maps.companyId}
+            </if>
+            <if test="maps.companyId == -1">
+                and so.company_id is null
+            </if>
+            <if test="maps.deliveryStatus != null">
+                and so.delivery_status =#{maps.deliveryStatus}
+            </if>
+            <if test="maps.customerId != null">
+                and so.customer_id =#{maps.customerId}
+            </if>
+            <if test="maps.deliveryPayStatus != null">
+                and so.delivery_pay_status =#{maps.deliveryPayStatus}
+            </if>
+            <if test="maps.tuiMoneyStatus != null">
+                and so.tui_money_status =#{maps.tuiMoneyStatus}
+            </if>
+            <if test="maps.deptId != null">
+                AND (so.dept_id = #{maps.deptId} OR so.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
+            </if>
+            <if test="maps.packageName != null and maps.packageName != ''">
+                and so.package_name like concat('%', #{maps.packageName}, '%')
+            </if>
+            <if test="maps.payType != null">
+                and so.pay_type IN
+                <foreach collection="maps.payType.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.scheduleId != null  and  maps.scheduleId != -1">
+                and so.schedule_id IN
+                <foreach collection="maps.scheduleId.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.scheduleId == -1">
+                and so.schedule_id is null
+            </if>
+            <if test="maps.orderBuyType != null and maps.orderBuyType != -1">
+                and so.order_buy_type IN
+                <foreach collection="maps.orderBuyType.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.orderBuyType == -1">
+                and so.order_buy_type is null
+            </if>
+            <if test="maps.orderChannel == -1">
+                and so.order_channel is null
+            </if>
+            <if test="maps.orderChannel != null and maps.orderChannel != -1">
+                and so.order_channel IN
+                <foreach collection="maps.orderChannel.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.qwSubject == -1">
+                and so.qw_subject is null
+            </if>
+            <if test="maps.qwSubject != null and maps.qwSubject != -1">
+                and so.qw_subject IN
+                <foreach collection="maps.qwSubject.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
+                and so.erp_phone like concat(#{maps.erpPhoneNumber},'%')
+            </if>
+            <if test="maps.isPay != null">
+                and so.is_pay = #{maps.isPay}
+            </if>
+
+        </where>
+        ORDER BY
+
+        <if test="maps.sortField == 'companyUserName'">
+            cu.nick_name
+        </if>
+        <if test="maps.sortField == 'packageName'">
+            so.package_name
+        </if>
+        <if test="maps.sortField == 'payPrice'">
+            so.pay_price
+        </if>
+        <if test="maps.sortField == 'payMoney'">
+            so.pay_money
+        </if>
+        <if test="maps.sortOrder != null and maps.sortOrder != ''">
+            ${maps.sortOrder}
+        </if>
+        <if test="maps.sortField == null or maps.sortField == ''">
+            so.order_id desc
+        </if>
+    </select>
 
 </mapper>