main
杜函宇 1 month ago
parent 36a7653668
commit 92e082ba4c

@ -7,6 +7,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tc.entity.AssetApp; import com.ruoyi.tc.entity.AssetApp;
import com.ruoyi.tc.entity.request.AssetAppPageRequest; import com.ruoyi.tc.entity.request.AssetAppPageRequest;
@ -51,6 +52,13 @@ public class AssetAppController extends BaseController {
Page<AssetApp> page = new Page<>(); Page<AssetApp> page = new Page<>();
page.setCurrent(req.getCurrent()); page.setCurrent(req.getCurrent());
page.setSize(req.getSize()); page.setSize(req.getSize());
try {
if (!SecurityUtils.getLoginUser().getUser().isAdmin() && !SecurityUtils.hasRole("common")) {
req.setDwmc(SecurityUtils.getLoginUser().getUser().getNickName());
}
} catch (Exception e) {
throw new ServiceException("获取用户信息异常");
}
return success(assetAppService.page(page, req)); return success(assetAppService.page(page, req));
} }
@ -76,7 +84,8 @@ public class AssetAppController extends BaseController {
@PostMapping @PostMapping
@Log(title = "新增app数据", businessType = BusinessType.INSERT) @Log(title = "新增app数据", businessType = BusinessType.INSERT)
public AjaxResult add(@RequestBody AssetApp assetApp) { public AjaxResult add(@RequestBody AssetApp assetApp) {
return success(assetAppService.save(assetApp));
return success(assetAppService.add(assetApp));
} }
/** /**
@ -89,7 +98,7 @@ public class AssetAppController extends BaseController {
@Log(title = "编辑app数据", businessType = BusinessType.UPDATE) @Log(title = "编辑app数据", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody AssetApp assetApp) { public AjaxResult edit(@RequestBody AssetApp assetApp) {
return success(assetAppService.updateById(assetApp)); return success(assetAppService.edit(assetApp));
} }
/** /**
@ -145,9 +154,9 @@ public class AssetAppController extends BaseController {
.eq(AssetApp::getAppName, x.getAppName()).one(); .eq(AssetApp::getAppName, x.getAppName()).one();
if(one!=null){ if(one!=null){
x.setId(one.getId()); x.setId(one.getId());
assetAppService.updateById(x); assetAppService.edit(x);
}else { }else {
assetAppService.save(x); assetAppService.add(x);
} }
}); });
} else { } else {

@ -2,47 +2,22 @@ package com.ruoyi.tc.controller;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
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.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tc.entity.AssetBasicNetwork; import com.ruoyi.tc.entity.*;
import com.ruoyi.tc.entity.AssetCurrent; import com.ruoyi.tc.entity.po.*;
import com.ruoyi.tc.entity.AssetExport;
import com.ruoyi.tc.entity.AssetSupplyChain;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.UnitOtherConcat;
import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo;
import com.ruoyi.tc.entity.po.AssetCurrentCpPo;
import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo;
import com.ruoyi.tc.entity.po.UnitOtherConcatCpPo;
import com.ruoyi.tc.entity.request.AssetCurrentPageRequest; import com.ruoyi.tc.entity.request.AssetCurrentPageRequest;
import com.ruoyi.tc.service.AssetBasicNetworkCpService; import com.ruoyi.tc.service.*;
import com.ruoyi.tc.service.AssetBasicNetworkService;
import com.ruoyi.tc.service.AssetBusinessFormCpService;
import com.ruoyi.tc.service.AssetBusinessFormService;
import com.ruoyi.tc.service.AssetCurrentCpService;
import com.ruoyi.tc.service.AssetCurrentService;
import com.ruoyi.tc.service.AssetSupplyChainCpService;
import com.ruoyi.tc.service.AssetSupplyChainService;
import com.ruoyi.tc.service.AssetTaskService;
import com.ruoyi.tc.service.UnitOtherConcatCpService;
import com.ruoyi.tc.service.UnitOtherConcatService;
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;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -99,6 +74,8 @@ public class AssetCurrentController extends BaseController {
@Resource @Resource
private UnitOtherConcatCpService unitOtherConcatCpService; private UnitOtherConcatCpService unitOtherConcatCpService;
@Resource
private UnitService unitService;
/** /**
* *
@ -191,46 +168,43 @@ public class AssetCurrentController extends BaseController {
// 单位有进行中的任务时,管理端新增该单位下的资产则需同步至当前进行中的任务中。 // 单位有进行中的任务时,管理端新增该单位下的资产则需同步至当前进行中的任务中。
//获取新增资产id //获取新增资产id
Long id = assetCurrent.getId(); Long id = assetCurrent.getId();
List<AssetTask> assetTasks = assetTaskService.taskList(assetCurrent.getDwmc()); Integer i = unitService.selectTaskId(assetCurrent.getDwmc(), "0");
if (assetTasks != null) {
for (AssetTask assetTask : assetTasks) { //新增资产复制主表
//新增资产复制主表 AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo();
AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo(); BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo);
BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo); assetCurrentCpPo.setTaskId(i);
assetCurrentCpPo.setTaskId(assetTask.getId()); assetCurrentCpService.save(assetCurrentCpPo);
assetCurrentCpService.save(assetCurrentCpPo); //新增新监管业务形态
//新增新监管业务形态 //根据资产id查询新监管业务形态主表id
//根据资产id查询新监管业务形态主表id if (assetCurrent.getXjgywxt() != null) {
if (assetCurrent.getXjgywxt() != null) { assetCurrentCpPo.getXjgywxt().setAssetId(id);
assetCurrentCpPo.getXjgywxt().setAssetId(id); assetCurrentCpPo.getXjgywxt().setTaskId(i);
assetCurrentCpPo.getXjgywxt().setTaskId(assetTask.getId()); assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt());
assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt()); }
} if (assetCurrent.getGylxxList() != null) {
if (assetCurrent.getGylxxList() != null) { for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) {
for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) { items.setAssetId(id);
items.setAssetId(id); items.setTaskId(i);
items.setTaskId(assetTask.getId());
}
//新增供应链
assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList());
}
if (assetCurrent.getJcwlList() != null) {
for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(assetTask.getId());
}
//新增基础网络
assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList());
}
if (assetCurrent.getOtherConcat() != null) {
for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(assetTask.getId());
}
//新增其他联系人
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
}
} }
//新增供应链
assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList());
}
if (assetCurrent.getJcwlList() != null) {
for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(i);
}
//新增基础网络
assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList());
}
if (assetCurrent.getOtherConcat() != null) {
for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(i);
}
//新增其他联系人
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
} }
return success(); return success();
@ -296,6 +270,62 @@ public class AssetCurrentController extends BaseController {
//新增其他联系人 //新增其他联系人
unitOtherConcatService.saveBatch(assetCurrent.getOtherConcat()); unitOtherConcatService.saveBatch(assetCurrent.getOtherConcat());
} }
//================================
QueryWrapper<AssetCurrentCpPo> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("id", assetCurrent.getId());
assetCurrentCpService.remove(queryWrapper1);
Integer i = unitService.selectTaskId(assetCurrent.getDwmc(), "0");
AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo();
BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo);
assetCurrentCpPo.setTaskId(i);
assetCurrentCpService.save(assetCurrentCpPo);
QueryWrapper<AssetSupplyChainCpPo> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("asset_id", assetCurrent.getId());
assetSupplyChainCpService.remove(queryWrapper2);
QueryWrapper<AssetBasicNetworkCpPo> queryWrapper3 = new QueryWrapper<>();
queryWrapper3.eq("asset_id", assetCurrent.getId());
assetBasicNetworkCpService.remove(queryWrapper3);
QueryWrapper<AssetBusinessFormCpPo> queryWrapper4 = new QueryWrapper<>();
queryWrapper4.eq("asset_id", assetCurrent.getId());
assetBusinessFormCpService.remove(queryWrapper4);
QueryWrapper<UnitOtherConcatCpPo> queryWrapper5 = new QueryWrapper<>();
queryWrapper5.eq("asset_id", assetCurrent.getId());
unitOtherConcatCpService.remove(queryWrapper5);
if (assetCurrent.getXjgywxt() != null) {
assetCurrentCpPo.getXjgywxt().setAssetId(assetCurrent.getId());
assetCurrentCpPo.getXjgywxt().setTaskId(i);
assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt());
}
if (assetCurrent.getGylxxList() != null) {
for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(i);
}
//新增供应链
assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList());
}
if (assetCurrent.getJcwlList() != null) {
for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(i);
}
//新增基础网络
assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList());
}
if (assetCurrent.getOtherConcat() != null) {
for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(i);
}
//新增其他联系人
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
}
return success(); return success();
} }
@ -314,6 +344,24 @@ public class AssetCurrentController extends BaseController {
assetBusinessFormService.deleteByAssetIds(id); assetBusinessFormService.deleteByAssetIds(id);
unitOtherConcatService.deleteByAssetIds(id); unitOtherConcatService.deleteByAssetIds(id);
assetCurrentService.deleteByUnitIds(id); assetCurrentService.deleteByUnitIds(id);
QueryWrapper<AssetCurrentCpPo> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("id", id);
assetCurrentCpService.remove(queryWrapper1);
QueryWrapper<AssetSupplyChainCpPo> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("asset_id", id);
assetSupplyChainCpService.remove(queryWrapper2);
QueryWrapper<AssetBasicNetworkCpPo> queryWrapper3 = new QueryWrapper<>();
queryWrapper3.eq("asset_id", id);
assetBasicNetworkCpService.remove(queryWrapper3);
QueryWrapper<AssetBusinessFormCpPo> queryWrapper4 = new QueryWrapper<>();
queryWrapper4.eq("asset_id", id);
assetBusinessFormCpService.remove(queryWrapper4);
QueryWrapper<UnitOtherConcatCpPo> queryWrapper5 = new QueryWrapper<>();
queryWrapper5.eq("asset_id", id);
unitOtherConcatCpService.remove(queryWrapper5);
return success(); return success();
} }
@ -421,77 +469,75 @@ public class AssetCurrentController extends BaseController {
//============= //=============
Long id = as.getId(); Long id = as.getId();
List<AssetTask> assetTasks = assetTaskService.taskList(as.getDwmc()); Integer i = unitService.selectTaskId(as.getDwmc(), "0");
if (assetTasks != null) { if (i != null) {
for (AssetTask assetTask : assetTasks) { //新增资产复制主表
//新增资产复制主表 AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo();
AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo(); BeanUtil.copyProperties(as, assetCurrentCpPo);
BeanUtil.copyProperties(as, assetCurrentCpPo); assetCurrentCpPo.setTaskId(i);
assetCurrentCpPo.setTaskId(assetTask.getId()); AssetCurrentCpPo two = assetCurrentCpService.lambdaQuery().eq(AssetCurrentCpPo::getXtmc, as.getXtmc())
AssetCurrentCpPo two = assetCurrentCpService.lambdaQuery().eq(AssetCurrentCpPo::getXtmc, as.getXtmc()) .eq(AssetCurrentCpPo::getDwmc, as.getDwmc()).one();
.eq(AssetCurrentCpPo::getDwmc, as.getDwmc()).one(); if (two != null) {
if (two != null) { assetCurrentCpPo.setId(two.getId());
assetCurrentCpPo.setId(two.getId()); assetCurrentCpService.updateById(assetCurrentCpPo);
assetCurrentCpService.updateById(assetCurrentCpPo); assetSupplyChainCpService.deletByAssetIdandTaskId(id, i);
assetSupplyChainCpService.deletByAssetIdandTaskId(id,assetTask.getId()); assetBasicNetworkCpService.deletByAssetIdandTaskId(id, i);
assetBasicNetworkCpService.deletByAssetIdandTaskId(id,assetTask.getId()); } else {
} else { assetCurrentCpService.save(assetCurrentCpPo);
assetCurrentCpService.save(assetCurrentCpPo);
}
//新增系统建设单位
AssetSupplyChainCpPo co1 = new AssetSupplyChainCpPo();
BeanUtil.copyProperties(items, co1);
co1.setType(5);
co1.setAssetId(id);
co1.setTaskId(assetTask.getId());
assetSupplyChainCpService.save(co1);
//新增系统运营单位
AssetSupplyChainCpPo co2 = new AssetSupplyChainCpPo();
co2.setGyszcdz(items.getGyszcdz1());
co2.setLxr(items.getLxr1());
co2.setLxdh(items.getLxdh1());
co2.setSfwtc(items.getSfwtc1());
co2.setName(items.getName1());
co2.setTyshxydm(items.getTyshxydm1());
co2.setType(7);
co2.setAssetId(as.getId());
co2.setTaskId(assetTask.getId());
assetSupplyChainCpService.save(co2);
//新增服务器信息
AssetBasicNetworkCpPo co3 = new AssetBasicNetworkCpPo();
BeanUtil.copyProperties(items, co3);
co3.setType(1);
co3.setAssetId(id);
co3.setTaskId(assetTask.getId());
assetBasicNetworkCpService.save(co3);
//新增网络设备
AssetBasicNetworkCpPo co4 = new AssetBasicNetworkCpPo();
co4.setSblx(items.getWlsblx());
co4.setPp(items.getWlpp());
co4.setSbIp(items.getWlsbIp());
co4.setYjxh(items.getWlyjxh());
co4.setYjxlh(items.getWlyjxlh());
co4.setYjbbxx(items.getWlyjbbxx());
co4.setYjyt(items.getWlyjyt());
co4.setYjbsxx(items.getWlyjbsxx());
co4.setType(2);
co4.setAssetId(id);
co4.setTaskId(assetTask.getId());
assetBasicNetworkCpService.save(co4);
//新增安全设备
AssetBasicNetworkCpPo co5 = new AssetBasicNetworkCpPo();
co5.setSblx(items.getAqwlsblx());
co5.setPp(items.getAqwlpp());
co5.setSbIp(items.getAqwlsbIp());
co5.setType(3);
co5.setAssetId(id);
co5.setTaskId(assetTask.getId());
assetBasicNetworkCpService.save(co5);
} }
//新增系统建设单位
AssetSupplyChainCpPo co1 = new AssetSupplyChainCpPo();
BeanUtil.copyProperties(items, co1);
co1.setType(5);
co1.setAssetId(id);
co1.setTaskId(i);
assetSupplyChainCpService.save(co1);
//新增系统运营单位
AssetSupplyChainCpPo co2 = new AssetSupplyChainCpPo();
co2.setGyszcdz(items.getGyszcdz1());
co2.setLxr(items.getLxr1());
co2.setLxdh(items.getLxdh1());
co2.setSfwtc(items.getSfwtc1());
co2.setName(items.getName1());
co2.setTyshxydm(items.getTyshxydm1());
co2.setType(7);
co2.setAssetId(as.getId());
co2.setTaskId(i);
assetSupplyChainCpService.save(co2);
//新增服务器信息
AssetBasicNetworkCpPo co3 = new AssetBasicNetworkCpPo();
BeanUtil.copyProperties(items, co3);
co3.setType(1);
co3.setAssetId(id);
co3.setTaskId(i);
assetBasicNetworkCpService.save(co3);
//新增网络设备
AssetBasicNetworkCpPo co4 = new AssetBasicNetworkCpPo();
co4.setSblx(items.getWlsblx());
co4.setPp(items.getWlpp());
co4.setSbIp(items.getWlsbIp());
co4.setYjxh(items.getWlyjxh());
co4.setYjxlh(items.getWlyjxlh());
co4.setYjbbxx(items.getWlyjbbxx());
co4.setYjyt(items.getWlyjyt());
co4.setYjbsxx(items.getWlyjbsxx());
co4.setType(2);
co4.setAssetId(id);
co4.setTaskId(i);
assetBasicNetworkCpService.save(co4);
//新增安全设备
AssetBasicNetworkCpPo co5 = new AssetBasicNetworkCpPo();
co5.setSblx(items.getAqwlsblx());
co5.setPp(items.getAqwlpp());
co5.setSbIp(items.getAqwlsbIp());
co5.setType(3);
co5.setAssetId(id);
co5.setTaskId(i);
assetBasicNetworkCpService.save(co5);
} }
} }
return AjaxResult.success(); return AjaxResult.success();

@ -7,6 +7,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tc.entity.AssetEmail; import com.ruoyi.tc.entity.AssetEmail;
import com.ruoyi.tc.entity.request.AssetEmailPageRequest; import com.ruoyi.tc.entity.request.AssetEmailPageRequest;
@ -49,6 +50,13 @@ public class AssetEmailController extends BaseController {
Page<AssetEmail> page = new Page<>(); Page<AssetEmail> page = new Page<>();
page.setCurrent(req.getCurrent()); page.setCurrent(req.getCurrent());
page.setSize(req.getSize()); page.setSize(req.getSize());
try {
if (!SecurityUtils.getLoginUser().getUser().isAdmin() && !SecurityUtils.hasRole("common")) {
req.setDwmc(SecurityUtils.getLoginUser().getUser().getNickName());
}
} catch (Exception e) {
throw new ServiceException("获取用户信息异常");
}
return success(assetEmailService.page(page, req)); return success(assetEmailService.page(page, req));
} }
@ -74,7 +82,7 @@ public class AssetEmailController extends BaseController {
@PostMapping @PostMapping
@Log(title = "新增email数据", businessType = BusinessType.INSERT) @Log(title = "新增email数据", businessType = BusinessType.INSERT)
public AjaxResult add(@RequestBody AssetEmail assetEmail) { public AjaxResult add(@RequestBody AssetEmail assetEmail) {
return success(assetEmailService.save(assetEmail)); return success(assetEmailService.add(assetEmail));
} }
/** /**
@ -87,7 +95,7 @@ public class AssetEmailController extends BaseController {
@Log(title = "编辑email数据", businessType = BusinessType.UPDATE) @Log(title = "编辑email数据", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody AssetEmail assetEmail) { public AjaxResult edit(@RequestBody AssetEmail assetEmail) {
return success(assetEmailService.updateById(assetEmail)); return success(assetEmailService.edit(assetEmail));
} }
/** /**
@ -143,9 +151,9 @@ public class AssetEmailController extends BaseController {
.eq(AssetEmail::getSsdw, x.getSsdw()).one(); .eq(AssetEmail::getSsdw, x.getSsdw()).one();
if(one!=null){ if(one!=null){
x.setId(one.getId()); x.setId(one.getId());
assetEmailService.updateById(x); assetEmailService.edit(x);
}else { }else {
assetEmailService.save(x); assetEmailService.add(x);
} }
}); });
} else { } else {

@ -1,15 +1,19 @@
package com.ruoyi.tc.controller; package com.ruoyi.tc.controller;
import cn.hutool.core.bean.BeanUtil;
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.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tc.entity.AssetMiniPrograms; import com.ruoyi.tc.entity.AssetMiniPrograms;
import com.ruoyi.tc.entity.po.AssetMiniProgramsCpPo;
import com.ruoyi.tc.entity.request.AssetMiniProgramsPageRequest; import com.ruoyi.tc.entity.request.AssetMiniProgramsPageRequest;
import com.ruoyi.tc.service.AssetMiniProgramsCpService;
import com.ruoyi.tc.service.AssetMiniProgramsService; import com.ruoyi.tc.service.AssetMiniProgramsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -51,6 +55,13 @@ public class AssetMiniProgramsController extends BaseController {
Page<AssetMiniPrograms> page = new Page<>(); Page<AssetMiniPrograms> page = new Page<>();
page.setCurrent(req.getCurrent()); page.setCurrent(req.getCurrent());
page.setSize(req.getSize()); page.setSize(req.getSize());
try {
if (!SecurityUtils.getLoginUser().getUser().isAdmin() && !SecurityUtils.hasRole("common")) {
req.setDwmc(SecurityUtils.getLoginUser().getUser().getNickName());
}
} catch (Exception e) {
throw new ServiceException("获取用户信息异常");
}
return success(assetMiniProgramsService.page(page, req)); return success(assetMiniProgramsService.page(page, req));
} }
@ -76,7 +87,7 @@ public class AssetMiniProgramsController extends BaseController {
@PostMapping @PostMapping
@Log(title = "新增小程序数据", businessType = BusinessType.INSERT) @Log(title = "新增小程序数据", businessType = BusinessType.INSERT)
public AjaxResult add(@RequestBody AssetMiniPrograms assetMiniPrograms) { public AjaxResult add(@RequestBody AssetMiniPrograms assetMiniPrograms) {
return success(assetMiniProgramsService.save(assetMiniPrograms)); return success(assetMiniProgramsService.add(assetMiniPrograms));
} }
/** /**
@ -89,7 +100,7 @@ public class AssetMiniProgramsController extends BaseController {
@Log(title = "编辑小程序数据", businessType = BusinessType.UPDATE) @Log(title = "编辑小程序数据", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody AssetMiniPrograms assetMiniPrograms) { public AjaxResult edit(@RequestBody AssetMiniPrograms assetMiniPrograms) {
return success(assetMiniProgramsService.updateById(assetMiniPrograms)); return success(assetMiniProgramsService.edit(assetMiniPrograms));
} }
/** /**
@ -145,9 +156,9 @@ public class AssetMiniProgramsController extends BaseController {
.eq(AssetMiniPrograms::getXcxmc, x.getXcxmc()).one(); .eq(AssetMiniPrograms::getXcxmc, x.getXcxmc()).one();
if(one!=null){ if(one!=null){
x.setId(one.getId()); x.setId(one.getId());
assetMiniProgramsService.updateById(x); assetMiniProgramsService.edit(x);
}else { }else {
assetMiniProgramsService.save(x); assetMiniProgramsService.add(x);
} }
}); });
} else { } else {

@ -52,6 +52,13 @@ public class AssetOfficialAccountController {
Page<AssetOfficialAccount> page = new Page<>(); Page<AssetOfficialAccount> page = new Page<>();
page.setCurrent(req.getCurrent()); page.setCurrent(req.getCurrent());
page.setSize(req.getSize()); page.setSize(req.getSize());
try {
if (!SecurityUtils.getLoginUser().getUser().isAdmin() && !SecurityUtils.hasRole("common")) {
req.setDwmc(SecurityUtils.getLoginUser().getUser().getNickName());
}
} catch (Exception e) {
throw new ServiceException("获取用户信息异常");
}
return success(assetOfficialAccountService.page(page, req)); return success(assetOfficialAccountService.page(page, req));
} }
@ -77,7 +84,7 @@ public class AssetOfficialAccountController {
@PostMapping @PostMapping
@Log(title = "新增公众号数据", businessType = BusinessType.INSERT) @Log(title = "新增公众号数据", businessType = BusinessType.INSERT)
public AjaxResult add(@RequestBody AssetOfficialAccount assetOfficialAccount) { public AjaxResult add(@RequestBody AssetOfficialAccount assetOfficialAccount) {
return success(assetOfficialAccountService.save(assetOfficialAccount)); return success(assetOfficialAccountService.add(assetOfficialAccount));
} }
/** /**
@ -90,7 +97,7 @@ public class AssetOfficialAccountController {
@Log(title = "编辑公众号数据", businessType = BusinessType.UPDATE) @Log(title = "编辑公众号数据", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody AssetOfficialAccount assetOfficialAccount) { public AjaxResult edit(@RequestBody AssetOfficialAccount assetOfficialAccount) {
return success(assetOfficialAccountService.updateById(assetOfficialAccount)); return success(assetOfficialAccountService.edit(assetOfficialAccount));
} }
/** /**
@ -146,9 +153,9 @@ public class AssetOfficialAccountController {
.eq(AssetOfficialAccount::getGzhmc, x.getGzhmc()).one(); .eq(AssetOfficialAccount::getGzhmc, x.getGzhmc()).one();
if(one!=null){ if(one!=null){
x.setId(one.getId()); x.setId(one.getId());
assetOfficialAccountService.updateById(x); assetOfficialAccountService.edit(x);
}else { }else {
assetOfficialAccountService.save(x); assetOfficialAccountService.add(x);
} }
}); });
} else { } else {

@ -2,6 +2,7 @@ package com.ruoyi.tc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.Unit; import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.request.GeneralQueryRequest; import com.ruoyi.tc.entity.request.GeneralQueryRequest;
import com.ruoyi.tc.entity.request.UnitRequest; import com.ruoyi.tc.entity.request.UnitRequest;
@ -78,4 +79,9 @@ public interface UnitMapper extends BaseMapper<Unit> {
* @return * @return
*/ */
Integer findBydwmc(@Param("part") String part); Integer findBydwmc(@Param("part") String part);
/**
* 5
*/
Integer selectTaskId(@Param("dwmc") String dwmc,@Param("type") String type);
} }

@ -55,4 +55,21 @@ public interface AssetAppService extends IService<AssetApp> {
* @return * @return
*/ */
Integer findBydwmc(String part); Integer findBydwmc(String part);
/**
*
*
* @param assetApp
* @return
*/
Boolean add(AssetApp assetApp);
/**
*
*
* @param assetApp
* @return
*/
Boolean edit(AssetApp assetApp);
} }

@ -54,5 +54,21 @@ public interface AssetEmailService extends IService<AssetEmail> {
* @return * @return
*/ */
Integer findBydwmc(String part); Integer findBydwmc(String part);
/**
* email
*
* @param assetEmail
* @return
*/
Boolean add(AssetEmail assetEmail);
/**
* email
*
* @param assetEmail
* @return
*/
Boolean edit(AssetEmail assetEmail);
} }

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.tc.entity.AssetMiniPrograms; import com.ruoyi.tc.entity.AssetMiniPrograms;
import com.ruoyi.tc.entity.AssetMiniPrograms; import com.ruoyi.tc.entity.AssetMiniPrograms;
import com.ruoyi.tc.entity.po.AssetMiniProgramsCpPo;
import com.ruoyi.tc.entity.request.AssetMiniProgramsPageRequest; import com.ruoyi.tc.entity.request.AssetMiniProgramsPageRequest;
import java.util.List; import java.util.List;
@ -52,4 +53,20 @@ public interface AssetMiniProgramsService extends IService<AssetMiniPrograms> {
* @param idList * @param idList
*/ */
void deleteIdList(List<Long> idList); void deleteIdList(List<Long> idList);
/**
*
*
* @param assetMiniPrograms
* @return
*/
Boolean add(AssetMiniPrograms assetMiniPrograms);
/**
*
*
* @param assetMiniPrograms
* @return
*/
Boolean edit(AssetMiniPrograms assetMiniPrograms);
} }

@ -50,4 +50,20 @@ public interface AssetOfficialAccountService extends IService<AssetOfficialAccou
* @param idList * @param idList
*/ */
void deleteIdList(List<Long> idList); void deleteIdList(List<Long> idList);
/**
*
*
* @param assetOfficialAccount
* @return
*/
Boolean add(AssetOfficialAccount assetOfficialAccount);
/**
*
*
* @param assetOfficialAccount
* @return
*/
Boolean edit(AssetOfficialAccount assetOfficialAccount);
} }

@ -3,6 +3,7 @@ package com.ruoyi.tc.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.Unit; import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.request.GeneralQueryRequest; import com.ruoyi.tc.entity.request.GeneralQueryRequest;
import com.ruoyi.tc.entity.request.UnitRequest; import com.ruoyi.tc.entity.request.UnitRequest;
@ -74,6 +75,11 @@ public interface UnitService extends IService<Unit> {
*/ */
List<Unit> selectAllUnit(GeneralQueryRequest req); List<Unit> selectAllUnit(GeneralQueryRequest req);
/**
* 5
*/
Integer selectTaskId(String dwmc,String type);
/** /**
* *

@ -1,13 +1,20 @@
package com.ruoyi.tc.service.impl; package com.ruoyi.tc.service.impl;
import cn.hutool.core.bean.BeanUtil;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.tc.entity.AssetApp; import com.ruoyi.tc.entity.AssetApp;
import com.ruoyi.tc.entity.po.AssetAppCpPo;
import com.ruoyi.tc.entity.po.AssetEmailCpPo;
import com.ruoyi.tc.entity.request.AssetAppPageRequest; import com.ruoyi.tc.entity.request.AssetAppPageRequest;
import com.ruoyi.tc.mapper.AssetAppMapper; import com.ruoyi.tc.mapper.AssetAppMapper;
import com.ruoyi.tc.service.AssetAppCpService;
import com.ruoyi.tc.service.AssetAppService; import com.ruoyi.tc.service.AssetAppService;
import com.ruoyi.tc.service.UnitService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -18,6 +25,12 @@ import java.util.List;
*/ */
@Service("assetAppService") @Service("assetAppService")
public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> implements AssetAppService{ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> implements AssetAppService{
@Resource
private UnitService unitService;
@Resource
private AssetAppCpService assetAppCpService;
/** /**
* *
* *
@ -36,6 +49,9 @@ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> i
@Override @Override
public void deleteById(Long id) { public void deleteById(Long id) {
baseMapper.deleteById(id); baseMapper.deleteById(id);
QueryWrapper<AssetAppCpPo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("asset_id", id);
assetAppCpService.remove(queryWrapper);
} }
@ -61,6 +77,38 @@ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> i
} }
/**
*
*
* @param assetApp
* @return
*/
@Override
public Boolean add(AssetApp assetApp) {
save(assetApp);
AssetAppCpPo a = new AssetAppCpPo();
BeanUtil.copyProperties(assetApp, a);
a.setTaskId(unitService.selectTaskId(assetApp.getSsdw(), "4"));
a.setAssetId(assetApp.getId());
return assetAppCpService.save(a);
}
/**
*
*
* @param assetApp
* @return
*/
@Override
public Boolean edit(AssetApp assetApp) {
updateById(assetApp);
AssetAppCpPo one = assetAppCpService.lambdaQuery().eq(AssetAppCpPo::getAssetId, assetApp.getId()).one();
BeanUtil.copyProperties(assetApp, one);
one.setTaskId(unitService.selectTaskId(assetApp.getSsdw(), "4"));
one.setAssetId(assetApp.getId());
return assetAppCpService.updateById(one);
}
} }

@ -1,13 +1,20 @@
package com.ruoyi.tc.service.impl; package com.ruoyi.tc.service.impl;
import cn.hutool.core.bean.BeanUtil;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.tc.entity.AssetEmail; import com.ruoyi.tc.entity.AssetEmail;
import com.ruoyi.tc.entity.po.AssetEmailCpPo;
import com.ruoyi.tc.entity.po.AssetMiniProgramsCpPo;
import com.ruoyi.tc.entity.request.AssetEmailPageRequest; import com.ruoyi.tc.entity.request.AssetEmailPageRequest;
import com.ruoyi.tc.mapper.AssetEmailMapper; import com.ruoyi.tc.mapper.AssetEmailMapper;
import com.ruoyi.tc.service.AssetEmailCpService;
import com.ruoyi.tc.service.AssetEmailService; import com.ruoyi.tc.service.AssetEmailService;
import com.ruoyi.tc.service.UnitService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -18,6 +25,13 @@ import java.util.List;
*/ */
@Service("assetEmailService") @Service("assetEmailService")
public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEmail> implements AssetEmailService { public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEmail> implements AssetEmailService {
@Resource
private UnitService unitService;
@Resource
private AssetEmailCpService assetEmailCpService;
/** /**
* *
* *
@ -27,7 +41,7 @@ public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEm
*/ */
@Override @Override
public Page<AssetEmail> page(Page<AssetEmail> page, AssetEmailPageRequest as) { public Page<AssetEmail> page(Page<AssetEmail> page, AssetEmailPageRequest as) {
return baseMapper.page(page,as); return baseMapper.page(page, as);
} }
/** /**
@ -35,14 +49,17 @@ public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEm
*/ */
@Override @Override
public void deleteById(Long id) { public void deleteById(Long id) {
baseMapper.deleteById(id); baseMapper.deleteById(id);
QueryWrapper<AssetEmailCpPo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("asset_id", id);
assetEmailCpService.remove(queryWrapper);
} }
/** /**
* *
* *
* @param as * @param as
* @return * @return
*/ */
@Override @Override
@ -56,9 +73,40 @@ public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEm
} }
@Override @Override
public Integer findBydwmc(String part) { public Integer findBydwmc(String part) {
return baseMapper.findBydwmc(part); return baseMapper.findBydwmc(part);
} }
/**
* email
*
* @param assetEmail
* @return
*/
@Override
public Boolean add(AssetEmail assetEmail) {
save(assetEmail);
AssetEmailCpPo a = new AssetEmailCpPo();
BeanUtil.copyProperties(assetEmail, a);
a.setTaskId(unitService.selectTaskId(assetEmail.getSsdw(), "3"));
a.setAssetId(assetEmail.getId());
return assetEmailCpService.save(a);
}
/**
* email
*
* @param assetEmail
* @return
*/
@Override
public Boolean edit(AssetEmail assetEmail) {
updateById(assetEmail);
AssetEmailCpPo one = assetEmailCpService.lambdaQuery().eq(AssetEmailCpPo::getAssetId, assetEmail.getId()).one();
BeanUtil.copyProperties(assetEmail, one);
one.setTaskId(unitService.selectTaskId(assetEmail.getSsdw(), "3"));
one.setAssetId(assetEmail.getId());
return assetEmailCpService.updateById(one);
}
} }

@ -1,13 +1,19 @@
package com.ruoyi.tc.service.impl; package com.ruoyi.tc.service.impl;
import cn.hutool.core.bean.BeanUtil;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.tc.entity.AssetMiniPrograms; import com.ruoyi.tc.entity.AssetMiniPrograms;
import com.ruoyi.tc.entity.po.AssetMiniProgramsCpPo;
import com.ruoyi.tc.entity.request.AssetMiniProgramsPageRequest; import com.ruoyi.tc.entity.request.AssetMiniProgramsPageRequest;
import com.ruoyi.tc.mapper.AssetMiniProgramsMapper; import com.ruoyi.tc.mapper.AssetMiniProgramsMapper;
import com.ruoyi.tc.service.AssetMiniProgramsCpService;
import com.ruoyi.tc.service.AssetMiniProgramsService; import com.ruoyi.tc.service.AssetMiniProgramsService;
import com.ruoyi.tc.service.UnitService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -18,6 +24,12 @@ import java.util.List;
*/ */
@Service("assetMiniProgramsService") @Service("assetMiniProgramsService")
public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsMapper, AssetMiniPrograms> implements AssetMiniProgramsService{ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsMapper, AssetMiniPrograms> implements AssetMiniProgramsService{
@Resource
private AssetMiniProgramsCpService assetMiniProgramsCpService;
@Resource
private UnitService unitService;
/** /**
* *
* *
@ -35,7 +47,10 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsM
*/ */
@Override @Override
public void deleteById(Long id) { public void deleteById(Long id) {
baseMapper.deleteById(id); baseMapper.deleteById(id);
QueryWrapper<AssetMiniProgramsCpPo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("asset_id", id);
assetMiniProgramsCpService.remove(queryWrapper);
} }
@ -55,7 +70,37 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsM
baseMapper.deleteIdList(idList); baseMapper.deleteIdList(idList);
} }
/**
*
*
* @param assetMiniPrograms
* @return
*/
@Override
public Boolean add(AssetMiniPrograms assetMiniPrograms) {
save(assetMiniPrograms);
AssetMiniProgramsCpPo assetMiniProgramsCpPo = new AssetMiniProgramsCpPo();
BeanUtil.copyProperties(assetMiniPrograms,assetMiniProgramsCpPo);
assetMiniProgramsCpPo.setTaskId(unitService.selectTaskId(assetMiniPrograms.getSsdw(),"1"));
assetMiniProgramsCpPo.setAssetId(assetMiniPrograms.getId());
return assetMiniProgramsCpService.save(assetMiniProgramsCpPo);
}
/**
*
*
* @param assetMiniPrograms
* @return
*/
@Override
public Boolean edit(AssetMiniPrograms assetMiniPrograms) {
updateById(assetMiniPrograms);
AssetMiniProgramsCpPo one = assetMiniProgramsCpService.lambdaQuery().eq(AssetMiniProgramsCpPo::getAssetId, assetMiniPrograms.getId()).one();
BeanUtil.copyProperties(assetMiniPrograms,one);
one.setTaskId(unitService.selectTaskId(assetMiniPrograms.getSsdw(),"1"));
one.setAssetId(assetMiniPrograms.getId());
return assetMiniProgramsCpService.updateById(one);
}
@Override @Override

@ -1,13 +1,19 @@
package com.ruoyi.tc.service.impl; package com.ruoyi.tc.service.impl;
import cn.hutool.core.bean.BeanUtil;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.tc.entity.AssetOfficialAccount; import com.ruoyi.tc.entity.AssetOfficialAccount;
import com.ruoyi.tc.entity.po.AssetOfficialAccountCpPo;
import com.ruoyi.tc.entity.request.AssetOfficialAccountPageRequest; import com.ruoyi.tc.entity.request.AssetOfficialAccountPageRequest;
import com.ruoyi.tc.mapper.AssetOfficialAccountMapper; import com.ruoyi.tc.mapper.AssetOfficialAccountMapper;
import com.ruoyi.tc.service.AssetOfficialAccountCpService;
import com.ruoyi.tc.service.AssetOfficialAccountService; import com.ruoyi.tc.service.AssetOfficialAccountService;
import com.ruoyi.tc.service.UnitService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -17,7 +23,15 @@ import java.util.List;
* @since 2024-11-28 17:13:07 * @since 2024-11-28 17:13:07
*/ */
@Service("assetOfficialAccountService") @Service("assetOfficialAccountService")
public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAccountMapper, AssetOfficialAccount> implements AssetOfficialAccountService{ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAccountMapper, AssetOfficialAccount> implements AssetOfficialAccountService {
@Resource
private UnitService unitService;
@Resource
private AssetOfficialAccountCpService assetOfficialAccountCpService;
/** /**
* *
* *
@ -27,7 +41,7 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
*/ */
@Override @Override
public Page<AssetOfficialAccount> page(Page<AssetOfficialAccount> page, AssetOfficialAccountPageRequest as) { public Page<AssetOfficialAccount> page(Page<AssetOfficialAccount> page, AssetOfficialAccountPageRequest as) {
return baseMapper.page(page,as); return baseMapper.page(page, as);
} }
/** /**
@ -35,14 +49,17 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
*/ */
@Override @Override
public void deleteById(Long id) { public void deleteById(Long id) {
baseMapper.deleteById(id); baseMapper.deleteById(id);
QueryWrapper<AssetOfficialAccountCpPo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("asset_id", id);
assetOfficialAccountCpService.remove(queryWrapper);
} }
/** /**
* *
* *
* @param as * @param as
* @return * @return
*/ */
@Override @Override
@ -56,6 +73,37 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
baseMapper.deleteIdList(idList); baseMapper.deleteIdList(idList);
} }
/**
*
*
* @param assetOfficialAccount
* @return
*/
@Override
public Boolean add(AssetOfficialAccount assetOfficialAccount) {
save(assetOfficialAccount);
AssetOfficialAccountCpPo a = new AssetOfficialAccountCpPo();
BeanUtil.copyProperties(assetOfficialAccount, a);
a.setTaskId(unitService.selectTaskId(assetOfficialAccount.getSsdw(), "2"));
a.setAssetId(assetOfficialAccount.getId());
return assetOfficialAccountCpService.save(a);
}
/**
*
*
* @param assetOfficialAccount
* @return
*/
@Override
public Boolean edit(AssetOfficialAccount assetOfficialAccount) {
updateById(assetOfficialAccount);
AssetOfficialAccountCpPo one = assetOfficialAccountCpService.lambdaQuery().eq(AssetOfficialAccountCpPo::getAssetId, assetOfficialAccount.getId()).one();
BeanUtil.copyProperties(assetOfficialAccount, one);
one.setTaskId(unitService.selectTaskId(assetOfficialAccount.getSsdw(), "2"));
one.setAssetId(assetOfficialAccount.getId());
return assetOfficialAccountCpService.updateById(one);
}
@Override @Override

@ -8,6 +8,7 @@ import com.ruoyi.common.utils.PasswordGenerator;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.Unit; import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.request.GeneralQueryRequest; import com.ruoyi.tc.entity.request.GeneralQueryRequest;
import com.ruoyi.tc.entity.request.UnitRequest; import com.ruoyi.tc.entity.request.UnitRequest;
@ -130,6 +131,14 @@ public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements Un
return baseMapper.selectAllUnit(req); return baseMapper.selectAllUnit(req);
} }
/**
* 5
*/
@Override
public Integer selectTaskId(String dwmc, String type) {
return baseMapper.selectTaskId(dwmc,type);
}
@Override @Override
public Integer findBydwmc(String part) { public Integer findBydwmc(String part) {
return baseMapper.findBydwmc(part); return baseMapper.findBydwmc(part);

@ -185,6 +185,9 @@
from unit_info from unit_info
where nick_name = #{part} where nick_name = #{part}
</select> </select>
<select id="selectTaskId" resultType="java.lang.Integer">
select id from asset_task where dwmc like concat('%',#{dwmc},'%') and type like concat('%',#{type},'%')
</select>
<update id="deleteUnits"> <update id="deleteUnits">
update unit_info update unit_info

Loading…
Cancel
Save