czh 2 лет назад
Родитель
Сommit
0a255341e4

+ 0 - 89
sckw-auth/src/main/java/com/sckw/auth/controller/AuthController.java

@@ -3,7 +3,6 @@ package com.sckw.auth.controller;
 import com.sckw.auth.model.vo.req.*;
 import com.sckw.auth.service.IAuthService;
 import com.sckw.core.common.enums.enums.DictEnum;
-import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.enums.LoginMethodEnum;
 import com.sckw.core.model.enums.SystemTypeEnum;
 import com.sckw.core.utils.RegularUtils;
@@ -28,62 +27,6 @@ public class AuthController {
     @Autowired
     private IAuthService authService;
 
-    @PostMapping("/auth")
-    public HttpResult auth(@RequestHeader(name = "System-Type") int systemType,
-                            @RequestHeader(name = "Client-Type") String clientType,
-                            @RequestBody @Valid LoginBase loginBase) {
-        loginBase.setSystemType(systemType);
-        loginBase.setClientType(clientType);
-        loginBase.setLoginMethod(LoginMethodEnum.ORDINARY.getValue());
-
-        /**参数校验**/
-        HttpResult result = checkParams(loginBase);
-        if (result.getCode() != HttpStatus.SUCCESS_CODE) {
-            return result;
-        }
-
-        /**运营端/企业端登录(PC/APP)**/
-        if (loginBase.getSystemType() == SystemTypeEnum.MANAGE.getCode()
-                || loginBase.getSystemType() == SystemTypeEnum.COMPANY.getCode()) {
-            return authService.commonAuth(loginBase);
-        }
-
-        /**司机端**/
-        if (loginBase.getSystemType() == SystemTypeEnum.DRIVER.getCode()) {
-            return authService.driverAuth(loginBase);
-        }
-
-        return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.GLOBAL_EXCEPTION_MESSAGE);
-    }
-
-    @PostMapping("/smsAuth")
-    public HttpResult smsAuth(@RequestHeader(name = "System-Type") int systemType,
-                            @RequestHeader(name = "Client-Type") String clientType,
-                            @RequestBody @Valid LoginBase loginBase) {
-        loginBase.setSystemType(systemType);
-        loginBase.setClientType(clientType);
-        loginBase.setLoginMethod(LoginMethodEnum.SMS.getValue());
-
-        /**参数校验**/
-        HttpResult result = checkParams(loginBase);
-        if (result.getCode() != HttpStatus.SUCCESS_CODE) {
-            return result;
-        }
-
-        /**运营端/企业端登录(PC/APP)**/
-        if (loginBase.getSystemType() == SystemTypeEnum.MANAGE.getCode()
-                || loginBase.getSystemType() == SystemTypeEnum.COMPANY.getCode()) {
-            return authService.commonAuth(loginBase);
-        }
-
-        /**司机端**/
-        if (loginBase.getSystemType() == SystemTypeEnum.DRIVER.getCode()) {
-            return authService.driverAuth(loginBase);
-        }
-
-        return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.GLOBAL_EXCEPTION_MESSAGE);
-    }
-
     /**
      * @param
      * @return
@@ -172,41 +115,9 @@ public class AuthController {
         }
 
         return HttpResult.error(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.GLOBAL_EXCEPTION_MESSAGE);
-//        reqVo.setSystemType(systemType);
-//        reqVo.setClientType(clientType);
-//        return HttpResult.ok(authService.login(reqVo));
     }
 
 
-    /**
-     * @param reqVo 注册
-     * @return HttpResult
-     * @desc: 用户注册
-     * @author: czh
-     * @date: 2023/6/16
-     */
-    @PostMapping("/register")
-    public HttpResult register(@Valid @RequestBody RegisterReqVo reqVo,
-                               @RequestHeader(name = "System-Type", required = true) int systemType) {
-        reqVo.setSystemType(systemType);
-        authService.register(reqVo);
-        return HttpResult.ok(HttpStatus.MSG_007);
-    }
-
-    /**
-     * @param reqVo 忘记密码入参
-     * @return HttpResult
-     * @desc: 忘记密码
-     * @author: czh
-     * @date: 2023/6/19
-     */
-    @PostMapping("/forgetPassword")
-    public HttpResult forgetPassword(@Valid @RequestBody ForgetPasswordReqVo reqVo,
-                                     @RequestHeader(name = "System-Type", required = true) int systemType) {
-        reqVo.setSystemType(systemType);
-        authService.forgetPassword(reqVo);
-        return HttpResult.ok(HttpStatus.MSG_002);
-    }
 
 
     /**

+ 4 - 8
sckw-auth/src/main/java/com/sckw/auth/service/impl/AuthServiceImpl.java

@@ -19,7 +19,6 @@ import com.sckw.core.web.model.LoginUserInfo;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.fleet.api.RemoteFleetService;
 import com.sckw.fleet.api.model.vo.RDriverDetailVo;
-import com.sckw.message.api.dubbo.SmsInfoService;
 import com.sckw.redis.constant.RedisConstant;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.req.*;
@@ -53,9 +52,6 @@ public class AuthServiceImpl implements IAuthService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService systemService;
 
-    /*@DubboReference(version = "1.0.0", group = "design", check = false)
-    private SmsInfoService smsInfoService;*/
-
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteFleetService fleetService;
 
@@ -382,9 +378,9 @@ public class AuthServiceImpl implements IAuthService {
         loginRes.setPhone(driver.getPhone());
         loginRes.setStatus(driver.getStatus());
         loginRes.setEntId(driver.getEntId());
-        loginRes.setFirmName(enterprise == null ? enterprise.getFirmName() : null);
-        loginRes.setApproval(enterprise == null ? enterprise.getApproval() : null);
-        loginRes.setEntTypeNames(enterprise == null ? enterprise.getEntTypeNames() : null);
+        loginRes.setFirmName(enterprise != null ? enterprise.getFirmName() : null);
+        loginRes.setApproval(enterprise != null ? enterprise.getApproval() : null);
+        loginRes.setEntTypeNames(enterprise != null ? enterprise.getEntTypeNames() : null);
         loginRes.setClientType(loginBase.getClientType());
         loginRes.setSystemType(loginBase.getSystemType());
         loginRes.setToken(token);
@@ -466,7 +462,7 @@ public class AuthServiceImpl implements IAuthService {
         info.put("account", loginBase.getAccount());
         info.put("clientType", loginBase.getClientType());
         info.put("systemType", loginBase.getSystemType());
-        info.put("timestamp", System.currentTimeMillis());
+//        info.put("timestamp", System.currentTimeMillis());
         String key = Global.getFullUserTokenKey(loginBase.getClientType(), userId);
         String token = EncryUtil.encryV1(Global.PRI_KEY, JSON.toJSONString(info));
         int expireTime = ClientTypeEnum.expireTime(loginBase.getClientType());

+ 9 - 0
sckw-modules-api/sckw-contract-api/src/main/java/com/sckw/contract/api/RemoteContractService.java

@@ -2,6 +2,7 @@ package com.sckw.contract.api;
 
 import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -20,4 +21,12 @@ public interface RemoteContractService {
      * @date: 2023/7/20
      */
     Map<Long, ContractCommonInfoResDto> queryContractBaseInfo(List<Long> contractId);
+
+    /**
+     * @param contractId 合同id  performedAmount履约量
+     * @desc: 更新已履约量
+     * @author: czh
+     * @date: 2023/8/31
+     */
+    void updatePerformed(Long contractId, BigDecimal performedAmount);
 }

+ 27 - 2
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dubbo/RemoteContractServiceImpl.java

@@ -15,6 +15,8 @@ import com.sckw.core.model.enums.SigningWayEnum;
 import com.sckw.core.utils.CollectionUtils;
 import org.apache.dubbo.config.annotation.DubboService;
 import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
 import java.util.*;
 
 /**
@@ -42,7 +44,7 @@ public class RemoteContractServiceImpl implements RemoteContractService {
             if (Objects.nonNull(kwcContractLogistics)) {
                 Integer status = kwcContractLogistics.getStatus();
                 Integer delFlag = kwcContractLogistics.getDelFlag();
-                if (Objects.equals(status, ContractStatusEnum.SAVE.getCode()) || Objects.equals(status, ContractStatusEnum.COMPLETE.getCode()) || delFlag.equals(Global.YES)) {
+                if (Objects.equals(status, ContractStatusEnum.SAVE.getCode()) || delFlag.equals(Global.YES)) {
                     continue;
                 }
                 map.put(contractId, fillContractLogistics(kwcContractLogistics));
@@ -53,7 +55,7 @@ public class RemoteContractServiceImpl implements RemoteContractService {
             if (Objects.nonNull(kwcContractTrade)) {
                 Integer status = kwcContractTrade.getStatus();
                 Integer delFlag = kwcContractTrade.getDelFlag();
-                if (Objects.equals(status, ContractStatusEnum.SAVE.getCode()) || Objects.equals(status, ContractStatusEnum.COMPLETE.getCode()) || delFlag.equals(Global.YES)) {
+                if (Objects.equals(status, ContractStatusEnum.SAVE.getCode()) || delFlag.equals(Global.YES)) {
                     continue;
                 }
                 map.put(contractId, fillContractTrade(kwcContractTrade));
@@ -62,6 +64,29 @@ public class RemoteContractServiceImpl implements RemoteContractService {
         return map;
     }
 
+
+    /**
+     * @param contractId 合同id  performedAmount履约量
+     * @desc: 更新已履约量
+     * @author: czh
+     * @date: 2023/8/31
+     */
+    @Override
+    public void updatePerformed(Long contractId, BigDecimal performedAmount) {
+        KwcContractLogistics kwcContractLogistics = kwcContractLogisticsMapper.selectById(contractId);
+        if (Objects.nonNull(kwcContractLogistics)) {
+            kwcContractLogistics.setPerformedAmount(kwcContractLogistics.getPerformedAmount().add(performedAmount));
+            kwcContractLogisticsMapper.updateById(kwcContractLogistics);
+            return;
+        }
+
+        KwcContractTrade kwcContractTrade = kwcContractTradeMapper.selectById(contractId);
+        if (Objects.nonNull(kwcContractTrade)) {
+            kwcContractTrade.setPerformedAmount(kwcContractTrade.getPerformedAmount().add(performedAmount));
+            kwcContractTradeMapper.updateById(kwcContractTrade);
+        }
+    }
+
     private ContractCommonInfoResDto fillContractLogistics(KwcContractLogistics kwcContractLogistics) {
         ContractCommonInfoResDto contractCommonInfoResDto = new ContractCommonInfoResDto();
         List<EntInfo> entList = new ArrayList<>();

+ 0 - 1
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/controller/KwmAddressController.java

@@ -1,6 +1,5 @@
 package com.sckw.manage.controller;
 
-import com.sckw.core.exception.SystemException;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.manage.model.vo.req.*;

+ 0 - 1
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/controller/KwmCooperateApplyController.java

@@ -1,6 +1,5 @@
 package com.sckw.manage.controller;
 
-import com.sckw.core.exception.SystemException;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.manage.model.vo.req.CooperateApplyQueryReqVo;

+ 0 - 1
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/controller/KwmCooperateManageController.java

@@ -1,6 +1,5 @@
 package com.sckw.manage.controller;
 
-import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.enums.CooperateStatusEnum;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;

+ 5 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/dto/req/CooperateManageQueryReqDto.java

@@ -48,6 +48,11 @@ public class CooperateManageQueryReqDto {
      */
     private List<Long> currentEntIdList;
 
+    /**
+     * 对方企业id
+     */
+    private List<Long> targetEntIdList;
+
     /**
      * 申请状态
      */

+ 3 - 9
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/CommonBusinessService.java

@@ -145,17 +145,17 @@ public class CommonBusinessService {
             return Collections.emptyList();
         }
 
-        return getCooperateManageQueryResVos(reqDto, list);
+        return getCooperateManageQueryResVos(list);
     }
 
     /**
-     * @param reqDto 入参  list数据
+     * @param list 数据
      * @return CooperateManageQueryResVo
      * @desc: 组装返参
      * @author: czh
      * @date: 2023/8/2
      */
-    public List<CooperateManageQueryResVo> getCooperateManageQueryResVos(CooperateManageQueryReqDto reqDto, List<CooperateManageQueryResDto> list) {
+    public List<CooperateManageQueryResVo> getCooperateManageQueryResVos(List<CooperateManageQueryResDto> list) {
         //dubbo接口查用户和企业
         Long entId = LoginUserHolder.getEntId();
         List<Long> userIds = list.stream().map(CooperateManageQueryResDto::getCreateBy).distinct().toList();
@@ -179,12 +179,6 @@ public class CommonBusinessService {
         for (CooperateManageQueryResDto cooperateManageQueryResDto : list) {
             Long targetEntId = cooperateManageQueryResDto.getTargetEntId();
             String targetEntName = entMap.get(targetEntId);
-            String keywords = reqDto.getKeywords();
-            if (StringUtils.isNotBlank(keywords)) {
-                if (StringUtils.isBlank(targetEntName) || (!targetEntName.contains(keywords) && !matchContacts(keywords, cooperateManageQueryResDto))) {
-                    continue;
-                }
-            }
 
             CooperateManageQueryResVo cooperateManageQueryResVo = new CooperateManageQueryResVo();
             cooperateManageQueryResVo.setId(cooperateManageQueryResDto.getId());

+ 12 - 13
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java

@@ -79,19 +79,19 @@ public class KwmCooperateApplyService {
             return PageHelperUtil.getPageResult(new PageInfo<>());
         }
 
-        List<CooperateManageQueryResVo> cooperateManageQueryResVos = getCooperateManageQueryResVos(reqDto, list);
+        List<CooperateManageQueryResVo> cooperateManageQueryResVos = getCooperateManageQueryResVos(list);
         return PageHelperUtil.getPageResult(new PageInfo<>(cooperateManageQueryResVos), list, reqVo.getPageSize());
     }
 
 
     /**
-     * @param reqDto 入参  list数据
+     * @param   list 数据
      * @return CooperateManageQueryResVo
      * @desc: 组装返参
      * @author: czh
      * @date: 2023/8/2
      */
-    public List<CooperateManageQueryResVo> getCooperateManageQueryResVos(CooperateManageQueryReqDto reqDto, List<CooperateManageQueryResDto> list) {
+    public List<CooperateManageQueryResVo> getCooperateManageQueryResVos(List<CooperateManageQueryResDto> list) {
         //dubbo接口查用户和企业
         Long entId = LoginUserHolder.getEntId();
         List<Long> userIds = list.stream().map(CooperateManageQueryResDto::getCreateBy).distinct().toList();
@@ -115,12 +115,6 @@ public class KwmCooperateApplyService {
         for (CooperateManageQueryResDto cooperateManageQueryResDto : list) {
             Long targetEntId = cooperateManageQueryResDto.getTargetEntId();
             String targetEntName = entMap.get(targetEntId);
-            String keywords = reqDto.getKeywords();
-            if (StringUtils.isNotBlank(keywords)) {
-                if (StringUtils.isBlank(targetEntName) || (!targetEntName.contains(keywords) && !commonBusinessService.matchContacts(keywords, cooperateManageQueryResDto))) {
-                    continue;
-                }
-            }
 
             CooperateManageQueryResVo cooperateManageQueryResVo = new CooperateManageQueryResVo();
             cooperateManageQueryResVo.setId(cooperateManageQueryResDto.getId());
@@ -209,6 +203,13 @@ public class KwmCooperateApplyService {
             }
         }
         cooperateManageQueryReqDto.setCurrentEntIdList(currentEntIdList);
+
+        if (StringUtils.isNotBlank(reqVo.getKeywords())) {
+            List<EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntCacheByName(reqVo.getKeywords());
+            if (CollectionUtils.isNotEmpty(entCacheResDtos)) {
+                cooperateManageQueryReqDto.setTargetEntIdList(entCacheResDtos.stream().map(EntCacheResDto::getId).toList());
+            }
+        }
         return cooperateManageQueryReqDto;
     }
 
@@ -512,7 +513,7 @@ public class KwmCooperateApplyService {
         if (CollectionUtils.isEmpty(list)) {
             return;
         }
-        List<CooperateManageQueryResVo> cooperateManageQueryResVos = getCooperateManageQueryResVos(reqDto, list);
+        List<CooperateManageQueryResVo> cooperateManageQueryResVos = getCooperateManageQueryResVos(list);
         if (CollectionUtils.isEmpty(cooperateManageQueryResVos)) {
             return;
         }
@@ -535,14 +536,12 @@ public class KwmCooperateApplyService {
     public List<FindListGroupResVo> findListGroup(CooperateApplyQueryReqVo reqVo) {
         //初始化分组返参
         List<FindListGroupResVo> result = commonBusinessService.init();
-
-        CooperateManageQueryReqDto reqDto = buildQueryParam(reqVo);
         List<CooperateManageQueryResDto> list = kwmCooperateMapper.findList(buildQueryParam(reqVo));
         if (CollectionUtils.isEmpty(list)) {
             return result;
         }
 
-        List<CooperateManageQueryResVo> cooperateManageQueryResVos = getCooperateManageQueryResVos(reqDto, list);
+        List<CooperateManageQueryResVo> cooperateManageQueryResVos = getCooperateManageQueryResVos(list);
         if (CollectionUtils.isEmpty(cooperateManageQueryResVos)) {
             return result;
         }

+ 9 - 4
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java

@@ -41,7 +41,6 @@ import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.Assert;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -90,7 +89,7 @@ public class KwmCooperateManageService {
         if (CollectionUtils.isEmpty(list)) {
             return PageHelperUtil.getPageResult(new PageInfo<>());
         }
-        List<CooperateManageQueryResVo> cooperateManageQueryResVos = commonBusinessService.getCooperateManageQueryResVos(reqDto, list);
+        List<CooperateManageQueryResVo> cooperateManageQueryResVos = commonBusinessService.getCooperateManageQueryResVos(list);
         return PageHelperUtil.getPageResult(new PageInfo<>(cooperateManageQueryResVos), list, reqVo.getPageSize());
     }
 
@@ -145,6 +144,12 @@ public class KwmCooperateManageService {
         }
         cooperateManageQueryReqDto.setCurrentEntIdList(currentEntIdList);
 
+        if (StringUtils.isNotBlank(reqVo.getKeywords())) {
+            List<EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntCacheByName(reqVo.getKeywords());
+            if (CollectionUtils.isNotEmpty(entCacheResDtos)) {
+                cooperateManageQueryReqDto.setTargetEntIdList(entCacheResDtos.stream().map(EntCacheResDto::getId).toList());
+            }
+        }
         return cooperateManageQueryReqDto;
     }
 
@@ -292,7 +297,7 @@ public class KwmCooperateManageService {
         if (CollectionUtils.isEmpty(list)) {
             return ;
         }
-        List<CooperateManageQueryResVo> cooperateManageQueryResVos = commonBusinessService.getCooperateManageQueryResVos(reqDto, list);
+        List<CooperateManageQueryResVo> cooperateManageQueryResVos = commonBusinessService.getCooperateManageQueryResVos(list);
         if (CollectionUtils.isEmpty(cooperateManageQueryResVos)) {
             return;
         }
@@ -321,7 +326,7 @@ public class KwmCooperateManageService {
         if (CollectionUtils.isEmpty(list)) {
             return result;
         }
-        List<CooperateManageQueryResVo> cooperateManageQueryResVos = commonBusinessService.getCooperateManageQueryResVos(reqDto, list);
+        List<CooperateManageQueryResVo> cooperateManageQueryResVos = commonBusinessService.getCooperateManageQueryResVos(list);
         if (CollectionUtils.isEmpty(cooperateManageQueryResVos)) {
             return result;
         }

+ 87 - 32
sckw-modules/sckw-manage/src/main/resources/mapper/KwmCooperateMapper.xml

@@ -33,36 +33,58 @@
     <select id="findList" parameterType="com.sckw.manage.model.dto.req.CooperateManageQueryReqDto"
             resultType="com.sckw.manage.model.dto.res.CooperateManageQueryResDto">
         SELECT a.id,
-               b.status,
-               group_concat(b.type) types,
-               min(a.ent_id) entId,
-               min(a.invitee_ent_id) inviteeEntId,
-               min(a.inviter_ent_id) inviterEntId,
-               min(a.invitee_contacts) inviteeContacts,
-               min(a.inviter_contacts) inviterContacts,
-               min(a.invitee_contacts_id) inviteeContactsId,
-               min(a.inviter_contacts_id) inviterContactsId,
-               min(a.invitee_phone) inviteePhone,
-               min(a.inviter_phone) inviterPhone,
-               min(b.create_time) createTime,
-               min(b.create_by) createBy,
-               min(a.remark) remark,
-               min(a.approval_remark) approvalRemark,
-               case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.invitee_ent_id) else min(a.inviter_ent_id) end targetEntId,
-               case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.inviter_ent_id) else min(a.invitee_ent_id) end ourEntId,
-               case when min(a.ent_id) = #{reqDto.currentEntId} then 1 else 2 end applyTypeCode
-          FROM kwm_cooperate a
-          LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id
-         WHERE a.del_flag = 0
-           and (a.invitee_ent_id in
+        b.status,
+        group_concat(b.type) types,
+        min(a.ent_id) entId,
+        min(a.invitee_ent_id) inviteeEntId,
+        min(a.inviter_ent_id) inviterEntId,
+        min(a.invitee_contacts) inviteeContacts,
+        min(a.inviter_contacts) inviterContacts,
+        min(a.invitee_contacts_id) inviteeContactsId,
+        min(a.inviter_contacts_id) inviterContactsId,
+        min(a.invitee_phone) inviteePhone,
+        min(a.inviter_phone) inviterPhone,
+        min(b.create_time) createTime,
+        min(b.create_by) createBy,
+        min(a.remark) remark,
+        min(a.approval_remark) approvalRemark,
+        case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.invitee_ent_id) else min(a.inviter_ent_id) end
+        targetEntId,
+        case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.inviter_ent_id) else min(a.invitee_ent_id) end
+        ourEntId,
+        case when min(a.ent_id) = #{reqDto.currentEntId} then 1 else 2 end applyTypeCode
+        FROM kwm_cooperate a
+        LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id
+        WHERE a.del_flag = 0
+          and ((a.invitee_ent_id in
                 <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
-                OR a.inviter_ent_id in
+
+                <if test="reqDto.targetEntIdList != null and reqDto.targetEntIdList.size() > 0">
+                    and (a.inviter_ent_id in
+                    <foreach collection="reqDto.targetEntIdList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                          or a.inviter_contacts like concat('%', #{reqDto.keywords}, '%') or
+                            a.inviter_phone like concat('%', #{reqDto.keywords}, '%')
+                        )
+                </if>
+                ) OR
+               (a.inviter_ent_id in
                 <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
-               )
+                <if test="reqDto.targetEntIdList != null and reqDto.targetEntIdList.size() > 0">
+                    and (a.invitee_ent_id in
+                    <foreach collection="reqDto.targetEntIdList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                        or a.invitee_contacts like concat('%', #{reqDto.keywords}, '%') or
+                        a.invitee_phone like concat('%', #{reqDto.keywords}, '%')
+                        )
+                </if>
+               ))
            <if test="reqDto.startTime != null">
                and b.create_time >= #{reqDto.startTime}
            </if>
@@ -93,6 +115,13 @@
                  #{item}
              </foreach>
          </if>
+        <if test="reqDto.keywords != null and reqDto.keywords != ''">
+            and (a.invitee_contacts like concat('%', #{reqDto.keywords}, '%') or
+                 a.inviter_contacts like concat('%', #{reqDto.keywords}, '%') or
+                 a.invitee_phone like concat('%', #{reqDto.keywords}, '%') or
+                 a.inviter_phone like concat('%', #{reqDto.keywords}, '%')
+                )
+        </if>
          <if test="reqDto.ids != null and reqDto.ids.size() > 0">
              and a.id in
              <foreach collection="reqDto.ids" item="item" open="(" close=")" separator=",">
@@ -153,15 +182,34 @@
         FROM kwm_cooperate a
         LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id and b.status = 1 and b.del_flag = 0
         WHERE a.del_flag = 0
-        and (a.invitee_ent_id in
-            <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
-                #{item}
-            </foreach>
-            OR a.inviter_ent_id in
-            <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
-                #{item}
-            </foreach>
+        and ((a.invitee_ent_id in
+                <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
+                  #{item}
+                </foreach>
+                <if test="reqDto.targetEntIdList != null and reqDto.targetEntIdList.size() > 0">
+                    and (a.inviter_ent_id in
+                    <foreach collection="reqDto.targetEntIdList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                            or a.inviter_contacts like concat('%', #{reqDto.keywords}, '%') or
+                            a.inviter_phone like concat('%', #{reqDto.keywords}, '%')
+                            )
+                </if>
             )
+            OR (a.inviter_ent_id in
+                <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+                <if test="reqDto.targetEntIdList != null and reqDto.targetEntIdList.size() > 0">
+                    and (a.invitee_ent_id in
+                    <foreach collection="reqDto.targetEntIdList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                        or a.invitee_contacts like concat('%', #{reqDto.keywords}, '%') or
+                        a.invitee_phone like concat('%', #{reqDto.keywords}, '%')
+                       )
+                </if>
+            ))
         <if test="reqDto.startTime != null">
             and b.create_time >= #{reqDto.startTime}
         </if>
@@ -192,6 +240,13 @@
                 #{item}
             </foreach>
         </if>
+        <if test="reqDto.keywords != null">
+            and (a.invitee_contacts like concat('%', #{reqDto.keywords}, '%') or
+                 a.inviter_contacts like concat('%', #{reqDto.keywords}, '%') or
+                 a.invitee_phone like concat('%', #{reqDto.keywords}, '%') or
+                 a.inviter_phone like concat('%', #{reqDto.keywords}, '%')
+                )
+        </if>
         <if test="reqDto.ids != null and reqDto.ids.size() > 0">
             and a.id in
             <foreach collection="reqDto.ids" item="item" open="(" close=")" separator=",">