|
@@ -142,38 +142,16 @@ public class BizRecycleBinController extends BaseController {
|
|
|
@PostMapping("/{ids}")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public AjaxResult add(@PathVariable List<Long> ids) throws NoSuchFieldException, IllegalAccessException {
|
|
|
- BizCompany com = new BizCompany();
|
|
|
- List<BizRecycleBin> recycleBins = new ArrayList<>();
|
|
|
//遍历id查询客户数据并在回收站中插入
|
|
|
+
|
|
|
for (Long id : ids) {
|
|
|
- BizRecycleBin bin = new BizRecycleBin();
|
|
|
- com = bizCompanyMapper.getById(id);
|
|
|
- bin.setFromId(0L);
|
|
|
- bin.setSourceValue(com.getName());
|
|
|
- bin.setSourceTableName("biz_company");
|
|
|
- bin.setSourceId(com.getId());
|
|
|
- setTenantId(bin);
|
|
|
- bizRecycleBinService.save(bin);
|
|
|
- //软删除客户关联子表数据
|
|
|
- bizRecycleBinService.deleteData(id, tabs);
|
|
|
- List<Map<String, Object>> tabList = Arrays.stream(tabs).map(v -> {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("tab", v);
|
|
|
- map.put("id", id);
|
|
|
- return map;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- List<BizRecycleBin> children = bizRecycleBinService.getChildIdsByParentId(tabList);
|
|
|
- Long tenantId = getTenantId();
|
|
|
- BizCompany finalCom = com;
|
|
|
- children.forEach(child -> {
|
|
|
- child.setFromId(bin.getId());
|
|
|
- child.setSourceValue(finalCom.getName());
|
|
|
- child.setTenantId(tenantId);
|
|
|
- recycleBins.add(child);
|
|
|
- });
|
|
|
+ List<BizArchiveInput> bizArchiveInputList = bizArchiveInputService.query().eq("company_id",id).eq("verify_status",1).list();
|
|
|
+ if(!bizArchiveInputList.isEmpty()) {
|
|
|
+ return error("有合同正在进行,不可以删除客户");
|
|
|
+ }
|
|
|
}
|
|
|
//查询客户关联子表数据在回收站中插入
|
|
|
- bizRecycleBinService.saveBatch(recycleBins);
|
|
|
+ //bizRecycleBinService.saveBatch(recycleBins);
|
|
|
//删除客户表数据
|
|
|
return toAjax(bizCompanyService.removeBatchByIds(ids));
|
|
|
}
|
|
@@ -381,6 +359,15 @@ public class BizRecycleBinController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('business:bin:restore')")
|
|
|
@PostMapping("/restoreArchive/{ids}")
|
|
|
public AjaxResult restoreArchive(@PathVariable List<Long> ids) {
|
|
|
+ BizArchiveInput bizArchiveInput;
|
|
|
+ BizCompany bizCompany;
|
|
|
+ for(Long id : ids){
|
|
|
+ bizArchiveInput = bizArchiveInputService.getById(id);
|
|
|
+ bizCompany = bizCompanyService.getByComId(bizArchiveInput.getCompanyId());
|
|
|
+ if(null != bizCompany && bizCompany.getDeleted() == 1L){
|
|
|
+ return error("此合同关联的用户,已被删除,只能进行删除操作");
|
|
|
+ }
|
|
|
+ }
|
|
|
return toAjax(bizRecycleBinService.restore(ids, ordertabs, false));
|
|
|
}
|
|
|
|