Browse Source

feat: 订单列表增加 互医用户id搜索功能

yh 3 tuần trước cách đây
mục cha
commit
74fa3c5583

+ 10 - 0
fs-admin/src/main/java/com/fs/core/config/DruidConfig.java

@@ -50,6 +50,15 @@ public class DruidConfig
         return druidProperties.dataSource(dataSource);
     }
 
+    @Bean
+    @ConfigurationProperties("spring.datasource.druid.huyi")
+    @ConditionalOnProperty(prefix = "spring.datasource.druid.huyi", name = "enabled", havingValue = "true", matchIfMissing = true)
+    public DataSource huyiDataSource(DruidProperties druidProperties)
+    {
+        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
+        return druidProperties.dataSource(dataSource);
+    }
+
     @Bean(name = "dynamicDataSource")
     @Primary
     public DynamicDataSource dataSource(DataSource masterDataSource)
@@ -57,6 +66,7 @@ public class DruidConfig
         Map<Object, Object> targetDataSources = new HashMap<>();
         targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
         setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
+        setDataSource(targetDataSources, DataSourceType.HUYI.name(), "huyiDataSource");
         return new DynamicDataSource(masterDataSource, targetDataSources);
     }
 

+ 15 - 0
fs-admin/src/main/java/com/fs/store/controller/FsStoreAfterSalesController.java

@@ -1,17 +1,20 @@
 package com.fs.store.controller;
 
 import java.text.ParseException;
+import java.util.ArrayList;
 import java.util.List;
 
 import com.fs.common.core.domain.R;
 import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.core.security.LoginUser;
 import com.fs.core.web.service.TokenService;
 import com.fs.express.FsStoreDeliversService;
 import com.fs.express.cache.FsStoreDeliversCacheService;
 import com.fs.store.domain.*;
 
+import com.fs.store.mapper.FsStoreOrderMapper;
 import com.fs.store.param.FsStoreAfterSalesAudit1Param;
 import com.fs.store.param.FsStoreAfterSalesAudit2Param;
 import com.fs.store.param.FsStoreAfterSalesCancelParam;
@@ -58,6 +61,9 @@ public class FsStoreAfterSalesController extends BaseController
 
     @Autowired
     private FsStoreDeliversService fsStoreDeliversService;
+
+    @Autowired
+    private FsStoreOrderMapper fsStoreOrderMapper;
     /**
      * 查询售后记录列表
      */
@@ -65,6 +71,15 @@ public class FsStoreAfterSalesController extends BaseController
     @GetMapping("/list")
     public TableDataInfo list(FsStoreAfterSales fsStoreAfterSales)
     {
+        if (fsStoreAfterSales.getHuYiUserId() != null) {
+            String unionId = fsStoreOrderMapper.selectUnionIdByHyUserId(fsStoreAfterSales.getHuYiUserId());
+            if (StringUtils.isEmpty(unionId)) {
+                return getDataTable(new ArrayList<>());
+            }
+
+            fsStoreAfterSales.setUnionId(unionId);
+        }
+
         startPage();
         List<FsStoreAfterSalesVO> list = fsStoreAfterSalesService.selectFsStoreAfterSalesListVO(fsStoreAfterSales);
         for (FsStoreAfterSalesVO vo : list){

+ 13 - 0
fs-admin/src/main/java/com/fs/store/controller/FsStoreHealthOrderController.java

@@ -13,6 +13,7 @@ import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.store.cache.IFsStoreProductCacheService;
 import com.fs.store.dto.StoreOrderProductDTO;
+import com.fs.store.mapper.FsStoreOrderMapper;
 import com.fs.store.param.FsStoreOrderParam;
 import com.fs.store.service.*;
 import com.fs.store.vo.FsStoreOrderExportVO;
@@ -40,12 +41,24 @@ public class FsStoreHealthOrderController extends BaseController {
     @Autowired
     private IFsStoreProductCacheService fsStoreProductCacheService;
 
+    @Autowired
+    private FsStoreOrderMapper fsStoreOrderMapper;
+
     /**
      * 查询健康商城订单列表
      */
     @PreAuthorize("@ss.hasPermi('store:healthStoreOrder:list')")
     @GetMapping("/healthList")
     public TableDataInfo healthStoreList(FsStoreOrderParam param) {
+        if (param.getHuYiUserId() != null) {
+            String unionId = fsStoreOrderMapper.selectUnionIdByHyUserId(param.getHuYiUserId());
+            if (StringUtils.isEmpty(unionId)) {
+                return getDataTable(new ArrayList<>());
+            }
+
+            param.setUnionId(unionId);
+        }
+
         startPage();
         if(!StringUtils.isEmpty(param.getCreateTimeRange())){
             param.setCreateTimeList(param.getCreateTimeRange().split("--"));

+ 9 - 0
fs-admin/src/main/java/com/fs/store/controller/FsStoreOrderController.java

@@ -93,6 +93,15 @@ public class FsStoreOrderController extends BaseController {
     @PreAuthorize("@ss.hasPermi('store:storeOrder:list')")
     @GetMapping("/list")
     public TableDataInfo list(FsStoreOrderParam param) {
+        if (param.getHuYiUserId() != null) {
+            String unionId = fsStoreOrderMapper.selectUnionIdByHyUserId(param.getHuYiUserId());
+            if (StringUtils.isEmpty(unionId)) {
+                return getDataTable(new ArrayList<>());
+            }
+
+            param.setUnionId(unionId);
+        }
+
         startPage();
         if(!StringUtils.isEmpty(param.getCreateTimeRange())){
             param.setCreateTimeList(param.getCreateTimeRange().split("--"));

+ 5 - 0
fs-admin/src/main/resources/application-druid.yml

@@ -38,6 +38,11 @@ spring:
                 url:
                 username:
                 password:
+
+            huyi:
+                url: jdbc:mysql://1.14.207.209:8008/fs_his?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                username: root
+                password: X7k#9mPq$2LvR&5n
             # 初始连接数
             initialSize: 5
             # 最小连接池数量

+ 6 - 1
fs-common/src/main/java/com/fs/common/enums/DataSourceType.java

@@ -15,5 +15,10 @@ public enum DataSourceType
     /**
      * 从库
      */
-    SLAVE
+    SLAVE,
+
+    /**
+     * huyi数据源
+     */
+    HUYI
 }

+ 10 - 0
fs-company/src/main/java/com/fs/core/config/DruidConfig.java

@@ -49,6 +49,15 @@ public class DruidConfig
         return druidProperties.dataSource(dataSource);
     }
 
+    @Bean
+    @ConfigurationProperties("spring.datasource.druid.huyi")
+    @ConditionalOnProperty(prefix = "spring.datasource.druid.huyi", name = "enabled", havingValue = "true", matchIfMissing = true)
+    public DataSource huyiDataSource(DruidProperties druidProperties)
+    {
+        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
+        return druidProperties.dataSource(dataSource);
+    }
+
     @Bean(name = "dynamicDataSource")
     @Primary
     public DynamicDataSource dataSource(DataSource masterDataSource)
@@ -56,6 +65,7 @@ public class DruidConfig
         Map<Object, Object> targetDataSources = new HashMap<>();
         targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
         setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
+        setDataSource(targetDataSources, DataSourceType.HUYI.name(), "huyiDataSource");
         return new DynamicDataSource(masterDataSource, targetDataSources);
     }
     

+ 14 - 0
fs-company/src/main/java/com/fs/store/controller/FsStoreAfterSalesController.java

@@ -8,18 +8,21 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.company.service.ICompanyService;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.core.security.LoginUser;
 import com.fs.core.web.service.TokenService;
 import com.fs.store.domain.*;
+import com.fs.store.mapper.FsStoreOrderMapper;
 import com.fs.store.service.*;
 import com.fs.store.vo.FsStoreAfterSalesVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -48,6 +51,8 @@ public class FsStoreAfterSalesController extends BaseController
     private ICompanyUserService companyUserService;
     @Autowired
     private ICompanyService companyService;
+    @Autowired
+    private FsStoreOrderMapper fsStoreOrderMapper;
 
 
     /**
@@ -57,6 +62,15 @@ public class FsStoreAfterSalesController extends BaseController
     @GetMapping("/list")
     public TableDataInfo list(FsStoreAfterSales fsStoreAfterSales)
     {
+        if (fsStoreAfterSales.getHuYiUserId() != null) {
+            String unionId = fsStoreOrderMapper.selectUnionIdByHyUserId(fsStoreAfterSales.getHuYiUserId());
+            if (StringUtils.isEmpty(unionId)) {
+                return getDataTable(new ArrayList<>());
+            }
+
+            fsStoreAfterSales.setUnionId(unionId);
+        }
+
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         fsStoreAfterSales.setCompanyId(loginUser.getCompany().getCompanyId());
         startPage();

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

@@ -24,6 +24,7 @@ import com.fs.store.dto.ExpressInfoDTO;
 import com.fs.store.dto.StoreOrderProductDTO;
 import com.fs.store.enums.OrderLogEnum;
 import com.fs.store.enums.ShipperCodeEnum;
+import com.fs.store.mapper.FsStoreOrderMapper;
 import com.fs.store.param.FsStoreOrderBindCustomerParam;
 import com.fs.store.param.FsStoreOrderCreateUserParam;
 import com.fs.store.param.FsStoreOrderFinishParam;
@@ -40,6 +41,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -71,6 +73,9 @@ public class FsStoreOrderController extends BaseController
     private TokenService tokenService;
     @Autowired
     private ICrmCustomerService crmCustomerService;
+    @Autowired
+    private FsStoreOrderMapper fsStoreOrderMapper;
+
     /**
      * 查询订单列表
      */
@@ -79,6 +84,15 @@ public class FsStoreOrderController extends BaseController
     @DataScope(deptAlias = "cu",userAlias = "cu")
     public TableDataInfo list(FsStoreOrderParam param)
     {
+        if (param.getHuYiUserId() != null) {
+            String unionId = fsStoreOrderMapper.selectUnionIdByHyUserId(param.getHuYiUserId());
+            if (StringUtils.isEmpty(unionId)) {
+                return getDataTable(new ArrayList<>());
+            }
+
+            param.setUnionId(unionId);
+        }
+
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId(loginUser.getCompany().getCompanyId());
         startPage();

+ 5 - 0
fs-company/src/main/resources/application-druid.yml

@@ -38,6 +38,11 @@ spring:
                 url:
                 username:
                 password:
+
+            huyi:
+                url: jdbc:mysql://1.14.207.209:8008/fs_his?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                username: root
+                password: X7k#9mPq$2LvR&5n
             # 初始连接数
             initialSize: 5
             # 最小连接池数量

+ 19 - 0
fs-service-system/src/main/java/com/fs/store/domain/FsStoreAfterSales.java

@@ -104,6 +104,25 @@ public class FsStoreAfterSales extends BaseEntity
     private Long deptId;
     private String consigneePhone;
 
+    private Long huYiUserId;
+    private String unionId;
+
+    public Long getHuYiUserId() {
+        return huYiUserId;
+    }
+
+    public void setHuYiUserId(Long huYiUserId) {
+        this.huYiUserId = huYiUserId;
+    }
+
+    public String getUnionId() {
+        return unionId;
+    }
+
+    public void setUnionId(String unionId) {
+        this.unionId = unionId;
+    }
+
     /** 开始时间 */
     @JsonIgnore
     private String beginTime;

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

@@ -6,6 +6,8 @@ import java.util.Map;
 import com.alibaba.fastjson.JSONObject;
 import com.fs.api.param.OrderListParam;
 import com.fs.api.vo.OrderListVO;
+import com.fs.common.annotation.DataSource;
+import com.fs.common.enums.DataSourceType;
 import com.fs.company.param.CompanyStatisticsParam;
 import com.fs.company.vo.CompanySmsLogsStatisticsVO;
 import com.fs.company.vo.CompanyTuiMoneyStatisticsVO;
@@ -1130,4 +1132,7 @@ public interface FsStoreOrderMapper
     List<FsStoreOrder> selectBankOrder();
 
     void updateUpdateTimeByExtendIds(@Param("batch") List<String> batch);
+
+    @DataSource(DataSourceType.HUYI)
+    String selectUnionIdByHyUserId(Long huYiUserId);
 }

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

@@ -96,4 +96,7 @@ public class FsStoreOrderParam extends BaseEntity implements Serializable
 
     private String orderVisit;
 
+    private Long huYiUserId;
+    private String unionId;
+
 }

+ 3 - 0
fs-service-system/src/main/resources/mapper/store/FsStoreAfterSalesMapper.xml

@@ -146,6 +146,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test = 'maps.deptId != null'>
                 AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
             </if>
+            <if test = 'maps.unionId != null and  maps.unionId != "" '>
+                AND u.union_id = #{maps.unionId}
+            </if>
             ${maps.params.dataScope}
         </where>
         order by s.create_time desc

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

@@ -684,6 +684,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test = 'maps.deptId != null    '>
                 AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
             </if>
+            <if test = 'maps.unionId != null and  maps.unionId != "" '>
+                AND u.union_id = #{maps.unionId}
+            </if>
             ${maps.params.dataScope}
         </where>
         <if test = 'maps.productName != null and  maps.productName != "" '>
@@ -692,6 +695,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by o.id desc
     </select>
 
+    <select id="selectUnionIdByHyUserId" resultType="java.lang.String">
+        SELECT union_id unionId FROM `fs_user` WHERE user_id = #{huYiUserId}
+    </select>
+
     <update id="updateUpdateTimeByExtendIds">
         UPDATE fs_store_order SET update_time = NOW()
         WHERE extend_order_id IN