|
|
@ -1,6 +1,7 @@
|
|
|
|
package com.ruoyi.tc.controller;
|
|
|
|
package com.ruoyi.tc.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.CreditCodeUtil;
|
|
|
|
import cn.hutool.core.util.CreditCodeUtil;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
@ -13,13 +14,12 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
|
import com.ruoyi.tc.entity.Unit;
|
|
|
|
import com.ruoyi.tc.entity.*;
|
|
|
|
|
|
|
|
import com.ruoyi.tc.entity.po.*;
|
|
|
|
import com.ruoyi.tc.entity.request.UnitRequest;
|
|
|
|
import com.ruoyi.tc.entity.request.UnitRequest;
|
|
|
|
import com.ruoyi.tc.regular.AssetCurrentChange;
|
|
|
|
import com.ruoyi.tc.regular.AssetCurrentChange;
|
|
|
|
import com.ruoyi.tc.regular.UnitChange;
|
|
|
|
import com.ruoyi.tc.regular.UnitChange;
|
|
|
|
import com.ruoyi.tc.service.ExamineInfoService;
|
|
|
|
import com.ruoyi.tc.service.*;
|
|
|
|
import com.ruoyi.tc.service.UnitOtherConcatService;
|
|
|
|
|
|
|
|
import com.ruoyi.tc.service.UnitService;
|
|
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
@ -43,6 +43,8 @@ import java.util.*;
|
|
|
|
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
|
|
|
|
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
|
|
|
|
@RequestMapping("/tc/unit")
|
|
|
|
@RequestMapping("/tc/unit")
|
|
|
|
public class UnitController {
|
|
|
|
public class UnitController {
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetCurrentService assetCurrentService;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private UnitService unitService;
|
|
|
|
private UnitService unitService;
|
|
|
@ -64,7 +66,52 @@ public class UnitController {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private AssetCurrentChange assetCurrentChange;
|
|
|
|
private AssetCurrentChange assetCurrentChange;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetCurrentCpService assetCurrentCpService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetBusinessFormCpService assetBusinessFormCpService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetSupplyChainCpService assetSupplyChainCpService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetBasicNetworkCpService assetBasicNetworkCpService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetSupplyChainService assetSupplyChainService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetBasicNetworkService assetBasicNetworkService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetBusinessFormService assetBusinessFormService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private UnitOtherConcatCpService unitOtherConcatCpService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetAppService assetAppService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetAppCpService assetAppCpService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetEmailService assetEmailService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetEmailCpService assetEmailCpService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetOfficialAccountService assetOfficialAccountService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetOfficialAccountCpService assetOfficialAccountCpService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetMiniProgramsService assetMiniProgramsService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetMiniProgramsCpService assetMiniProgramsCpService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取单位列表
|
|
|
|
* 获取单位列表
|
|
|
@ -274,18 +321,84 @@ public class UnitController {
|
|
|
|
@Log(title = "删除单位", businessType = BusinessType.DELETE)
|
|
|
|
@Log(title = "删除单位", businessType = BusinessType.DELETE)
|
|
|
|
@DeleteMapping("/{id}")
|
|
|
|
@DeleteMapping("/{id}")
|
|
|
|
public AjaxResult remove(@PathVariable Long id) {
|
|
|
|
public AjaxResult remove(@PathVariable Long id) {
|
|
|
|
List<String> userNames = unitService.selectByIds(id);
|
|
|
|
String userNames = unitService.selectByIds(id);
|
|
|
|
//逻辑删除单位和用户
|
|
|
|
//根据单位名称查询任务
|
|
|
|
if (!userNames.isEmpty()) {
|
|
|
|
List<AssetTask> units = unitService.selectTaskIdToDwmc(userNames);
|
|
|
|
for (String it : userNames) {
|
|
|
|
if(units!=null && units.size()>0){
|
|
|
|
if (it != null) {
|
|
|
|
unitService.deleteUsers(userNames);
|
|
|
|
unitService.deleteUsers(it);
|
|
|
|
unitService.deleteUnits(id);
|
|
|
|
}
|
|
|
|
unitOtherConcatService.deleteByUnitIds(id);
|
|
|
|
|
|
|
|
examineInfoService.deleteByUnitIds(id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AssetCurrent> wrapper1 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
wrapper1.eq("dwmc", userNames);
|
|
|
|
|
|
|
|
wrapper1.eq("del_flag","0");
|
|
|
|
|
|
|
|
List<AssetCurrent> list = assetCurrentService.list(wrapper1);
|
|
|
|
|
|
|
|
if(list!=null&&list.size()>0){
|
|
|
|
|
|
|
|
list.forEach(x->{
|
|
|
|
|
|
|
|
assetSupplyChainService.deleteByAssetIds(x.getId());
|
|
|
|
|
|
|
|
assetBasicNetworkService.deleteByAssetIds(x.getId());
|
|
|
|
|
|
|
|
assetBusinessFormService.deleteByAssetIds(x.getId());
|
|
|
|
|
|
|
|
unitOtherConcatService.deleteByAssetIds(x.getId());
|
|
|
|
|
|
|
|
QueryWrapper<AssetSupplyChainCpPo> queryWrapper2 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
queryWrapper2.eq("asset_id", x.getId());
|
|
|
|
|
|
|
|
assetSupplyChainCpService.remove(queryWrapper2);
|
|
|
|
|
|
|
|
QueryWrapper<AssetBasicNetworkCpPo> queryWrapper3 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
queryWrapper3.eq("asset_id", x.getId());
|
|
|
|
|
|
|
|
assetBasicNetworkCpService.remove(queryWrapper3);
|
|
|
|
|
|
|
|
QueryWrapper<AssetBusinessFormCpPo> queryWrapper4 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
queryWrapper4.eq("asset_id", x.getId());
|
|
|
|
|
|
|
|
assetBusinessFormCpService.remove(queryWrapper4);
|
|
|
|
|
|
|
|
QueryWrapper<UnitOtherConcatCpPo> queryWrapper5 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
queryWrapper5.eq("asset_id", x.getId());
|
|
|
|
|
|
|
|
unitOtherConcatCpService.remove(queryWrapper5);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryWrapper<AssetApp> r1 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
r1.eq("ssdw", userNames);
|
|
|
|
|
|
|
|
AssetApp e1 = new AssetApp();
|
|
|
|
|
|
|
|
e1.setDelFlag("2");
|
|
|
|
|
|
|
|
assetAppService.update(e1, r1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AssetEmail> r2 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
r2.eq("ssdw", userNames);
|
|
|
|
|
|
|
|
AssetEmail e2 = new AssetEmail();
|
|
|
|
|
|
|
|
e2.setDelFlag("2");
|
|
|
|
|
|
|
|
assetEmailService.update(e2, r2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AssetOfficialAccount> r3 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
r3.eq("ssdw", userNames);
|
|
|
|
|
|
|
|
AssetOfficialAccount e3 = new AssetOfficialAccount();
|
|
|
|
|
|
|
|
e3.setDelFlag("2");
|
|
|
|
|
|
|
|
assetOfficialAccountService.update(e3, r3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AssetMiniPrograms> r4 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
r4.eq("ssdw", userNames);
|
|
|
|
|
|
|
|
AssetMiniPrograms e4 = new AssetMiniPrograms();
|
|
|
|
|
|
|
|
e4.setDelFlag("2");
|
|
|
|
|
|
|
|
assetMiniProgramsService.update(e4, r4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AssetAppCpPo> s1 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
s1.eq("ssdw", userNames);
|
|
|
|
|
|
|
|
assetAppCpService.remove(s1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AssetEmailCpPo> s2 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
s2.eq("ssdw", userNames);
|
|
|
|
|
|
|
|
assetEmailCpService.remove(s2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AssetOfficialAccountCpPo> s3 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
s3.eq("ssdw", userNames);
|
|
|
|
|
|
|
|
assetOfficialAccountCpService.remove(s3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AssetMiniProgramsCpPo> s4 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
s4.eq("ssdw", userNames);
|
|
|
|
|
|
|
|
assetMiniProgramsCpService.remove(s4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
throw new ServiceException("该单位有在运行的任务,无法删除!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
unitService.deleteUnits(id);
|
|
|
|
|
|
|
|
unitOtherConcatService.deleteByUnitIds(id);
|
|
|
|
|
|
|
|
examineInfoService.deleteByUnitIds(id);
|
|
|
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
return AjaxResult.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|