|
|
|
@ -144,6 +144,11 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public AjaxResult insert(@RequestBody @Valid AssetCurrent assetCurrent) {
|
|
|
|
|
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc())
|
|
|
|
|
.eq(Unit::getDelFlag, 0).list();
|
|
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
|
|
throw new ServiceException("请选择已有单位!");
|
|
|
|
|
}
|
|
|
|
|
StringBuilder a = new StringBuilder();
|
|
|
|
|
if (assetCurrent.getGlymList() != null) {
|
|
|
|
|
assetCurrent.getGlymList().forEach(x -> {
|
|
|
|
@ -442,32 +447,34 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
//如果有任务也修改任务这边
|
|
|
|
|
AssetCurrentCpPo one = assetCurrentCpService.lambdaQuery()
|
|
|
|
|
.isNotNull(AssetCurrentCpPo::getTaskId)
|
|
|
|
|
.eq(AssetCurrentCpPo::getStatus,"1")
|
|
|
|
|
.ne(AssetCurrentCpPo::getStatus, 5)
|
|
|
|
|
.eq(AssetCurrentCpPo::getId, byId.getId()).one();
|
|
|
|
|
if(one!=null){
|
|
|
|
|
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);
|
|
|
|
|
queryWrapper2.eq("task_id", taskId);
|
|
|
|
|
assetSupplyChainCpService.remove(queryWrapper2);
|
|
|
|
|
QueryWrapper<AssetBasicNetworkCpPo> queryWrapper3 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper3.eq("asset_id", one.getId());
|
|
|
|
|
queryWrapper3.eq("task_id",taskId);
|
|
|
|
|
queryWrapper3.eq("task_id", taskId);
|
|
|
|
|
assetBasicNetworkCpService.remove(queryWrapper3);
|
|
|
|
|
QueryWrapper<AssetBusinessFormCpPo> queryWrapper4 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper4.eq("asset_id", one.getId());
|
|
|
|
|
queryWrapper4.eq("task_id",taskId);
|
|
|
|
|
queryWrapper4.eq("task_id", taskId);
|
|
|
|
|
assetBusinessFormCpService.remove(queryWrapper4);
|
|
|
|
|
QueryWrapper<UnitOtherConcatCpPo> queryWrapper5 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper5.eq("task_id",taskId);
|
|
|
|
|
queryWrapper5.eq("task_id", taskId);
|
|
|
|
|
queryWrapper5.eq("asset_id", one.getId());
|
|
|
|
|
unitOtherConcatCpService.remove(queryWrapper5);
|
|
|
|
|
list.forEach(x -> {
|
|
|
|
@ -560,35 +567,37 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
//================================
|
|
|
|
|
|
|
|
|
|
Integer i = unitService.selectTaskId(assetCurrent.getDwmc(), "0");
|
|
|
|
|
if(i!=null){
|
|
|
|
|
|
|
|
|
|
if (i != null) {
|
|
|
|
|
QueryWrapper<AssetCurrentCpPo> queryWrapper1 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper1.eq("id", assetCurrent.getId());
|
|
|
|
|
queryWrapper1.eq("status","1");
|
|
|
|
|
queryWrapper1.eq("task_id",i);
|
|
|
|
|
assetCurrentCpService.remove(queryWrapper1);
|
|
|
|
|
queryWrapper1.eq("task_id", i);
|
|
|
|
|
queryWrapper1.ne("status", 5);
|
|
|
|
|
AssetCurrentCpPo x = assetCurrentCpService.getOne(queryWrapper1);
|
|
|
|
|
|
|
|
|
|
Integer status = x.getStatus();
|
|
|
|
|
Long currentId = x.getCurrentId();
|
|
|
|
|
AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo();
|
|
|
|
|
BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo);
|
|
|
|
|
assetCurrentCpPo.setTaskId(i);
|
|
|
|
|
assetCurrentCpPo.setStatus(1);
|
|
|
|
|
assetCurrentCpService.save(assetCurrentCpPo);
|
|
|
|
|
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);
|
|
|
|
|
queryWrapper2.eq("task_id", i);
|
|
|
|
|
assetSupplyChainCpService.remove(queryWrapper2);
|
|
|
|
|
QueryWrapper<AssetBasicNetworkCpPo> queryWrapper3 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper3.eq("task_id",i);
|
|
|
|
|
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("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);
|
|
|
|
|
queryWrapper5.eq("task_id", i);
|
|
|
|
|
unitOtherConcatCpService.remove(queryWrapper5);
|
|
|
|
|
|
|
|
|
|
if (assetCurrent.getXjgywxt() != null) {
|
|
|
|
@ -620,7 +629,6 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
//新增其他联系人
|
|
|
|
|
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
@ -701,7 +709,9 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
//读取所有的字段
|
|
|
|
|
ExcelUtil<AssetExport> util = new ExcelUtil<>(AssetExport.class);
|
|
|
|
|
List<AssetExport> proList = util.importExcel(file.getInputStream());
|
|
|
|
|
int j = 0;
|
|
|
|
|
for (AssetExport items : proList) {
|
|
|
|
|
j++;
|
|
|
|
|
AssetCurrent as = new AssetCurrent();
|
|
|
|
|
//copy新增到新的现有资产表里面
|
|
|
|
|
BeanUtil.copyProperties(items, as);
|
|
|
|
@ -715,6 +725,11 @@ 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();
|
|
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
|
|
throw new ServiceException(j + "行单位未入库!");
|
|
|
|
|
}
|
|
|
|
|
assetCurrentService.save(as);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|