Răsfoiți Sursa

登录修改,合作加消息推送

czh 2 ani în urmă
părinte
comite
f0f12c01e6

+ 7 - 9
sckw-auth/src/main/java/com/sckw/auth/service/impl/AuthServiceImpl.java

@@ -359,7 +359,7 @@ public class AuthServiceImpl implements IAuthService {
             return HttpResult.error(HttpStatus.CODE_10301, "您的账号已冻结,如需帮助,请致电平台客服!");
         }
         //企业信息
-        REnterpriseVo enterprise = systemService.queryEntDetails(driver.getEntId());
+        EntCacheResDto enterprise = systemService.queryEntDetails(driver.getEntId());
 
         /**生成token**/
         String token = generateToken(loginBase, driver.getId());
@@ -409,7 +409,7 @@ public class AuthServiceImpl implements IAuthService {
             return HttpResult.error(HttpStatus.CODE_10301, "您的账号已冻结,如需帮助,请致电平台客服!");
         }
         //企业信息
-        REnterpriseVo enterprise = systemService.queryEntDetails(user.getEntId());
+        EntCacheResDto enterprise = systemService.queryEntDetails(user.getEntId());
         if (loginBase.getSystemType() == SystemTypeEnum.COMPANY.getCode() && enterprise == null) {
             return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "账号没有归属企业,请检查并重新输入!");
         }
@@ -482,11 +482,11 @@ public class AuthServiceImpl implements IAuthService {
 
         private final RDriverDetailVo driver;
 
-        private final REnterpriseVo enterprise;
+        private final EntCacheResDto enterprise;
 
         private final RemoteUserService remoteUserService;
 
-        public AsyncProcess1(LoginBase loginBase, KwsUserResDto user, RDriverDetailVo driver, REnterpriseVo enterprise ,
+        public AsyncProcess1(LoginBase loginBase, KwsUserResDto user, RDriverDetailVo driver, EntCacheResDto enterprise ,
                              RemoteUserService remoteUserService) {
             this.loginBase = loginBase;
             this.user = user;
@@ -513,14 +513,12 @@ public class AuthServiceImpl implements IAuthService {
          * @author: czh
          * @date: 2023/7/3
          */
-        private void SaveEntToCache(REnterpriseVo ent) {
+        private void SaveEntToCache(EntCacheResDto ent) {
             if (ent == null) {
                 return;
             }
-            LoginEntInfo loginEntInfo = new LoginEntInfo();
-            BeanUtils.copyProperties(ent, loginEntInfo);
-            String key = Global.getFullUserEntKey(loginEntInfo.getId());
-            RedissonUtils.putString(key, JSON.toJSONString(loginEntInfo), Global.APP_TOKEN_EXPIRE);
+            String key = Global.getFullUserEntKey(ent.getId());
+            RedissonUtils.putString(key, JSON.toJSONString(ent), Global.APP_TOKEN_EXPIRE);
         }
 
         /**

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

@@ -198,7 +198,7 @@ public interface RemoteSystemService {
      * @author zk
      * @date 2023/8/10
      **/
-    REnterpriseVo queryEntDetails(Long entId);
+    EntCacheResDto queryEntDetails(Long entId);
 
     /**
      * @param account 账号

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

@@ -70,6 +70,11 @@ public class EntCacheResDto implements Serializable {
      */
     private String entTypes;
 
+    /**
+     * 企业属性 (1供应商,2采购商,34PL物流,43PL物流)
+     */
+    private String entTypeNames;
+
     /**
      * 机构信息
      */
@@ -91,13 +96,20 @@ public class EntCacheResDto implements Serializable {
     private String business;
 
     /**
-     * 企业地址-----区域表id---实际用途?
+     * 企业地址
      */
     private String cityName;
 
+    /**
+     * 企业地址
+     */
+    private Integer cityCode;
+
     /**
      * 联系人id
      */
     private Long contactsId;
 
+    private Integer status;
+
 }

+ 21 - 4
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java

@@ -88,7 +88,7 @@ public class KwmCooperateApplyService {
 
 
     /**
-     * @param   list 数据
+     * @param list 数据
      * @return CooperateManageQueryResVo
      * @desc: 组装返参
      * @author: czh
@@ -515,10 +515,27 @@ public class KwmCooperateApplyService {
     @Transactional(rollbackFor = {})
     public void approve(CooperateApproveReqVo reqVo) {
         updateCooperateInfo(reqVo.getIds(), reqVo.getApprove(), reqVo.getRemark());
-
-        if (reqVo.getApprove().equals(CooperateStatusEnum.OK.getCode())) {
-            for (String id : reqVo.getIds().split(Global.COMMA)) {
+        for (String id : reqVo.getIds().split(Global.COMMA)) {
+            if (reqVo.getApprove().equals(CooperateStatusEnum.OK.getCode())) {
                 commonBusinessService.bingManager(reqVo.getManager(), Long.parseLong(id));
+
+                KwmCooperate kwmCooperate = kwmCooperateMapper.selectById(Long.parseLong(id));
+                EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(kwmCooperate.getEntId());
+                Map<String, Object> map = new HashMap<>(Global.NUMERICAL_TWO);
+                map.put("entName", entCacheResDto.getFirmName());
+                commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(entCacheResDto.getContactsId()).setEntId(entCacheResDto.getId())),
+                        MessageEnum.COOPERATE_PASS,
+                        map,
+                        cooperateApplyUrl);
+            } else {
+                KwmCooperate kwmCooperate = kwmCooperateMapper.selectById(Long.parseLong(id));
+                EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(kwmCooperate.getEntId());
+                Map<String, Object> map = new HashMap<>(Global.NUMERICAL_TWO);
+                map.put("entName", entCacheResDto.getFirmName());
+                commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(entCacheResDto.getContactsId()).setEntId(entCacheResDto.getId())),
+                        MessageEnum.COOPERATE_REFUSED,
+                        map,
+                        cooperateApplyUrl);
             }
         }
     }

+ 74 - 31
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java

@@ -3,7 +3,6 @@ package com.sckw.manage.service;
 import java.io.IOException;
 import java.util.Date;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -32,6 +31,8 @@ import com.sckw.manage.model.vo.req.FindCooperateByEntReqVo;
 import com.sckw.manage.model.vo.req.FindEntCooperateReqVo;
 import com.sckw.manage.model.vo.res.*;
 import com.sckw.payment.api.model.constant.OrderEnum;
+import com.sckw.stream.enums.MessageEnum;
+import com.sckw.stream.model.UserInfo;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.order.api.dubbo.TradeOrderInfoService;
 import com.sckw.transport.api.dubbo.TransportDubboService;
@@ -40,10 +41,10 @@ import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.json.JsonObject;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -77,6 +78,8 @@ public class KwmCooperateManageService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private PaymentDubboService paymentDubboService;
 
+    @Value(value = "${}")
+    private String cooperateManageUrl;
 
     /**
      * @param reqVo 分页入参
@@ -198,20 +201,80 @@ public class KwmCooperateManageService {
         }
         Long userId = LoginUserHolder.getUserId();
         Date date = new Date();
+        //校验解除限制
+        checkLimit(kwmCooperates);
+        kwmCooperates.forEach(item -> {
+            //运营端可以操作任意状态,企业端只能操作合作中的数据
+            if (SystemTypeEnum.MANAGE.getCode().equals(LoginUserHolder.getSystemType())) {
+                if (!item.getStatus().equals(CooperateStatusEnum.OK.getCode()) && type.equals(CooperateStatusEnum.PASS.getCode())) {
+                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_012);
+                }
+
+                if (!item.getStatus().equals(CooperateStatusEnum.PASS.getCode()) && type.equals(CooperateStatusEnum.OK.getCode())) {
+                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_012);
+                }
+            }
+            item.setStatus(type);
+            item.setUpdateBy(userId);
+            item.setUpdateTime(date);
+            if (kwmCooperateMapper.updateById(item) <= 0) {
+                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
+            }
+        });
+
+        Map<String, Object> map = new HashMap<>(Global.NUMERICAL_FOUR);
+        for (KwmCooperate kwmCooperate : kwmCooperates) {
+            Long targetEntId = kwmCooperate.getEntId().equals(LoginUserHolder.getEntId()) ? kwmCooperate.getInviteeEntId() : kwmCooperate.getInviterEntId();
+            Long entId = kwmCooperate.getEntId().equals(LoginUserHolder.getEntId()) ? kwmCooperate.getInviterEntId() : kwmCooperate.getInviteeEntId();
+            EntCacheResDto targetEntCacheResDto = remoteSystemService.queryEntCacheById(targetEntId);
+            EntCacheResDto targetEntTreeCacheResDto = remoteSystemService.queryEntTreeById(targetEntId);
+            EntCacheResDto ourEntCacheResDto = remoteSystemService.queryEntCacheById(entId);
+            EntCacheResDto ourEntTopCacheResDto = remoteSystemService.queryEntCacheById(kwmCooperate.getEntId());
+            if (type.equals(CooperateStatusEnum.PASS.getCode())) {
+                map.put("entName", targetEntCacheResDto.getFirmName());
+                map.put("createByName", LoginUserHolder.getUserName());
+                commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(ourEntTopCacheResDto.getContactsId()).setEntId(ourEntTopCacheResDto.getId())),
+                        MessageEnum.COOPERATE_DISSOLVE,
+                        map,
+                        cooperateManageUrl);
+
+                map.put("entName", ourEntCacheResDto.getFirmName());
+                commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(targetEntTreeCacheResDto.getContactsId()).setEntId(targetEntTreeCacheResDto.getId())),
+                        MessageEnum.COOPERATE_DISSOLVED,
+                        map,
+                        cooperateManageUrl);
+            } else {
+                map.put("entName", targetEntCacheResDto.getFirmName());
+                map.put("createByName", LoginUserHolder.getUserName());
+                commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(ourEntTopCacheResDto.getContactsId()).setEntId(ourEntTopCacheResDto.getId())),
+                        MessageEnum.COOPERATE_RESTORE,
+                        map,
+                        cooperateManageUrl);
+
+
+            }
+
+        }
+
+    }
+
+
+    /**
+     * @param kwmCooperates 实体
+     * @desc: 解除的校验限制
+     * @author: czh
+     * @date: 2023/9/7
+     */
+    private void checkLimit(List<KwmCooperate> kwmCooperates) {
         //判断是否可以解除-销售订单
         KwmCooperate kwmCooperate = kwmCooperates.get(0);
-        Boolean order = tradeOrderInfoService.associateEnt(kwmCooperate.getInviteeEntId(), kwmCooperate.getInviterEntId());
-        if (order) {
+        if (tradeOrderInfoService.associateEnt(kwmCooperate.getInviteeEntId(), kwmCooperate.getInviterEntId())) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_031);
         }
-
         //判断是否可以解除-托运和承运
         HttpResult response = transportDubboService.checkLogisticsOrderIsFinishByEntId(kwmCooperate.getInviteeEntId(), kwmCooperate.getInviterEntId());
-        log.info("getInviteeEntId-{}", kwmCooperate.getInviteeEntId());
-        log.info("getInviterEntId-{}", kwmCooperate.getInviterEntId());
-        log.info("aaaaa-{}", JSONObject.toJSONString(response));
-        Integer receivedResult = response.getCode();
-        if (!receivedResult.toString().equals(String.valueOf(HttpStatus.SUCCESS_CODE))) {
+        int receivedResult = response.getCode();
+        if (!Integer.toString(receivedResult).equals(String.valueOf(HttpStatus.SUCCESS_CODE))) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_032);
         }
         Map<OrderEnum, List<String>> ledgerMap = paymentDubboService.checkLedger(kwmCooperate.getInviteeEntId(), kwmCooperate.getInviterEntId());
@@ -228,26 +291,6 @@ public class KwmCooperateManageService {
         if (!CollectionUtils.isEmpty(settlementMap.get(OrderEnum.TRADE))) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_034);
         }
-        kwmCooperates.forEach(item -> {
-            //运营端可以操作任意状态,企业端只能操作合作中的数据
-            if (SystemTypeEnum.MANAGE.getCode().equals(LoginUserHolder.getSystemType())) {
-                if (!item.getStatus().equals(CooperateStatusEnum.OK.getCode()) && type.equals(CooperateStatusEnum.PASS.getCode())) {
-                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_012);
-                }
-
-                if (!item.getStatus().equals(CooperateStatusEnum.PASS.getCode()) && type.equals(CooperateStatusEnum.OK.getCode())) {
-                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_012);
-                }
-            }
-
-            item.setStatus(type);
-            item.setUpdateBy(userId);
-            item.setUpdateTime(date);
-            if (kwmCooperateMapper.updateById(item) <= 0) {
-                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
-            }
-        });
-
     }
 
     /**
@@ -258,7 +301,7 @@ public class KwmCooperateManageService {
      * @date: 2023/7/11
      */
     private boolean checkUserPermission(int status) {
-        return status != CooperateStatusEnum.OK.getCode() && !LoginUserHolder.getSystemType().equals(SystemTypeEnum.MANAGE.getCode());
+        return status != CooperateStatusEnum.OK.getCode() && !Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode());
     }
 
     /**

+ 12 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsMenuController.java

@@ -137,4 +137,16 @@ public class KwsMenuController {
         kwsMenuService.saveMapping(reqVo);
         return HttpResult.ok();
     }
+
+    /**
+     * @param  reqVo 入参
+     * @return HttpResult
+     * @desc: 根据菜单查映射关系
+     * @author: czh
+     * @date: 2023/6/13
+     */
+    @PostMapping("/queryMapping")
+    public HttpResult queryMapping(@Valid @RequestBody QueryChildMenuReqVo reqVo) {
+        return HttpResult.ok(kwsMenuService.queryMapping(reqVo.getId()));
+    }
 }

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

@@ -184,7 +184,7 @@ public class RemoteBaseService {
      * @author zk
      * @date 2023/8/10
      **/
-    public REnterpriseVo queryEntDetails(Long entId) {
+    public EntCacheResDto queryEntDetails(Long entId) {
         return kwsEnterpriseService.queryEntDetails(entId);
     }
 

+ 46 - 24
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -1,15 +1,16 @@
 package com.sckw.system.dubbo;
 
+
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.enums.EntTypeEnum;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.redis.utils.RedissonUtils;
 import com.sckw.system.api.RemoteSystemService;
-import com.sckw.system.api.model.dto.res.REnterpriseVo;
 import com.sckw.system.api.model.dto.res.*;
 import com.sckw.system.api.model.pojo.DeptInfoPojo;
 import com.sckw.system.dao.SysDictDao;
@@ -19,7 +20,9 @@ import com.sckw.system.model.vo.res.KwsUserResVo;
 import com.sckw.system.service.KwsUserService;
 import com.sckw.system.service.SysAreaService;
 import org.apache.dubbo.config.annotation.DubboService;
+import org.jetbrains.annotations.Nullable;
 import org.springframework.beans.factory.annotation.Autowired;
+
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -273,28 +276,47 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         String dictCache = RedissonUtils.getString(key);
         //从redis查,查不到从数据库查,并写入redis
         if (StringUtils.isBlank(dictCache)) {
-            KwsEnterpriseResDto kwsEnterpriseResDto = remoteBaseService.queryEnterpriseById(entId);
-            if (Objects.isNull(kwsEnterpriseResDto)) {
+            EntCacheResDto entCacheResDto = getEntCacheResDto(entId);
+            if (Objects.isNull(entCacheResDto)) {
                 return null;
             }
-
-            EntCacheResDto entCacheResDto = new EntCacheResDto();
-            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()));
-            }
             RedissonUtils.putString(key, JSON.toJSONString(entCacheResDto), Global.COMMON_EXPIRE);
             return entCacheResDto;
         }
+
+        EntCacheResDto entCacheResDto = JSONObject.parseObject(dictCache, EntCacheResDto.class);
+        if (Objects.isNull(entCacheResDto.getContactsId())) {
+            entCacheResDto = getEntCacheResDto(entId);
+            if (Objects.isNull(entCacheResDto)) {
+                return null;
+            }
+        }
+
         RedissonUtils.putString(key, dictCache, Global.COMMON_EXPIRE);
-        return JSONObject.parseObject(dictCache, EntCacheResDto.class);
+        return entCacheResDto;
+    }
+
+    @Nullable
+    private EntCacheResDto getEntCacheResDto(Long entId) {
+        KwsEnterpriseResDto kwsEnterpriseResDto = remoteBaseService.queryEnterpriseById(entId);
+        if (Objects.isNull(kwsEnterpriseResDto)) {
+            return null;
+        }
+
+        EntCacheResDto entCacheResDto = new EntCacheResDto();
+        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()));
+            entCacheResDto.setEntTypeNames(EntTypeEnum.getNames(entCacheResDto.getEntTypes()));
+        }
+        return entCacheResDto;
     }
 
     /**
@@ -656,13 +678,13 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 
     /**
      * @param entId 企业ID
-     * @desc 企业详情(企业登录/司机登录)
+     * @return
+     * @desc 企业详情(企业登录 / 司机登录)
      * @author zk
      * @date 2023/8/10
-     *
-     * @return*/
+     */
     @Override
-    public REnterpriseVo queryEntDetails(Long entId) {
+    public EntCacheResDto queryEntDetails(Long entId) {
         if (Objects.isNull(entId)) {
             return null;
         }
@@ -670,9 +692,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
     }
 
     /**
-     * @param account 账号
+     * @param account    账号
      * @param systemType 系统类型
-     * @desc 用户详情(企业端登录/运营端登录)
+     * @desc 用户详情(企业端登录 / 运营端登录)
      * @author zk
      * @date 2023/8/10
      **/
@@ -685,7 +707,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         params.setAccount(account);
         params.setSystemType(systemType);
         List<KwsUserResVo> users = kwsUserService.findList(params);
-        if(CollectionUtils.isEmpty(users)) {
+        if (CollectionUtils.isEmpty(users)) {
             return null;
         }
         KwsUserResVo userResVo = users.get(Global.NUMERICAL_ZERO);

+ 28 - 18
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -1,4 +1,6 @@
 package com.sckw.system.service;
+import com.google.common.collect.Lists;
+import java.util.Date;
 
 import cn.hutool.core.date.DateUtil;
 import com.github.pagehelper.PageHelper;
@@ -987,23 +989,29 @@ public class KwsEnterpriseService {
      * @author zk
      * @date 2023/8/10
      **/
-    public REnterpriseVo queryEntDetails(Long entId) {
+    public EntCacheResDto queryEntDetails(Long entId) {
         //企业信息
         KwsEnterprise enterprise = kwsEnterpriseDao.selectByKey(entId);
         if (enterprise == null) {
             return null;
         }
-        REnterpriseVo enterpriseVo = new REnterpriseVo();
-        enterpriseVo.setId(enterprise.getId());
-        enterpriseVo.setFirmName(enterprise.getFirmName());
-        enterpriseVo.setRegTime(enterprise.getRegTime());
-        enterpriseVo.setStatus(enterprise.getStatus());
-        enterpriseVo.setApproval(enterprise.getApproval());
-
+        EntCacheResDto entCacheResDto = new EntCacheResDto();
+        entCacheResDto.setId(enterprise.getId());
+        entCacheResDto.setFirmName(enterprise.getFirmName());
+        entCacheResDto.setApproval(enterprise.getApproval());
+        entCacheResDto.setRegTime(enterprise.getRegTime());
+        entCacheResDto.setContacts(enterprise.getContacts());
+        entCacheResDto.setPhone(enterprise.getPhone());
+        entCacheResDto.setBusiness(enterprise.getBusiness());
+        entCacheResDto.setCityName(enterprise.getCityName());
+        entCacheResDto.setCityCode(enterprise.getCityCode());
+        entCacheResDto.setStatus(enterprise.getStatus());
         //企业类型
         List<KwsEntType> entTypes = kwsEntTypeDao.findListByEntId(entId);
-        enterpriseVo.setEntTypes(entTypes != null ? String.join(Global.COMMA, entTypes.stream().map(KwsEntType::getType).map(String::valueOf).distinct().toList()) : null);
-        enterpriseVo.setEntTypeNames(enterpriseVo.getEntTypes() != null ? EntTypeEnum.getNames(enterpriseVo.getEntTypes()) : null);
+        if (CollectionUtils.isNotEmpty(entTypes)) {
+            entCacheResDto.setEntTypes(String.join(Global.COMMA, entTypes.stream().map(KwsEntType::getType).map(String::valueOf).distinct().toList()));
+            entCacheResDto.setEntTypeNames(EntTypeEnum.getNames(entCacheResDto.getEntTypes()));
+        }
 
         Map<String, Object> queryParams = new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
             put("isMain", Global.YES);
@@ -1011,10 +1019,12 @@ public class KwsEnterpriseService {
             put("systemType", SystemTypeEnum.COMPANY.getCode());
         }};
         List<KwsUserResVo> users = kwsUserService.findPage(queryParams);
-        KwsUserResVo user = users != null && users.size() > 0 ? users.get(Global.NUMERICAL_ZERO) : null;
-        enterpriseVo.setMainId(user != null ? user.getId() : null);
-        enterpriseVo.setMainName(user != null ? user.getName() : null);
-        enterpriseVo.setMainPhone(user != null ? user.getPhone() : null);
+        if (CollectionUtils.isNotEmpty(users)) {
+            KwsUserResVo kwsUserResVo = users.get(0);
+            entCacheResDto.setContactsId(kwsUserResVo.getId());
+            entCacheResDto.setContacts(kwsUserResVo.getName());
+            entCacheResDto.setPhone(kwsUserResVo.getPhone());
+        }
 
         //企业资质有效性判断  1、当前资质没过期,且状态是已认证  2、只要有认证过一次就算有效  参数判断
         String checkType = String.valueOf(Global.NUMERICAL_TWO);
@@ -1022,16 +1032,16 @@ public class KwsEnterpriseService {
             List<CertificateResVo> certificates = queryCertificate(entId);
             for (CertificateResVo certificate : certificates) {
                 Date expireTime = certificate.getExpireTime();
-                enterpriseVo.setValid(DateUtil.compare(new Date(), expireTime) <= 0);
+                entCacheResDto.setValid(DateUtil.compare(new Date(), expireTime) <= 0);
             }
         } else {
             List<KwsEntCheckTrack> entCheckTrackResDtoList = entCheck(entId);
             if (CollectionUtils.isEmpty(entCheckTrackResDtoList)) {
-                enterpriseVo.setValid(false);
+                entCacheResDto.setValid(false);
             }
-            enterpriseVo.setValid(entCheckTrackResDtoList.stream().anyMatch(item -> item.getStatus() == Global.NO));
+            entCacheResDto.setValid(entCheckTrackResDtoList.stream().anyMatch(item -> item.getStatus() == Global.NO));
         }
-        return enterpriseVo;
+        return entCacheResDto;
     }
 
     /**

+ 16 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsMenuService.java

@@ -487,4 +487,20 @@ public class KwsMenuService {
         kwsMenuMappingDao.saveBatch(list);
     }
 
+
+    /**
+     * @param  id 菜单id
+     * @return HttpResult
+     * @desc: 根据菜单查映射关系
+     * @author: czh
+     * @date: 2023/6/13
+     */
+    public List<KwsMenu> queryMapping(Long id) {
+        List<KwsMenuMapping> kwsMenuMappings = kwsMenuMappingDao.selectByMenuId(id);
+        if (CollectionUtils.isEmpty(kwsMenuMappings)) {
+            return Collections.emptyList();
+        }
+
+        return kwsMenuDao.selectByKeys(kwsMenuMappings.stream().map(KwsMenuMapping::getMappingId).toList());
+    }
 }

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

@@ -238,7 +238,7 @@
       and b.del_flag = 0
       and d.del_flag = 0
     <if test="systemType != null and systemType != ''">
-      and su.system_type = #{system_type, jdbcType=VARCHAR}
+      and su.system_type = #{systemType, jdbcType=VARCHAR}
     </if>
     <if test="account != null and account != ''">
       and su.account = #{account, jdbcType=VARCHAR}