czh 2 yıl önce
ebeveyn
işleme
c510d87c96

+ 8 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteUserService.java

@@ -211,4 +211,12 @@ public interface RemoteUserService {
      * @date: 2023/9/20
      */
     List<FindEntUserResDto> findEntUser(Long entId);
+
+    /**
+     * @param code 区域code
+     * @desc: 查某区域下的所有区域
+     * @author: czh
+     * @date: 2023/10/8
+     */
+    List<AreaTreeFrontResDto> findAllArea(Integer code);
 }

+ 1 - 1
sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractLogisticsMapper.xml

@@ -107,7 +107,7 @@
                e.firm_name carrierEntName,
                a.performed_amount performedAmount,
                a.contract_pid contractPid,
-               f.name contractPname,
+               f.name contractPname
           from kwc_contract_logistics a
           left join kwc_contract_logistics_unit b on a.id = b.contract_id and b.del_flag = 0 and b.unit_type = 3
           left join kwc_contract_logistics_unit e on a.id = e.contract_id and e.del_flag = 0 and e.unit_type = 4

+ 5 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/req/AddressQueryReqVo.java

@@ -27,6 +27,11 @@ public class AddressQueryReqVo extends PageRequest implements Serializable {
      */
     private Integer cityCode;
 
+    /**
+     * 所属区域
+     */
+    private List<Integer> cityCodeList;
+
     /**
      * 地址名称、详细地址
      */

+ 17 - 2
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java

@@ -2,6 +2,7 @@ package com.sckw.manage.service;
 
 import java.io.IOException;
 import java.util.*;
+import java.util.stream.Collectors;
 
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -33,6 +34,8 @@ import com.sckw.manage.model.vo.res.AddressQueryResVo;
 import com.sckw.stream.enums.MessageEnum;
 import com.sckw.stream.model.UserInfo;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
+import com.sckw.system.api.model.dto.res.AreaTreeFrontResDto;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
@@ -66,6 +69,9 @@ public class KwmAddressService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteUserService remoteUserService;
+
     @Autowired
     private StreamBridge streamBridge;
 
@@ -77,6 +83,16 @@ public class KwmAddressService {
      * @date: 2023/7/12
      */
     public PageResult queryByPage(AddressQueryReqVo reqVo) {
+        Integer cityCode = reqVo.getCityCode();
+        List<Integer> cityCodeList = new ArrayList<>();
+        if (Objects.nonNull(cityCode)) {
+            cityCodeList.add(cityCode);
+            List<AreaTreeFrontResDto> allArea = remoteUserService.findAllArea(cityCode);
+            if (CollectionUtils.isNotEmpty(allArea)) {
+                cityCodeList.addAll(allArea.stream().map(AreaTreeFrontResDto::getCode).distinct().toList());
+            }
+        }
+        reqVo.setCityCodeList(cityCodeList);
         PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
         List<KwmAddress> kwmAddressList = findList(reqVo);
         if (CollectionUtils.isEmpty(kwmAddressList)) {
@@ -95,7 +111,7 @@ public class KwmAddressService {
      */
     private List<KwmAddress> findList(AddressQueryReqVo reqVo) {
         LambdaQueryWrapper<KwmAddress> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(Objects.nonNull(reqVo.getCityCode()), KwmAddress::getCityCode, reqVo.getCityCode()).
+        wrapper.in(Objects.nonNull(reqVo.getCityCode()), KwmAddress::getCityCode, reqVo.getCityCodeList()).
                 eq(Objects.nonNull(reqVo.getType()), KwmAddress::getType, reqVo.getType()).
                 eq(KwmAddress::getDelFlag, Global.NO).
                 and(StringUtils.isNotBlank(reqVo.getKeywords()),
@@ -113,7 +129,6 @@ public class KwmAddressService {
 
         if (StringUtils.isNotBlank(reqVo.getIds())) {
             wrapper.in(KwmAddress::getId, StringUtils.splitStrToList(reqVo.getIds(), Long.class));
-
         }
 
         if (!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode())) {

+ 20 - 22
sckw-modules/sckw-manage/src/main/resources/mapper/KwmCooperateMapper.xml

@@ -75,18 +75,18 @@
                    #{item}
                </foreach>
            </if>
-           <if test="reqDto.cooperateTypes != null and reqDto.cooperateTypes.size() > 0">
-               and exists (select 1
-                             from kwm_cooperate_type c
-                            where c.cooperate_id = a.id
-                               and c.status = b.status
-                               and c.del_flag = 0
-                              and c.type in
-                            <foreach collection="reqDto.cooperateTypes" item="item" open="(" close=")" separator=",">
-                               #{item}
-                           </foreach>
-                          )
+            <if test="reqDto.cooperateTypes != null and reqDto.cooperateTypes.size() > 0">
+                <foreach collection="reqDto.cooperateTypes" item="item">
+                    and exists (select 1
+                                  from kwm_cooperate_type c
+                                 where c.cooperate_id = a.id
+                                   and c.status = b.status
+                                   and c.del_flag = 0
+                                   and c.type = #{item}
+                    )
+                </foreach>
            </if>
+
          <if test="reqDto.status != null and reqDto.status.size() > 0">
              and b.status in
              <foreach collection="reqDto.status" item="item" open="(" close=")" separator=",">
@@ -207,18 +207,16 @@
                 #{item}
             </foreach>
         </if>
-
         <if test="reqDto.cooperateTypes != null and reqDto.cooperateTypes.size() > 0">
-            and exists (select 1
-                            from kwm_cooperate_type c
-                            where c.cooperate_id = a.id
-                              and c.status = 1
-                                and c.del_flag = 0
-                            and c.type in
-                        <foreach collection="reqDto.cooperateTypes" item="item" open="(" close=")" separator=",">
-                            #{item}
-                        </foreach>
-                        )
+            <foreach collection="reqDto.cooperateTypes" item="item">
+                and exists (select 1
+                              from kwm_cooperate_type c
+                             where c.cooperate_id = a.id
+                               and c.status = 1
+                               and c.del_flag = 0
+                               and c.type = #{item}
+                            )
+            </foreach>
         </if>
         <if test="reqDto.status != null and reqDto.status.size() > 0">
             and a.status in

+ 3 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/SysAreaDao.java

@@ -2,6 +2,7 @@ package com.sckw.system.dao;
 
 import com.sckw.system.model.SysArea;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -19,4 +20,6 @@ public interface SysAreaDao {
     SysArea selectById(Integer code);
 
     List<SysArea> selectByIds(List<Integer> list);
+
+    List<SysArea> findAllArea(@Param(value = "code") Integer code);
 }

+ 20 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteUserServiceImpl.java

@@ -15,6 +15,7 @@ import com.sckw.system.api.model.dto.req.*;
 import com.sckw.system.api.model.dto.res.*;
 import com.sckw.system.dao.KwsEnterpriseDao;
 import com.sckw.system.dao.KwsUserLoginDao;
+import com.sckw.system.dao.SysAreaDao;
 import com.sckw.system.dao.SysDictDao;
 import com.sckw.system.model.*;
 import com.sckw.system.model.pojo.FindEntUserPojo;
@@ -64,6 +65,9 @@ public class RemoteUserServiceImpl implements RemoteUserService {
     @Resource
     private SysDictDao sysDictDao;
 
+    @Resource
+    private SysAreaDao sysAreaDao;
+
     @Resource
     private CommonService commonService;
 
@@ -237,6 +241,22 @@ public class RemoteUserServiceImpl implements RemoteUserService {
     }
 
 
+    /**
+     * @param code 区域code
+     * @desc: 查某区域下的所有区域
+     * @author: czh
+     * @date: 2023/10/8
+     */
+    @Override
+    public List<AreaTreeFrontResDto> findAllArea(Integer code) {
+        List<SysArea> list = sysAreaDao.findAllArea(code);
+        if (CollectionUtils.isEmpty(list)) {
+            return Collections.emptyList();
+        }
+        return BeanUtils.copyToList(list, AreaTreeFrontResDto.class);
+    }
+
+
     /**
      * 根据用户名查用户信息
      * @param username 用户账号

+ 1 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java

@@ -372,6 +372,7 @@ public class KwsUserService {
      */
     public List<KwsUserResVo> findPage(Map<String, Object> params) {
         params.put("entId", LoginUserHolder.getEntId());
+        params.put("isMain", Global.NO);
         return kwsUserDao.findPage(params);
     }
 

+ 2 - 2
sckw-modules/sckw-system/src/main/resources/mapper/KwsUserDao.xml

@@ -258,8 +258,8 @@
     <if test="email != null and email != ''">
       and su.email = #{email, jdbcType=VARCHAR}
     </if>
-    <if test="isMain != null and isMain != ''">
-      and su.is_main = #{isMain, jdbcType=INTEGER}
+    <if test="isMain != null">
+      and su.is_main = #{isMain}
     </if>
     <if test="deptId != null and deptId != ''">
       and c.id = #{deptId, jdbcType=VARCHAR}

+ 7 - 0
sckw-modules/sckw-system/src/main/resources/mapper/SysAreaDao.xml

@@ -68,4 +68,11 @@
         #{item}
       </foreach>
     </select>
+
+  <select id="findAllArea" resultType="com.sckw.system.model.SysArea">
+    select a.*
+      from sys_area a
+     where a.pcode = #{code} or a.province_code = #{code}
+  </select>
+
 </mapper>