Quellcode durchsuchen

合作单位+地址dubbo接口

czh vor 2 Jahren
Ursprung
Commit
8f275331df

+ 35 - 0
sckw-modules-api/sckw-manage-api/pom.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>sckw-modules-api</artifactId>
+        <groupId>com.sckw</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>sckw-manage-api</artifactId>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-openfeign-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-common-core</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

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

@@ -0,0 +1,24 @@
+package com.sckw.manage.api;
+
+import com.sckw.manage.api.model.dto.res.EntAddressResDto;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author czh
+ * @desc 基础信息+合作管理远程接口
+ * @date 2023/7/31
+ */
+public interface RemoteManageService {
+
+    /**
+     * @param idList 企业id集合
+     * @return Map<Long, List<EntAddressResDto>>
+     * @desc: 根据企业id查下面的地址
+     * @author: czh
+     * @date: 2023/7/31
+     */
+    Map<Long, List<EntAddressResDto>> queryEntAddressByEntIdList(List<Long> idList);
+
+}

+ 74 - 0
sckw-modules-api/sckw-manage-api/src/main/java/com/sckw/manage/api/model/dto/res/EntAddressResDto.java

@@ -0,0 +1,74 @@
+package com.sckw.manage.api.model.dto.res;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author czh
+ * @desc 企业地址
+ * @date 2023/7/31
+ */
+@Data
+public class EntAddressResDto implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -7929121414731623227L;
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 企业id
+     */
+    private Long entId;
+
+    /**
+     * 地址名称
+     */
+    private String name;
+
+    /**
+     * 地址类型
+     */
+    private Integer type;
+
+    /**
+     * 1 默认装货地址 2默认卸货地址 3都是
+     */
+    private Integer defaultType;
+
+    /**
+     * 所在地区
+     */
+    private Integer cityCode;
+
+    /**
+     * 所属区域名称
+     */
+    private String cityName;
+
+    /**
+     * 详细地址
+     */
+    private String detailAddress;
+
+    /**
+     * 纬度
+     */
+    private String lat;
+
+    /**
+     * 经度
+     */
+    private String lng;
+
+    /**
+     * 电子围栏
+     */
+    private String fence;
+
+}

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

@@ -1,11 +1,9 @@
 package com.sckw.contract.dubbo;
-import com.google.common.collect.Lists;
 
 import com.sckw.contract.api.RemoteContractService;
 import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
 import com.sckw.contract.api.model.dto.res.EntInfo;
 import com.sckw.contract.dao.KwcContractLogisticsMapper;
-import com.sckw.contract.dao.KwcContractLogisticsUnitMapper;
 import com.sckw.contract.dao.KwcContractTradeMapper;
 import com.sckw.contract.model.entity.KwcContractLogistics;
 import com.sckw.contract.model.entity.KwcContractLogisticsUnit;

+ 6 - 2
sckw-modules/sckw-manage/pom.xml

@@ -62,7 +62,11 @@
             <groupId>com.sckw</groupId>
             <artifactId>sckw-common-excel</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-manage-api</artifactId>
+            <version>1.0.0</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
-
 </project>

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

@@ -125,4 +125,9 @@ public class KwmAddressController {
         return HttpResult.ok(kwmAddressService.detail(reqVo.getId()));
     }
 
+    @PostMapping("test")
+    public HttpResult test(@RequestBody IdsReqVo reqVo) throws SystemException {
+        return HttpResult.ok(kwmAddressService.test(reqVo.getId()));
+    }
+
 }

+ 53 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/dubbo/RemoteManageServiceImpl.java

@@ -0,0 +1,53 @@
+package com.sckw.manage.dubbo;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.sckw.core.model.constant.Global;
+import com.sckw.core.utils.BeanUtils;
+import com.sckw.core.utils.CollectionUtils;
+import com.sckw.manage.api.RemoteManageService;
+import com.sckw.manage.api.model.dto.res.EntAddressResDto;
+import com.sckw.manage.dao.KwmAddressMapper;
+import com.sckw.manage.model.entity.KwmAddress;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author czh
+ * @desc 基础信息+合作管理远程接口实现
+ * @date 2023/7/31
+ */
+@DubboService(group = "design", version = "2.0.0")
+@Service
+public class RemoteManageServiceImpl implements RemoteManageService {
+
+    @Autowired
+    private KwmAddressMapper kwmAddressMapper;
+
+    /**
+     * @param idList 企业id集合
+     * @return Map<Long, List<EntAddressResDto>>
+     * @desc: 根据企业id查下面的地址
+     * @author: czh
+     * @date: 2023/7/31
+     */
+    @Override
+    public Map<Long, List<EntAddressResDto>> queryEntAddressByEntIdList(List<Long> idList) {
+        Map<Long, List<EntAddressResDto>> map = new HashMap<>();
+        LambdaQueryWrapper<KwmAddress> kwmAddressLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        kwmAddressLambdaQueryWrapper.in(KwmAddress::getEntId, idList).
+                                     eq(KwmAddress::getDelFlag, Global.NO);
+        List<KwmAddress> kwmAddressList = kwmAddressMapper.selectList(kwmAddressLambdaQueryWrapper);
+        if (CollectionUtils.isEmpty(kwmAddressList)) {
+            return map;
+        }
+
+        List<EntAddressResDto> entAddressResDtoList= BeanUtils.copyToList(kwmAddressList, EntAddressResDto.class);
+        return entAddressResDtoList.stream().collect(Collectors.groupingBy(EntAddressResDto::getEntId));
+    }
+}

+ 8 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java

@@ -20,7 +20,9 @@ import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.excel.utils.EasyExcelUtil;
+import com.sckw.manage.api.model.dto.res.EntAddressResDto;
 import com.sckw.manage.dao.KwmAddressMapper;
+import com.sckw.manage.dubbo.RemoteManageServiceImpl;
 import com.sckw.manage.model.entity.KwmAddress;
 import com.sckw.manage.model.vo.req.*;
 import com.sckw.manage.model.vo.res.AddressDetailResVo;
@@ -47,6 +49,8 @@ public class KwmAddressService {
     @Autowired
     private CommonBusinessService commonBusinessService;
 
+    @Autowired
+    private RemoteManageServiceImpl remoteManageService;
     /**
      * @param reqVo 分页入参
      * @return HttpResult
@@ -366,4 +370,8 @@ public class KwmAddressService {
         BeanUtils.copyProperties(kwmAddress, addressDetailResVo);
         return addressDetailResVo;
     }
+
+    public Map<Long, List<EntAddressResDto>> test(Long id) {
+        return remoteManageService.queryEntAddressByEntIdList(Collections.singletonList(id));
+    }
 }

+ 6 - 3
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -104,7 +104,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
             RedissonUtils.putString(key, JSON.toJSONString(sysDictResDtos), Global.COMMON_EXPIRE);
             return sysDictResDtos;
         }
-
+        RedissonUtils.putString(key, dictCache, Global.COMMON_EXPIRE);
         return JSONObject.parseArray(dictCache, SysDictResDto.class);
     }
 
@@ -130,6 +130,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
             RedissonUtils.putString(key, JSON.toJSONString(sysDictResDto), Global.COMMON_EXPIRE);
             return sysDictResDto;
         }
+        RedissonUtils.putString(key, dictCache, Global.COMMON_EXPIRE);
         return JSONObject.parseObject(dictCache, SysDictResDto.class);
     }
 
@@ -228,6 +229,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
             RedissonUtils.putString(key, JSON.toJSONString(sysDictGroupResDto), Global.COMMON_EXPIRE);
             return sysDictGroupResDto;
         }
+        RedissonUtils.putString(key, dictCache, Global.COMMON_EXPIRE);
         return JSONObject.parseObject(dictCache, SysDictGroupResDto.class);
     }
 
@@ -261,7 +263,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
             RedissonUtils.putString(key, JSON.toJSONString(entCacheResDto), Global.COMMON_EXPIRE);
             return entCacheResDto;
         }
-
+        RedissonUtils.putString(key, dictCache, Global.COMMON_EXPIRE);
         return JSONObject.parseObject(dictCache, EntCacheResDto.class);
     }
 
@@ -413,7 +415,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
             RedissonUtils.putString(key, JSON.toJSONString(userCacheResDto), Global.COMMON_EXPIRE);
             return userCacheResDto;
         }
-
+        RedissonUtils.putString(key, dictCache, Global.COMMON_EXPIRE);
         return JSONObject.parseObject(dictCache, UserCacheResDto.class);
     }
 
@@ -456,6 +458,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
             RedissonUtils.putString(key, JSON.toJSONString(sysAreaCacheResDto), Global.COMMON_EXPIRE);
             return sysAreaCacheResDto;
         }
+        RedissonUtils.putString(key, areaCache, Global.COMMON_EXPIRE);
         return JSONObject.parseObject(areaCache, SysAreaCacheResDto.class);
     }