Przeglądaj źródła

导出条件同步字段

yuhongqi 1 tydzień temu
rodzic
commit
46a7c004f5

+ 2 - 2
fs-admin/src/main/java/com/fs/quartz/config/ScheduleConfig.java

@@ -8,8 +8,8 @@ import java.util.Properties;
 
 /**
  * 定时任务配置
- * 
- 
+ *
+
  */
 @Configuration
 public class ScheduleConfig

+ 8 - 0
fs-service-system/src/main/java/com/fs/live/domain/LiveOrder.java

@@ -36,6 +36,14 @@ public class LiveOrder extends BaseEntity {
     @Excel(name = "院端部门")
     private String appDeptName;
 
+    /** APP(his_java)销售/客服 user_id */
+    @Excel(name = "院端销售")
+    private Long appCompanyUserId;
+
+    /** APP(his_java)销售/客服姓名 */
+    @Excel(name = "销售姓名")
+    private String appCompanyUserName;
+
     /** 管易云订单号 */
     @Excel(name = "管易云订单号")
     private String extendOrderId;

+ 6 - 0
fs-service-system/src/main/java/com/fs/live/vo/LiveOrderQueryVO.java

@@ -33,6 +33,12 @@ public class LiveOrderQueryVO extends BaseEntity {
     /** 院端部门名称(his_java) */
     private String appDeptName;
 
+    /** 院端销售ID(his_java) */
+    private Long appCompanyUserId;
+
+    /** 院端销售姓名(his_java) */
+    private String appCompanyUserName;
+
     /** 管易云订单号 */
     @Excel(name = "管易云订单号")
     private String extendOrderId;

+ 6 - 0
fs-service-system/src/main/java/com/fs/store/domain/FsUser.java

@@ -134,6 +134,12 @@ public class FsUser extends BaseEntity
     /** APP(his_java)部门名称 */
     private String appDeptName;
 
+    /** APP(his_java)销售/客服 user_id */
+    private Long appCompanyUserId;
+
+    /** APP(his_java)销售/客服姓名 */
+    private String appCompanyUserName;
+
     /** APP用户同步标记:0/空未同步,1已同步 */
     private Integer appSyncFlag;
 

+ 38 - 2
fs-service-system/src/main/java/com/fs/store/mapper/FsStoreOrderMapper.java

@@ -104,6 +104,12 @@ public interface FsStoreOrderMapper
             "<if test = 'maps.appDeptName != null and maps.appDeptName != \"\"     '> " +
             "and u.app_dept_name like CONCAT('%',#{maps.appDeptName},'%') " +
             "</if>" +
+            "<if test = 'maps.appCompanyUserId != null      '> " +
+            "and u.app_company_user_id =#{maps.appCompanyUserId} " +
+            "</if>" +
+            "<if test = 'maps.appCompanyUserName != null and maps.appCompanyUserName != \"\"     '> " +
+            "and u.app_company_user_name like CONCAT('%',#{maps.appCompanyUserName},'%') " +
+            "</if>" +
             "<if test = 'maps.deliveryId != null  and  maps.deliveryId !=\"\"    '> " +
             "and o.delivery_id =#{maps.deliveryId} " +
             "</if>" +
@@ -188,7 +194,7 @@ public interface FsStoreOrderMapper
     List<FsStoreOrderVO> selectFsStoreOrderAllListVO(@Param("maps")FsStoreOrderParam param);
 
     @Select({"<script> " +
-            "select o.*,u.phone,u.register_code,u.register_date,u.source,u.app_user_id as appUserId,u.app_dept_name as appDeptName, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber ,fp.pay_money as lastPayMoney   from fs_store_order o left join fs_user u on o.user_id=u.user_id  left join company c on c.company_id=o.company_id left join company_user cu on cu.user_id=o.company_user_id  " +
+            "select o.*,u.phone,u.register_code,u.register_date,u.source,u.app_user_id as appUserId,u.app_dept_name as appDeptName,u.app_company_user_id as appCompanyUserId,u.app_company_user_name as appCompanyUserName, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber ,fp.pay_money as lastPayMoney   from fs_store_order o left join fs_user u on o.user_id=u.user_id  left join company c on c.company_id=o.company_id left join company_user cu on cu.user_id=o.company_user_id  " +
             " left join (select * from fs_store_payment where is_pay_remain = 1 and status = 1) fp on o.id = fp.order_id  "+
             "<if test = 'maps.productName != null and  maps.productName !=  \"\" '> " +
             "left join fs_store_order_item oi on o.id = oi.order_id "+
@@ -210,6 +216,12 @@ public interface FsStoreOrderMapper
             "<if test = 'maps.appDeptName != null and maps.appDeptName != \"\"     '> " +
             "and u.app_dept_name like CONCAT('%',#{maps.appDeptName},'%') " +
             "</if>" +
+            "<if test = 'maps.appCompanyUserId != null      '> " +
+            "and u.app_company_user_id =#{maps.appCompanyUserId} " +
+            "</if>" +
+            "<if test = 'maps.appCompanyUserName != null and maps.appCompanyUserName != \"\"     '> " +
+            "and u.app_company_user_name like CONCAT('%',#{maps.appCompanyUserName},'%') " +
+            "</if>" +
             "<if test = 'maps.deliveryId != null  and  maps.deliveryId !=\"\"    '> " +
             "and o.delivery_id =#{maps.deliveryId} " +
             "</if>" +
@@ -314,6 +326,12 @@ public interface FsStoreOrderMapper
             "<if test = 'maps.appDeptName != null and maps.appDeptName != \"\"     '> " +
             "and u.app_dept_name like CONCAT('%',#{maps.appDeptName},'%') " +
             "</if>" +
+            "<if test = 'maps.appCompanyUserId != null      '> " +
+            "and u.app_company_user_id =#{maps.appCompanyUserId} " +
+            "</if>" +
+            "<if test = 'maps.appCompanyUserName != null and maps.appCompanyUserName != \"\"     '> " +
+            "and u.app_company_user_name like CONCAT('%',#{maps.appCompanyUserName},'%') " +
+            "</if>" +
             "<if test = 'maps.deliveryId != null  and  maps.deliveryId !=\"\"    '> " +
             "and o.delivery_id =#{maps.deliveryId} " +
             "</if>" +
@@ -568,7 +586,7 @@ public interface FsStoreOrderMapper
     List<FsStoreOrder> selectFsStoreOrderListByFinish7Day();
 
     @Select({"<script> " +
-            "select o.*,deliver.deliver_id as deliver_code,deliver.state_ex as delivery_type_code,deliver.status as kdn_delivery_status,cts.name as scheduleName,u.nickname,u.phone,u.app_user_id as appUserId,u.app_dept_name as appDeptName,cc.push_code,cc.create_time as customer_create_time,cc.source,cc.customer_code, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber ,p.title as package_title ,p.cate_id,CASE WHEN o.certificates IS NULL OR o.certificates = '' THEN 0 ELSE 1 END AS is_upload  " +
+            "select o.*,deliver.deliver_id as deliver_code,deliver.state_ex as delivery_type_code,deliver.status as kdn_delivery_status,cts.name as scheduleName,u.nickname,u.phone,u.app_user_id as appUserId,u.app_dept_name as appDeptName,u.app_company_user_id as appCompanyUserId,u.app_company_user_name as appCompanyUserName,cc.push_code,cc.create_time as customer_create_time,cc.source,cc.customer_code, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber ,p.title as package_title ,p.cate_id,CASE WHEN o.certificates IS NULL OR o.certificates = '' THEN 0 ELSE 1 END AS is_upload  " +
             " from fs_store_order o  left JOIN fs_store_product_package p on o.package_id=p.package_id left join fs_user u on o.user_id=u.user_id  " +
             " left join company c on c.company_id=o.company_id left join company_user cu on cu.user_id=o.company_user_id left join crm_customer cc on cc.customer_id=o.customer_id left join company_tcm_schedule cts on cts.id = o.schedule_id " +
             " left join fs_store_delivers deliver on deliver.order_id=o.id "+
@@ -588,6 +606,12 @@ public interface FsStoreOrderMapper
             "<if test = 'maps.appDeptName != null and maps.appDeptName != \"\"     '> " +
             "and u.app_dept_name like CONCAT('%',#{maps.appDeptName},'%') " +
             "</if>" +
+            "<if test = 'maps.appCompanyUserId != null      '> " +
+            "and u.app_company_user_id =#{maps.appCompanyUserId} " +
+            "</if>" +
+            "<if test = 'maps.appCompanyUserName != null and maps.appCompanyUserName != \"\"     '> " +
+            "and u.app_company_user_name like CONCAT('%',#{maps.appCompanyUserName},'%') " +
+            "</if>" +
             "<if test = 'maps.deliveryId != null  and  maps.deliveryId !=\"\"    '> " +
             "and o.delivery_id =#{maps.deliveryId} " +
             "</if>" +
@@ -690,6 +714,12 @@ public interface FsStoreOrderMapper
             "<if test = 'maps.appDeptName != null and maps.appDeptName != \"\"     '> " +
             "and u.app_dept_name like CONCAT('%',#{maps.appDeptName},'%') " +
             "</if>" +
+            "<if test = 'maps.appCompanyUserId != null      '> " +
+            "and u.app_company_user_id =#{maps.appCompanyUserId} " +
+            "</if>" +
+            "<if test = 'maps.appCompanyUserName != null and maps.appCompanyUserName != \"\"     '> " +
+            "and u.app_company_user_name like CONCAT('%',#{maps.appCompanyUserName},'%') " +
+            "</if>" +
             "<if test = 'maps.deliveryId != null  and  maps.deliveryId !=\"\"    '> " +
             "and o.delivery_id =#{maps.deliveryId} " +
             "</if>" +
@@ -777,6 +807,12 @@ public interface FsStoreOrderMapper
             "<if test = 'maps.appDeptName != null and maps.appDeptName != \"\"     '> " +
             "and u.app_dept_name like CONCAT('%',#{maps.appDeptName},'%') " +
             "</if>" +
+            "<if test = 'maps.appCompanyUserId != null      '> " +
+            "and u.app_company_user_id =#{maps.appCompanyUserId} " +
+            "</if>" +
+            "<if test = 'maps.appCompanyUserName != null and maps.appCompanyUserName != \"\"     '> " +
+            "and u.app_company_user_name like CONCAT('%',#{maps.appCompanyUserName},'%') " +
+            "</if>" +
             "<if test = 'maps.deliveryId != null  and  maps.deliveryId !=\"\"    '> " +
             "and o.delivery_id =#{maps.deliveryId} " +
             "</if>" +

+ 4 - 0
fs-service-system/src/main/java/com/fs/store/mapper/FsUserMapper.java

@@ -248,4 +248,8 @@ public interface FsUserMapper
      * 批量更新 APP 用户同步字段
      */
     int batchUpdateAppSyncFields(@Param("list") List<FsUser> list);
+
+    @Select("SELECT user_id, union_id, app_user_id, app_dept_name, app_company_user_id, app_company_user_name, app_sync_flag, update_time " +
+            "FROM fs_user WHERE app_sync_flag = 1 ORDER BY update_time DESC LIMIT #{limit}")
+    List<FsUser> selectSyncedAppUsers(@Param("limit") int limit);
 }

+ 4 - 0
fs-service-system/src/main/java/com/fs/store/param/FsStoreOrderParam.java

@@ -62,6 +62,10 @@ public class FsStoreOrderParam extends BaseEntity implements Serializable
 
     private String appDeptName;
 
+    private Long appCompanyUserId;
+
+    private String appCompanyUserName;
+
     private Long customerId;
 
     private String realName;

+ 5 - 0
fs-service-system/src/main/java/com/fs/store/service/IFsUserService.java

@@ -147,4 +147,9 @@ public interface IFsUserService
      * 同步近N天直播订单关联且未同步的APP用户数据
      */
     void syncAppUsersForRecentLiveOrders(int days);
+
+    /**
+     * 查询已同步的APP用户(app_sync_flag=1)
+     */
+    List<FsUser> selectSyncedAppUsers(int limit);
 }

+ 8 - 0
fs-service-system/src/main/java/com/fs/store/service/impl/FsUserServiceImpl.java

@@ -809,6 +809,8 @@ public class FsUserServiceImpl implements IFsUserService
                     update.setUserId(localUser.getUserId());
                     update.setAppUserId(vo.getAppUserId());
                     update.setAppDeptName(vo.getAppDeptName());
+                    update.setAppCompanyUserId(vo.getAppCompanyUserId());
+                    update.setAppCompanyUserName(vo.getAppCompanyUserName());
                     update.setAppSyncFlag(1);
                     updateList.add(update);
                 }
@@ -857,4 +859,10 @@ public class FsUserServiceImpl implements IFsUserService
         return JSONObject.parseObject(decryptedJson, new TypeReference<Map<String, AppUserSyncVo>>() {});
     }
 
+    @Override
+    public List<FsUser> selectSyncedAppUsers(int limit) {
+        int queryLimit = limit <= 0 ? 50 : Math.min(limit, 500);
+        return fsUserMapper.selectSyncedAppUsers(queryLimit);
+    }
+
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/store/vo/AppUserSyncVo.java

@@ -10,4 +10,6 @@ public class AppUserSyncVo {
     private Long appUserId;
     private String unionId;
     private String appDeptName;
+    private Long appCompanyUserId;
+    private String appCompanyUserName;
 }

+ 6 - 0
fs-service-system/src/main/java/com/fs/store/vo/FsStoreOrderExportVO.java

@@ -35,6 +35,12 @@ public class FsStoreOrderExportVO implements Serializable
     @Excel(name = "院端部门")
     private String appDeptName;
 
+    @Excel(name = "院端销售")
+    private Long appCompanyUserId;
+
+    @Excel(name = "销售姓名")
+    private String appCompanyUserName;
+
     /** 额外订单号 */
     @Excel(name = "管易云订单号")
     private String extendOrderId;

+ 6 - 0
fs-service-system/src/main/java/com/fs/store/vo/FsStoreOrderVO.java

@@ -35,6 +35,12 @@ public class FsStoreOrderVO implements Serializable
     @Excel(name = "院端部门")
     private String appDeptName;
 
+    @Excel(name = "院端销售")
+    private Long appCompanyUserId;
+
+    @Excel(name = "销售姓名")
+    private String appCompanyUserName;
+
     /** 额外订单号 */
     @Excel(name = "管易云订单号")
     private String extendOrderId;

+ 5 - 1
fs-service-system/src/main/resources/mapper/live/LiveOrderMapper.xml

@@ -78,6 +78,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="companyName"    column="company_name"    />
         <result property="appUserId"    column="app_user_id"    />
         <result property="appDeptName"    column="app_dept_name"    />
+        <result property="appCompanyUserId"    column="app_company_user_id"    />
+        <result property="appCompanyUserName"    column="app_company_user_name"    />
         <result property="customerId"    column="customer_id"    />
     </resultMap>
 
@@ -111,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         a.delivery_pay_money,	a.delivery_import_time,	a.delivery_send_time,	a.is_after_sales,	a.dept_id,
         a.channel,	a.source,	a.bill_price,	a.total_postage,	a.pay_postage,	a.gain_integral,
         a.use_integral,	a.pay_integral,	a.back_integral,	a.is_edit_money,	b.product_info as product_introduce,a.customer_id,
-        fu.app_user_id, fu.app_dept_name,
+        fu.app_user_id, fu.app_dept_name, fu.app_company_user_id, fu.app_company_user_name,
         b.product_name as product_name,'0' as delivery_collection_amount
         FROM
         live_order a LEFT JOIN fs_store_product b ON a.product_id = b.product_id
@@ -125,6 +127,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userId != null  and userId != ''"> and a.user_id = #{userId}</if>
             <if test="appUserId != null"> and fu.app_user_id = #{appUserId}</if>
             <if test="appDeptName != null and appDeptName != ''"> and fu.app_dept_name like concat('%', #{appDeptName}, '%')</if>
+            <if test="appCompanyUserId != null"> and fu.app_company_user_id = #{appCompanyUserId}</if>
+            <if test="appCompanyUserName != null and appCompanyUserName != ''"> and fu.app_company_user_name like concat('%', #{appCompanyUserName}, '%')</if>
             <if test="userName != null  and userName != ''"> and a.user_name like concat('%', #{userName}, '%')</if>
             <if test="userPhone != null  and userPhone != ''"> and a.user_phone = #{userPhone}</if>
             <if test="userAddress != null  and userAddress != ''"> and a.user_address = #{userAddress}</if>

+ 7 - 0
fs-service-system/src/main/resources/mapper/store/FsStoreOrderMapper.xml

@@ -561,6 +561,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         o.`service_fee`
                ,u.phone,u.register_code,u.register_date,
                u.source, u.app_user_id as appUserId, u.app_dept_name as appDeptName,
+               u.app_company_user_id as appCompanyUserId, u.app_company_user_name as appCompanyUserName,
                c.company_name ,
                cu.nick_name as company_user_nick_name ,
                cu.phonenumber as company_usere_phonenumber
@@ -593,6 +594,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test = 'maps.appDeptName != null and maps.appDeptName != ""     '>
                 and u.app_dept_name like CONCAT('%',#{maps.appDeptName},'%')
             </if>
+            <if test = 'maps.appCompanyUserId != null      '>
+                and u.app_company_user_id = #{maps.appCompanyUserId}
+            </if>
+            <if test = 'maps.appCompanyUserName != null and maps.appCompanyUserName != ""     '>
+                and u.app_company_user_name like CONCAT('%',#{maps.appCompanyUserName},'%')
+            </if>
             <if test = 'maps.deliveryId != null  and  maps.deliveryId !=""    '>
                 and deliver.deliver_id =#{maps.deliveryId}
             </if>

+ 7 - 1
fs-service-system/src/main/resources/mapper/store/FsUserMapper.xml

@@ -43,11 +43,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="userCode"    column="user_code"    />
         <result property="appUserId"    column="app_user_id"    />
         <result property="appDeptName"    column="app_dept_name"    />
+        <result property="appCompanyUserId"    column="app_company_user_id"    />
+        <result property="appCompanyUserName"    column="app_company_user_name"    />
         <result property="appSyncFlag"    column="app_sync_flag"    />
     </resultMap>
 
     <sql id="selectFsUserVo">
-        select user_id, username, password, real_name, birthday, id_card, remark, nickname, avatar, phone, create_time, update_time, last_ip, now_money, brokerage_price, integral, sign_num, status, level, spread_user_id, spread_time, user_type, is_promoter, pay_count, spread_count, addres,ma_open_id,mp_open_id,union_id, is_del,is_weixin_auth,company_id,company_user_id,register_date,register_code,source,user_code,app_user_id,app_dept_name,app_sync_flag from fs_user
+        select user_id, username, password, real_name, birthday, id_card, remark, nickname, avatar, phone, create_time, update_time, last_ip, now_money, brokerage_price, integral, sign_num, status, level, spread_user_id, spread_time, user_type, is_promoter, pay_count, spread_count, addres,ma_open_id,mp_open_id,union_id, is_del,is_weixin_auth,company_id,company_user_id,register_date,register_code,source,user_code,app_user_id,app_dept_name,app_company_user_id,app_company_user_name,app_sync_flag from fs_user
     </sql>
 
     <select id="selectFsUserList" parameterType="FsUser" resultMap="FsUserResult">
@@ -233,6 +235,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userCode != null">user_code = #{userCode},</if>
             <if test="appUserId != null">app_user_id = #{appUserId},</if>
             <if test="appDeptName != null">app_dept_name = #{appDeptName},</if>
+            <if test="appCompanyUserId != null">app_company_user_id = #{appCompanyUserId},</if>
+            <if test="appCompanyUserName != null">app_company_user_name = #{appCompanyUserName},</if>
             <if test="appSyncFlag != null">app_sync_flag = #{appSyncFlag},</if>
         </trim>
         where user_id = #{userId}
@@ -243,6 +247,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             update fs_user
             set app_user_id = #{item.appUserId},
                 app_dept_name = #{item.appDeptName},
+                app_company_user_id = #{item.appCompanyUserId},
+                app_company_user_name = #{item.appCompanyUserName},
                 app_sync_flag = #{item.appSyncFlag}
             where user_id = #{item.userId}
         </foreach>