18482106067 2 лет назад
Родитель
Сommit
5a65bb68c1
15 измененных файлов с 83 добавлено и 32 удалено
  1. 6 6
      sckw-auth/src/main/java/com/sckw/auth/service/impl/AuthServiceImpl.java
  2. 4 2
      sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractLogisticsMapper.xml
  3. 2 1
      sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractTradeMapper.xml
  4. 5 0
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/dto/res/CooperateManageQueryResDto.java
  5. 6 0
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/req/AddressQueryReqVo.java
  6. 7 1
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/req/InitiateReqVo.java
  7. 6 0
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/res/AddressQueryResVo.java
  8. 12 3
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/res/CooperateManageQueryResVo.java
  9. 8 5
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/CommonBusinessService.java
  10. 1 1
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java
  11. 12 8
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java
  12. 1 1
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java
  13. 2 0
      sckw-modules/sckw-manage/src/main/resources/mapper/KwmCooperateMapper.xml
  14. 2 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/RoleBindMenuReqVo.java
  15. 9 2
      sckw-modules/sckw-system/src/main/resources/mapper/KwsMenuRightsDao.xml

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

@@ -67,7 +67,7 @@ public class AuthServiceImpl implements IAuthService {
         BeanUtils.copyProperties(kwsUser, loginResVo);
 
         //平台管理员直接过了
-        if (kwsUser.getIsMain() == Global.YES && kwsUser.getSystemType() == SystemTypeEnum.MANAGE.getCode()) {
+        if (kwsUser.getIsMain() == Global.YES && kwsUser.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
             afterProcessor(loginResVo);
             return loginResVo;
         }
@@ -146,11 +146,11 @@ public class AuthServiceImpl implements IAuthService {
             remoteUserService.checkPassword(reqDto.getPassword(), kwsUser.getPassword());
         } else {
             String key = Global.USER_LOGIN_CAPTCHA + reqDto.getSystemType() + Global.COLON + kwsUser.getAccount();
-            String captcha = RedissonUtils.getString(key);
-            if (StringUtils.isBlank(captcha) || StringUtils.isBlank(reqDto.getCaptcha()) || !reqDto.getCaptcha().equals(captcha)) {
-                throw new SystemException(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.CAPCHA_ERROR);
-            }
-            RedissonUtils.delete(key);
+//            String captcha = RedissonUtils.getString(key);
+//            if (StringUtils.isBlank(captcha) || StringUtils.isBlank(reqDto.getCaptcha()) || !reqDto.getCaptcha().equals(captcha)) {
+//                throw new SystemException(HttpStatus.PARAMETERS_MISSING_CODE, HttpStatus.CAPCHA_ERROR);
+//            }
+//            RedissonUtils.delete(key);
         }
         return kwsUser;
     }

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

@@ -76,7 +76,7 @@
           left join kwc_contract_logistics_track d on a.id = d.contract_id and d.del_flag = 0 and d.type = 0
           left join kwc_contract_logistics_unit e on a.id = e.contract_id and e.unit_type != #{entType} and e.del_flag = 0
         where a.del_flag = 0
-          and case when a.status = 3 then a.ent_id = #{entId} and #{entType} = 1
+          and case when a.status = 3 then a.ent_id = #{entId} and #{entType} = 3
                 else (b.ent_id in
                     <foreach collection="allEnt" separator="," open="(" close=")" item="item">
                         #{item}
@@ -97,7 +97,9 @@
                    e.firm_name like concat('%', #{keywords}, '%') or
                    b.contacts like concat('%', #{keywords}, '%') or
                    b.phone like concat('%', #{keywords}, '%') or
-                   b.sign_phone like concat('%', #{keywords}, '%'))
+                   b.sign_phone like concat('%', #{keywords}, '%') or
+                   a.contract_no like concat('%', #{keywords}, '%') or
+                   a.name like concat('%', #{keywords}, '%'))
           </if>
           <if test="idList != null and idList.size() > 0">
               and a.id in

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

@@ -95,8 +95,9 @@
                  e.firm_name like concat('%', #{keywords}, '%') or
                  b.contacts like concat('%', #{keywords}, '%') or
                  b.phone like concat('%', #{keywords}, '%') or
+                 b.sign_phone like concat('%', #{keywords}, '%') or
                  a.contract_no like concat('%', #{keywords}, '%') or
-                 b.sign_phone like concat('%', #{keywords}, '%'))
+                 a.name like concat('%', #{keywords}, '%'))
         </if>
         <if test="idList != null and idList.size() > 0">
             and a.id in

+ 5 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/dto/res/CooperateManageQueryResDto.java

@@ -87,6 +87,11 @@ public class CooperateManageQueryResDto {
      */
     private Long targetEntId;
 
+    /**
+     * 我方企业id
+     */
+    private Long ourEntId;
+
     /**
      * 申请类型 1 我放发起  2对方发起
      */

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

@@ -1,8 +1,10 @@
 package com.sckw.manage.model.vo.req;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.sckw.core.model.page.PageRequest;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serial;
 import java.io.Serializable;
@@ -33,11 +35,15 @@ public class AddressQueryReqVo extends PageRequest implements Serializable {
     /**
      * 创建开始时间(时间戳)
      */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date startTime;
 
     /**
      * 创建结束时间(时间戳)
      */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date endTime;
 
     /**

+ 7 - 1
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/req/InitiateReqVo.java

@@ -30,11 +30,17 @@ public class InitiateReqVo implements Serializable {
     @NotBlank(message = "合作属性不能为空")
     private String chooseCooperateTypes;
 
+    /**
+     * 我方单位id
+     */
+    @NotNull(message = "我方单位不能为空")
+    private Long entId;
+
     /**
      * 合作单位id
      */
     @NotNull(message = "合作单位不能为空")
-    private Long entId;
+    private Long targetEntId;
 
     /**
      * 备注

+ 6 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/res/AddressQueryResVo.java

@@ -115,4 +115,10 @@ public class AddressQueryResVo implements Serializable {
      * 默认类型
      */
     private String defaultTypeName;
+
+    /**
+     * 默认类型code
+     */
+    private Integer defaultType;
+
 }

+ 12 - 3
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/res/CooperateManageQueryResVo.java

@@ -45,13 +45,22 @@ public class CooperateManageQueryResVo implements Serializable {
     private Date createTime;
 
     /**
-     * 单位Id
+     * 对方单位Id
+     */
+    private Long targetEntId;
+
+    /**
+     * 对方单位名称
+     */
+    private String targetEntName;
+
+    /**
+     * 我方单位Id
      */
-    @JsonSerialize(using = LongToStringUtils.class)
     private Long entId;
 
     /**
-     * 单位名称
+     * 我方单位名称
      */
     private String entName;
 

+ 8 - 5
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/CommonBusinessService.java

@@ -12,7 +12,6 @@ import com.sckw.manage.dao.KwmCooperateMapper;
 import com.sckw.manage.model.dto.req.CooperateManageQueryReqDto;
 import com.sckw.manage.model.dto.res.CooperateManageQueryResDto;
 import com.sckw.manage.model.entity.KwmCooperate;
-import com.sckw.manage.model.vo.req.BindManagerReqVo;
 import com.sckw.manage.model.vo.res.CooperateManageQueryResVo;
 import com.sckw.manage.model.vo.res.FindListGroupResVo;
 import com.sckw.system.api.RemoteSystemService;
@@ -21,7 +20,6 @@ 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;
 import org.apache.dubbo.config.annotation.DubboReference;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -162,6 +160,8 @@ public class CommonBusinessService {
         Long entId = LoginUserHolder.getEntId();
         List<Long> userIds = list.stream().map(CooperateManageQueryResDto::getCreateBy).distinct().toList();
         List<Long> targetEntIds = list.stream().map(CooperateManageQueryResDto::getTargetEntId).distinct().toList();
+        List<Long> ourEntIds = list.stream().map(CooperateManageQueryResDto::getOurEntId).distinct().toList();
+        targetEntIds.addAll(ourEntIds);
         List<UserCacheResDto> userCacheResDtos = remoteSystemService.queryUserCacheByIds(userIds);
         List<EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntCacheByIds(targetEntIds);
         Map<Long, String> userMap = new HashMap<>();
@@ -192,12 +192,15 @@ public class CommonBusinessService {
             cooperateManageQueryResVo.setStatus(cooperateManageQueryResDto.getStatus());
             cooperateManageQueryResVo.setApplyTypeCode(cooperateManageQueryResDto.getApplyTypeCode());
             cooperateManageQueryResVo.setCreateByName(userMap.get(cooperateManageQueryResDto.getCreateBy()));
-            cooperateManageQueryResVo.setEntName(targetEntName);
-            cooperateManageQueryResVo.setEntId(targetEntId);
+            cooperateManageQueryResVo.setCreateTime(cooperateManageQueryResDto.getCreateTime());
+            cooperateManageQueryResVo.setTargetEntName(targetEntName);
+            cooperateManageQueryResVo.setTargetEntId(targetEntId);
+            cooperateManageQueryResVo.setEntId(cooperateManageQueryResDto.getOurEntId());
+            cooperateManageQueryResVo.setEntName(entMap.get(cooperateManageQueryResDto.getOurEntId()));
             cooperateManageQueryResVo.setApprovalRemark(cooperateManageQueryResDto.getApprovalRemark());
 
             //我方是发起方
-            if (entId.compareTo(cooperateManageQueryResDto.getInviterEntId()) == 0) {
+            if (entId.compareTo(cooperateManageQueryResDto.getEntId()) == 0) {
                 cooperateManageQueryResVo.setContacts(cooperateManageQueryResDto.getInviteeContacts());
                 cooperateManageQueryResVo.setPhone(cooperateManageQueryResDto.getInviteePhone());
                 cooperateManageQueryResVo.setContactsId(cooperateManageQueryResDto.getInviteeContactsId());

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

@@ -89,7 +89,7 @@ public class KwmAddressService {
                 eq(KwmAddress::getDelFlag, Global.NO).
                 and(StringUtils.isNotBlank(reqVo.getKeywords()),
                         wq -> wq.like(KwmAddress::getDetailAddress, reqVo.getKeywords()).or().
-                                like(KwmAddress::getCityName, reqVo.getKeywords())).
+                                like(KwmAddress::getName, reqVo.getKeywords())).
                 orderByDesc(KwmAddress::getUpdateTime);
 
         if (Objects.nonNull(reqVo.getStartTime())) {

+ 12 - 8
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java

@@ -96,6 +96,8 @@ public class KwmCooperateApplyService {
         Long entId = LoginUserHolder.getEntId();
         List<Long> userIds = list.stream().map(CooperateManageQueryResDto::getCreateBy).distinct().toList();
         List<Long> targetEntIds = list.stream().map(CooperateManageQueryResDto::getTargetEntId).distinct().toList();
+        List<Long> ourEntIds = list.stream().map(CooperateManageQueryResDto::getOurEntId).distinct().toList();
+        targetEntIds.addAll(ourEntIds);
         List<UserCacheResDto> userCacheResDtos = remoteSystemService.queryUserCacheByIds(userIds);
         List<EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntCacheByIds(targetEntIds);
         Map<Long, String> userMap = new HashMap<>();
@@ -126,12 +128,14 @@ public class KwmCooperateApplyService {
             cooperateManageQueryResVo.setStatus(cooperateManageQueryResDto.getStatus());
             cooperateManageQueryResVo.setApplyTypeCode(cooperateManageQueryResDto.getApplyTypeCode());
             cooperateManageQueryResVo.setCreateByName(userMap.get(cooperateManageQueryResDto.getCreateBy()));
-            cooperateManageQueryResVo.setEntName(targetEntName);
-            cooperateManageQueryResVo.setEntId(targetEntId);
+            cooperateManageQueryResVo.setTargetEntName(targetEntName);
+            cooperateManageQueryResVo.setTargetEntId(targetEntId);
+            cooperateManageQueryResVo.setEntId(cooperateManageQueryResDto.getOurEntId());
+            cooperateManageQueryResVo.setEntName(entMap.get(cooperateManageQueryResDto.getOurEntId()));
             cooperateManageQueryResVo.setApprovalRemark(cooperateManageQueryResDto.getApprovalRemark());
 
             //我方是发起方
-            if (entId.compareTo(cooperateManageQueryResDto.getInviterEntId()) == 0) {
+            if (entId.compareTo(cooperateManageQueryResDto.getEntId()) == 0) {
                 cooperateManageQueryResVo.setContacts(cooperateManageQueryResDto.getInviteeContacts());
                 cooperateManageQueryResVo.setPhone(cooperateManageQueryResDto.getInviteePhone());
                 cooperateManageQueryResVo.setContactsId(cooperateManageQueryResDto.getInviteeContactsId());
@@ -215,11 +219,11 @@ public class KwmCooperateApplyService {
      */
     @Transactional(rollbackFor = {})
     public void initiate(InitiateReqVo reqVo) {
-        Long currentEntId = LoginUserHolder.getEntId();
+        Long currentEntId = reqVo.getEntId();
         List<Integer> chooseCooperateTypes = Arrays.stream(reqVo.getChooseCooperateTypes().split(Global.COMMA)).map(Integer::parseInt).toList();
 
         //查是否有在合作中、审核中的记录
-        List<CooperateQueryDto> cooperateQueryDtoList = queryValidCooperate(reqVo.getEntId(), currentEntId);
+        List<CooperateQueryDto> cooperateQueryDtoList = queryValidCooperate(reqVo.getTargetEntId(), currentEntId);
         if (!CollectionUtils.isEmpty(cooperateQueryDtoList)) {
             //有待审核的记录不允许新增申请
             for (CooperateQueryDto cooperateQueryDto : cooperateQueryDtoList) {
@@ -272,9 +276,9 @@ public class KwmCooperateApplyService {
         if (Objects.isNull(reqVo.getId())) {
             KwmCooperate kwmCooperate = new KwmCooperate();
             id = new IdWorker(1L).nextId();
-            kwmCooperate.setEntId(currentEntId);
+            kwmCooperate.setEntId(LoginUserHolder.getEntId());
             kwmCooperate.setInviterEntId(currentEntId);
-            kwmCooperate.setInviteeEntId(reqVo.getEntId());
+            kwmCooperate.setInviteeEntId(reqVo.getTargetEntId());
 
             //我方联系人
             UserCacheResDto contactDto = remoteSystemService.queryUserCacheById(reqVo.getUserId());
@@ -285,7 +289,7 @@ public class KwmCooperateApplyService {
             }
 
             //对方联系人
-            UserCacheResDto userCacheResDto = remoteSystemService.queryManagerInfoByEntId(reqVo.getEntId());
+            UserCacheResDto userCacheResDto = remoteSystemService.queryManagerInfoByEntId(reqVo.getTargetEntId());
             if (Objects.nonNull(userCacheResDto)) {
                 kwmCooperate.setInviteeContactsId(userCacheResDto.getId());
                 kwmCooperate.setInviteeContacts(contactDto.getName());

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

@@ -342,7 +342,7 @@ public class KwmCooperateManageService {
         List<KwmCooperateType> kwmCooperateTypeList = new ArrayList<>();
         for (KwmCooperate kwmCooperate : kwmCooperates) {
             Integer type = reqVo.getCooperateType();
-            if (!kwmCooperate.getEntId().equals(reqVo.getId())) {
+            if (kwmCooperate.getInviteeEntId().equals(reqVo.getId())) {
                 type = commonBusinessService.changeCooperateType(type);
             }
             LambdaQueryWrapper<KwmCooperateType> kwmCooperateTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();

+ 2 - 0
sckw-modules/sckw-manage/src/main/resources/mapper/KwmCooperateMapper.xml

@@ -49,6 +49,7 @@
                min(a.remark) remark,
                min(a.approval_remark) approvalRemark,
                case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.invitee_ent_id) else min(a.inviter_ent_id) end targetEntId,
+               case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.inviter_ent_id) else min(a.invitee_ent_id) end ourEntId,
                case when min(a.ent_id) = #{reqDto.currentEntId} then 1 else 2 end applyTypeCode
           FROM kwm_cooperate a
           LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id
@@ -147,6 +148,7 @@
                 min(a.remark) remark,
                 min(a.approval_remark) approvalRemark,
                 case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.invitee_ent_id) else min(a.inviter_ent_id) end targetEntId,
+                case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.inviter_ent_id) else min(a.invitee_ent_id) end ourEntId,
                 case when min(a.ent_id) = #{reqDto.currentEntId} then 1 else 2 end applyTypeCode
         FROM kwm_cooperate a
         LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id and b.status = 1 and b.del_flag = 0

+ 2 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/RoleBindMenuReqVo.java

@@ -22,13 +22,13 @@ public class RoleBindMenuReqVo implements Serializable {
      * 角色ID
      */
     @NotNull(message = "角色不能为空")
-    private long roleId;
+    private Long roleId;
 
     /**
      * 企业id
      */
     @NotNull(message = "企业不能为空")
-    private long entId;
+    private Long entId;
 
     /**
      * 菜单ID,多个用","隔开

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

@@ -133,7 +133,7 @@
       id,
       ent_id,
       menu_id,
-      role_id,
+     role_id,
       remark,
       status,
       create_by,
@@ -148,7 +148,14 @@
         #{item.id,jdbcType=BIGINT},
         #{item.entId,jdbcType=BIGINT},
         #{item.menuId,jdbcType=BIGINT},
-        #{item.roleId,jdbcType=BIGINT},
+            <choose>
+              <when test="item.roleId != null">
+                #{item.roleId,jdbcType=BIGINT},
+              </when>
+            <otherwise>
+              null,
+            </otherwise>
+            </choose>
         #{item.remark,jdbcType=VARCHAR},
         #{item.status,jdbcType=INTEGER},
         #{item.createBy,jdbcType=BIGINT},