资产唯一性和单位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.AssetAppCpService;
import com.ruoyi.tc.service.AssetAppJyService; import com.ruoyi.tc.service.AssetAppJyService;
import com.ruoyi.tc.service.AssetAppService; import com.ruoyi.tc.service.AssetAppService;
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;
@ -55,6 +56,8 @@ public class AssetAppController extends BaseController {
@Resource @Resource
private AssetAppJyService assetAppJyService; private AssetAppJyService assetAppJyService;
@Resource
private UnitService unitService;
/** /**
* *
* *
@ -84,6 +87,18 @@ public class AssetAppController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('unit')") @PreAuthorize("@ss.hasAnyRoles('unit')")
@PostMapping("/unitEdit") @PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetAppJyPo assetAppJyPo) { 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()) AssetAppJyPo one = assetAppJyService.lambdaQuery().eq(AssetAppJyPo::getAppName,assetAppJyPo.getAppName())
.eq(AssetAppJyPo::getSsdw,assetAppJyPo.getSsdw()).isNull(AssetAppJyPo::getTaskId).one(); .eq(AssetAppJyPo::getSsdw,assetAppJyPo.getSsdw()).isNull(AssetAppJyPo::getTaskId).one();
assetAppJyPo.setAuditState("1"); assetAppJyPo.setAuditState("1");

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

@ -10,14 +10,15 @@ 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.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.AssetEmail; 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.AssetAuditPageRequest;
import com.ruoyi.tc.entity.request.AssetAuditRequest; import com.ruoyi.tc.entity.request.AssetAuditRequest;
import com.ruoyi.tc.entity.request.AssetEmailPageRequest; import com.ruoyi.tc.entity.request.AssetEmailPageRequest;
import com.ruoyi.tc.service.AssetEmailJyService; import com.ruoyi.tc.service.AssetEmailJyService;
import com.ruoyi.tc.service.AssetEmailService; import com.ruoyi.tc.service.AssetEmailService;
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;
@ -46,6 +47,9 @@ public class AssetEmailController extends BaseController {
@Resource @Resource
private AssetEmailService assetEmailService; private AssetEmailService assetEmailService;
@Resource
private UnitService unitService;
@Resource @Resource
private AssetEmailJyService assetEmailJyService; private AssetEmailJyService assetEmailJyService;
/** /**
@ -78,6 +82,18 @@ public class AssetEmailController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('unit')") @PreAuthorize("@ss.hasAnyRoles('unit')")
@PostMapping("/unitEdit") @PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetEmailJyPo assetEmailJyPo) { 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()) AssetEmailJyPo one = assetEmailJyService.lambdaQuery().eq(AssetEmailJyPo::getSsdw,assetEmailJyPo.getSsdw())
.eq(AssetEmailJyPo::getDzyxhz,assetEmailJyPo.getDzyxhz()).isNull(AssetEmailJyPo::getTaskId).one(); .eq(AssetEmailJyPo::getDzyxhz,assetEmailJyPo.getDzyxhz()).isNull(AssetEmailJyPo::getTaskId).one();
assetEmailJyPo.setAuditState("1"); assetEmailJyPo.setAuditState("1");

@ -10,8 +10,10 @@ 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.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tc.entity.AssetCurrent;
import com.ruoyi.tc.entity.AssetEmail; import com.ruoyi.tc.entity.AssetEmail;
import com.ruoyi.tc.entity.AssetMiniPrograms; 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.AssetAppCpPo;
import com.ruoyi.tc.entity.po.AssetAppJyPo; import com.ruoyi.tc.entity.po.AssetAppJyPo;
import com.ruoyi.tc.entity.po.AssetEmailJyPo; 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.entity.request.AssetMiniProgramsPageRequest;
import com.ruoyi.tc.service.AssetMiniProgramsJyService; import com.ruoyi.tc.service.AssetMiniProgramsJyService;
import com.ruoyi.tc.service.AssetMiniProgramsService; import com.ruoyi.tc.service.AssetMiniProgramsService;
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;
@ -51,6 +54,9 @@ public class AssetMiniProgramsController extends BaseController {
@Resource @Resource
private AssetMiniProgramsJyService assetMiniProgramsJyService; private AssetMiniProgramsJyService assetMiniProgramsJyService;
@Resource
private UnitService unitService;
/** /**
* *
* *
@ -81,6 +87,18 @@ public class AssetMiniProgramsController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('unit')") @PreAuthorize("@ss.hasAnyRoles('unit')")
@PostMapping("/unitEdit") @PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetMiniProgramsJyPo assetMiniProgramsJyPo) { 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()) AssetMiniProgramsJyPo one = assetMiniProgramsJyService.lambdaQuery().eq(AssetMiniProgramsJyPo::getSsdw,assetMiniProgramsJyPo.getSsdw())
.eq(AssetMiniProgramsJyPo::getXcxmc,assetMiniProgramsJyPo.getXcxmc()).isNull(AssetMiniProgramsJyPo::getTaskId).one(); .eq(AssetMiniProgramsJyPo::getXcxmc,assetMiniProgramsJyPo.getXcxmc()).isNull(AssetMiniProgramsJyPo::getTaskId).one();
assetMiniProgramsJyPo.setAuditState("1"); assetMiniProgramsJyPo.setAuditState("1");

@ -9,8 +9,10 @@ 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.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.AssetMiniPrograms; import com.ruoyi.tc.entity.AssetMiniPrograms;
import com.ruoyi.tc.entity.AssetOfficialAccount; 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.AssetAppJyPo;
import com.ruoyi.tc.entity.po.AssetMiniProgramsJyPo; import com.ruoyi.tc.entity.po.AssetMiniProgramsJyPo;
import com.ruoyi.tc.entity.po.AssetOfficialAccountJyPo; 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.entity.request.AssetOfficialAccountPageRequest;
import com.ruoyi.tc.service.AssetOfficialAccountJyService; import com.ruoyi.tc.service.AssetOfficialAccountJyService;
import com.ruoyi.tc.service.AssetOfficialAccountService; import com.ruoyi.tc.service.AssetOfficialAccountService;
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;
@ -55,6 +58,9 @@ public class AssetOfficialAccountController {
@Resource @Resource
private AssetOfficialAccountJyService assetOfficialAccountJyService; private AssetOfficialAccountJyService assetOfficialAccountJyService;
@Resource
private UnitService unitService;
/** /**
* *
* *
@ -117,6 +123,18 @@ public class AssetOfficialAccountController {
@PostMapping("/unitEdit") @PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetOfficialAccountJyPo ao) { 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()) { if (ao.getCdList() != null && !ao.getCdList().isEmpty()) {
StringBuilder a = new StringBuilder(); StringBuilder a = new StringBuilder();
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();

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

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

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

@ -84,6 +84,17 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
*/ */
@Override @Override
public Boolean add(AssetOfficialAccount assetOfficialAccount) { 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()) { if (assetOfficialAccount.getCdList() != null && !assetOfficialAccount.getCdList().isEmpty()) {
StringBuilder a = new StringBuilder(); StringBuilder a = new StringBuilder();
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
@ -131,6 +142,18 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
@Override @Override
public Boolean edit(AssetOfficialAccount assetOfficialAccount) { 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()) { if (assetOfficialAccount.getCdList() != null && !assetOfficialAccount.getCdList().isEmpty()) {
StringBuilder a = new StringBuilder(); StringBuilder a = new StringBuilder();
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();

Loading…
Cancel
Save