编辑同步任务

dongdingding
杜函宇 5 days ago
parent 813bc40735
commit d5b109a551

@ -9,57 +9,18 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tc.entity.AssetBasicNetwork;
import com.ruoyi.tc.entity.AssetBusinessForm;
import com.ruoyi.tc.entity.AssetCurrent;
import com.ruoyi.tc.entity.AssetExport;
import com.ruoyi.tc.entity.AssetSupplyChain;
import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.UnitOtherConcat;
import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo;
import com.ruoyi.tc.entity.po.AssetBasicNetworkJyPo;
import com.ruoyi.tc.entity.po.AssetBusinessFormCpPo;
import com.ruoyi.tc.entity.po.AssetBusinessFormJyPo;
import com.ruoyi.tc.entity.po.AssetCurrentCpPo;
import com.ruoyi.tc.entity.po.AssetCurrentJyPo;
import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo;
import com.ruoyi.tc.entity.po.AssetSupplyChainJyPo;
import com.ruoyi.tc.entity.po.UnitOtherConcatCpPo;
import com.ruoyi.tc.entity.po.UnitOtherConcatJyPo;
import com.ruoyi.tc.entity.*;
import com.ruoyi.tc.entity.po.*;
import com.ruoyi.tc.entity.request.Acomma;
import com.ruoyi.tc.entity.request.AssetAuditPageRequest;
import com.ruoyi.tc.entity.request.AssetAuditRequest;
import com.ruoyi.tc.entity.request.AssetCurrentPageRequest;
import com.ruoyi.tc.service.AssetBasicNetworkCpService;
import com.ruoyi.tc.service.AssetBasicNetworkJyService;
import com.ruoyi.tc.service.AssetBasicNetworkService;
import com.ruoyi.tc.service.AssetBusinessFormCpService;
import com.ruoyi.tc.service.AssetBusinessFormJyService;
import com.ruoyi.tc.service.AssetBusinessFormService;
import com.ruoyi.tc.service.AssetCurrentCpService;
import com.ruoyi.tc.service.AssetCurrentJyService;
import com.ruoyi.tc.service.AssetCurrentService;
import com.ruoyi.tc.service.AssetSupplyChainCpService;
import com.ruoyi.tc.service.AssetSupplyChainJyService;
import com.ruoyi.tc.service.AssetSupplyChainService;
import com.ruoyi.tc.service.AssetTaskService;
import com.ruoyi.tc.service.UnitOtherConcatCpService;
import com.ruoyi.tc.service.UnitOtherConcatJyservice;
import com.ruoyi.tc.service.UnitOtherConcatService;
import com.ruoyi.tc.service.UnitService;
import com.ruoyi.tc.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@ -183,8 +144,7 @@ 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();
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
@ -292,8 +252,7 @@ public class AssetCurrentController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('unit')")
@PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetCurrentJyPo assetCurrentJyPo) {
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.setAuditYy(null);
if (one != null) {
@ -484,10 +443,7 @@ public class AssetCurrentController extends BaseController {
unitOtherConcatService.save(a4);
});
//如果有任务也修改任务这边
AssetCurrentCpPo one = assetCurrentCpService.lambdaQuery()
.isNotNull(AssetCurrentCpPo::getTaskId)
.ne(AssetCurrentCpPo::getStatus, 5)
.eq(AssetCurrentCpPo::getId, byId.getId()).one();
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();
@ -549,6 +505,8 @@ public class AssetCurrentController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@PutMapping
public AjaxResult update(@RequestBody @Valid AssetCurrent assetCurrent) {
//保存未修改之前的单位名称
AssetCurrent byId = assetCurrentService.getById(assetCurrent.getId());
StringBuilder a = new StringBuilder();
if (assetCurrent.getGlymList() != null) {
assetCurrent.getGlymList().forEach(x -> {
@ -569,7 +527,13 @@ 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);
assetSupplyChainService.deleteByAssetIds(assetCurrent.getId());
assetBasicNetworkService.deleteByAssetIds(assetCurrent.getId());
assetBusinessFormService.deleteByAssetIds(assetCurrent.getId());
@ -603,72 +567,88 @@ public class AssetCurrentController extends BaseController {
//新增其他联系人
unitOtherConcatService.saveBatch(assetCurrent.getOtherConcat());
}
//================================
Integer i = unitService.selectTaskId(assetCurrent.getDwmc(), "0");
if (i != null) {
QueryWrapper<AssetCurrentCpPo> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("id", assetCurrent.getId());
queryWrapper1.eq("task_id", i);
queryWrapper1.ne("status", 5);
AssetCurrentCpPo x = assetCurrentCpService.getOne(queryWrapper1);
if (BeanUtil.isEmpty(x)) {
Integer status = x.getStatus();
Long currentId = x.getCurrentId();
AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo();
BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo);
assetCurrentCpPo.setTaskId(i);
assetCurrentCpPo.setCurrentId(currentId);
assetCurrentCpPo.setStatus(status);
assetCurrentCpService.updateById(assetCurrentCpPo);
QueryWrapper<AssetSupplyChainCpPo> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("asset_id", assetCurrent.getId());
queryWrapper2.eq("task_id", i);
assetSupplyChainCpService.remove(queryWrapper2);
QueryWrapper<AssetBasicNetworkCpPo> queryWrapper3 = new QueryWrapper<>();
queryWrapper3.eq("task_id", i);
queryWrapper3.eq("asset_id", assetCurrent.getId());
assetBasicNetworkCpService.remove(queryWrapper3);
QueryWrapper<AssetBusinessFormCpPo> queryWrapper4 = new QueryWrapper<>();
queryWrapper4.eq("task_id", i);
queryWrapper4.eq("asset_id", assetCurrent.getId());
assetBusinessFormCpService.remove(queryWrapper4);
QueryWrapper<UnitOtherConcatCpPo> queryWrapper5 = new QueryWrapper<>();
queryWrapper5.eq("asset_id", assetCurrent.getId());
queryWrapper5.eq("task_id", i);
unitOtherConcatCpService.remove(queryWrapper5);
//================================
//根据未修改之前的单位名称去寻找正在进行中的任务,报废的任务,单位自编辑的任务
List<AssetCurrentCpPo> list1 = assetCurrentCpService.lambdaQuery().eq(AssetCurrentCpPo::getId, assetCurrent.getId()).list();
list1.forEach(x -> {
Integer taskId = x.getTaskId();
Long currentId = x.getCurrentId();
Integer status = x.getStatus();
String auditState = x.getAuditState();
String auditYy = x.getAuditYy();
AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo();
BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo);
assetCurrentCpPo.setTaskId(taskId);
assetCurrentCpPo.setCurrentId(currentId);
assetCurrentCpPo.setStatus(status);
assetCurrentCpPo.setAuditState(auditState);
assetCurrentCpPo.setAuditYy(auditYy);
assetCurrentCpService.updateById(assetCurrentCpPo);
QueryWrapper<AssetSupplyChainCpPo> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("asset_id", assetCurrent.getId());
if (taskId == null) {
queryWrapper2.isNull("task_id");
} else {
queryWrapper2.eq("task_id", taskId);
}
assetSupplyChainCpService.remove(queryWrapper2);
QueryWrapper<AssetBasicNetworkCpPo> queryWrapper3 = new QueryWrapper<>();
if (taskId == null) {
queryWrapper3.isNull("task_id");
} else {
queryWrapper3.eq("task_id", taskId);
}
queryWrapper3.eq("asset_id", assetCurrent.getId());
assetBasicNetworkCpService.remove(queryWrapper3);
QueryWrapper<AssetBusinessFormCpPo> queryWrapper4 = new QueryWrapper<>();
if (taskId == null) {
queryWrapper4.isNull("task_id");
} else {
queryWrapper4.eq("task_id", taskId);
}
queryWrapper4.eq("asset_id", assetCurrent.getId());
assetBusinessFormCpService.remove(queryWrapper4);
QueryWrapper<UnitOtherConcatCpPo> queryWrapper5 = new QueryWrapper<>();
queryWrapper5.eq("asset_id", assetCurrent.getId());
if (taskId == null) {
queryWrapper5.isNull("task_id");
} else {
queryWrapper5.eq("task_id", taskId);
}
unitOtherConcatCpService.remove(queryWrapper5);
if (assetCurrent.getXjgywxt() != null) {
assetCurrentCpPo.getXjgywxt().setAssetId(assetCurrent.getId());
assetCurrentCpPo.getXjgywxt().setTaskId(i);
assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt());
}
if (assetCurrent.getGylxxList() != null) {
for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(i);
}
//新增供应链
assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList());
if (assetCurrent.getXjgywxt() != null) {
assetCurrentCpPo.getXjgywxt().setAssetId(assetCurrent.getId());
assetCurrentCpPo.getXjgywxt().setTaskId(taskId);
assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt());
}
if (assetCurrent.getGylxxList() != null) {
for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(taskId);
}
if (assetCurrent.getJcwlList() != null) {
for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(i);
}
//新增基础网络
assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList());
//新增供应链
assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList());
}
if (assetCurrent.getJcwlList() != null) {
for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(taskId);
}
if (assetCurrent.getOtherConcat() != null) {
for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(i);
}
//新增其他联系人
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
//新增基础网络
assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList());
}
if (assetCurrent.getOtherConcat() != null) {
for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) {
items.setAssetId(assetCurrent.getId());
items.setTaskId(taskId);
}
//新增其他联系人
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
}
}
});
return success();
}
@ -754,8 +734,7 @@ public class AssetCurrentController extends BaseController {
AssetCurrent as = new AssetCurrent();
//copy新增到新的现有资产表里面
BeanUtil.copyProperties(items, as);
AssetCurrent one = assetCurrentService.lambdaQuery().eq(AssetCurrent::getXtmc, as.getXtmc())
.eq(AssetCurrent::getDwmc, as.getDwmc()).one();
AssetCurrent one = assetCurrentService.lambdaQuery().eq(AssetCurrent::getXtmc, as.getXtmc()).eq(AssetCurrent::getDwmc, as.getDwmc()).one();
if (one != null) {
as.setId(one.getId());
assetCurrentService.updateById(as);
@ -764,8 +743,7 @@ public class AssetCurrentController extends BaseController {
assetSupplyChainService.deleteIdList(a1);
assetBasicNetworkService.deleteIdList(a1);
} else {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, items.getDwmc())
.eq(Unit::getDelFlag, 0).list();
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, items.getDwmc()).eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) {
throw new ServiceException(j + "行单位未入库!");
}
@ -834,8 +812,7 @@ public class AssetCurrentController extends BaseController {
BeanUtil.copyProperties(as, assetCurrentCpPo);
assetCurrentCpPo.setTaskId(i);
assetCurrentCpPo.setStatus(0);
AssetCurrentCpPo two = assetCurrentCpService.lambdaQuery().eq(AssetCurrentCpPo::getXtmc, as.getXtmc())
.eq(AssetCurrentCpPo::getDwmc, as.getDwmc()).isNotNull(AssetCurrentCpPo::getTaskId).one();
AssetCurrentCpPo two = assetCurrentCpService.lambdaQuery().eq(AssetCurrentCpPo::getXtmc, as.getXtmc()).eq(AssetCurrentCpPo::getDwmc, as.getDwmc()).isNotNull(AssetCurrentCpPo::getTaskId).one();
if (two != null) {
assetCurrentCpPo.setId(two.getId());
assetCurrentCpService.updateById(assetCurrentCpPo);

@ -8,9 +8,6 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.tc.entity.AssetApp;
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.AssetEmailCpPo;
import com.ruoyi.tc.entity.po.AssetOfficialAccountCpPo;
import com.ruoyi.tc.entity.request.AssetAppPageRequest;
import com.ruoyi.tc.mapper.AssetAppMapper;
import com.ruoyi.tc.service.AssetAppCpService;
@ -28,7 +25,7 @@ import java.util.List;
* @since 2024-11-28 17:13:07
*/
@Service("assetAppService")
public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> implements AssetAppService{
public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> implements AssetAppService {
@Resource
private UnitService unitService;
@ -44,7 +41,7 @@ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> i
*/
@Override
public Page<AssetApp> page(Page<AssetApp> page, AssetAppPageRequest as) {
return baseMapper.page(page,as);
return baseMapper.page(page, as);
}
/**
@ -52,7 +49,7 @@ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> i
*/
@Override
public void deleteById(Long id) {
baseMapper.deleteById(id);
baseMapper.deleteById(id);
QueryWrapper<AssetAppCpPo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("asset_id", id);
assetAppCpService.remove(queryWrapper);
@ -62,7 +59,7 @@ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> i
/**
*
*
* @param as
* @param as
* @return
*/
@Override
@ -91,14 +88,14 @@ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> i
public Boolean add(AssetApp assetApp) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetApp.getSsdw())
.eq(Unit::getDelFlag, 0).list();
if(list==null || list.isEmpty()){
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
save(assetApp);
AssetAppCpPo a = new AssetAppCpPo();
BeanUtil.copyProperties(assetApp, a);
Integer i = unitService.selectTaskId(assetApp.getSsdw(), "4");
if(i!=null){
if (i != null) {
a.setTaskId(i);
a.setAssetId(assetApp.getId());
assetAppCpService.save(a);
@ -116,25 +113,24 @@ public class AssetAppServiceImpl extends ServiceImpl<AssetAppMapper, AssetApp> i
@Override
public Boolean edit(AssetApp assetApp) {
updateById(assetApp);
AssetAppCpPo one = assetAppCpService.lambdaQuery()
.eq(AssetAppCpPo::getAssetId, assetApp.getId())
.ne(AssetAppCpPo::getStatus, 5)
.isNotNull(AssetAppCpPo::getTaskId)
.one();
if (one != null) {
Integer status = one.getStatus();
Integer taskId = one.getTaskId();
Long appId = one.getAppId();
BeanUtil.copyProperties(assetApp, one);
one.setStatus(status);
one.setTaskId(taskId);
one.setAssetId(assetApp.getId());
one.setAppId(appId);
return assetAppCpService.updateById(one);
}else {
return true;
}
List<AssetAppCpPo> list = assetAppCpService.lambdaQuery()
.eq(AssetAppCpPo::getAssetId, assetApp.getId()).list();
list.forEach(x -> {
Integer status = x.getStatus();
Integer taskId = x.getTaskId();
Long appId = x.getAppId();
String auditState = x.getAuditState();
String auditYy = x.getAuditYy();
BeanUtil.copyProperties(assetApp, x);
x.setStatus(status);
x.setTaskId(taskId);
x.setAssetId(assetApp.getId());
x.setAppId(appId);
x.setAuditYy(auditYy);
x.setAuditState(auditState);
assetAppCpService.updateById(x);
});
return true;
}
}

@ -8,8 +8,6 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.tc.entity.AssetEmail;
import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.po.AssetEmailCpPo;
import com.ruoyi.tc.entity.po.AssetEmailJyPo;
import com.ruoyi.tc.entity.po.AssetMiniProgramsCpPo;
import com.ruoyi.tc.entity.request.AssetEmailPageRequest;
import com.ruoyi.tc.mapper.AssetEmailMapper;
import com.ruoyi.tc.service.AssetEmailCpService;
@ -91,14 +89,14 @@ public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEm
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()){
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
save(assetEmail);
AssetEmailCpPo a = new AssetEmailCpPo();
BeanUtil.copyProperties(assetEmail, a);
Integer i = unitService.selectTaskId(assetEmail.getSsdw(), "3");
if(i!=null){
if (i != null) {
a.setTaskId(i);
a.setAssetId(assetEmail.getId());
assetEmailCpService.save(a);
@ -115,22 +113,23 @@ public class AssetEmailServiceImpl extends ServiceImpl<AssetEmailMapper, AssetEm
@Override
public Boolean edit(AssetEmail assetEmail) {
updateById(assetEmail);
AssetEmailCpPo one = assetEmailCpService.lambdaQuery()
.eq(AssetEmailCpPo::getAssetId, assetEmail.getId())
.ne(AssetEmailCpPo::getStatus, 5)
.isNotNull(AssetEmailCpPo::getTaskId).one();
if (one != null) {
Integer status = one.getStatus();
Integer taskId = one.getTaskId();
Long appId = one.getEmailId();
BeanUtil.copyProperties(assetEmail, one);
one.setStatus(status);
one.setTaskId(taskId);
one.setAssetId(assetEmail.getId());
one.setEmailId(appId);
return assetEmailCpService.updateById(one);
}else {
return true;
}
List<AssetEmailCpPo> list = assetEmailCpService.lambdaQuery()
.eq(AssetEmailCpPo::getAssetId, assetEmail.getId()).list();
list.forEach(x -> {
Integer status = x.getStatus();
Integer taskId = x.getTaskId();
Long appId = x.getEmailId();
String auditState = x.getAuditState();
String auditYy = x.getAuditYy();
BeanUtil.copyProperties(assetEmail, x);
x.setStatus(status);
x.setTaskId(taskId);
x.setAssetId(assetEmail.getId());
x.setEmailId(appId);
x.setAuditYy(auditYy);
x.setAuditState(auditState);
assetEmailCpService.updateById(x);
});
return true;
}
}

@ -7,9 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
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.AssetMiniProgramsCpPo;
import com.ruoyi.tc.entity.po.AssetMiniProgramsJyPo;
import com.ruoyi.tc.entity.request.AssetMiniProgramsPageRequest;
import com.ruoyi.tc.mapper.AssetMiniProgramsMapper;
import com.ruoyi.tc.service.AssetMiniProgramsCpService;
@ -27,13 +25,14 @@ import java.util.List;
* @since 2024-11-28 17:13:07
*/
@Service("assetMiniProgramsService")
public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsMapper, AssetMiniPrograms> implements AssetMiniProgramsService{
public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsMapper, AssetMiniPrograms> implements AssetMiniProgramsService {
@Resource
private AssetMiniProgramsCpService assetMiniProgramsCpService;
@Resource
private UnitService unitService;
/**
*
*
@ -43,7 +42,7 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsM
*/
@Override
public Page<AssetMiniPrograms> page(Page<AssetMiniPrograms> page, AssetMiniProgramsPageRequest as) {
return baseMapper.page(page,as);
return baseMapper.page(page, as);
}
/**
@ -61,7 +60,7 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsM
/**
*
*
* @param as
* @param as
* @return
*/
@Override
@ -84,14 +83,14 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsM
public Boolean add(AssetMiniPrograms assetMiniPrograms) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw())
.eq(Unit::getDelFlag, 0).list();
if(list==null || list.isEmpty()){
if (list == null || list.isEmpty()) {
throw new ServiceException("请选择已有单位!");
}
save(assetMiniPrograms);
AssetMiniProgramsCpPo assetMiniProgramsCpPo = new AssetMiniProgramsCpPo();
BeanUtil.copyProperties(assetMiniPrograms,assetMiniProgramsCpPo);
BeanUtil.copyProperties(assetMiniPrograms, assetMiniProgramsCpPo);
Integer i = unitService.selectTaskId(assetMiniPrograms.getSsdw(), "1");
if(i!=null){
if (i != null) {
assetMiniProgramsCpPo.setTaskId(i);
assetMiniProgramsCpPo.setAssetId(assetMiniPrograms.getId());
assetMiniProgramsCpService.save(assetMiniProgramsCpPo);
@ -108,23 +107,24 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl<AssetMiniProgramsM
@Override
public Boolean edit(AssetMiniPrograms assetMiniPrograms) {
updateById(assetMiniPrograms);
AssetMiniProgramsCpPo one = assetMiniProgramsCpService.lambdaQuery()
.eq(AssetMiniProgramsCpPo::getAssetId, assetMiniPrograms.getId())
.ne(AssetMiniProgramsCpPo::getStatus, 5)
.isNotNull(AssetMiniProgramsCpPo::getTaskId).one();
if (one!=null){
Integer status = one.getStatus();
Integer taskId = one.getTaskId();
Long miniId = one.getMiniId();
BeanUtil.copyProperties(assetMiniPrograms,one);
one.setTaskId(taskId);
one.setAssetId(assetMiniPrograms.getId());
one.setStatus(status);
one.setMiniId(miniId);
return assetMiniProgramsCpService.updateById(one);
}else{
return true;
}
List<AssetMiniProgramsCpPo> list = assetMiniProgramsCpService.lambdaQuery()
.eq(AssetMiniProgramsCpPo::getAssetId, assetMiniPrograms.getId()).list();
list.forEach(x -> {
Integer status = x.getStatus();
Integer taskId = x.getTaskId();
Long miniId = x.getMiniId();
String auditState = x.getAuditState();
String auditYy = x.getAuditYy();
BeanUtil.copyProperties(assetMiniPrograms, x);
x.setTaskId(taskId);
x.setAssetId(assetMiniPrograms.getId());
x.setStatus(status);
x.setMiniId(miniId);
x.setAuditYy(auditYy);
x.setAuditState(auditState);
assetMiniProgramsCpService.updateById(x);
});
return true;
}

@ -7,10 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.tc.entity.AssetOfficialAccount;
import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.po.AssetAppCpPo;
import com.ruoyi.tc.entity.po.AssetEmailCpPo;
import com.ruoyi.tc.entity.po.AssetOfficialAccountCpPo;
import com.ruoyi.tc.entity.po.AssetOfficialAccountJyPo;
import com.ruoyi.tc.entity.request.AssetOfficialAccountPageRequest;
import com.ruoyi.tc.mapper.AssetOfficialAccountMapper;
import com.ruoyi.tc.service.AssetOfficialAccountCpService;
@ -88,19 +85,19 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
public Boolean add(AssetOfficialAccount assetOfficialAccount) {
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw())
.eq(Unit::getDelFlag, 0).list();
if(list==null || list.isEmpty()){
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){
if (i != null) {
a.setTaskId(i);
a.setAssetId(assetOfficialAccount.getId());
assetOfficialAccountCpService.save(a);
}
return true;
return true;
}
/**
@ -112,25 +109,24 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
@Override
public Boolean edit(AssetOfficialAccount assetOfficialAccount) {
updateById(assetOfficialAccount);
AssetOfficialAccountCpPo one = assetOfficialAccountCpService.lambdaQuery()
.eq(AssetOfficialAccountCpPo::getAssetId, assetOfficialAccount.getId())
.ne(AssetOfficialAccountCpPo::getStatus, 5)
.isNotNull(AssetOfficialAccountCpPo::getTaskId)
.one();
if (one != null) {
Integer status = one.getStatus();
Integer taskId = one.getTaskId();
Long appId = one.getAccountId();
BeanUtil.copyProperties(assetOfficialAccount, one);
one.setTaskId(taskId);
one.setAssetId(assetOfficialAccount.getId());
one.setStatus(status);
one.setAccountId(appId);
return assetOfficialAccountCpService.updateById(one);
}else {
return true;
}
List<AssetOfficialAccountCpPo> list = assetOfficialAccountCpService.lambdaQuery()
.eq(AssetOfficialAccountCpPo::getAssetId, assetOfficialAccount.getId()).list();
list.forEach(x -> {
Integer status = x.getStatus();
Integer taskId = x.getTaskId();
Long appId = x.getAccountId();
String auditState = x.getAuditState();
String auditYy = x.getAuditYy();
BeanUtil.copyProperties(assetOfficialAccount, x);
x.setTaskId(taskId);
x.setAssetId(assetOfficialAccount.getId());
x.setStatus(status);
x.setAccountId(appId);
x.setAuditYy(auditYy);
x.setAuditState(auditState);
assetOfficialAccountCpService.updateById(x);
});
return true;
}

Loading…
Cancel
Save