dongxin 1 год назад
Родитель
Сommit
9d801dda89

+ 2 - 1
commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementUndwrtRulesAttr.java

@@ -3,6 +3,7 @@ package com.jzg.commons.entity.po;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.jzg.commons.core.base.BaseModel;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -16,7 +17,7 @@ import java.util.List;
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
-public class PtlAgreementUndwrtRulesAttr {
+public class PtlAgreementUndwrtRulesAttr extends BaseModel {
 
     @TableId(value = "id", type = com.baomidou.mybatisplus.annotation.IdType.AUTO)
     private String id;

+ 1 - 1
commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementUndwrtRulesAttrLink.java

@@ -14,7 +14,7 @@ import lombok.Data;
  */
 @Schema(description = "协议承保规则属性关联表表")
 @Data
-public class PtlAgreementUndwrtRulesAttrLink  extends BaseModel {
+public class PtlAgreementUndwrtRulesAttrLink extends BaseModel {
 
     /** 主键/自增 */
     @Schema(description = "主键/自增")

+ 1 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/AgreementController.java

@@ -13,6 +13,7 @@ import com.jzg.commons.entity.vo.UpAndDownVo;
 import com.jzg.commons.util.AssertionUtils;
 import com.jzg.organization.service.PtlAgreementDeptService;
 import com.jzg.organization.service.PtlAgreementService;
+import com.jzg.organization.service.PtlAgreementUndwrtRulesService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.beans.factory.annotation.Autowired;

+ 26 - 6
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementServiceImpl.java

@@ -12,10 +12,7 @@ import com.jzg.commons.entity.dto.AgreementAuthParam;
 import com.jzg.commons.entity.dto.AgreementEditParam;
 import com.jzg.commons.entity.dto.AgreementParam;
 import com.jzg.commons.entity.enums.YesNoEnum;
-import com.jzg.commons.entity.po.EsmInsCompany;
-import com.jzg.commons.entity.po.PtlAgreement;
-import com.jzg.commons.entity.po.PtlAgreementDept;
-import com.jzg.commons.entity.po.SysSystem;
+import com.jzg.commons.entity.po.*;
 import com.jzg.commons.entity.vo.AgreementInfoVo;
 import com.jzg.commons.entity.vo.AgreementUserVo;
 import com.jzg.commons.entity.vo.AgreementVo;
@@ -28,8 +25,7 @@ import com.jzg.commons.util.idgen.IdWorker;
 import com.jzg.organization.client.EsmInsCompanyClient;
 import com.jzg.organization.mapper.PtlAgreementMapper;
 import com.jzg.organization.mapper.SysUserMapper;
-import com.jzg.organization.service.PtlAgreementDeptService;
-import com.jzg.organization.service.PtlAgreementService;
+import com.jzg.organization.service.*;
 import jakarta.annotation.Resource;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
@@ -42,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
 * @author dongxin
@@ -68,6 +65,15 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Autowired
     private SysUserMapper userMapper;
 
+    @Autowired
+    private PtlAgreementUndwrtRulesService agreementRulesService;
+
+    @Autowired
+    private PtlAgreementUndwrtRulesAttrService agreementUndwrtRulesAttrService;
+
+    @Autowired
+    private PtlAgreementUndwrtRulesAttrLinkService agreementUndwrtRulesAttrLinkService;
+
 
     @Override
     public Page<AgreementVo> queryPage(AgreementParam param) {
@@ -184,7 +190,21 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public boolean deleteByIds(List<String> ids) {
+
+        List<PtlAgreementUndwrtRules> rulesList = agreementRulesService.list(
+                new LambdaQueryWrapper<PtlAgreementUndwrtRules>()
+                .in(PtlAgreementUndwrtRules::getAgreementId, ids)
+                .eq(PtlAgreementUndwrtRules::getIsDelete, YesNoEnum.NO.getCode()));
+        List<String> rulesIdList = rulesList.stream().map(PtlAgreementUndwrtRules::getId)
+                .collect(Collectors.toList());
+        if(CollUtil.isNotEmpty(rulesIdList)){
+            agreementUndwrtRulesAttrLinkService.remove(new LambdaQueryWrapper<PtlAgreementUndwrtRulesAttrLink>()
+                    .in(PtlAgreementUndwrtRulesAttrLink::getRulesId, ids)
+                    .eq(PtlAgreementUndwrtRulesAttrLink::getIsDelete, YesNoEnum.NO.getCode()));
+            agreementRulesService.removeByIds(rulesIdList);
+        }
         return baseMapper.deleteByIds(ids) > 0;
     }