Browse Source

dubbo加判空

18482106067 2 years ago
parent
commit
86ce28bc16

+ 1 - 1
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteSystemService.java

@@ -207,5 +207,5 @@ public interface RemoteSystemService {
      * @author zk
      * @date 2023/8/10
      **/
-    KwsUserResDto queryUserDetails(String account, int systemType);
+    KwsUserResDto queryUserDetails(String account, Integer systemType);
 }

+ 11 - 1
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java

@@ -398,11 +398,22 @@ public class KwcContractTradeService {
             //创建合同
             id = addTradeContract(reqVo);
             changeToSubmit(id);
+            sign(reqVo, id);
             return id;
         }
         update(reqVo);
         changeToSubmit(id);
+        sign(reqVo, id);
+        return id;
+    }
 
+    /**
+     * @param reqVo 入参 id合同id
+     * @desc: 签约
+     * @author: czh
+     * @date: 2023/8/18
+     */
+    private void sign(ContractTradeReqVo reqVo, Long id) {
         if (DictEnum.SIGNING_WAY_1.getValue().equals(String.valueOf(reqVo.getBaseInfo().getSigningWay()))) {
             if (DictEnum.SIGNING_WAY_1.getValue().equals(String.valueOf(reqVo.getBaseInfo().getSigningWay()))) {
                 commonBusinessService.postToEsign(reqVo.getBaseInfo().getProvidePhone(),
@@ -422,7 +433,6 @@ public class KwcContractTradeService {
             eSignCallBackReqVo.setStatus(ContractStatusEnum.SIGNED.getCode());
             commonBusinessService.approval(eSignCallBackReqVo);
         }
-        return id;
     }
 
 

+ 73 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -52,6 +52,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public Map<String, SysDictResDto> queryDictMapByTypeValues(String keys) {
+        if (StringUtils.isBlank(keys)) {
+            return null;
+        }
         Map<String, SysDictResDto> map = new HashMap<>();
         String[] typeValueArr = keys.split(Global.COMMA);
         for (String typeValue : typeValueArr) {
@@ -74,6 +77,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public Map<String, SysDictResDto> queryDictMapByType(String type) {
+        if (StringUtils.isBlank(type)) {
+            return null;
+        }
         List<SysDictResDto> sysDictResDtos = queryDictByType(type);
         if (CollectionUtils.isEmpty(sysDictResDtos)) {
             return Collections.emptyMap();
@@ -91,6 +97,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public List<SysDictResDto> queryDictByType(String type) {
+        if (StringUtils.isBlank(type)) {
+            return Collections.emptyList();
+        }
         String key = Global.REDIS_SYS_DICT_TYPE_PREFIX + type;
         String dictCache = RedissonUtils.getString(key);
         //从redis查,查不到从数据库查,并写入redis
@@ -116,6 +125,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public SysDictResDto queryDictByTypeAndValue(String type, String value) {
+        if (StringUtils.isBlank(type) || StringUtils.isBlank(value)) {
+            return null;
+        }
         String key = Global.REDIS_SYS_DICT_PREFIX + type + Global.POUND + value;
         String dictCache = RedissonUtils.getString(key);
         //从redis查,查不到从数据库查,并写入redis
@@ -142,6 +154,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public List<SysDictGroupResDto> queryDictGroupByType(String type) {
+        if (StringUtils.isBlank(type)) {
+            return Collections.emptyList();
+        }
         List<SysDict> sysDicts = sysDictDao.queryByType(type);
         if (CollectionUtils.isEmpty(sysDicts)) {
             return Collections.emptyList();
@@ -174,6 +189,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public List<SysDictResDto> queryDictBottom(String type, String value) {
+        if (StringUtils.isBlank(type) || StringUtils.isBlank(value)) {
+            return Collections.emptyList();
+        }
         SysDictGroupResDto sysDictGroupResDto = queryDictGroupByTypeAndValue(type, value);
         if (Objects.isNull(sysDictGroupResDto)) {
             return Collections.emptyList();
@@ -188,6 +206,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
     }
 
     private List<SysDictGroupResDto> checkNextLevelDict(List<SysDictGroupResDto> list) {
+        if (CollectionUtils.isEmpty(list)) {
+            return Collections.emptyList();
+        }
         List<SysDictGroupResDto> sysDictGroupResDtos = list.stream().filter(item -> CollectionUtils.isNotEmpty(item.getChild())).toList();
         if (CollectionUtils.isEmpty(sysDictGroupResDtos)) {
             return list;
@@ -209,6 +230,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public SysDictGroupResDto queryDictGroupByTypeAndValue(String type, String value) {
+        if (StringUtils.isBlank(type) || StringUtils.isBlank(value)) {
+            return null;
+        }
         String key = Global.REDIS_SYS_DICT_GROUP_PREFIX + type + Global.POUND + value;
         String dictCache = RedissonUtils.getString(key);
         //从redis查,查不到从数据库查,并写入redis
@@ -242,6 +266,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public EntCacheResDto queryEntCacheById(Long entId) {
+        if (Objects.isNull(entId)) {
+            return null;
+        }
         String key = Global.REDIS_ENTERPRISE_PREFIX + entId;
         String dictCache = RedissonUtils.getString(key);
         //从redis查,查不到从数据库查,并写入redis
@@ -275,6 +302,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public List<EntCacheResDto> queryEntCacheByName(String entName) {
+        if (StringUtils.isBlank(entName)) {
+            return Collections.emptyList();
+        }
         List<KwsEnterprise> kwsEnterprises = remoteBaseService.queryEntByName(entName);
         if (CollectionUtils.isEmpty(kwsEnterprises)) {
             return Collections.emptyList();
@@ -299,6 +329,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      */
     @Override
     public Map<Long, EntCacheResDto> queryEntTreeByIds(List<Long> entIdList) {
+        if (CollectionUtils.isEmpty(entIdList)) {
+            return null;
+        }
         Map<Long, EntCacheResDto> result = new HashMap<>(4);
         for (Long entId : entIdList) {
             EntCacheResDto entCacheResDto = queryEntCacheById(entId);
@@ -334,6 +367,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
     @Override
     public EntCacheResDto queryEntTreeById(Long entId) {
+        if (Objects.isNull(entId)) {
+            return null;
+        }
         Map<Long, EntCacheResDto> longEntCacheResDtoMap = queryEntTreeByIds(Collections.singletonList(entId));
         if (longEntCacheResDtoMap.isEmpty()) {
             return null;
@@ -358,6 +394,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
     @Override
     public Map<Long, List<EntCacheResDto>> queryEntDeptCacheByIds(List<Long> entIds) {
+        if (CollectionUtils.isEmpty(entIds)) {
+            return null;
+        }
         List<KwsEntDept> kwsEntDepts = remoteBaseService.queryEntDeptCacheByIds(entIds);
         if (CollectionUtils.isEmpty(kwsEntDepts)) {
             return Collections.emptyMap();
@@ -376,6 +415,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
     @Override
     public Map<Long, EntCacheResDto> queryEntCacheMapByIds(List<Long> entIds) {
+        if (CollectionUtils.isEmpty(entIds)) {
+            return null;
+        }
         List<EntCacheResDto> entCacheResDtos = queryEntCacheByIds(entIds);
         if (CollectionUtils.isEmpty(entCacheResDtos)) {
             return Collections.emptyMap();
@@ -385,6 +427,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
     @Override
     public UserCacheResDto queryUserCacheById(Long userId) {
+        if (Objects.isNull(userId)) {
+            return null;
+        }
         String key = Global.REDIS_USER_PREFIX + userId;
         String dictCache = RedissonUtils.getString(key);
         //从redis查,查不到从数据库查,并写入redis
@@ -444,6 +489,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
     @Override
     public Map<Long, UserCacheResDto> queryUserCacheMapByIds(List<Long> userIds) {
+        if (CollectionUtils.isEmpty(userIds)) {
+            return null;
+        }
         List<UserCacheResDto> userCacheResDtos = queryUserCacheByIds(userIds);
         if (CollectionUtils.isEmpty(userCacheResDtos)) {
             return Collections.emptyMap();
@@ -453,6 +501,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
     @Override
     public SysAreaCacheResDto queryAreaCacheById(Integer code) {
+        if (Objects.isNull(code)) {
+            return null;
+        }
         String key = Global.REDIS_AREA_PREFIX + code;
         String areaCache = RedissonUtils.getString(key);
         //从redis查,查不到从数据库查,并写入redis
@@ -472,6 +523,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
     @Override
     public List<AreaTreeFrontResDto> queryAreaTreeFrontByCodeList(List<Integer> list) {
+        if (CollectionUtils.isEmpty(list)) {
+            return Collections.emptyList();
+        }
         List<SysArea> sysAreas = sysAreaService.selectByIds(list);
         if (CollectionUtils.isEmpty(sysAreas)) {
             return Collections.emptyList();
@@ -509,6 +563,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
     @Override
     public UserCacheResDto queryManagerInfoByEntId(Long entId) {
+        if (Objects.isNull(entId)) {
+            return null;
+        }
         KwsEnterpriseResDto kwsEnterpriseResDto = remoteBaseService.queryEnterpriseById(entId);
         if (Objects.isNull(kwsEnterpriseResDto) || Objects.isNull(kwsEnterpriseResDto.getManager())) {
             return null;
@@ -525,6 +582,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      * @date: 2023/7/7
      */
     private List<SysDictGroupResDto> getChild(Long id, List<SysDict> list) {
+        if (Objects.isNull(id) || CollectionUtils.isEmpty(list)) {
+            return Collections.emptyList();
+        }
         List<SysDictGroupResDto> child = new ArrayList<>();
         for (SysDict sysDict : list) {
             if (sysDict.getParentId().equals(String.valueOf(id))) {
@@ -551,6 +611,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      * @date: 2023/7/31
      */
     public List<FindAreaTreeResVo> queryAreaTree(Integer code) {
+        if (Objects.isNull(code)) {
+            return Collections.emptyList();
+        }
         String key = Global.REDIS_GROUP_AREA_PREFIX + code;
         String areaCache = RedissonUtils.getString(key);
         if (StringUtils.isBlank(areaCache)) {
@@ -570,6 +633,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      * @date: 2023/7/31
      */
     private List<FindAreaTreeResVo> queryAreaGroup(Integer code) {
+        if (Objects.isNull(code)) {
+            return Collections.emptyList();
+        }
         Map<String, Object> params = new HashMap<>(1);
         params.put("pcode", code);
         List<Map<String, Object>> list = sysAreaService.findList(params);
@@ -592,6 +658,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      *
      * @return*/
     public REnterpriseVo queryEntDetails(Long entId) {
+        if (Objects.isNull(entId)) {
+            return null;
+        }
         return remoteBaseService.queryEntDetails(entId);
     }
 
@@ -602,7 +671,10 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
      * @author zk
      * @date 2023/8/10
      **/
-    public KwsUserResDto queryUserDetails(String account, int systemType) {
+    public KwsUserResDto queryUserDetails(String account, Integer systemType) {
+        if (Objects.isNull(systemType) || StringUtils.isBlank(account)) {
+            return null;
+        }
         KwsUser params = new KwsUser();
         params.setAccount(account);
         params.setSystemType(systemType);

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

@@ -13,6 +13,7 @@ import com.sckw.system.api.model.dto.req.UpdatePasswordReqDto;
 import com.sckw.system.api.model.dto.res.AreaTreeFrontResDto;
 import com.sckw.system.api.model.dto.res.KwsUserResDto;
 import com.sckw.system.api.model.dto.res.RegisterResDto;
+import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.dao.*;
 import com.sckw.system.dubbo.RemoteSystemServiceImpl;
 import com.sckw.system.model.*;
@@ -594,6 +595,8 @@ public class KwsUserService {
     }
 
     public List<AreaTreeFrontResDto> test(List<Integer> list) {
+        List<SysDictResDto> asdasd = remoteSystemService.queryDictByType("asdasd");
+
         return remoteSystemService.queryAreaTreeFrontByCodeList(list);
     }
 

+ 14 - 5
sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml

@@ -103,9 +103,6 @@
     <if test="dto.approval != null">
       and a.approval = #{dto.approval}
     </if>
-    <if test="dto.entId != null">
-      and a.id = #{dto.entId}
-    </if>
     <if test="dto.keywords != null">
       and (a.contacts like concat('%', #{dto.keywords}, '%') or a.phone like concat('%', #{dto.keywords}, '%') or a.firm_name like concat('%', #{dto.keywords}, '%'))
     </if>
@@ -132,10 +129,22 @@
     </if>
     <choose>
       <when test="dto.entDept != null and dto.entDept == 0">
-        and not exists (select 1 from kws_ent_dep dep where a.id = dep.ent_id)
+        and not exists (
+            select 1
+              from kws_ent_dep dep
+              where a.id = dep.ent_id
+              <if test="dto.entId != null">
+                and dep.ent_pid = #{dto.entId}
+              </if>
+            )
       </when>
      <when test="dto.entDept != null and dto.entDept == 1">
-       and exists (select 1 from kws_ent_dep dep where a.id = dep.ent_id)
+       and exists (
+           select 1 from kws_ent_dep dep
+            where a.id = dep.ent_id
+       <if test="dto.entId != null">
+         and dep.ent_pid = #{dto.entId}
+       </if>)
      </when>
     </choose>
     group by a.id