main
杜函宇 1 month ago
parent 1497cb7751
commit 6761277da9

@ -1,6 +1,7 @@
package com.ruoyi.tc.controller;
import cn.hutool.core.util.CreditCodeUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.Log;
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.system.service.ISysDeptService;
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.regular.AssetCurrentChange;
import com.ruoyi.tc.regular.UnitChange;
import com.ruoyi.tc.service.ExamineInfoService;
import com.ruoyi.tc.service.UnitOtherConcatService;
import com.ruoyi.tc.service.UnitService;
import com.ruoyi.tc.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@ -43,6 +43,8 @@ import java.util.*;
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@RequestMapping("/tc/unit")
public class UnitController {
@Resource
private AssetCurrentService assetCurrentService;
@Resource
private UnitService unitService;
@ -64,7 +66,52 @@ public class UnitController {
@Resource
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)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) {
List<String> userNames = unitService.selectByIds(id);
//逻辑删除单位和用户
if (!userNames.isEmpty()) {
for (String it : userNames) {
if (it != null) {
unitService.deleteUsers(it);
}
}
}
String userNames = unitService.selectByIds(id);
//根据单位名称查询任务
List<AssetTask> units = unitService.selectTaskIdToDwmc(userNames);
if(units!=null && units.size()>0){
unitService.deleteUsers(userNames);
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("该单位有在运行的任务,无法删除!");
}
return AjaxResult.success();
}

@ -36,7 +36,7 @@ public interface UnitMapper extends BaseMapper<Unit> {
/**
* id
*/
List<String> selectByIds(Long id);
String selectByIds(Long id);
/**
*
@ -86,6 +86,11 @@ public interface UnitMapper extends BaseMapper<Unit> {
*/
Integer selectTaskId(@Param("dwmc") String dwmc,@Param("type") String type);
/**
*
*/
List<AssetTask> selectTaskIdToDwmc(@Param("dwmc") String dwmc);
/**
* app

@ -48,7 +48,7 @@ public interface UnitService extends IService<Unit> {
/**
* id
*/
List<String> selectByIds(Long id);
String selectByIds(Long id);
/**
*
@ -81,6 +81,11 @@ public interface UnitService extends IService<Unit> {
*/
Integer selectTaskId(String dwmc,String type);
/**
*
*/
List<AssetTask> selectTaskIdToDwmc(String dwmc);
/**
*

@ -11,6 +11,7 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.request.GeneralQueryRequest;
import com.ruoyi.tc.entity.request.UnitRequest;
@ -102,7 +103,7 @@ public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements Un
* id
*/
@Override
public List<String> selectByIds(Long id) {
public String selectByIds(Long id) {
return baseMapper.selectByIds(id);
}
@ -145,6 +146,13 @@ public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements Un
public Integer selectTaskId(String dwmc, String type) {
return baseMapper.selectTaskId(dwmc, type);
}
/**
*
*/
@Override
public List<AssetTask> selectTaskIdToDwmc(String dwmc) {
return baseMapper.selectTaskIdToDwmc(dwmc);
}
@Override
public Integer findBydwmc(String part) {

@ -19,7 +19,7 @@
left join unit_info b on a.ssdw = b.nick_name
left join sys_dept c on b.dept_id = c.dept_id
<where>
a.del_flag = '0' and b.del_flag = '0'
a.del_flag = '0'
<if test="req.yymc!=null and req.yymc!='' ">
and a.app_name like concat('%',#{req.yymc},'%')
</if>

@ -17,7 +17,7 @@
left join unit_info b on a.dwmc = b.nick_name
left join sys_dept c on b.dept_id = c.dept_id
<where>
a. del_flag = '0' and b.del_flag = '0'
a. del_flag = '0'
<if test="req.xtmc!=null and req.xtmc!='' ">
and a.xtmc like concat('%',#{req.xtmc},'%')
</if>

@ -19,7 +19,7 @@
left join unit_info b on a.ssdw = b.nick_name
left join sys_dept c on b.dept_id = c.dept_id
<where>
a.del_flag = '0' and b.del_flag = '0'
a.del_flag = '0'
<if test="req.dzyxhz!=null and req.dzyxhz!='' ">
and a.dzyxhz like concat('%',#{req.dzyxhz},'%')
</if>

@ -19,7 +19,7 @@
left join unit_info b on a.ssdw = b.nick_name
left join sys_dept c on b.dept_id = c.dept_id
<where>
a.del_flag = '0' and b.del_flag = '0'
a.del_flag = '0'
<if test="req.xcxmc!=null and req.xcxmc!='' ">
and a.xcxmc like concat('%',#{req.xcxmc},'%')
</if>

@ -23,7 +23,7 @@
left join unit_info b on a.ssdw = b.nick_name
left join sys_dept c on b.dept_id = c.dept_id
<where>
a.del_flag = '0' and b.del_flag = '0'
a.del_flag = '0'
<if test="req.gzhmc!=null and req.gzhmc!='' ">
and a.gzhmc like concat('%',#{req.gzhmc},'%')
</if>

@ -125,7 +125,7 @@
<select id="selectByIds" resultType="java.lang.String">
select user_name
from unit_info
where id = #{id}
where id = #{id} and del_flag= '0'
</select>
<select id="dwList" resultType="com.ruoyi.tc.entity.Unit">
SELECT distinct a.*
@ -212,6 +212,9 @@
<select id="selectTaskId" resultType="java.lang.Integer">
select id from asset_task where dwmc like concat('%',#{dwmc},'%') and type like concat('%',#{type},'%') and task_status = '1'
</select>
<select id="selectTaskIdToDwmc" resultType="com.ruoyi.tc.entity.AssetTask">
select id from asset_task where dwmc like concat('%',#{dwmc},'%') and task_status = '1'
</select>
<select id="getAppSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept">
WITH RECURSIVE category_tree AS (-- 初始查询找出根节点或特定parentid的记录
SELECT
@ -221,7 +224,7 @@
LEFT JOIN unit_info b ON a.ssdw = b.nick_name
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
WHERE
d.dept_id IS NOT NULL
d.dept_id IS NOT NULL and a.del_flag = '0' and d.del_flag = '0'
GROUP BY
d.dept_id,
@ -256,7 +259,7 @@
LEFT JOIN unit_info b ON a.ssdw = b.nick_name
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
WHERE
d.dept_id IS NOT NULL
d.dept_id IS NOT NULL and a.del_flag = '0' and d.del_flag = '0'
GROUP BY
d.dept_id,
@ -291,7 +294,7 @@
LEFT JOIN unit_info b ON a.ssdw = b.nick_name
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
WHERE
d.dept_id IS NOT NULL
d.dept_id IS NOT NULL and a.del_flag = '0' and d.del_flag = '0'
GROUP BY
d.dept_id,
@ -326,7 +329,7 @@
LEFT JOIN unit_info b ON a.ssdw = b.nick_name
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
WHERE
d.dept_id IS NOT NULL
d.dept_id IS NOT NULL and a.del_flag = '0' and d.del_flag = '0'
GROUP BY
d.dept_id,
@ -361,7 +364,7 @@
LEFT JOIN unit_info b ON a.dwmc = b.nick_name
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
WHERE
d.dept_id IS NOT NULL
d.dept_id IS NOT NULL and a.del_flag = '0' and d.del_flag = '0'
GROUP BY
d.dept_id,
d.parent_id,
@ -387,6 +390,7 @@
ORDER BY dept_id desc
</select>
<update id="deleteUnits">
update unit_info
set del_flag = '2'

Loading…
Cancel
Save