Explorar o código

企微客户修改 财务对账修改

xgb hai 1 mes
pai
achega
c0db6dcf04

+ 28 - 4
fs-company/src/main/java/com/fs/company/controller/qw/QwExternalContactController.java

@@ -28,6 +28,7 @@ import com.fs.his.domain.FsUser;
 import com.fs.his.service.IFsUserService;
 import com.fs.qw.domain.QwContactWay;
 import com.fs.qw.domain.QwExternalContact;
+import com.fs.qw.domain.QwExternalContactCommunication;
 import com.fs.qw.domain.QwTag;
 import com.fs.qw.dto.CompanyTransferDTO;
 import com.fs.qw.param.*;
@@ -98,6 +99,9 @@ public class QwExternalContactController extends BaseController
     @Autowired
     private IFsUserCompanyBindService fsUserCompanyBindService;
 
+    @Autowired
+    private IQwExternalContactCommunicationService qwExternalContactCommunicationService;
+
     /**
      * 查询企业微信客户列表
      */
@@ -114,7 +118,20 @@ public class QwExternalContactController extends BaseController
         startPage();
         qwExternalContact.setCompanyId(loginUser.getCompany().getCompanyId());
         List<QwExternalContactVO> list = qwExternalContactService.selectQwExternalContactListVO(qwExternalContact);
+
+        if(list==null|| list.isEmpty()){
+            return getDataTable(list);
+        }
+        List<Long> ids=list.stream().map(QwExternalContactVO::getId).collect(Collectors.toList());
+
+        // 查询用户沟通内容
+        List<QwExternalContactCommunication> contactCommunications=qwExternalContactCommunicationService.getListByExternalContactIds(ids);
+        Map<String, String> communicationMap = contactCommunications.stream().collect(Collectors.toMap(QwExternalContactCommunication::getExternalContactId, QwExternalContactCommunication::getCommunicationContent));
+
         list.forEach(item->{
+            // 设置最后沟通内容
+            item.setLastContactContent(communicationMap.get(String.valueOf(item.getId())));
+
 
             if (!Objects.equals(item.getTagIds(), "[]") && item.getTagIds()!=null) {
                 QwTagSearchParam param = new QwTagSearchParam();
@@ -262,7 +279,18 @@ public class QwExternalContactController extends BaseController
         startPage();
         qwExternalContact.setCompanyId(loginUser.getCompany().getCompanyId());
         List<QwExternalContactVO> list = qwExternalContactService.selectQwExternalContactListVO(qwExternalContact);
+        if(list==null|| list.isEmpty()){
+            return getDataTable(list);
+        }
+        List<Long> ids=list.stream().map(QwExternalContactVO::getId).collect(Collectors.toList());
+
+        // 查询用户沟通内容
+        List<QwExternalContactCommunication> contactCommunications=qwExternalContactCommunicationService.getListByExternalContactIds(ids);
+        Map<String, String> communicationMap = contactCommunications.stream().collect(Collectors.toMap(QwExternalContactCommunication::getExternalContactId, QwExternalContactCommunication::getCommunicationContent));
+
         list.forEach(item->{
+            // 设置最后沟通内容
+            item.setLastContactContent(communicationMap.get(String.valueOf(item.getId())));
 
             if (!Objects.equals(item.getTagIds(), "[]") && item.getTagIds()!=null) {
                 QwTagSearchParam param = new QwTagSearchParam();
@@ -289,10 +317,6 @@ public class QwExternalContactController extends BaseController
             }
 
         });
-        // 查询用户沟通内容
-
-        // 查询用户身体情况
-
 
 
 

+ 4 - 2
fs-company/src/main/java/com/fs/hisStore/controller/FsStorePaymentScrmController.java

@@ -50,12 +50,13 @@ public class FsStorePaymentScrmController extends BaseController
     public TableDataInfo list(FsStorePaymentParam fsStorePayment)
     {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        fsStorePayment.setBusinessType(1);
+        fsStorePayment.setBusinessType(2); // 查询明细
         fsStorePayment.setCompanyId(loginUser.getCompany().getCompanyId());
         startPage();
         List<FsStorePaymentVO> list = fsStorePaymentService.selectFsStorePaymentListQueryVO(fsStorePayment);
         for (FsStorePaymentVO vo : list){
             vo.setUserPhone(ParseUtils.parsePhone(vo.getUserPhone()));
+            vo.setPayCode("store-"+vo.getPayCode());
         }
         return getDataTable(list);
     }
@@ -68,12 +69,13 @@ public class FsStorePaymentScrmController extends BaseController
     @GetMapping("/export")
     public AjaxResult export(FsStorePaymentParam fsStorePayment)
     {
-        fsStorePayment.setBusinessType(1);
+        fsStorePayment.setBusinessType(2);
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         fsStorePayment.setCompanyId(loginUser.getCompany().getCompanyId());
         List<FsStorePaymentVO> list = fsStorePaymentService.selectFsStorePaymentListQueryVO(fsStorePayment);
         for (FsStorePaymentVO vo : list){
             vo.setUserPhone(ParseUtils.parsePhone(vo.getUserPhone()));
+            vo.setPayCode("store-"+vo.getPayCode());
         }
         ExcelUtil<FsStorePaymentVO> util = new ExcelUtil<FsStorePaymentVO>(FsStorePaymentVO.class);
         return util.exportExcel(list, "storePayment");

+ 3 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsStorePaymentScrmMapper.java

@@ -190,7 +190,9 @@ public interface FsStorePaymentScrmMapper
     List<FsStorePaymentVO> exportFsStorePaymentList(@Param("maps") FsStorePaymentParam fsStorePayment);
 
     @Select({"<script> " +
-            "select p.*,c.company_name,d.dept_name,u.phone as user_phone,cu.nick_name as company_user_nick_name,cu.user_name as company_user_name  from fs_store_payment_scrm p left join company_user cu on p.company_user_id=cu.user_id left join fs_user u on u.user_id=p.user_id left join company_dept d on d.dept_id=p.dept_id left join company c on c.company_id=p.company_id  " +
+            "select p.*,c.company_name,d.dept_name,u.phone as user_phone,cu.nick_name as company_user_nick_name,cu.user_name as company_user_name,os.order_code  from fs_store_payment_scrm p " +
+            "left join fs_store_order_scrm os on os.id = p.order_id "+
+            "left join company_user cu on p.company_user_id=cu.user_id left join fs_user u on u.user_id=p.user_id left join company_dept d on d.dept_id=p.dept_id left join company c on c.company_id=p.company_id  " +
             "where 1=1 " +
             "<if test = 'maps.payCode != null and  maps.payCode !=\"\"    '> " +
             "and p.pay_code like CONCAT('%',#{maps.payCode},'%') " +

+ 8 - 3
fs-service/src/main/java/com/fs/hisStore/vo/FsStorePaymentVO.java

@@ -20,6 +20,10 @@ public class FsStorePaymentVO implements Serializable
 
     @Excel(name = "支付订单号")
     private String payCode;
+
+    @Excel(name = "关联订单号")
+    private String orderCode;
+
     @Excel(name = "会员手机号")
     private String userPhone;
     /** ID */
@@ -54,7 +58,7 @@ public class FsStorePaymentVO implements Serializable
     private String businessOrderId;
 
     /** 状态 0未支付 1已支付 -1 已退款 */
-    @Excel(name = "支付状态 0未支付 1已支付 -1 已退款")
+    @Excel(name = "支付状态 0未支付 1已支付 -1 已退款",dictType = "store_payment_status")
     private Integer status;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@@ -83,8 +87,7 @@ public class FsStorePaymentVO implements Serializable
     private String companyUserName;
     @Excel(name = "销售姓名")
     private String companyUserNickName;
-    @Excel(name = "商城订单号")
-    private String orderCode;
+
     @Excel(name = "套餐名称")
     private String title;
 
@@ -92,4 +95,6 @@ public class FsStorePaymentVO implements Serializable
 
 
 
+
+
 }

+ 2 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwExternalContactCommunicationMapper.java

@@ -24,4 +24,6 @@ public interface QwExternalContactCommunicationMapper extends BaseMapper<QwExter
      * @return 沟通内容对象
      */
     QwExternalContactCommunication selectByWatchLogId(@Param("courseWatchLogId") Long courseWatchLogId);
+
+    List<QwExternalContactCommunication> getListByExternalContactIds(@Param("ids") List<Long> ids);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/qw/service/IQwExternalContactCommunicationService.java

@@ -39,5 +39,7 @@ public interface IQwExternalContactCommunicationService extends IService<QwExter
      * @return 结果
      */
     boolean deleteCommunicationByIds(Long[] ids);
+
+    List<QwExternalContactCommunication> getListByExternalContactIds(List<Long> ids);
 }
 

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

@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
@@ -74,4 +75,9 @@ public class QwExternalContactCommunicationServiceImpl
     public boolean deleteCommunicationByIds(Long[] ids) {
         return this.removeByIds(Arrays.asList(ids));
     }
+
+    @Override
+    public List<QwExternalContactCommunication> getListByExternalContactIds(List<Long> ids) {
+        return communicationMapper.getListByExternalContactIds(ids);
+    }
 }

+ 3 - 0
fs-service/src/main/java/com/fs/qw/vo/QwExternalContactVO.java

@@ -143,4 +143,7 @@ public class QwExternalContactVO {
     // 下次联系时间
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date nextContactTime;
+
+    // 最后沟通内容
+    private String LastContactContent;
 }

+ 12 - 0
fs-service/src/main/resources/mapper/qw/QwExternalContactCommunicationMapper.xml

@@ -33,5 +33,17 @@
         WHERE course_watch_log_id = #{courseWatchLogId}
             LIMIT 1
     </select>
+    <select id="getListByExternalContactIds" resultType="com.fs.qw.domain.QwExternalContactCommunication">
+        SELECT * FROM (
+            SELECT *,
+            ROW_NUMBER() OVER (PARTITION BY external_contact_id ORDER BY chat_time DESC) AS rn
+            FROM qw_external_contact_communication
+            WHERE external_contact_id IN
+            <foreach item="item" collection="ids" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+            ) ranked
+        WHERE rn = 1
+    </select>
 
 </mapper>