|
|
@@ -1,6 +1,7 @@
|
|
|
package cn.tr.module.smart.common.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.util.ArrayUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.tr.core.exception.ServiceException;
|
|
|
import cn.tr.core.exception.TRExcCode;
|
|
|
@@ -20,6 +21,7 @@ import cn.tr.module.smart.web.dto.BizDeptLinkQuestionDTO;
|
|
|
import cn.tr.module.smart.wx.controller.vo.BizWxDeptVO;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import jodd.util.ArraysUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -125,7 +127,10 @@ public class BizDeptServiceImpl implements IBizDeptService {
|
|
|
if (CollectionUtil.isEmpty(ids)) {
|
|
|
throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "请选择要删除的数据");
|
|
|
}
|
|
|
- return baseRepository.deleteBatchIds(ids);
|
|
|
+ int i = baseRepository.deleteBatchIds(ids);
|
|
|
+ bizDocDeptService.remove(new LambdaQueryWrapper<BizDocDeptPO>().in(BizDocDeptPO::getDeptId,ids));
|
|
|
+ bizQuestionDeptService.remove(new LambdaQueryWrapper<BizQuestionDeptPO>().in(BizQuestionDeptPO::getDeptId,ids));
|
|
|
+ return i;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -159,10 +164,12 @@ public class BizDeptServiceImpl implements IBizDeptService {
|
|
|
return bizDocDeptPO;
|
|
|
}).collect(Collectors.toList());
|
|
|
bizDocDeptService.saveOrUpdateBatch(bizDocDeptPOS);
|
|
|
+ Collections.shuffle(docIds);
|
|
|
//修改 宣教文档关联个数
|
|
|
return baseRepository.update(null,
|
|
|
new LambdaUpdateWrapper<BizDeptPO>()
|
|
|
.set(BizDeptPO::getMissionDocCount, bizDocDeptPOS.size())
|
|
|
+ .set(BizDeptPO::getGroupId,CollectionUtil.getFirst(docIds))
|
|
|
.eq(BizDeptPO::getId, deptId)) != 0;
|
|
|
}
|
|
|
|