管理端审核代码修改

main
dongdingding 4 months ago
parent 623b0c657a
commit 0456470ece

@ -2,7 +2,6 @@ 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.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
@ -11,9 +10,9 @@ 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.*; import com.ruoyi.tc.entity.AssetApp;
import com.ruoyi.tc.entity.po.*; import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.request.Acomma; import com.ruoyi.tc.entity.po.AssetAppJyPo;
import com.ruoyi.tc.entity.request.AssetAppPageRequest; import com.ruoyi.tc.entity.request.AssetAppPageRequest;
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;
@ -28,12 +27,8 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import static com.ruoyi.common.core.domain.AjaxResult.success;
/** /**
* (asset_app) * (asset_app)
* *
@ -60,6 +55,7 @@ public class AssetAppController extends BaseController {
@Resource @Resource
private UnitService unitService; private UnitService unitService;
/** /**
* *
* *
@ -82,6 +78,7 @@ public class AssetAppController extends BaseController {
return success(assetAppService.page(page, req)); return success(assetAppService.page(page, req));
} }
//================================================= //=================================================
/** /**
* *
*/ */
@ -95,8 +92,8 @@ public class AssetAppController extends BaseController {
} }
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");
assetAppJyPo.setAuditYy(null); assetAppJyPo.setAuditYy(null);
if (one != null) { if (one != null) {
@ -157,33 +154,46 @@ public class AssetAppController extends BaseController {
ass.setAppId(as.getCurrentId()); ass.setAppId(as.getCurrentId());
assetAppJyService.updateById(ass); assetAppJyService.updateById(ass);
//通过数据同步 //通过数据同步
if ("2".equals(as.getAuditState())) { if ("2".equals(as.getAuditState()) && as.getXzType() != 1) {
AssetAppJyPo byId = assetAppJyService.getById(as.getCurrentId()); AssetAppJyPo byId = assetAppJyService.getById(as.getCurrentId());
AssetApp aa = new AssetApp(); AssetApp aa = new AssetApp();
BeanUtil.copyProperties(byId, aa); BeanUtil.copyProperties(byId, aa);
aa.setId(byId.getAssetId()); aa.setId(byId.getAssetId());
//修改主表 //修改主表
assetAppService.updateById(aa); assetAppService.updateById(aa);
//如果有任务也修改任务这边 //任务同步
AssetAppJyPo one = assetAppJyService.lambdaQuery() taskTb(byId);
.isNotNull(AssetAppJyPo::getTaskId) }else{
.ne(AssetAppJyPo::getStatus, 5) AssetAppJyPo byId = assetAppJyService.getById(as.getCurrentId());
.eq(AssetAppJyPo::getAssetId, byId.getAssetId()).one(); AssetApp aa = new AssetApp();
if(one!=null){ BeanUtil.copyProperties(byId, aa);
Integer status = one.getStatus(); aa.setId(byId.getAssetId());
Integer taskId = one.getTaskId(); assetAppService.save(aa);
Long appId = one.getAppId(); //任务同步
BeanUtil.copyProperties(byId, one); taskTb(byId);
one.setAppId(appId);
one.setTaskId(taskId);
one.setAuditState(null);
one.setAuditYy(null);
one.setStatus(status);
assetAppJyService.updateById(one);
}
} }
return success(); return success();
} }
private void taskTb(AssetAppJyPo byId) {
//如果有任务也修改任务这边
AssetAppJyPo one = assetAppJyService.lambdaQuery()
.isNotNull(AssetAppJyPo::getTaskId)
.ne(AssetAppJyPo::getStatus, 5)
.eq(AssetAppJyPo::getAssetId, byId.getAssetId()).one();
if (one != null) {
Integer status = one.getStatus();
Integer taskId = one.getTaskId();
Long appId = one.getAppId();
BeanUtil.copyProperties(byId, one);
one.setAppId(appId);
one.setTaskId(taskId);
one.setAuditState(null);
one.setAuditYy(null);
one.setStatus(status);
assetAppJyService.updateById(one);
}
}
//================================================= //=================================================
/** /**

@ -147,107 +147,32 @@ 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) {
if (assetCurrent.getXzType() == 1) {
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();
if (assetCurrent.getGlymList() != null) {
assetCurrent.getGlymList().forEach(x -> {
if (!Objects.equals(x.getKey(), "") && x.getKey() != null) {
a.append(x.getKey());
a.append(",");
}
});
}
assetCurrent.setGlym(a.toString());
List<Acomma> a2 = new ArrayList<>();
if (assetCurrent.getGlIpList() != null) {
if (assetCurrent.getGlIp() != null && !assetCurrent.getGlIp().isEmpty()) {
for (Object o : JSONArray.parseArray(assetCurrent.getGlIp())) {
Acomma acomma = new Acomma();
JSONObject jsonObject = JSONObject.parseObject(o.toString());
if (BeanUtil.isNotEmpty(jsonObject.get("key"))) {
acomma.setKey(jsonObject.get("key").toString());
} else {
acomma.setKey("");
}
if (BeanUtil.isNotEmpty(jsonObject.get("ipType"))) {
acomma.setIpType(jsonObject.get("ipType").toString());
} else {
acomma.setIpType("");
}
Object portValue = jsonObject.get("port");
if (portValue != null && !portValue.toString().isEmpty()) {
acomma.setPort(portValue.toString());
}else{
acomma.setPort("");
}
a2.add(acomma);
}
assetCurrent.setGlIpList(a2);
}
} else {
assetCurrent.setGlIpList(new ArrayList<>());
}
// assetCurrent.setGlIp(b.toString());
assetCurrentService.save(assetCurrent);
//新增新监管业务形态
if (assetCurrent.getXjgywxt() != null) {
assetCurrent.getXjgywxt().setAssetId(assetCurrent.getId());
assetBusinessFormService.save(assetCurrent.getXjgywxt());
}
if (assetCurrent.getGylxxList() != null) {
for (AssetSupplyChain items : assetCurrent.getGylxxList()) {
items.setAssetId(assetCurrent.getId());
} }
//新增供应链 List<AssetCurrent> list1 = assetCurrentService.lambdaQuery().eq(AssetCurrent::getXtmc, assetCurrent.getXtmc()).eq(AssetCurrent::getDwmc, assetCurrent.getDwmc()).list();
assetSupplyChainService.saveBatch(assetCurrent.getGylxxList()); if (list1 != null && !list1.isEmpty()) {
} throw new ServiceException("不允许新增重复资产!");
if (assetCurrent.getJcwlList() != null) {
for (AssetBasicNetwork items : assetCurrent.getJcwlList()) {
items.setAssetId(assetCurrent.getId());
} }
//新增基础网络 //获取新增资产id
assetBasicNetworkService.saveBatch(assetCurrent.getJcwlList()); Long id = assetCurrent.getId();
}
if (assetCurrent.getOtherConcat() != null) {
for (UnitOtherConcat items : assetCurrent.getOtherConcat()) {
items.setAssetId(assetCurrent.getId());
}
//新增其他联系人
unitOtherConcatService.saveBatch(assetCurrent.getOtherConcat());
}
// 单位有进行中的任务时,管理端新增该单位下的资产则需同步至当前进行中的任务中。
//获取新增资产id
Long id = assetCurrent.getId();
Integer i = unitService.selectTaskId(assetCurrent.getDwmc(), "0");
if (i != null) {
//新增资产复制主表 //新增资产复制主表
AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo(); AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo();
BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo); BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo);
assetCurrentCpPo.setTaskId(i); assetCurrentCpPo.setAuditState("1");
assetCurrentCpPo.setXzType(1); assetCurrentCpPo.setXzType(1);
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);
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);
} }
//新增供应链 //新增供应链
assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList()); assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList());
@ -255,7 +180,6 @@ public class AssetCurrentController extends BaseController {
if (assetCurrent.getJcwlList() != null) { if (assetCurrent.getJcwlList() != null) {
for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) { for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) {
items.setAssetId(assetCurrent.getId()); items.setAssetId(assetCurrent.getId());
items.setTaskId(i);
} }
//新增基础网络 //新增基础网络
assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList()); assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList());
@ -263,11 +187,135 @@ public class AssetCurrentController extends BaseController {
if (assetCurrent.getOtherConcat() != null) { if (assetCurrent.getOtherConcat() != null) {
for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) { for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) {
items.setAssetId(assetCurrent.getId()); items.setAssetId(assetCurrent.getId());
items.setTaskId(i);
} }
//新增其他联系人 //新增其他联系人
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat()); unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
} }
} else {
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 -> {
if (!Objects.equals(x.getKey(), "") && x.getKey() != null) {
a.append(x.getKey());
a.append(",");
}
});
}
assetCurrent.setGlym(a.toString());
List<Acomma> a2 = new ArrayList<>();
if (assetCurrent.getGlIpList() != null) {
if (assetCurrent.getGlIp() != null && !assetCurrent.getGlIp().isEmpty()) {
for (Object o : JSONArray.parseArray(assetCurrent.getGlIp())) {
Acomma acomma = new Acomma();
JSONObject jsonObject = JSONObject.parseObject(o.toString());
if (BeanUtil.isNotEmpty(jsonObject.get("key"))) {
acomma.setKey(jsonObject.get("key").toString());
} else {
acomma.setKey("");
}
if (BeanUtil.isNotEmpty(jsonObject.get("ipType"))) {
acomma.setIpType(jsonObject.get("ipType").toString());
} else {
acomma.setIpType("");
}
Object portValue = jsonObject.get("port");
if (portValue != null && !portValue.toString().isEmpty()) {
acomma.setPort(portValue.toString());
} else {
acomma.setPort("");
}
a2.add(acomma);
}
assetCurrent.setGlIpList(a2);
}
} else {
assetCurrent.setGlIpList(new ArrayList<>());
}
// assetCurrent.setGlIp(b.toString());
assetCurrentService.save(assetCurrent);
//新增新监管业务形态
if (assetCurrent.getXjgywxt() != null) {
assetCurrent.getXjgywxt().setAssetId(assetCurrent.getId());
assetBusinessFormService.save(assetCurrent.getXjgywxt());
}
if (assetCurrent.getGylxxList() != null) {
for (AssetSupplyChain items : assetCurrent.getGylxxList()) {
items.setAssetId(assetCurrent.getId());
}
//新增供应链
assetSupplyChainService.saveBatch(assetCurrent.getGylxxList());
}
if (assetCurrent.getJcwlList() != null) {
for (AssetBasicNetwork items : assetCurrent.getJcwlList()) {
items.setAssetId(assetCurrent.getId());
}
//新增基础网络
assetBasicNetworkService.saveBatch(assetCurrent.getJcwlList());
}
if (assetCurrent.getOtherConcat() != null) {
for (UnitOtherConcat items : assetCurrent.getOtherConcat()) {
items.setAssetId(assetCurrent.getId());
}
//新增其他联系人
unitOtherConcatService.saveBatch(assetCurrent.getOtherConcat());
}
// 单位有进行中的任务时,管理端新增该单位下的资产则需同步至当前进行中的任务中。
//获取新增资产id
Long id = assetCurrent.getId();
Integer i = unitService.selectTaskId(assetCurrent.getDwmc(), "0");
if (i != null) {
//新增资产复制主表
AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo();
BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo);
assetCurrentCpPo.setTaskId(i);
assetCurrentCpPo.setXzType(1);
assetCurrentCpService.save(assetCurrentCpPo);
//新增新监管业务形态
//根据资产id查询新监管业务形态主表id
if (assetCurrent.getXjgywxt() != null) {
assetCurrentCpPo.getXjgywxt().setAssetId(id);
assetCurrentCpPo.getXjgywxt().setTaskId(i);
assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt());
}
if (assetCurrent.getGylxxList() != null) {
for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) {
items.setAssetId(id);
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();
@ -414,7 +462,7 @@ public class AssetCurrentController extends BaseController {
byId.setGlymList(new ArrayList<>()); byId.setGlymList(new ArrayList<>());
} }
List<Acomma> a2 = new ArrayList<>(); List<Acomma> a2 = new ArrayList<>();
if(byId.getGlIp()!=null&& !byId.getGlIp().isEmpty()){ if (byId.getGlIp() != null && !byId.getGlIp().isEmpty()) {
for (Object o : JSONArray.parseArray(byId.getGlIp())) { for (Object o : JSONArray.parseArray(byId.getGlIp())) {
Acomma acomma = new Acomma(); Acomma acomma = new Acomma();
JSONObject jsonObject = JSONObject.parseObject(o.toString()); JSONObject jsonObject = JSONObject.parseObject(o.toString());
@ -431,13 +479,13 @@ public class AssetCurrentController extends BaseController {
Object portValue = jsonObject.get("port"); Object portValue = jsonObject.get("port");
if (portValue != null && !portValue.toString().isEmpty()) { if (portValue != null && !portValue.toString().isEmpty()) {
acomma.setPort(portValue.toString()); acomma.setPort(portValue.toString());
}else{ } else {
acomma.setPort(""); acomma.setPort("");
} }
a2.add(acomma); a2.add(acomma);
} }
byId.setGlIpList(a2); byId.setGlIpList(a2);
}else { } else {
byId.setGlIpList(new ArrayList<>()); byId.setGlIpList(new ArrayList<>());
} }
@ -458,94 +506,142 @@ public class AssetCurrentController extends BaseController {
BeanUtil.copyProperties(as, ass); BeanUtil.copyProperties(as, ass);
assetCurrentCpService.updateById(ass); assetCurrentCpService.updateById(ass);
//通过数据同步 //通过数据同步
if ("2".equals(as.getAuditState())) { if ("2".equals(as.getAuditState()) && as.getXzType() != 1) {
AssetCurrentCpPo byId = assetCurrentCpService.getById(as.getCurrentId()); AssetCurrentCpPo byId = assetCurrentCpService.getById(as.getCurrentId());
AssetCurrent assetCurrent = new AssetCurrent(); AssetCurrent assetCurrent = new AssetCurrent();
BeanUtil.copyProperties(byId, assetCurrent); BeanUtil.copyProperties(byId, assetCurrent);
//修改主表 //修改主表
assetCurrentService.updateById(assetCurrent); assetCurrentService.updateById(assetCurrent);
//删除副表数据然后再添加 //删除副表数据然后再添加
assetSupplyChainService.deleteByAssetIds(assetCurrent.getId()); Result result = getResult(assetCurrent, byId);
assetBasicNetworkService.deleteByAssetIds(assetCurrent.getId()); //如果有任务也修改任务这边
assetBusinessFormService.deleteByAssetIds(assetCurrent.getId()); taskTb(byId, result.list, result.list1, result.list2, result.list3);
unitOtherConcatService.deleteByAssetIds(assetCurrent.getId()); } else {
AssetCurrentCpPo byId = assetCurrentCpService.getById(as.getCurrentId());
AssetCurrent assetCurrent = new AssetCurrent();
BeanUtil.copyProperties(byId, assetCurrent);
//修改主表
assetCurrentService.save(assetCurrent);
//删除副表数据然后再添加
Result result = getResult(assetCurrent, byId);
//如果有任务也修改任务这边
taskTb(byId, result.list, result.list1, result.list2, result.list3);
}
return success();
}
private Result getResult(AssetCurrent assetCurrent, AssetCurrentCpPo byId) {
assetSupplyChainService.deleteByAssetIds(assetCurrent.getId());
assetBasicNetworkService.deleteByAssetIds(assetCurrent.getId());
assetBusinessFormService.deleteByAssetIds(assetCurrent.getId());
unitOtherConcatService.deleteByAssetIds(assetCurrent.getId());
List<AssetSupplyChainCpPo> list = assetSupplyChainCpService.lambdaQuery().eq(AssetSupplyChainCpPo::getAssetId, byId.getId()).isNull(AssetSupplyChainCpPo::getTaskId).list();
list.forEach(x -> {
AssetSupplyChain a1 = new AssetSupplyChain();
BeanUtil.copyProperties(x, a1);
assetSupplyChainService.save(a1);
});
List<AssetBasicNetworkCpPo> list1 = assetBasicNetworkCpService.lambdaQuery().eq(AssetBasicNetworkCpPo::getAssetId, byId.getId()).isNull(AssetBasicNetworkCpPo::getTaskId).list();
list1.forEach(x -> {
AssetBasicNetwork a2 = new AssetBasicNetwork();
BeanUtil.copyProperties(x, a2);
assetBasicNetworkService.save(a2);
});
List<AssetBusinessFormCpPo> list2 = assetBusinessFormCpService.lambdaQuery().eq(AssetBusinessFormCpPo::getAssetId, byId.getId()).isNull(AssetBusinessFormCpPo::getTaskId).list();
list2.forEach(x -> {
AssetBusinessForm a3 = new AssetBusinessForm();
BeanUtil.copyProperties(x, a3);
assetBusinessFormService.save(a3);
});
List<AssetSupplyChainCpPo> list = assetSupplyChainCpService.lambdaQuery().eq(AssetSupplyChainCpPo::getAssetId, byId.getId()).isNull(AssetSupplyChainCpPo::getTaskId).list(); List<UnitOtherConcatCpPo> list3 = unitOtherConcatCpService.lambdaQuery().eq(UnitOtherConcatCpPo::getAssetId, byId.getId()).isNull(UnitOtherConcatCpPo::getTaskId).list();
list3.forEach(x -> {
UnitOtherConcat a4 = new UnitOtherConcat();
BeanUtil.copyProperties(x, a4);
unitOtherConcatService.save(a4);
});
Result result = new Result(list, list1, list2, list3);
return result;
}
private static class Result {
public final List<AssetSupplyChainCpPo> list;
public final List<AssetBasicNetworkCpPo> list1;
public final List<AssetBusinessFormCpPo> list2;
public final List<UnitOtherConcatCpPo> list3;
public Result(List<AssetSupplyChainCpPo> list, List<AssetBasicNetworkCpPo> list1, List<AssetBusinessFormCpPo> list2, List<UnitOtherConcatCpPo> list3) {
this.list = list;
this.list1 = list1;
this.list2 = list2;
this.list3 = list3;
}
}
private void taskTb(AssetCurrentCpPo byId, List<AssetSupplyChainCpPo> list, List<AssetBasicNetworkCpPo> list1, List<AssetBusinessFormCpPo> list2, List<UnitOtherConcatCpPo> list3) {
AssetCurrentCpPo one = assetCurrentCpService.lambdaQuery().isNotNull(AssetCurrentCpPo::getTaskId).ne(AssetCurrentCpPo::getStatus, 5).eq(AssetCurrentCpPo::getId, byId.getId()).one();
if (one != null) {
Integer taskId = one.getTaskId();
Long appId = one.getCurrentId();
Integer status = one.getStatus();
BeanUtil.copyProperties(byId, one);
one.setCurrentId(appId);
one.setTaskId(taskId);
one.setAuditState(null);
one.setAuditYy(null);
one.setStatus(status);
assetCurrentCpService.updateById(one);
QueryWrapper<AssetSupplyChainCpPo> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("asset_id", one.getId());
queryWrapper2.eq("task_id", taskId);
assetSupplyChainCpService.remove(queryWrapper2);
QueryWrapper<AssetBasicNetworkCpPo> queryWrapper3 = new QueryWrapper<>();
queryWrapper3.eq("asset_id", one.getId());
queryWrapper3.eq("task_id", taskId);
assetBasicNetworkCpService.remove(queryWrapper3);
QueryWrapper<AssetBusinessFormCpPo> queryWrapper4 = new QueryWrapper<>();
queryWrapper4.eq("asset_id", one.getId());
queryWrapper4.eq("task_id", taskId);
assetBusinessFormCpService.remove(queryWrapper4);
QueryWrapper<UnitOtherConcatCpPo> queryWrapper5 = new QueryWrapper<>();
queryWrapper5.eq("task_id", taskId);
queryWrapper5.eq("asset_id", one.getId());
unitOtherConcatCpService.remove(queryWrapper5);
list.forEach(x -> { list.forEach(x -> {
AssetSupplyChain a1 = new AssetSupplyChain(); x.setTaskId(taskId);
BeanUtil.copyProperties(x, a1); assetSupplyChainCpService.save(x);
assetSupplyChainService.save(a1);
}); });
List<AssetBasicNetworkCpPo> list1 = assetBasicNetworkCpService.lambdaQuery().eq(AssetBasicNetworkCpPo::getAssetId, byId.getId()).isNull(AssetBasicNetworkCpPo::getTaskId).list();
list1.forEach(x -> { list1.forEach(x -> {
AssetBasicNetwork a2 = new AssetBasicNetwork(); x.setTaskId(taskId);
BeanUtil.copyProperties(x, a2); assetBasicNetworkCpService.save(x);
assetBasicNetworkService.save(a2);
}); });
List<AssetBusinessFormCpPo> list2 = assetBusinessFormCpService.lambdaQuery().eq(AssetBusinessFormCpPo::getAssetId, byId.getId()).isNull(AssetBusinessFormCpPo::getTaskId).list();
list2.forEach(x -> { list2.forEach(x -> {
AssetBusinessForm a3 = new AssetBusinessForm(); x.setTaskId(taskId);
BeanUtil.copyProperties(x, a3); assetBusinessFormCpService.save(x);
assetBusinessFormService.save(a3);
}); });
List<UnitOtherConcatCpPo> list3 = unitOtherConcatCpService.lambdaQuery().eq(UnitOtherConcatCpPo::getAssetId, byId.getId()).isNull(UnitOtherConcatCpPo::getTaskId).list();
list3.forEach(x -> { list3.forEach(x -> {
UnitOtherConcat a4 = new UnitOtherConcat(); x.setTaskId(taskId);
BeanUtil.copyProperties(x, a4); unitOtherConcatCpService.save(x);
unitOtherConcatService.save(a4);
}); });
//如果有任务也修改任务这边
AssetCurrentCpPo one = assetCurrentCpService.lambdaQuery().isNotNull(AssetCurrentCpPo::getTaskId).ne(AssetCurrentCpPo::getStatus, 5).eq(AssetCurrentCpPo::getId, byId.getId()).one();
if (one != null) {
Integer taskId = one.getTaskId();
Long appId = one.getCurrentId();
Integer status = one.getStatus();
BeanUtil.copyProperties(byId, one);
one.setCurrentId(appId);
one.setTaskId(taskId);
one.setAuditState(null);
one.setAuditYy(null);
one.setStatus(status);
assetCurrentCpService.updateById(one);
QueryWrapper<AssetSupplyChainCpPo> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("asset_id", one.getId());
queryWrapper2.eq("task_id", taskId);
assetSupplyChainCpService.remove(queryWrapper2);
QueryWrapper<AssetBasicNetworkCpPo> queryWrapper3 = new QueryWrapper<>();
queryWrapper3.eq("asset_id", one.getId());
queryWrapper3.eq("task_id", taskId);
assetBasicNetworkCpService.remove(queryWrapper3);
QueryWrapper<AssetBusinessFormCpPo> queryWrapper4 = new QueryWrapper<>();
queryWrapper4.eq("asset_id", one.getId());
queryWrapper4.eq("task_id", taskId);
assetBusinessFormCpService.remove(queryWrapper4);
QueryWrapper<UnitOtherConcatCpPo> queryWrapper5 = new QueryWrapper<>();
queryWrapper5.eq("task_id", taskId);
queryWrapper5.eq("asset_id", one.getId());
unitOtherConcatCpService.remove(queryWrapper5);
list.forEach(x -> {
x.setTaskId(taskId);
assetSupplyChainCpService.save(x);
});
list1.forEach(x -> {
x.setTaskId(taskId);
assetBasicNetworkCpService.save(x);
});
list2.forEach(x -> {
x.setTaskId(taskId);
assetBusinessFormCpService.save(x);
});
list3.forEach(x -> {
x.setTaskId(taskId);
unitOtherConcatCpService.save(x);
});
}
} }
return success(); }
private static class deleteFb {
public final List<AssetSupplyChainCpPo> list;
public final List<AssetBasicNetworkCpPo> list1;
public final List<AssetBusinessFormCpPo> list2;
public final List<UnitOtherConcatCpPo> list3;
public deleteFb(List<AssetSupplyChainCpPo> list, List<AssetBasicNetworkCpPo> list1, List<AssetBusinessFormCpPo> list2, List<UnitOtherConcatCpPo> list3) {
this.list = list;
this.list1 = list1;
this.list2 = list2;
this.list3 = list3;
}
} }
//================================================= //=================================================
@ -596,7 +692,7 @@ public class AssetCurrentController extends BaseController {
Object portValue = jsonObject.get("port"); Object portValue = jsonObject.get("port");
if (portValue != null && !portValue.toString().isEmpty()) { if (portValue != null && !portValue.toString().isEmpty()) {
acomma.setPort(portValue.toString()); acomma.setPort(portValue.toString());
}else{ } else {
acomma.setPort(""); acomma.setPort("");
} }
a2.add(acomma); a2.add(acomma);

@ -162,33 +162,46 @@ public class AssetEmailController extends BaseController {
ass.setEmailId(as.getCurrentId()); ass.setEmailId(as.getCurrentId());
assetEmailJyService.updateById(ass); assetEmailJyService.updateById(ass);
//通过数据同步 //通过数据同步
if ("2".equals(as.getAuditState())) { if ("2".equals(as.getAuditState()) && as.getXzType() != 1) {
AssetEmailJyPo byId = assetEmailJyService.getById(as.getCurrentId()); AssetEmailJyPo byId = assetEmailJyService.getById(as.getCurrentId());
AssetEmail aa = new AssetEmail(); AssetEmail aa = new AssetEmail();
BeanUtil.copyProperties(byId, aa); BeanUtil.copyProperties(byId, aa);
aa.setId(byId.getAssetId()); aa.setId(byId.getAssetId());
//修改主表 //修改主表
assetEmailService.updateById(aa); assetEmailService.updateById(aa);
//如果有任务也修改任务这边 //任务同步
AssetEmailJyPo one = assetEmailJyService.lambdaQuery() taskTb(byId);
.isNotNull(AssetEmailJyPo::getTaskId) }else{
.ne(AssetEmailJyPo::getStatus, 5) AssetEmailJyPo byId = assetEmailJyService.getById(as.getCurrentId());
.eq(AssetEmailJyPo::getAssetId, byId.getAssetId()).one(); AssetEmail aa = new AssetEmail();
if (one != null) { BeanUtil.copyProperties(byId, aa);
Integer status = one.getStatus(); aa.setId(byId.getAssetId());
Integer taskId = one.getTaskId(); assetEmailService.save(aa);
Long appId = one.getEmailId(); //任务同步
BeanUtil.copyProperties(byId, one); taskTb(byId);
one.setEmailId(appId);
one.setTaskId(taskId);
one.setAuditState(null);
one.setAuditYy(null);
one.setStatus(status);
assetEmailJyService.updateById(one);
}
} }
return success(); return success();
} }
private void taskTb(AssetEmailJyPo byId) {
//如果有任务也修改任务这边
AssetEmailJyPo one = assetEmailJyService.lambdaQuery()
.isNotNull(AssetEmailJyPo::getTaskId)
.ne(AssetEmailJyPo::getStatus, 5)
.eq(AssetEmailJyPo::getAssetId, byId.getAssetId()).one();
if (one != null) {
Integer status = one.getStatus();
Integer taskId = one.getTaskId();
Long appId = one.getEmailId();
BeanUtil.copyProperties(byId, one);
one.setEmailId(appId);
one.setTaskId(taskId);
one.setAuditState(null);
one.setAuditYy(null);
one.setStatus(status);
assetEmailJyService.updateById(one);
}
}
//================================================= //=================================================
/** /**

@ -161,33 +161,57 @@ public class AssetMiniProgramsController extends BaseController {
ass.setMiniId(as.getCurrentId()); ass.setMiniId(as.getCurrentId());
assetMiniProgramsJyService.updateById(ass); assetMiniProgramsJyService.updateById(ass);
//通过数据同步 //通过数据同步
if ("2".equals(as.getAuditState())) { if ("2".equals(as.getAuditState()) && as.getXzType()!=1) {
AssetMiniProgramsJyPo byId = assetMiniProgramsJyService.getById(as.getCurrentId()); AssetMiniProgramsJyPo byId = assetMiniProgramsJyService.getById(as.getCurrentId());
AssetMiniPrograms aa = new AssetMiniPrograms(); AssetMiniPrograms aa = new AssetMiniPrograms();
BeanUtil.copyProperties(byId, aa); BeanUtil.copyProperties(byId, aa);
aa.setId(byId.getAssetId()); aa.setId(byId.getAssetId());
//修改主表 //修改主表
assetMiniProgramsService.updateById(aa); assetMiniProgramsService.updateById(aa);
//如果有任务也修改任务这边 //任务同步
AssetMiniProgramsJyPo one = assetMiniProgramsJyService.lambdaQuery() taskTb(byId);
.isNotNull(AssetMiniProgramsJyPo::getTaskId) }else {
.ne(AssetMiniProgramsJyPo::getStatus, 5) AssetMiniProgramsJyPo byId = assetMiniProgramsJyService.getById(as.getCurrentId());
.eq(AssetMiniProgramsJyPo::getAssetId, byId.getAssetId()).one(); AssetMiniPrograms aa = new AssetMiniPrograms();
if (one != null) { BeanUtil.copyProperties(byId, aa);
Integer taskId = one.getTaskId(); aa.setId(byId.getAssetId());
Long appId = one.getMiniId(); assetMiniProgramsService.save(aa);
Integer status = one.getStatus(); //任务同步
BeanUtil.copyProperties(byId, one); taskTb(byId);
one.setMiniId(appId);
one.setTaskId(taskId);
one.setAuditState(null);
one.setAuditYy(null);
one.setStatus(status);
assetMiniProgramsJyService.updateById(one);
}
} }
return success(); return success();
} }
private void taskTb(AssetMiniProgramsJyPo byId) {
//如果有任务也修改任务这边
AssetMiniProgramsJyPo one = assetMiniProgramsJyService.lambdaQuery()
.isNotNull(AssetMiniProgramsJyPo::getTaskId)
.ne(AssetMiniProgramsJyPo::getStatus, 5)
.eq(AssetMiniProgramsJyPo::getAssetId, byId.getAssetId()).one();
if (one != null) {
Integer taskId = one.getTaskId();
Long appId = one.getMiniId();
Integer status = one.getStatus();
BeanUtil.copyProperties(byId, one);
one.setMiniId(appId);
one.setTaskId(taskId);
one.setAuditState(null);
one.setAuditYy(null);
one.setStatus(status);
assetMiniProgramsJyService.updateById(one);
}
}
private void tb(AssetAuditRequest as) {
AssetMiniProgramsJyPo byId = assetMiniProgramsJyService.getById(as.getCurrentId());
AssetMiniPrograms aa = new AssetMiniPrograms();
BeanUtil.copyProperties(byId, aa);
aa.setId(byId.getAssetId());
//修改主表
assetMiniProgramsService.updateById(aa);
//如果有任务也修改任务这边
taskTb(byId);
}
//================================================= //=================================================
@ -204,18 +228,21 @@ public class AssetMiniProgramsController extends BaseController {
} }
/** /**
* *
* *
* @param assetMiniPrograms * @param assetMiniPrograms
* @return * @return
*/ */
@ApiOperation(value = "新增小程序数据") @ApiOperation(value = "管理端新增小程序数据")
@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.add(assetMiniPrograms)); return success(assetMiniProgramsService.add(assetMiniPrograms));
} }
/** /**
* *
* *

@ -235,33 +235,47 @@ public class AssetOfficialAccountController {
ass.setAccountId(as.getCurrentId()); ass.setAccountId(as.getCurrentId());
assetOfficialAccountJyService.updateById(ass); assetOfficialAccountJyService.updateById(ass);
//通过数据同步 //通过数据同步
if ("2".equals(as.getAuditState())) { if ("2".equals(as.getAuditState()) && as.getXzType()!=1) {
AssetOfficialAccountJyPo byId = assetOfficialAccountJyService.getById(as.getCurrentId()); AssetOfficialAccountJyPo byId = assetOfficialAccountJyService.getById(as.getCurrentId());
AssetOfficialAccount aa = new AssetOfficialAccount(); AssetOfficialAccount aa = new AssetOfficialAccount();
BeanUtil.copyProperties(byId, aa); BeanUtil.copyProperties(byId, aa);
aa.setId(byId.getAssetId()); aa.setId(byId.getAssetId());
//修改主表 //修改主表
assetOfficialAccountService.updateById(aa); assetOfficialAccountService.updateById(aa);
//如果有任务也修改任务这边 //任务同步
AssetOfficialAccountJyPo one = assetOfficialAccountJyService.lambdaQuery() taskTb(byId);
.isNotNull(AssetOfficialAccountJyPo::getTaskId) }else{
.ne(AssetOfficialAccountJyPo::getStatus, 5) AssetOfficialAccountJyPo byId = assetOfficialAccountJyService.getById(as.getCurrentId());
.eq(AssetOfficialAccountJyPo::getAssetId, byId.getAssetId()).one(); AssetOfficialAccount aa = new AssetOfficialAccount();
if (one != null) { BeanUtil.copyProperties(byId, aa);
Integer status = one.getStatus(); aa.setId(byId.getAssetId());
Integer taskId = one.getTaskId(); //修改主表
Long appId = one.getAccountId(); assetOfficialAccountService.save(aa);
BeanUtil.copyProperties(byId, one); //任务同步
one.setAccountId(appId); taskTb(byId);
one.setTaskId(taskId);
one.setAuditState(null);
one.setAuditYy(null);
one.setStatus(status);
assetOfficialAccountJyService.updateById(one);
}
} }
return success(); return success();
} }
private void taskTb(AssetOfficialAccountJyPo byId) {
//如果有任务也修改任务这边
AssetOfficialAccountJyPo one = assetOfficialAccountJyService.lambdaQuery()
.isNotNull(AssetOfficialAccountJyPo::getTaskId)
.ne(AssetOfficialAccountJyPo::getStatus, 5)
.eq(AssetOfficialAccountJyPo::getAssetId, byId.getAssetId()).one();
if (one != null) {
Integer status = one.getStatus();
Integer taskId = one.getTaskId();
Long appId = one.getAccountId();
BeanUtil.copyProperties(byId, one);
one.setAccountId(appId);
one.setTaskId(taskId);
one.setAuditState(null);
one.setAuditYy(null);
one.setStatus(status);
assetOfficialAccountJyService.updateById(one);
}
}
//================================================= //=================================================
/** /**

@ -26,4 +26,11 @@ public class AssetAuditRequest {
@ApiModelProperty("单位自己编辑的 不通过原因") @ApiModelProperty("单位自己编辑的 不通过原因")
private String auditYy; private String auditYy;
/**
*
*/
@ApiModelProperty("类型0:管理端1单位端")
private Integer xzType=0;
} }

@ -55,7 +55,7 @@ public interface AssetMiniProgramsService extends IService<AssetMiniPrograms> {
void deleteIdList(List<Long> idList); void deleteIdList(List<Long> idList);
/** /**
* *
* *
* @param assetMiniPrograms * @param assetMiniPrograms
* @return * @return

@ -18,9 +18,6 @@ import com.ruoyi.tc.service.UnitService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -95,26 +92,48 @@ 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()).eq(Unit::getDelFlag, 0).list(); if (assetApp.getXzType() == 1) {
if (list == null || list.isEmpty()) { //单位端新增做校验
throw new ServiceException("请选择已有单位!"); 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()) List<AssetApp> list1 = lambdaQuery().eq(AssetApp::getSsdw, assetApp.getSsdw())
.eq(AssetApp::getAppName, assetApp.getAppName()).list(); .eq(AssetApp::getAppName, assetApp.getAppName()).list();
if (list1 != null && !list1.isEmpty()) { if (list1 != null && !list1.isEmpty()) {
throw new ServiceException("不允许新增重复资产!"); throw new ServiceException("不允许新增重复资产!");
} }
save(assetApp); AssetAppCpPo a = new AssetAppCpPo();
AssetAppCpPo a = new AssetAppCpPo(); BeanUtil.copyProperties(assetApp, a);
BeanUtil.copyProperties(assetApp, a); a.setAuditState("1");
Integer i = unitService.selectTaskId(assetApp.getSsdw(), "4");
if (i != null) {
a.setTaskId(i);
a.setXzType(1); a.setXzType(1);
a.setAssetId(assetApp.getId()); a.setAssetId(assetApp.getId());
assetAppCpService.save(a); assetAppCpService.save(a);
}else{
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);
Integer i = unitService.selectTaskId(assetApp.getSsdw(), "4");
if (i != null) {
a.setTaskId(i);
a.setXzType(1);
a.setAssetId(assetApp.getId());
assetAppCpService.save(a);
}
} }
return true; return true;
} }

@ -5,11 +5,8 @@ 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.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.tc.entity.AssetCurrent;
import com.ruoyi.tc.entity.AssetEmail; import com.ruoyi.tc.entity.AssetEmail;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.Unit; import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.po.AssetCurrentCpPo;
import com.ruoyi.tc.entity.po.AssetEmailCpPo; import com.ruoyi.tc.entity.po.AssetEmailCpPo;
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;
@ -95,27 +92,50 @@ public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEm
@Override @Override
public Boolean add(AssetEmail assetEmail) { public Boolean add(AssetEmail assetEmail) {
if (assetEmail.getXzType() == 1) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetEmail.getSsdw()) //单位端新增做校验
.eq(Unit::getDelFlag, 0).list(); List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetEmail.getSsdw())
if (list == null || list.isEmpty()) { .eq(Unit::getDelFlag, 0).list();
throw new ServiceException("请选择已有单位!"); if (list == null || list.isEmpty()) {
} throw new ServiceException("请选择已有单位!");
List<AssetEmail> list1 = lambdaQuery().eq(AssetEmail::getSsdw, assetEmail.getSsdw()) }
.eq(AssetEmail::getDzyxhz, assetEmail.getDzyxhz()).list(); List<AssetEmail> list1 = lambdaQuery().eq(AssetEmail::getSsdw, assetEmail.getSsdw())
if (list1 != null&& !list1.isEmpty()){ .eq(AssetEmail::getDzyxhz, assetEmail.getDzyxhz()).list();
throw new ServiceException("不允许新增重复资产!"); if (list1 != null && !list1.isEmpty()) {
} throw new ServiceException("不允许新增重复资产!");
save(assetEmail); }
AssetEmailCpPo a = new AssetEmailCpPo(); AssetEmailCpPo a = new AssetEmailCpPo();
BeanUtil.copyProperties(assetEmail, a); BeanUtil.copyProperties(assetEmail, a);
Integer i = unitService.selectTaskId(assetEmail.getSsdw(), "3"); a.setXzType(1);
if (i != null) { a.setAuditState("1");
a.setTaskId(i);
a.setXzType(1); a.setXzType(1);
a.setAssetId(assetEmail.getId()); a.setAssetId(assetEmail.getId());
assetEmailCpService.save(a); assetEmailCpService.save(a);
}else{
//管理端
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);
Integer i = unitService.selectTaskId(assetEmail.getSsdw(), "3");
if (i != null) {
a.setTaskId(i);
a.setXzType(1);
a.setAssetId(assetEmail.getId());
assetEmailCpService.save(a);
}
} }
return true; return true;
} }
@ -168,7 +188,7 @@ public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEm
// assetEmailCpService.updateById(assetEmailCpPo); // assetEmailCpService.updateById(assetEmailCpPo);
// } // }
// } // }
return true; return true;
} }

@ -6,9 +6,7 @@ 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.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.tc.entity.AssetMiniPrograms; import com.ruoyi.tc.entity.AssetMiniPrograms;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.Unit; import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.po.AssetEmailCpPo;
import com.ruoyi.tc.entity.po.AssetMiniProgramsCpPo; 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;
@ -78,33 +76,53 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsM
} }
/** /**
* *
* *
* @param assetMiniPrograms * @param assetMiniPrograms
* @return * @return
*/ */
@Override @Override
public Boolean add(AssetMiniPrograms assetMiniPrograms) { public Boolean add(AssetMiniPrograms assetMiniPrograms) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw()).eq(Unit::getDelFlag, 0).list(); if (assetMiniPrograms.getXzType() == 1) {
if (list == null || list.isEmpty()) { //单位端新增做校验
throw new ServiceException("请选择已有单位!"); 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(); List<AssetMiniPrograms> list1 = lambdaQuery().eq(AssetMiniPrograms::getSsdw, assetMiniPrograms.getSsdw())
if (list1 != null&& !list1.isEmpty()){ .eq(AssetMiniPrograms::getXcxmc, assetMiniPrograms.getXcxmc()).list();
throw new ServiceException("不允许新增重复资产!"); if (list1 != null && !list1.isEmpty()) {
} throw new ServiceException("不允许新增重复资产!");
save(assetMiniPrograms); }
AssetMiniProgramsCpPo assetMiniProgramsCpPo = new AssetMiniProgramsCpPo(); AssetMiniProgramsCpPo assetMiniProgramsCpPo = new AssetMiniProgramsCpPo();
BeanUtil.copyProperties(assetMiniPrograms, assetMiniProgramsCpPo); BeanUtil.copyProperties(assetMiniPrograms, assetMiniProgramsCpPo);
Integer i = unitService.selectTaskId(assetMiniPrograms.getSsdw(), "1");
if (i != null) {
assetMiniProgramsCpPo.setTaskId(i);
assetMiniProgramsCpPo.setXzType(1); assetMiniProgramsCpPo.setXzType(1);
assetMiniProgramsCpPo.setAuditState("1");
assetMiniProgramsCpPo.setAssetId(assetMiniPrograms.getId()); assetMiniProgramsCpPo.setAssetId(assetMiniPrograms.getId());
assetMiniProgramsCpService.save(assetMiniProgramsCpPo); assetMiniProgramsCpService.save(assetMiniProgramsCpPo);
} else {
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);
Integer i = unitService.selectTaskId(assetMiniPrograms.getSsdw(), "1");
if (i != null) {
assetMiniProgramsCpPo.setTaskId(i);
assetMiniProgramsCpPo.setAssetId(assetMiniPrograms.getId());
assetMiniProgramsCpService.save(assetMiniProgramsCpPo);
}
} }
return true; return true;
} }
@ -123,7 +141,6 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsM
} }
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();

@ -6,9 +6,7 @@ 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.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.tc.entity.AssetOfficialAccount; import com.ruoyi.tc.entity.AssetOfficialAccount;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.Unit; import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.po.AssetMiniProgramsCpPo;
import com.ruoyi.tc.entity.po.AssetOfficialAccountCpPo; 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;
@ -88,55 +86,94 @@ 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.getXzType() == 1) {
StringBuilder a = new StringBuilder(); List<AssetOfficialAccount> list1 = lambdaQuery()
StringBuilder b = new StringBuilder(); .eq(AssetOfficialAccount::getSsdw, assetOfficialAccount.getSsdw())
StringBuilder c = new StringBuilder(); .eq(AssetOfficialAccount::getGzhmc, assetOfficialAccount.getGzhmc()).list();
assetOfficialAccount.getCdList().forEach(x -> { if (list1 != null && !list1.isEmpty()) {
if(!Objects.equals(x.getCdmc(), "") &&x.getCdmc()!=null){ throw new ServiceException("不允许新增重复资产!");
a.append(x.getCdmc()).append("|"); }
}
if(!Objects.equals(x.getCdlj(), "") &&x.getCdlj()!=null){ if (assetOfficialAccount.getCdList() != null && !assetOfficialAccount.getCdList().isEmpty()) {
b.append(x.getCdlj()).append("|"); StringBuilder a = new StringBuilder();
} StringBuilder b = new StringBuilder();
if(!Objects.equals(x.getCdlx(), "") &&x.getCdlx()!=null){ StringBuilder c = new StringBuilder();
c.append(x.getCdlx()).append("|"); assetOfficialAccount.getCdList().forEach(x -> {
} if (!Objects.equals(x.getCdmc(), "") && x.getCdmc() != null) {
}); a.append(x.getCdmc()).append("|");
assetOfficialAccount.setCdmc(a.toString()); }
assetOfficialAccount.setCdlj(b.toString()); if (!Objects.equals(x.getCdlj(), "") && x.getCdlj() != null) {
assetOfficialAccount.setCdlx(c.toString()); b.append(x.getCdlj()).append("|");
} }
if (!Objects.equals(x.getCdlx(), "") && x.getCdlx() != null) {
c.append(x.getCdlx()).append("|");
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()) }
.eq(Unit::getDelFlag, 0).list(); });
if (list == null || list.isEmpty()) { assetOfficialAccount.setCdmc(a.toString());
throw new ServiceException("请选择已有单位!"); assetOfficialAccount.setCdlj(b.toString());
} assetOfficialAccount.setCdlx(c.toString());
save(assetOfficialAccount); }
AssetOfficialAccountCpPo a = new AssetOfficialAccountCpPo();
BeanUtil.copyProperties(assetOfficialAccount, a);
Integer i = unitService.selectTaskId(assetOfficialAccount.getSsdw(), "2"); List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw())
if (i != null) { .eq(Unit::getDelFlag, 0).list();
a.setTaskId(i); if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
AssetOfficialAccountCpPo a = new AssetOfficialAccountCpPo();
BeanUtil.copyProperties(assetOfficialAccount, a);
a.setAssetId(assetOfficialAccount.getId()); a.setAssetId(assetOfficialAccount.getId());
a.setXzType(1); a.setXzType(1);
a.setAuditState("1");
assetOfficialAccountCpService.save(a); assetOfficialAccountCpService.save(a);
} else {
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();
StringBuilder c = new StringBuilder();
assetOfficialAccount.getCdList().forEach(x -> {
if (!Objects.equals(x.getCdmc(), "") && x.getCdmc() != null) {
a.append(x.getCdmc()).append("|");
}
if (!Objects.equals(x.getCdlj(), "") && x.getCdlj() != null) {
b.append(x.getCdlj()).append("|");
}
if (!Objects.equals(x.getCdlx(), "") && x.getCdlx() != null) {
c.append(x.getCdlx()).append("|");
}
});
assetOfficialAccount.setCdmc(a.toString());
assetOfficialAccount.setCdlj(b.toString());
assetOfficialAccount.setCdlx(c.toString());
}
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw())
.eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
save(assetOfficialAccount);
AssetOfficialAccountCpPo a = new AssetOfficialAccountCpPo();
BeanUtil.copyProperties(assetOfficialAccount, a);
Integer i = unitService.selectTaskId(assetOfficialAccount.getSsdw(), "2");
if (i != null) {
a.setTaskId(i);
a.setAssetId(assetOfficialAccount.getId());
a.setXzType(1);
assetOfficialAccountCpService.save(a);
}
} }
return true; return true;
} }
@ -159,13 +196,13 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
StringBuilder c = new StringBuilder(); StringBuilder c = new StringBuilder();
assetOfficialAccount.getCdList().forEach(x -> { assetOfficialAccount.getCdList().forEach(x -> {
if(!Objects.equals(x.getCdmc(), "") &&x.getCdmc()!=null){ if (!Objects.equals(x.getCdmc(), "") && x.getCdmc() != null) {
a.append(x.getCdmc()).append("|"); a.append(x.getCdmc()).append("|");
} }
if(!Objects.equals(x.getCdlj(), "") &&x.getCdlj()!=null){ if (!Objects.equals(x.getCdlj(), "") && x.getCdlj() != null) {
b.append(x.getCdlj()).append("|"); b.append(x.getCdlj()).append("|");
} }
if(!Objects.equals(x.getCdlx(), "") &&x.getCdlx()!=null){ if (!Objects.equals(x.getCdlx(), "") && x.getCdlx() != null) {
c.append(x.getCdlx()).append("|"); c.append(x.getCdlx()).append("|");
} }
}); });

@ -4,7 +4,7 @@
<select id="getAuditList" resultType="com.ruoyi.tc.entity.po.AssetAppJyPo"> <select id="getAuditList" resultType="com.ruoyi.tc.entity.po.AssetAppJyPo">
select a.* from asset_app_cp a select a.* from asset_app_cp a
<where> <where>
a.task_id is null or xz_type=1 a.task_id is null
<if test="req.name!=null and req.name!='' "> <if test="req.name!=null and req.name!='' ">
and a.app_name like concat('%',#{req.name},'%') and a.app_name like concat('%',#{req.name},'%')
</if> </if>
@ -14,6 +14,7 @@
<if test="req.auditState!=null"> <if test="req.auditState!=null">
and a.audit_state =#{req.auditState} and a.audit_state =#{req.auditState}
</if> </if>
or xz_type=1
</where> </where>
order by a.create_time desc order by a.create_time desc
</select> </select>

@ -4,7 +4,7 @@
<select id="getAuditList" resultType="com.ruoyi.tc.entity.po.AssetCurrentJyPo"> <select id="getAuditList" resultType="com.ruoyi.tc.entity.po.AssetCurrentJyPo">
select a.* from asset_current_cp a select a.* from asset_current_cp a
<where> <where>
a.task_id is null or xz_type=1 a.task_id is null
<if test="req.name!=null and req.name!='' "> <if test="req.name!=null and req.name!='' ">
and a.xtmc like concat('%',#{req.name},'%') and a.xtmc like concat('%',#{req.name},'%')
</if> </if>
@ -14,6 +14,7 @@
<if test="req.auditState!=null"> <if test="req.auditState!=null">
and a.audit_state =#{req.auditState} and a.audit_state =#{req.auditState}
</if> </if>
or xz_type=1
</where> </where>
order by a.create_time desc order by a.create_time desc
</select> </select>

@ -4,7 +4,7 @@
<select id="getAuditList" resultType="com.ruoyi.tc.entity.po.AssetEmailJyPo"> <select id="getAuditList" resultType="com.ruoyi.tc.entity.po.AssetEmailJyPo">
select a.* from asset_email_cp a select a.* from asset_email_cp a
<where> <where>
a.task_id is null or xz_type=1 a.task_id is null
<if test="req.name!=null and req.name!='' "> <if test="req.name!=null and req.name!='' ">
and a.dzyxhz like concat('%',#{req.name},'%') and a.dzyxhz like concat('%',#{req.name},'%')
</if> </if>
@ -14,6 +14,7 @@
<if test="req.auditState!=null"> <if test="req.auditState!=null">
and a.audit_state =#{req.auditState} and a.audit_state =#{req.auditState}
</if> </if>
or xz_type=1
</where> </where>
order by a.create_time desc order by a.create_time desc
</select> </select>

@ -4,7 +4,7 @@
<select id="getAuditList" resultType="com.ruoyi.tc.entity.po.AssetMiniProgramsJyPo"> <select id="getAuditList" resultType="com.ruoyi.tc.entity.po.AssetMiniProgramsJyPo">
select a.* from asset_mini_programs_cp a select a.* from asset_mini_programs_cp a
<where> <where>
a.task_id is null or xz_type=1 a.task_id is null
<if test="req.name!=null and req.name!='' "> <if test="req.name!=null and req.name!='' ">
and a.xcxmc like concat('%',#{req.name},'%') and a.xcxmc like concat('%',#{req.name},'%')
</if> </if>
@ -14,6 +14,7 @@
<if test="req.auditState!=null"> <if test="req.auditState!=null">
and a.audit_state = #{req.auditState} and a.audit_state = #{req.auditState}
</if> </if>
or xz_type=1
</where> </where>
order by a.create_time desc order by a.create_time desc
</select> </select>

@ -4,7 +4,7 @@
<select id="getAuditList" resultType="com.ruoyi.tc.entity.po.AssetOfficialAccountJyPo"> <select id="getAuditList" resultType="com.ruoyi.tc.entity.po.AssetOfficialAccountJyPo">
select a.* from asset_official_account_cp a select a.* from asset_official_account_cp a
<where> <where>
a.task_id is null or xz_type=1 a.task_id is null
<if test="req.name!=null and req.name!='' "> <if test="req.name!=null and req.name!='' ">
and a.gzhmc like concat('%',#{req.name},'%') and a.gzhmc like concat('%',#{req.name},'%')
</if> </if>
@ -14,6 +14,7 @@
<if test="req.auditState!=null"> <if test="req.auditState!=null">
and a.audit_state =#{req.auditState} and a.audit_state =#{req.auditState}
</if> </if>
or xz_type=1
</where> </where>
order by a.create_time desc order by a.create_time desc
</select> </select>

Loading…
Cancel
Save