资产唯一性和单位xiaojian

dongdingding
杜函宇 3 days ago
parent 649fdf24f1
commit e4667ffbf0

@ -20,6 +20,7 @@ import com.ruoyi.tc.entity.request.AssetAuditRequest;
import com.ruoyi.tc.service.AssetAppCpService;
import com.ruoyi.tc.service.AssetAppJyService;
import com.ruoyi.tc.service.AssetAppService;
import com.ruoyi.tc.service.UnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@ -55,6 +56,8 @@ public class AssetAppController extends BaseController {
@Resource
private AssetAppJyService assetAppJyService;
@Resource
private UnitService unitService;
/**
*
*
@ -84,6 +87,18 @@ public class AssetAppController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('unit')")
@PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetAppJyPo assetAppJyPo) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetAppJyPo.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetApp> list1 = assetAppService.lambdaQuery().eq(AssetApp::getSsdw, assetAppJyPo.getSsdw())
.eq(AssetApp::getAppName, assetAppJyPo.getAppName()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
AssetAppJyPo one = assetAppJyService.lambdaQuery().eq(AssetAppJyPo::getAppName,assetAppJyPo.getAppName())
.eq(AssetAppJyPo::getSsdw,assetAppJyPo.getSsdw()).isNull(AssetAppJyPo::getTaskId).one();
assetAppJyPo.setAuditState("1");

@ -145,10 +145,16 @@ public class AssetCurrentController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@Transactional(rollbackFor = Exception.class)
public AjaxResult insert(@RequestBody @Valid AssetCurrent assetCurrent) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetCurrent> list1 = assetCurrentService.lambdaQuery().eq(AssetCurrent::getXtmc, assetCurrent.getXtmc()).eq(AssetCurrent::getDwmc, assetCurrent.getDwmc()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
StringBuilder a = new StringBuilder();
if (assetCurrent.getGlymList() != null) {
assetCurrent.getGlymList().forEach(x -> {
@ -239,9 +245,7 @@ public class AssetCurrentController extends BaseController {
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
}
}
return
success();
return success();
}
//=================================================
@ -253,6 +257,17 @@ public class AssetCurrentController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('unit')")
@PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetCurrentJyPo assetCurrentJyPo) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrentJyPo.getDwmc()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetCurrent> list1 = assetCurrentService.lambdaQuery().eq(AssetCurrent::getXtmc, assetCurrentJyPo.getXtmc()).eq(AssetCurrent::getDwmc, assetCurrentJyPo.getDwmc()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
AssetCurrentJyPo one = assetCurrentJyService.lambdaQuery().eq(AssetCurrentJyPo::getXtmc, assetCurrentJyPo.getXtmc()).eq(AssetCurrentJyPo::getDwmc, assetCurrentJyPo.getDwmc()).isNull(AssetCurrentJyPo::getTaskId).one();
assetCurrentJyPo.setAuditState("1");
assetCurrentJyPo.setAuditYy(null);
@ -506,6 +521,15 @@ public class AssetCurrentController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@PutMapping
public AjaxResult update(@RequestBody @Valid AssetCurrent assetCurrent) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetCurrent> list3 = assetCurrentService.lambdaQuery().eq(AssetCurrent::getXtmc, assetCurrent.getXtmc()).eq(AssetCurrent::getDwmc, assetCurrent.getDwmc()).list();
if (list3 != null&& !list3.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
//保存未修改之前的单位名称
// AssetCurrent byId = assetCurrentService.getById(assetCurrent.getId());
StringBuilder a = new StringBuilder();
@ -528,10 +552,7 @@ public class AssetCurrentController extends BaseController {
});
}
assetCurrent.setGlIp(b.toString());
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
assetCurrentService.updateById(assetCurrent);

@ -10,14 +10,15 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tc.entity.AssetApp;
import com.ruoyi.tc.entity.AssetEmail;
import com.ruoyi.tc.entity.po.*;
import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.po.AssetEmailJyPo;
import com.ruoyi.tc.entity.request.AssetAuditPageRequest;
import com.ruoyi.tc.entity.request.AssetAuditRequest;
import com.ruoyi.tc.entity.request.AssetEmailPageRequest;
import com.ruoyi.tc.service.AssetEmailJyService;
import com.ruoyi.tc.service.AssetEmailService;
import com.ruoyi.tc.service.UnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@ -46,6 +47,9 @@ public class AssetEmailController extends BaseController {
@Resource
private AssetEmailService assetEmailService;
@Resource
private UnitService unitService;
@Resource
private AssetEmailJyService assetEmailJyService;
/**
@ -78,6 +82,18 @@ public class AssetEmailController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('unit')")
@PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetEmailJyPo assetEmailJyPo) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetEmailJyPo.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetEmail> list1 = assetEmailService.lambdaQuery().eq(AssetEmail::getSsdw, assetEmailJyPo.getSsdw())
.eq(AssetEmail::getDzyxhz, assetEmailJyPo.getDzyxhz()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
AssetEmailJyPo one = assetEmailJyService.lambdaQuery().eq(AssetEmailJyPo::getSsdw,assetEmailJyPo.getSsdw())
.eq(AssetEmailJyPo::getDzyxhz,assetEmailJyPo.getDzyxhz()).isNull(AssetEmailJyPo::getTaskId).one();
assetEmailJyPo.setAuditState("1");

@ -10,8 +10,10 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tc.entity.AssetCurrent;
import com.ruoyi.tc.entity.AssetEmail;
import com.ruoyi.tc.entity.AssetMiniPrograms;
import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.po.AssetAppCpPo;
import com.ruoyi.tc.entity.po.AssetAppJyPo;
import com.ruoyi.tc.entity.po.AssetEmailJyPo;
@ -21,6 +23,7 @@ import com.ruoyi.tc.entity.request.AssetAuditRequest;
import com.ruoyi.tc.entity.request.AssetMiniProgramsPageRequest;
import com.ruoyi.tc.service.AssetMiniProgramsJyService;
import com.ruoyi.tc.service.AssetMiniProgramsService;
import com.ruoyi.tc.service.UnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@ -51,6 +54,9 @@ public class AssetMiniProgramsController extends BaseController {
@Resource
private AssetMiniProgramsJyService assetMiniProgramsJyService;
@Resource
private UnitService unitService;
/**
*
*
@ -81,6 +87,18 @@ public class AssetMiniProgramsController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('unit')")
@PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetMiniProgramsJyPo assetMiniProgramsJyPo) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniProgramsJyPo.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetMiniPrograms> list1 = assetMiniProgramsService.lambdaQuery().eq(AssetMiniPrograms::getSsdw, assetMiniProgramsJyPo.getSsdw())
.eq(AssetMiniPrograms::getXcxmc, assetMiniProgramsJyPo.getXcxmc()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
AssetMiniProgramsJyPo one = assetMiniProgramsJyService.lambdaQuery().eq(AssetMiniProgramsJyPo::getSsdw,assetMiniProgramsJyPo.getSsdw())
.eq(AssetMiniProgramsJyPo::getXcxmc,assetMiniProgramsJyPo.getXcxmc()).isNull(AssetMiniProgramsJyPo::getTaskId).one();
assetMiniProgramsJyPo.setAuditState("1");

@ -9,8 +9,10 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tc.entity.AssetEmail;
import com.ruoyi.tc.entity.AssetMiniPrograms;
import com.ruoyi.tc.entity.AssetOfficialAccount;
import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.po.AssetAppJyPo;
import com.ruoyi.tc.entity.po.AssetMiniProgramsJyPo;
import com.ruoyi.tc.entity.po.AssetOfficialAccountJyPo;
@ -20,6 +22,7 @@ import com.ruoyi.tc.entity.request.AssetOfficialAccountMenu;
import com.ruoyi.tc.entity.request.AssetOfficialAccountPageRequest;
import com.ruoyi.tc.service.AssetOfficialAccountJyService;
import com.ruoyi.tc.service.AssetOfficialAccountService;
import com.ruoyi.tc.service.UnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@ -55,6 +58,9 @@ public class AssetOfficialAccountController {
@Resource
private AssetOfficialAccountJyService assetOfficialAccountJyService;
@Resource
private UnitService unitService;
/**
*
*
@ -117,6 +123,18 @@ public class AssetOfficialAccountController {
@PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetOfficialAccountJyPo ao) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, ao.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetOfficialAccount> list1 = assetOfficialAccountService.lambdaQuery().eq(AssetOfficialAccount::getSsdw, ao.getSsdw())
.eq(AssetOfficialAccount::getGzhmc, ao.getGzhmc()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
if (ao.getCdList() != null && !ao.getCdList().isEmpty()) {
StringBuilder a = new StringBuilder();
StringBuilder b = new StringBuilder();

@ -36,6 +36,9 @@ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> i
@Resource
private AssetTaskService assetTaskService;
/**
*
*
@ -90,11 +93,16 @@ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> i
*/
@Override
public Boolean add(AssetApp assetApp) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetApp.getSsdw())
.eq(Unit::getDelFlag, 0).list();
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetApp.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetApp> list1 = lambdaQuery().eq(AssetApp::getSsdw, assetApp.getSsdw())
.eq(AssetApp::getAppName, assetApp.getAppName()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
save(assetApp);
AssetAppCpPo a = new AssetAppCpPo();
BeanUtil.copyProperties(assetApp, a);
@ -118,10 +126,16 @@ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> i
public Boolean edit(AssetApp assetApp) {
AssetApp byId = getById(assetApp.getId());
List<Unit> list1 = unitService.lambdaQuery().eq(Unit::getNickName, assetApp.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list1 == null || list1.isEmpty()) {
List<Unit> list2 = unitService.lambdaQuery().eq(Unit::getNickName, assetApp.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list2 == null || list2.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetApp> list1 = lambdaQuery().eq(AssetApp::getSsdw, assetApp.getSsdw())
.eq(AssetApp::getAppName, assetApp.getAppName()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
updateById(assetApp);

@ -37,6 +37,7 @@ public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEm
@Resource
private AssetTaskService assetTaskService;
/**
*
*
@ -91,11 +92,18 @@ public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEm
*/
@Override
public Boolean add(AssetEmail assetEmail) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetEmail.getSsdw())
.eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetEmail> list1 = lambdaQuery().eq(AssetEmail::getSsdw, assetEmail.getSsdw())
.eq(AssetEmail::getDzyxhz, assetEmail.getDzyxhz()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
save(assetEmail);
AssetEmailCpPo a = new AssetEmailCpPo();
BeanUtil.copyProperties(assetEmail, a);
@ -121,7 +129,11 @@ public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEm
if (list1 == null || list1.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetEmail> list3 = lambdaQuery().eq(AssetEmail::getSsdw, assetEmail.getSsdw())
.eq(AssetEmail::getDzyxhz, assetEmail.getDzyxhz()).list();
if (list3 != null&& !list3.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
updateById(assetEmail);

@ -81,11 +81,16 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsM
*/
@Override
public Boolean add(AssetMiniPrograms assetMiniPrograms) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw())
.eq(Unit::getDelFlag, 0).list();
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetMiniPrograms> list1 = lambdaQuery().eq(AssetMiniPrograms::getSsdw, assetMiniPrograms.getSsdw())
.eq(AssetMiniPrograms::getXcxmc, assetMiniPrograms.getXcxmc()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
save(assetMiniPrograms);
AssetMiniProgramsCpPo assetMiniProgramsCpPo = new AssetMiniProgramsCpPo();
BeanUtil.copyProperties(assetMiniPrograms, assetMiniProgramsCpPo);
@ -107,11 +112,17 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsM
@Override
public Boolean edit(AssetMiniPrograms assetMiniPrograms) {
List<Unit> list1 = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list1 == null || list1.isEmpty()) {
List<Unit> list3 = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list3 == null || list3.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetMiniPrograms> list1 = lambdaQuery().eq(AssetMiniPrograms::getSsdw, assetMiniPrograms.getSsdw())
.eq(AssetMiniPrograms::getXcxmc, assetMiniPrograms.getXcxmc()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
updateById(assetMiniPrograms);
List<AssetMiniProgramsCpPo> list = assetMiniProgramsCpService.lambdaQuery()
.eq(AssetMiniProgramsCpPo::getAssetId, assetMiniPrograms.getId()).list();

@ -84,6 +84,17 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
*/
@Override
public Boolean add(AssetOfficialAccount assetOfficialAccount) {
List<Unit> list3 = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list3 == null || list3.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetOfficialAccount> list1 = lambdaQuery().eq(AssetOfficialAccount::getSsdw, assetOfficialAccount.getSsdw())
.eq(AssetOfficialAccount::getGzhmc, assetOfficialAccount.getGzhmc()).list();
if (list1 != null&& !list1.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
if (assetOfficialAccount.getCdList() != null && !assetOfficialAccount.getCdList().isEmpty()) {
StringBuilder a = new StringBuilder();
StringBuilder b = new StringBuilder();
@ -131,6 +142,18 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
@Override
public Boolean edit(AssetOfficialAccount assetOfficialAccount) {
List<Unit> list3 = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list3 == null || list3.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
List<AssetOfficialAccount> list4 = lambdaQuery().eq(AssetOfficialAccount::getSsdw, assetOfficialAccount.getSsdw())
.eq(AssetOfficialAccount::getGzhmc, assetOfficialAccount.getGzhmc()).list();
if (list4 != null&& !list4.isEmpty()){
throw new ServiceException("不允许新增重复资产!");
}
if (assetOfficialAccount.getCdList() != null && !assetOfficialAccount.getCdList().isEmpty()) {
StringBuilder a = new StringBuilder();
StringBuilder b = new StringBuilder();

Loading…
Cancel
Save