Przeglądaj źródła

修改产品权限时,同步修改所有机构的权限

hgw 3 lat temu
rodzic
commit
6b56751a93

+ 16 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/EmployeeDao.java

@@ -7,7 +7,6 @@ import com.ym.mec.biz.dal.dto.EmployeeLevelDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.common.dal.BaseDAO;
-
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -175,22 +174,27 @@ public interface EmployeeDao extends BaseDAO<Integer, Employee> {
      * @describe 根据角色和用户查找用户(包含离职和冻结的)
      */
     List<SimpleUserDto> findAllByRole(@Param("roleIds") String roleIds,
-                                   @Param("organIds") String organIds);
+                                      @Param("organIds") String organIds);
 
     /**
      * 获取离职员工所在的乐团列表
+     *
      * @param levelUserId
      * @return
      */
     List<String> queryMusicGroupIdByUserId(Integer levelUserId);
+
     /**
      * 获取离职员工所在的乐团列表
+     *
      * @param levelUserId
      * @return
      */
     List<String> queryPracticeGroupIdByUserId(Integer levelUserId);
+
     /**
      * 获取离职员工所在的乐团列表
+     *
      * @param levelUserId
      * @return
      */
@@ -198,6 +202,7 @@ public interface EmployeeDao extends BaseDAO<Integer, Employee> {
 
     /**
      * 获取用户信息
+     *
      * @param userIds
      * @return
      */
@@ -205,13 +210,20 @@ public interface EmployeeDao extends BaseDAO<Integer, Employee> {
 
     /**
      * 批量添加角色和菜单关系
-     * @param roleId 角色id
+     *
+     * @param roleId  角色id
      * @param menuIds 菜单集合
      */
-    int batchInsertRoleMenu(@Param("roleId") Integer roleId,@Param("menuIds")  List<Integer> menuIds, @Param("tenantId") Integer tenantId);
+    int batchInsertRoleMenu(@Param("roleId") Integer roleId, @Param("menuIds") List<Integer> menuIds, @Param("tenantId") Integer tenantId);
+
+    /**
+     * 根据机构id,和菜单id删除
+     */
+    int delRoleMenu(@Param("tenantId") Integer tenantId, @Param("menuIds") List<Integer> menuIds);
 
     /**
      * 添加角色信息
+     *
      * @param sysRole
      * @return
      */

+ 10 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/PlatformProductDao.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.entity.PlatformProduct;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 public interface PlatformProductDao extends BaseMapper<PlatformProduct> {
     int deleteByPrimaryKey(Integer id);
@@ -22,6 +23,14 @@ public interface PlatformProductDao extends BaseMapper<PlatformProduct> {
 
     List<String> queryMenuIdList(Integer serveId);
 
-    List<Integer> queryProductInTenant(Integer id);
+    /**
+     * 根据条件机构和产品的关系
+     *
+     * @param productId 产品id
+     * @param serveId   服务id
+     * @param tenantId  机构id
+     * @return tenantId 机构id,userId机构管理员id
+     */
+    List<Map<Integer, Integer>> queryTenantByMultiId(@Param("productId") Integer productId, @Param("serveId") Integer serveId, @Param("tenantId") Integer tenantId);
 
 }

+ 25 - 40
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/PlatformProduct.java

@@ -1,71 +1,56 @@
 package com.ym.mec.biz.dal.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+
 import java.io.Serializable;
 import java.util.Date;
 
 /**
- * platform_product
- * @author 
+ * 产品管理(PlatformProduct)表实体类
+ *
+ * @author hgw
+ * @since 2022-01-07 19:01:04
  */
-@ApiModel(value="产品管理")
+@ApiModel(value = "platform_product-产品管理")
 public class PlatformProduct implements Serializable {
-    /**
-     * 主键
-     */
-    @ApiModelProperty(value="主键")
     @TableId(value = "id_", type = IdType.AUTO)
+    @ApiModelProperty(value = "主键")
     private Integer id;
 
-    /**
-     * 产品名称
-     */
-    @ApiModelProperty(value="产品名称")
+    @TableField("name_")
+    @ApiModelProperty(value = "服务名称")
     private String name;
 
-    /**
-     * 菜单id
-     */
-    @ApiModelProperty(value="菜单id")
+    @TableField("menu_id_")
+    @ApiModelProperty(value = "菜单id")
     private String menuId;
 
-    /**
-     * 备注
-     */
-    @ApiModelProperty(value="备注")
+    @TableField("remark_")
+    @ApiModelProperty(value = "产品id多个用逗号分割")
     private String remark;
 
-    /**
-     * 是否删除0未删除 1删除
-     */
-    @ApiModelProperty(value="是否删除0未删除 1删除")
-    private Integer deleted = 0;
+    @TableField("deleted_")
+    @ApiModelProperty(value = "是否删除0未删除 1删除")
+    private Integer deleted;
 
-    /**
-     * 创建人
-     */
-    @ApiModelProperty(value="创建人")
+    @TableField("created_by_")
+    @ApiModelProperty(value = "创建人")
     private Integer createdBy;
 
-    /**
-     * 创建时间
-     */
-    @ApiModelProperty(value="创建时间")
+    @TableField("created_time_")
+    @ApiModelProperty(value = "创建时间")
     private Date createdTime;
 
-    /**
-     * 更新人
-     */
-    @ApiModelProperty(value="更新人")
+    @TableField("updated_by_")
+    @ApiModelProperty(value = "更新人")
     private Integer updatedBy;
 
-    /**
-     * 更新时间
-     */
-    @ApiModelProperty(value="更新时间")
+    @TableField("updated_time_")
+    @ApiModelProperty(value = "更新时间")
     private Date updatedTime;
 
     private static final long serialVersionUID = 1L;

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/PlatformProductService.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.entity.PlatformProduct;
 import com.ym.mec.common.page.PageInfo;
 
 import java.util.List;
+import java.util.Map;
 
 public interface PlatformProductService {
 
@@ -12,6 +13,10 @@ public interface PlatformProductService {
 
     void updateProduct(PlatformProductDto obj);
 
+    void checkUpdateRole(String menuIds, String sourceMenuIds, Map<Integer, Integer> map);
+
+    Map<Integer, Integer> queryTenantByMultiId(Integer productId, Integer serveId, Integer tenantId);
+
     PageInfo<PlatformProduct> queryPage(String search, Integer page, Integer rows);
 
     List<String> queryMenuIdList(Integer serveId);

+ 8 - 34
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -47,8 +47,6 @@ import java.io.IOException;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 
 import static com.ym.mec.biz.dal.entity.ApprovalStatus.PROCESSING;
@@ -597,7 +595,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         Date date = new Date();
         //使用优惠券
-        CouponPayParam couponPayParam = checkCoupon(renewParamDto);
+        CouponPayParam couponPayParam = checkCoupon(renewParamDto.getCouponIdList(), renewParamDto.getAmount());
         StudentPaymentOrder studentPaymentOrder = couponPayParam.getStudentPaymentOrder();
         studentPaymentOrder.setGroupType(GroupType.MUSIC);
         studentPaymentOrder.setUserId(userId);
@@ -774,43 +772,19 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         return goodsDto;
     }
 
-    private AtomicInteger getTotalNum(RegisterPayDto registerPayDto) {
-        AtomicInteger total = new AtomicInteger(0);
-        getTotal(registerPayDto.getGoodsGroups(), Map::size, total);
-        getTotal(registerPayDto.getNewCourse(), List::size, total);
-        getTotal(registerPayDto.getBuyCalenderActivityId(), List::size, total);
-        getTotal(registerPayDto.getBuyCloudTeacher(), total);
-        getTotal(registerPayDto.getBuyCloudTeacherPlus(), total);
-        getTotal(registerPayDto.getBuyMaintenance(), total);
-        return total;
-    }
-
-    private <T> void getTotal(T obj, Function<? super T, Integer> mapper, AtomicInteger total) {
-        Optional.ofNullable(obj)
-                .ifPresent(o -> total.set(total.get() + mapper.apply(o)));
-    }
-
-    private void getTotal(Boolean flag, AtomicInteger total) {
-        if (Objects.nonNull(flag) && flag) {
-            total.set(total.incrementAndGet());
-        }
-    }
-
     //校验如果使用了优惠券,优惠券的信息是否合法
-    public CouponPayParam checkCoupon(RegisterPayDto registerPayDto) {
+    public CouponPayParam checkCoupon(List<Integer> couponIdList, BigDecimal amount) {
         CouponPayParam couponPayParam = new CouponPayParam();
         StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
-        studentPaymentOrder.setExpectAmount(registerPayDto.getAmount());
-        studentPaymentOrder.setActualAmount(registerPayDto.getAmount());
+        studentPaymentOrder.setExpectAmount(amount);
+        studentPaymentOrder.setActualAmount(amount);
         //没有使用优惠券
-        if (CollectionUtils.isEmpty(registerPayDto.getCouponIdList())) {
+        if (CollectionUtils.isEmpty(couponIdList)) {
             studentPaymentOrder.setCouponRemitFee(BigDecimal.ZERO);
         } else {
-            //获取本次商品的总数
-            AtomicInteger total = getTotalNum(registerPayDto);
             //校验优惠券的使用
-            couponPayParam = sysCouponCodeService.getCouponPayParam(registerPayDto.getCouponIdList());
-            studentPaymentOrder.setCouponCodeId(StringUtils.join(registerPayDto.getCouponIdList(), ","));
+            couponPayParam = sysCouponCodeService.getCouponPayParam(couponIdList);
+            studentPaymentOrder.setCouponCodeId(StringUtils.join(couponIdList, ","));
             studentPaymentOrder.setCouponRemitFee(couponPayParam.getCouponRemitTotal());
         }
         couponPayParam.setStudentPaymentOrder(studentPaymentOrder);
@@ -860,7 +834,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         String channelType = "";
         //生成订单,校验优惠券的使用情况
-        CouponPayParam couponPayParam = checkCoupon(registerPayDto);
+        CouponPayParam couponPayParam = checkCoupon(registerPayDto.getCouponIdList(), registerPayDto.getAmount());
         StudentPaymentOrder studentPaymentOrder = couponPayParam.getStudentPaymentOrder();
         studentPaymentOrder.setUserId(studentRegistration.getUserId());
         studentPaymentOrder.setGroupType(GroupType.MUSIC);

+ 87 - 17
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PlatformProductServiceImpl.java

@@ -3,8 +3,10 @@ package com.ym.mec.biz.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dao.PlatformProductDao;
 import com.ym.mec.biz.dal.dto.PlatformProductDto;
 import com.ym.mec.biz.dal.entity.PlatformProduct;
@@ -12,14 +14,13 @@ import com.ym.mec.biz.service.PlatformProductService;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageUtil;
+import com.ym.mec.common.page.WrapperUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author hgw
@@ -29,6 +30,8 @@ import java.util.Optional;
 public class PlatformProductServiceImpl extends ServiceImpl<PlatformProductDao, PlatformProduct> implements PlatformProductService {
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     /**
      * 增加
@@ -53,24 +56,91 @@ public class PlatformProductServiceImpl extends ServiceImpl<PlatformProductDao,
      * 修改
      */
     @Override
-    public void updateProduct(PlatformProductDto obj) {
-        Optional.ofNullable(obj.getId()).orElseThrow(() -> new BizException("产品Id不能为空"));
+    public void updateProduct(PlatformProductDto dto) {
+        Optional.ofNullable(dto.getId()).orElseThrow(() -> new BizException("产品Id不能为空"));
         Integer userId = Optional.ofNullable(sysUserFeignService.queryUserInfo())
                 .map(SysUser::getId)
                 .orElseThrow(() -> new BizException("用户信息获取失败"));
+        //查询该产品
+        PlatformProduct sourceObj = Optional.ofNullable(this.getById(dto.getId()))
+                .filter(s -> s.getDeleted() == 0)
+                .orElseThrow(() -> new BizException("未查询到该产品信息!"));
+
         PlatformProduct platformProduct = new PlatformProduct();
-        platformProduct.setId(obj.getId());
-        platformProduct.setName(obj.getName());
-        platformProduct.setMenuId(obj.getMenuId());
-        platformProduct.setRemark(obj.getRemark());
+        platformProduct.setId(dto.getId());
+        platformProduct.setName(dto.getName());
+        platformProduct.setMenuId(dto.getMenuId());
+        platformProduct.setRemark(dto.getRemark());
         platformProduct.setUpdatedBy(userId);
         platformProduct.setUpdatedTime(new Date());
         baseMapper.updateByPrimaryKeySelective(platformProduct);
-        //查询哪些机构用了这个产品,需要修改对应的权限
-//        List<Integer> tenantIds = baseMapper.queryProductInTenant(obj.getId());
-//        if(CollectionUtils.isEmpty(tenantIds)){
-//            return;
-//        }
+        //查询该产品有多少机构关联
+        Map<Integer, Integer> map = queryTenantByMultiId(dto.getId(), null, null);
+        if (Objects.isNull(map)) {
+            return;
+        }
+        //检查是否需要修改权限
+        checkUpdateRole(dto.getMenuId(), sourceObj.getMenuId(), map);
+    }
+
+    /**
+     * 检查哪些机构用了这个产品,需要修改对应的权限
+     *
+     * @param menuIds       修改后的的菜单id,用逗号隔开
+     * @param sourceMenuIds 修改之前的的菜单id,用逗号隔开
+     * @param map           Map<机构id,机构的管理员id> queryProductInTenant
+     */
+    public void checkUpdateRole(String menuIds, String sourceMenuIds, Map<Integer, Integer> map) {
+        //需要删除的菜单id
+        List<Integer> deleteList = getList(sourceMenuIds);
+        //需要添加的菜单id
+        List<Integer> addList = getList(menuIds);
+        //求新旧产品菜单的差异
+        WrapperUtil.listDifference(deleteList, addList);
+        //修改数据
+        map.forEach((tenantId, uId) -> {
+            if (CollectionUtils.isNotEmpty(addList)) {
+                //uId查询机构管理员角色
+                List<Integer> roles = employeeDao.queryUserRole(uId);
+                //机构管理员只会有一个管理员角色
+                Integer adminRole = roles.get(0);
+                //给管理员角色添加dtoList菜单id
+                Lists.partition(addList, 50)
+                        .forEach(idList -> employeeDao.batchInsertRoleMenu(adminRole, idList, tenantId));
+            }
+            //根据机构id 和 角色的菜单id删除信息
+            if (CollectionUtils.isNotEmpty(deleteList)) {
+                Lists.partition(deleteList, 50)
+                        .forEach(idList -> employeeDao.delRoleMenu(tenantId, idList));
+            }
+        });
+    }
+
+    private List<Integer> getList(String str) {
+        List<String> strings = Optional.ofNullable(str).map(WrapperUtil::toList).orElse(null);
+        if (CollectionUtils.isEmpty(strings)) {
+            return null;
+        }
+        return strings.stream()
+                .map(WrapperUtil::toInt)
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * 根据多个id 查询出机构的id 和机构管理员id
+     *
+     * @param productId 产品id
+     * @param serveId   服务id
+     * @param tenantId  机构id
+     */
+    public Map<Integer, Integer> queryTenantByMultiId(Integer productId, Integer serveId, Integer tenantId) {
+        List<Map<Integer, Integer>> mapList = baseMapper.queryTenantByMultiId(productId, serveId, tenantId);
+        if (CollectionUtils.isEmpty(mapList)) {
+            return null;
+        }
+        //Map<机构id,机构的管理员id>
+        return mapList.stream()
+                .collect(Collectors.toMap(m -> m.get("tenantId"), m -> m.get("userId"), (a, b) -> b));
     }
 
     /**
@@ -85,8 +155,8 @@ public class PlatformProductServiceImpl extends ServiceImpl<PlatformProductDao,
                 .map(SysUser::getId)
                 .orElseThrow(() -> new BizException("用户信息获取失败"));
         //校验哪些机构用了该产品
-        List<Integer> tenantIds = baseMapper.queryProductInTenant(id);
-        if(CollectionUtils.isNotEmpty(tenantIds)){
+        List<Map<Integer, Integer>> map = baseMapper.queryTenantByMultiId(id, null, null);
+        if (CollectionUtils.isEmpty(map)) {
             throw new BizException("该产品关联的服务已有机构在使用,无法删除!");
         }
 

+ 10 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java

@@ -592,19 +592,23 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
         //缴费项目详情
         musicGroupPaymentCalenderDetailService.addCalenderDetail(studentPaymentOrder, studentRegistration);
 
-        List<OrderDetailTypeEnum> detailTypeEnums = allDetails.stream().map(e -> e.getType()).collect(Collectors.toList());
+        List<OrderDetailTypeEnum> detailTypeEnums = allDetails.stream().map(StudentPaymentOrderDetail::getType).collect(Collectors.toList());
         //销售订单详情
         if (allDetails.size() > 0 && (detailTypeEnums.contains(MUSICAL) || detailTypeEnums.contains(ACCESSORIES) || detailTypeEnums.contains(TEACHING))) {
             BigDecimal couponRemitFee = studentPaymentOrder.getCouponRemitFee();
             if (couponRemitFee.compareTo(BigDecimal.ZERO) > 0) {
-                BigDecimal musicFee = allDetails.stream().filter(o -> o.getType() == MUSICAL
-                                || o.getType() == ACCESSORIES || o.getType() == TEACHING)
-                        .map(o -> o.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+                BigDecimal musicFee = allDetails.stream()
+                        .filter(o -> o.getType() == MUSICAL || o.getType() == ACCESSORIES || o.getType() == TEACHING)
+                        .map(StudentPaymentOrderDetail::getPrice)
+                        .reduce(BigDecimal.ZERO, BigDecimal::add);
                 BigDecimal expectAmount = studentPaymentOrder.getExpectAmount();
                 //获取比例
-                BigDecimal ratioAmount = musicFee.divide(expectAmount, 6, BigDecimal.ROUND_HALF_UP);
+                BigDecimal ratioAmount = BigDecimal.ZERO;
+                if (BigDecimal.ZERO.compareTo(expectAmount) > 0) {
+                    ratioAmount = musicFee.divide(expectAmount, 6, RoundingMode.HALF_UP);
+                }
                 //获取分配的减免金额
-                couponRemitFee = couponRemitFee.multiply(ratioAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
+                couponRemitFee = couponRemitFee.multiply(ratioAmount).setScale(2, RoundingMode.HALF_UP);
             }
             sellOrderService.addOrderDetail2SellOrder(allDetails, studentPaymentOrder, musicGroup, couponRemitFee);
         }

+ 9 - 0
mec-biz/src/main/resources/config/mybatis/EmployeeMapper.xml

@@ -91,6 +91,15 @@
         </foreach>
     </insert>
 
+    <delete id="delRoleMenu">
+        DELETE FROM `sys_role_menu`
+        WHERE  tenant_id_ = #{tenantId}
+        and menu_id_ in
+        <foreach collection="menuIds" open="(" close=")" item="item" separator=",">
+            #{item}
+        </foreach>
+    </delete>
+
     <insert id="insertSysRole" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.auth.api.entity.SysRole"
             useGeneratedKeys="true">
         INSERT INTO `sys_role` (`role_name_`, `role_code_`, `role_desc_`, `create_time_`,

+ 30 - 9
mec-biz/src/main/resources/config/mybatis/PlatformProductMapper.xml

@@ -137,7 +137,7 @@
             </if>
         </where>
     </select>
-    
+
     <select id="queryMenuIdList" parameterType="integer" resultType="string">
         SELECT
             b.`menu_id_`
@@ -150,16 +150,37 @@
           AND a.`id_` = #{serveId}
     </select>
 
-    <select id="queryProductInTenant" parameterType="integer" resultType="integer">
+    <select id="queryTenantByMultiId" parameterType="integer" resultType="map">
         SELECT
-            DISTINCT
-            tpi.tenant_id_
+            a.id_ as tenantId,
+            a.`user_id_` as userId
         FROM
-            tenant_product_info as tpi
-                JOIN `platform_serve` AS a on tpi.serve_id_ = a.id_
-                JOIN `platform_product` AS b
-                     ON FIND_IN_SET(b.`id_`, a.`product_id_`)
-        where b.id_ = #{id}
+        tenant_info AS a
+                JOIN `tenant_product_info` AS b
+                     ON a.`id_` = b.`tenant_id_`
+                JOIN
+            (SELECT
+                 a.id_ AS serveId,
+                 a.`name_` AS serveName,
+                 GROUP_CONCAT(b.`name_`) AS productName
+             FROM
+                 `platform_serve` AS a
+                     JOIN `platform_product` AS b
+                          ON FIND_IN_SET(b.`id_`, a.`product_id_`)
+             WHERE
+                 a.deleted_ = 0 AND b.deleted_ = 0
+                 <if test="productId != null">
+                     and b.`id_` = #{productId}
+                 </if>
+                 <if test="serveId != null">
+                     and a.id_ = #{serveId}
+                 </if>
+             GROUP BY a.`id_`) AS c
+            ON b.`serve_id_` = c.serveId
+        WHERE a.`pay_state_` = 1
+        <if test="tenantId != null">
+            and a.id_ = #{tenantId}
+        </if>
     </select>
 
 </mapper>

+ 33 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/page/WrapperUtil.java

@@ -90,6 +90,12 @@ public class WrapperUtil<T> {
                 .orElse(null);
     }
 
+    public static Integer toInt(String str) {
+        return Optional.ofNullable(str)
+                .map(Integer::valueOf)
+                .orElse(null);
+    }
+
     public static <O> Optional<Integer> intOptional(Optional<O> optional) {
         return optional
                 .map(String::valueOf)
@@ -169,6 +175,14 @@ public class WrapperUtil<T> {
         }
     }
 
+    public static boolean checkInObj(Object o, Object... str) {
+        if (ObjPredicate.test(str)) {
+            return Arrays.asList(str).contains(o);
+        } else {
+            return false;
+        }
+    }
+
     /**
      * 根据分组groupVal进行聚合分组
      *
@@ -193,4 +207,23 @@ public class WrapperUtil<T> {
                 .reduce(BigDecimal.ZERO, BigDecimal::add);
     }
 
+    /**
+     * 对比a,b集和
+     * <p> 示例
+     * <p>  传入a -> [1, 3,4,6]
+     * <p>  传入b -> [1,2,4]
+     * <p> 执行该方法后a,b会被修改为
+     * <p> a -> [3,6]
+     * <p> b -> [2]
+     */
+    public static <O> void listDifference(List<O> a, List<O> b) {
+        //将ab并集
+        Collection abUn = CollectionUtils.retainAll(a, b);
+        System.out.println(abUn);
+        //删除a中abUn的值
+        a.removeAll(abUn);
+        //删除b中abUn的值
+        b.removeAll(abUn);
+    }
+
 }