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

+ 9 - 0
sckw-modules-api/sckw-manage-api/src/main/java/com/sckw/manage/api/RemoteManageService.java

@@ -31,4 +31,13 @@ public interface RemoteManageService {
      */
     List<FindEntCooperateResVo> findEntCooperate(Long entId, Long targetEntId, Integer cooperateType);
 
+    /**
+     * @param entId 集团企业id
+     * @return FindEntCooperateResVo
+     * @desc: 查询集团企业包括其主体单位下的合作单位所属的集团企业
+     * @author: czh
+     * @date: 2023/9/1
+     */
+    List<FindEntCooperateResVo> findAllCooperateEnt(Long entId);
+
 }

+ 5 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/res/EntCacheResDto.java

@@ -95,4 +95,9 @@ public class EntCacheResDto implements Serializable {
      */
     private String cityName;
 
+    /**
+     * 联系人id
+     */
+    private Long contactsId;
+
 }

+ 6 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dubbo/RemoteContractServiceImpl.java

@@ -75,6 +75,9 @@ public class RemoteContractServiceImpl implements RemoteContractService {
     public void updatePerformed(Long contractId, BigDecimal performedAmount) {
         KwcContractLogistics kwcContractLogistics = kwcContractLogisticsMapper.selectById(contractId);
         if (Objects.nonNull(kwcContractLogistics)) {
+            if (kwcContractLogistics.getStatus().equals(ContractStatusEnum.COMPLETE.getCode())) {
+                return;
+            }
             kwcContractLogistics.setPerformedAmount(kwcContractLogistics.getPerformedAmount().add(performedAmount));
             kwcContractLogisticsMapper.updateById(kwcContractLogistics);
             return;
@@ -82,6 +85,9 @@ public class RemoteContractServiceImpl implements RemoteContractService {
 
         KwcContractTrade kwcContractTrade = kwcContractTradeMapper.selectById(contractId);
         if (Objects.nonNull(kwcContractTrade)) {
+            if (kwcContractTrade.getStatus().equals(ContractStatusEnum.COMPLETE.getCode())) {
+                return;
+            }
             kwcContractTrade.setPerformedAmount(kwcContractTrade.getPerformedAmount().add(performedAmount));
             kwcContractTradeMapper.updateById(kwcContractTrade);
         }

+ 63 - 4
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/dubbo/RemoteManageServiceImpl.java

@@ -9,16 +9,19 @@ import com.sckw.manage.api.model.dto.res.EntAddressResDto;
 import com.sckw.manage.api.model.dto.res.FindEntCooperateResVo;
 import com.sckw.manage.dao.KwmAddressMapper;
 import com.sckw.manage.model.entity.KwmAddress;
+import com.sckw.manage.model.entity.KwmCooperate;
+import com.sckw.manage.model.vo.req.FindCooperateByEntReqVo;
 import com.sckw.manage.model.vo.req.FindEntCooperateReqVo;
+import com.sckw.manage.model.vo.res.FindCooperateByEntResVo;
 import com.sckw.manage.service.KwmCooperateManageService;
+import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.apache.dubbo.config.annotation.DubboService;
 import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -35,6 +38,9 @@ public class RemoteManageServiceImpl implements RemoteManageService {
     @Autowired
     private KwmCooperateManageService kwmCooperateManageService;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteSystemService remoteSystemService;
+
     /**
      * @param idList 企业id集合
      * @return Map<Long, List<EntAddressResDto>>
@@ -69,4 +75,57 @@ public class RemoteManageServiceImpl implements RemoteManageService {
         }
         return BeanUtils.copyToList(entCooperate, FindEntCooperateResVo.class);
     }
+
+
+    /**
+     * @param entId 集团企业id
+     * @return FindEntCooperateResVo
+     * @desc: 查询集团企业包括其主体单位下的合作单位所属的集团企业
+     * @author: czh
+     * @date: 2023/9/1
+     */
+    @Override
+    public List<FindEntCooperateResVo> findAllCooperateEnt(Long entId) {
+        if (Objects.isNull(entId)) {
+            return Collections.emptyList();
+        }
+        List<Long> ourEntIds = new ArrayList<>();
+        ourEntIds.add(entId);
+        EntCacheResDto entCacheResDto = remoteSystemService.queryEntTreeById(entId);
+        if (Objects.nonNull(entCacheResDto)) {
+            List<EntCacheResDto> child = entCacheResDto.getChild();
+            if (CollectionUtils.isNotEmpty(child)) {
+                ourEntIds.addAll(child.stream().map(EntCacheResDto::getId).toList());
+            }
+        }
+
+        //获取当前集团下所有的企业id,遍历,找到合作单位
+        List<Long> list = new ArrayList<>();
+        List<FindEntCooperateResVo> findEntCooperateResVoList = new ArrayList<>();
+        for (Long ourEntId : ourEntIds) {
+            FindCooperateByEntReqVo findCooperateByEntReqVo = new FindCooperateByEntReqVo();
+            findCooperateByEntReqVo.setEntId(ourEntId);
+            List<FindCooperateByEntResVo> cooperateByEnt = kwmCooperateManageService.findCooperateByEnt(findCooperateByEntReqVo);
+            if (CollectionUtils.isNotEmpty(cooperateByEnt)) {
+                List<Long> targetEntIds = cooperateByEnt.stream().map(FindCooperateByEntResVo::getTargetEntId).toList();
+                Map<Long, EntCacheResDto> longEntCacheResDtoMap = remoteSystemService.queryEntTreeByIds(targetEntIds);
+                for (Long targetEntId : targetEntIds) {
+                    EntCacheResDto entCacheResDto1 = longEntCacheResDtoMap.get(targetEntId);
+                    if (Objects.nonNull(entCacheResDto1)) {
+                        Long id = entCacheResDto1.getId();
+                        if (list.contains(id)) {
+                            continue;
+                        }
+                        list.add(id);
+                        FindEntCooperateResVo findEntCooperateResVo = new FindEntCooperateResVo();
+                        findEntCooperateResVo.setEntId(id);
+                        findEntCooperateResVo.setEntName(entCacheResDto1.getFirmName());
+                        findEntCooperateResVoList.add(findEntCooperateResVo);
+                    }
+                }
+            }
+        }
+
+        return findEntCooperateResVoList;
+    }
 }

+ 17 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java

@@ -588,4 +588,21 @@ public class KwmCooperateManageService {
         }
         return findCooperateByEntResVos;
     }
+
+
+    /**
+     * @param entId 发起合作的企业id
+     * @return KwmCooperate
+     * @desc: 根据发起合作的企业查询
+     * @author: czh
+     * @date: 2023/9/1
+     */
+    public List<KwmCooperate> findCooperateByInitEnt(Long entId) {
+        LambdaQueryWrapper<KwmCooperate> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwmCooperate::getEntId, entId).
+                eq(KwmCooperate::getDelFlag, Global.NO).
+                eq(KwmCooperate::getStatus, CooperateStatusEnum.OK.getCode());
+        return kwmCooperateMapper.selectList(wrapper);
+    }
+
 }

+ 10 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java

@@ -11,6 +11,7 @@ import com.sckw.system.dao.KwsEntTypeDao;
 import com.sckw.system.model.*;
 import com.sckw.system.model.vo.res.CertificateResVo;
 import com.sckw.system.model.vo.res.KwsDeptResVo;
+import com.sckw.system.model.vo.res.KwsUserResVo;
 import com.sckw.system.service.KwsDeptService;
 import com.sckw.system.service.KwsEnterpriseService;
 import com.sckw.system.service.KwsRoleService;
@@ -61,7 +62,15 @@ public class RemoteBaseService {
     }
 
     public KwsUserResDto getUserByAccount(String username) {
-        return null;
+        KwsUser kwsUser = new KwsUser();
+        kwsUser.setAccount(username);
+        List<KwsUserResVo> list = kwsUserService.findList(kwsUser);
+        if (CollectionUtils.isEmpty(list)) {
+            return null;
+        }
+        KwsUserResDto kwsUserResDto = new KwsUserResDto();
+        BeanUtils.copyProperties(list.get(0), kwsUserResDto);
+        return kwsUserResDto;
     }
 
     public List<KwsUserDeptResDto> queryUserDeptByUserId(Long userId) {

+ 4 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -282,6 +282,10 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
             BeanUtils.copyProperties(kwsEnterpriseResDto, entCacheResDto);
             entCacheResDto.setDeptInfo(remoteBaseService.queryDeftInfoByEntId(entId));
             entCacheResDto.setCertificateInfo(remoteBaseService.queryCertificateByEntId(entId));
+            KwsUserResDto userByAccount = remoteBaseService.getUserByAccount(kwsEnterpriseResDto.getPhone());
+            if (Objects.nonNull(userByAccount)) {
+                entCacheResDto.setContactsId(userByAccount.getId());
+            }
             List<EntTypeResDto> entTypeResDtos = remoteBaseService.queryEntTypeById(entId);
             if (CollectionUtils.isNotEmpty(entTypeResDtos)) {
                 entCacheResDto.setEntTypes(String.join(Global.COMMA, entTypeResDtos.stream().map(EntTypeResDto::getType).map(String::valueOf).distinct().toList()));