Browse Source

增加查询客户信息表订单接口与查询销售首款接口接口

cgp 1 day ago
parent
commit
34c1d07303

+ 17 - 2
fs-company/src/main/java/com/fs/company/controller/qw/FsCompanyCustomerController.java

@@ -16,13 +16,14 @@ import com.fs.his.param.CollectionPhoneParam;
 import com.fs.his.param.PrescribePhoneParam;
 import com.fs.his.service.IFsDoctorPatientService;
 import com.fs.his.service.IFsPrescribeService;
+import com.fs.hisStore.param.FsCompanyCustomerOrderParam;
 import com.fs.hisStore.service.IFsUserInformationCollectionService;
+import com.fs.hisStore.vo.FsStoreOrderVO;
 import com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo;
 import com.fs.qw.domain.FsCompanyCustomer;
 import com.fs.qw.service.IFsCompanyCustomerService;
 import com.fs.qw.vo.CompanyUserAndDoctorVO;
 import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -253,7 +254,6 @@ public class FsCompanyCustomerController extends BaseController {
         fsDoctorPatient.setCompanyUserId(companyUserId);
         PageHelper.startPage(fsDoctorPatient.getPageNum(), fsDoctorPatient.getPageSize());
         List<FsDoctorPatient> list = fsDoctorPatientService.selectFsDoctorPatientList(fsDoctorPatient);
-        PageInfo<FsDoctorPatient> listPageInfo=new PageInfo<>(list);
         return getDataTable(list);
     }
 
@@ -266,4 +266,19 @@ public class FsCompanyCustomerController extends BaseController {
         return AjaxResult.success(fsDoctorPatientService.selectFsDoctorPatientById(id));
     }
 
+    /**
+     * 销售端-查询客户订单列表信息
+     * */
+    @ApiOperation("查询客户订单列表信息")
+    @GetMapping("/getOrderList")
+    public TableDataInfo getOrderList(FsCompanyCustomerOrderParam customerOrderParam) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        Long companyUserId = loginUser.getUser().getUserId();
+        if (companyUserId == null){
+            throw new CustomException("销售登录信息获取异常");
+        }
+        PageHelper.startPage(customerOrderParam.getPageNum(), customerOrderParam.getPageSize());
+        List<FsStoreOrderVO> list = fsCompanyCustomerService.selectStoreOrderScrmByCompanyCustomerParam(customerOrderParam);
+        return getDataTable(list);
+    }
 }

+ 16 - 1
fs-company/src/main/java/com/fs/company/controller/qw/FsCompanyExternalPayReceiptController.java

@@ -2,6 +2,8 @@ package com.fs.company.controller.qw;
 
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
+import com.fs.framework.security.SecurityUtils;
+import com.fs.qw.domain.FsCompanyExternalPayReceipt;
 import com.fs.qw.domain.QwCompany;
 import com.fs.qw.service.IFsCompanyExternalPayReceiptService;
 import com.fs.qw.service.IQwCompanyService;
@@ -16,7 +18,7 @@ import java.time.ZoneOffset;
 import java.util.List;
 
 @RestController
-@RequestMapping("/admin/pay/receipt")
+@RequestMapping("/pay/receipt")
 public class FsCompanyExternalPayReceiptController extends BaseController {
 
     @Autowired
@@ -42,4 +44,17 @@ public class FsCompanyExternalPayReceiptController extends BaseController {
         receiptService.syncReceipts(beginTime, endTime, payeeUserid,qwCompanyList);
         return AjaxResult.success("同步完成");
     }
+
+    /**
+     * 查询销售人员可用的收款记录
+     * */
+    @GetMapping("/canUsePayReceiptList")
+    public AjaxResult canUsePayReceiptList() {
+        Long currentUserId = SecurityUtils.getLoginUser().getUser().getUserId();
+        if (currentUserId == null){
+            return AjaxResult.error("登录信息你已过期,请重新登录!");
+        }
+        List<FsCompanyExternalPayReceipt> fsCompanyExternalPayReceipts = receiptService.selectFsCompanyExternalPayReceiptListByCompanyUserId(currentUserId);
+        return AjaxResult.success(fsCompanyExternalPayReceipts);
+    }
 }

+ 5 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreOrderScrmMapper.java

@@ -1239,4 +1239,9 @@ public interface FsStoreOrderScrmMapper
 
     @Select("SELECT product_id FROM fs_store_order_item_scrm WHERE order_id IN ( SELECT id FROM fs_store_order_scrm WHERE user_id = #{userId} AND paid = 1 AND refund_status = 0 AND app_reward_flag IS NULL AND `status` NOT IN (-3,-2,-1,0))")
     List<Long> selectUserBuyProductIds(@Param("userId") Long userId);
+
+    /**
+     * 根据客户信息表(fs_company_customer)的客户id查询订单列表信息
+     * */
+    List<FsStoreOrderVO> selectStoreOrderScrmByCompanyCustomerParam(@Param("maps")FsCompanyCustomerOrderParam param);
 }

+ 27 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsCompanyCustomerOrderParam.java

@@ -0,0 +1,27 @@
+package com.fs.hisStore.param;
+
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 客户信息表订单参数
+ * */
+@Data
+public class FsCompanyCustomerOrderParam extends BaseEntity implements Serializable {
+    /**
+     * 客户信息表(fs_company_customer)主键id
+     * */
+    private Long companyCustomerId;
+
+    /**
+     * 商品名称
+     * */
+    private String productName;
+
+    //分页相关
+    private Integer pageNum;
+    private Integer pageSize;
+
+}

+ 6 - 0
fs-service/src/main/java/com/fs/qw/service/IFsCompanyCustomerService.java

@@ -1,7 +1,10 @@
 package com.fs.qw.service;
 
 import com.fs.company.domain.CompanyUser;
+import com.fs.hisStore.param.FsCompanyCustomerOrderParam;
+import com.fs.hisStore.vo.FsStoreOrderVO;
 import com.fs.qw.domain.FsCompanyCustomer;
+import com.fs.qw.domain.FsCompanyExternalPayReceipt;
 import com.fs.qw.param.TransferCustomerParam;
 
 import java.util.List;
@@ -31,4 +34,7 @@ public interface IFsCompanyCustomerService {
 
     //执行认领销售客户信息
     int claimCustomer(FsCompanyCustomer fsCompanyCustomer,CompanyUser companyUser);
+
+    //查询客户订单列表
+    List<FsStoreOrderVO> selectStoreOrderScrmByCompanyCustomerParam(FsCompanyCustomerOrderParam param);
 }

+ 4 - 0
fs-service/src/main/java/com/fs/qw/service/IFsCompanyExternalPayReceiptService.java

@@ -12,4 +12,8 @@ public interface IFsCompanyExternalPayReceiptService {
 
     // 查询收款记录(查数据库)
     List<FsCompanyExternalPayReceipt> queryReceipts(FsCompanyExternalPayReceipt receipt);
+
+
+    //查询销售可用的收款记录
+    List<FsCompanyExternalPayReceipt> selectFsCompanyExternalPayReceiptListByCompanyUserId(Long companyUserId);
 }

+ 20 - 0
fs-service/src/main/java/com/fs/qw/service/impl/FsCompanyCustomerServiceImpl.java

@@ -7,10 +7,15 @@ import com.fs.company.domain.CompanyUser;
 import com.fs.company.mapper.CompanyDeptMapper;
 import com.fs.his.domain.FsImportMember;
 import com.fs.his.mapper.FsImportMemberMapper;
+import com.fs.hisStore.mapper.FsStoreOrderScrmMapper;
+import com.fs.hisStore.param.FsCompanyCustomerOrderParam;
+import com.fs.hisStore.vo.FsStoreOrderVO;
 import com.fs.qw.domain.FsCompanyCustomer;
 import com.fs.qw.domain.FsCompanyCustomerLog;
+import com.fs.qw.domain.FsCompanyExternalPayReceipt;
 import com.fs.qw.mapper.FsCompanyCustomerLogMapper;
 import com.fs.qw.mapper.FsCompanyCustomerMapper;
+import com.fs.qw.mapper.FsCompanyExternalPayReceiptMapper;
 import com.fs.qw.param.TransferCustomerParam;
 import com.fs.qw.service.IFsCompanyCustomerService;
 import lombok.extern.slf4j.Slf4j;
@@ -45,6 +50,12 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
     @Autowired
     private CompanyDeptMapper companyDeptMapper;
 
+    @Autowired
+    private FsStoreOrderScrmMapper fsStoreOrderScrmMapper;
+
+    @Autowired
+    private FsCompanyExternalPayReceiptMapper externalPayReceiptMapper;
+
     @Override
     public FsCompanyCustomer selectFsCompanyCustomerById(Long id) {
         return fsCompanyCustomerMapper.selectFsCompanyCustomerById(id);
@@ -203,4 +214,13 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
         fsCompanyCustomer.setClaimStatus(BigDecimal.ONE.intValue());//已认领
         return fsCompanyCustomerMapper.updateFsCompanyCustomer(fsCompanyCustomer);
     }
+
+    @Override
+    public List<FsStoreOrderVO> selectStoreOrderScrmByCompanyCustomerParam(FsCompanyCustomerOrderParam param) {
+        List<FsStoreOrderVO> fsStoreOrderVOS = fsStoreOrderScrmMapper.selectStoreOrderScrmByCompanyCustomerParam(param);
+        if (CollectionUtils.isEmpty(fsStoreOrderVOS)){
+            return Collections.emptyList();
+        }
+        return fsStoreOrderVOS;
+    }
 }

+ 13 - 0
fs-service/src/main/java/com/fs/qw/service/impl/FsCompanyExternalPayReceiptServiceImpl.java

@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 
+import java.math.BigDecimal;
 import java.util.Collections;
 import java.util.Date;
 import java.util.List;
@@ -127,4 +128,16 @@ public class FsCompanyExternalPayReceiptServiceImpl implements IFsCompanyExterna
         }
         return fsCompanyExternalPayReceipts;
     }
+
+    @Override
+    public List<FsCompanyExternalPayReceipt> selectFsCompanyExternalPayReceiptListByCompanyUserId(Long companyUserId) {
+        FsCompanyExternalPayReceipt queryCondition=new FsCompanyExternalPayReceipt();
+        queryCondition.setCompanyUserId(companyUserId);
+        queryCondition.setStatus(BigDecimal.ZERO.intValue());//0:未使用
+        List<FsCompanyExternalPayReceipt> fsCompanyExternalPayReceipts = receiptMapper.selectFsCompanyExternalPayReceiptList(queryCondition);
+        if (org.apache.commons.collections4.CollectionUtils.isEmpty(fsCompanyExternalPayReceipts)){
+            return Collections.emptyList();
+        }
+        return fsCompanyExternalPayReceipts;
+    }
 }

+ 17 - 0
fs-service/src/main/resources/mapper/hisStore/FsStoreOrderScrmMapper.xml

@@ -1144,4 +1144,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and cd.dept_id = #{map.deptId}
         </if>
     </select>
+
+    <select id="selectStoreOrderScrmByCompanyCustomerParam" parameterType="com.fs.hisStore.param.FsCompanyCustomerOrderParam" resultType="com.fs.hisStore.vo.FsStoreOrderVO">
+        select o.*, u.phone, u.register_code, u.register_date, u.source,
+        c.company_name,
+        cu.nick_name as company_user_nick_name,
+        cu.phonenumber as company_usere_phonenumber
+        from fs_store_order_scrm 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
+        <where>
+            company_customer_id = #{maps.companyCustomerId}
+            <if test="maps.productName != null and maps.productName != ''">
+                and fsp.product_name like concat('%', #{maps.productName}, '%')
+            </if>
+        </where>
+    </select>
 </mapper>

+ 3 - 0
fs-service/src/main/resources/mapper/qw/FsCompanyExternalPayReceiptMapper.xml

@@ -75,6 +75,9 @@
             <if test="corpId != null and corpId != ''">
                 and corp_id = #{corpId}
             </if>
+            <if test="status != null and status != ''">
+                and status = #{status}
+            </if>
             <if test="companyUserId != null and companyUserId != ''">
                 and company_user_id = #{companyUserId}
             </if>