|
|
@@ -193,16 +193,16 @@ public class AssetServiceImpl extends BaseServiceImpl<AssetMapper, AssetEntity>
|
|
|
if (hoursMapper.countByZcbmAfterMonth(asset.getZcbm(), yearAndMonth) > 0) {
|
|
|
throw new ServiceException("无法删除,每月仪器设备工时打卡中引用了【" + asset.getZcbm() + "】");
|
|
|
}
|
|
|
- if (fixedAssetMapper.selectCount(Wrappers.<XmFixedAsset>lambdaQuery().eq(XmFixedAsset::getZcbm, asset.getZcbm()).ge(XmFixedAsset::getYearAndMonth, yearAndMonth)) > 0) {
|
|
|
+ if (fixedAssetMapper.selectCount(Wrappers.<XmFixedAsset>lambdaQuery().eq(XmFixedAsset::getZcbm, asset.getZcbm()).ge(XmFixedAsset::getYearAndMonth, yearAndMonth)) > 0) {
|
|
|
throw new ServiceException("无法删除,每月仪器设备明细/每月在用建筑物明细中引用了【" + asset.getZcbm() + "】");
|
|
|
}
|
|
|
- if (intangibleAssetMapper.selectCount(Wrappers.<XmIntangibleAsset>lambdaQuery().eq(XmIntangibleAsset::getZcbm, asset.getZcbm()).ge(XmIntangibleAsset::getYearAndMonth, yearAndMonth)) > 0) {
|
|
|
+ if (intangibleAssetMapper.selectCount(Wrappers.<XmIntangibleAsset>lambdaQuery().eq(XmIntangibleAsset::getZcbm, asset.getZcbm()).ge(XmIntangibleAsset::getYearAndMonth, yearAndMonth)) > 0) {
|
|
|
throw new ServiceException("无法删除,每月无形资产明细中引用了【" + asset.getZcbm() + "】");
|
|
|
}
|
|
|
- if(ysWxzctxfyMapper.countByZcbmAfterMonth(asset.getZcbm(), yearAndMonth) > 0){
|
|
|
+ if (ysWxzctxfyMapper.countByZcbmAfterMonth(asset.getZcbm(), yearAndMonth) > 0) {
|
|
|
throw new ServiceException("无法删除,研发项目预算-无形资产摊销费用中引用了【" + asset.getZcbm() + "】");
|
|
|
}
|
|
|
- if(ysZjfyycqdtfyMapper.countByZcbmAfterMonth(asset.getZcbm(), yearAndMonth) > 0){
|
|
|
+ if (ysZjfyycqdtfyMapper.countByZcbmAfterMonth(asset.getZcbm(), yearAndMonth) > 0) {
|
|
|
throw new ServiceException("无法删除,研发项目预算-折旧费用与长期待摊费用中引用了【" + asset.getZcbm() + "】");
|
|
|
}
|
|
|
}
|
|
|
@@ -323,20 +323,20 @@ public class AssetServiceImpl extends BaseServiceImpl<AssetMapper, AssetEntity>
|
|
|
}
|
|
|
// 正常状态、停用状态,可修改资产数据。其他情况不能修改。假设在修改资产时,正好出现使用寿命-已使用月份数=0时,即已足额折旧状态时,就显示为已足额折旧状态了,不可以再次修改了。
|
|
|
// 修改资产时,系统需要二次确认。
|
|
|
- if (Func.equals(dbAsset.getStatus(), AssetStatusEnum.正常.getCode()) || Func.equals(dbAsset.getStatus(), AssetStatusEnum.停用.getCode())) {
|
|
|
-// 仪器设置的算法:当前时间为2025年01月-2024年5月,差额为9个月,因为折旧从次月开始,所以已使用月数为8个月(即9-1=8),再将使用寿命-已使用月份数=0时,即已足额折旧。
|
|
|
-// 无形资产:当月即摊销,不需要-1
|
|
|
- long ysysm = cn.hutool.core.date.DateUtil.betweenMonth(DateUtil.parse(asset.getYearAndMonth(), DateUtil.PATTERN_YYYYMM), asset.getKssj(), false);
|
|
|
-// 这里
|
|
|
- if (!Func.equals("仪器设备", asset.getZclb())) {
|
|
|
- ysysm++;
|
|
|
- }
|
|
|
- asset.setYsysm((int) ysysm);
|
|
|
- }
|
|
|
- //使用寿命-已使用月份数=0时,即已足额折旧
|
|
|
- if (asset.getSysm() - asset.getYsysm() <= 0) {
|
|
|
- asset.setStatus(AssetStatusEnum.已足额折旧.getCode());
|
|
|
- }
|
|
|
+// if (Func.equals(dbAsset.getStatus(), AssetStatusEnum.正常.getCode()) || Func.equals(dbAsset.getStatus(), AssetStatusEnum.停用.getCode())) {
|
|
|
+//// 仪器设置的算法:当前时间为2025年01月-2024年5月,差额为9个月,因为折旧从次月开始,所以已使用月数为8个月(即9-1=8),再将使用寿命-已使用月份数=0时,即已足额折旧。
|
|
|
+//// 无形资产:当月即摊销,不需要-1
|
|
|
+// long ysysm = cn.hutool.core.date.DateUtil.betweenMonth(DateUtil.parse(asset.getYearAndMonth(), DateUtil.PATTERN_YYYYMM), asset.getKssj(), false);
|
|
|
+//// 这里
|
|
|
+// if (!Func.equals("仪器设备", asset.getZclb())) {
|
|
|
+// ysysm++;
|
|
|
+// }
|
|
|
+// asset.setYsysm((int) ysysm);
|
|
|
+// }
|
|
|
+// //使用寿命-已使用月份数=0时,即已足额折旧
|
|
|
+// if (asset.getSysm() - asset.getYsysm() <= 0) {
|
|
|
+// asset.setStatus(AssetStatusEnum.已足额折旧.getCode());
|
|
|
+// }
|
|
|
return this.updateOtherMonthAsset(asset);
|
|
|
}
|
|
|
|
|
|
@@ -353,16 +353,17 @@ public class AssetServiceImpl extends BaseServiceImpl<AssetMapper, AssetEntity>
|
|
|
updateEntity.setTenantId(null);
|
|
|
updateEntity.setZgs(null);
|
|
|
|
|
|
- long ysysm = cn.hutool.core.date.DateUtil.betweenMonth(DateUtil.parse(entity.getYearAndMonth(), DateUtil.PATTERN_YYYYMM), updateEntity.getKssj(), false);
|
|
|
-// 这里
|
|
|
- if (!Func.equals("仪器设备", updateEntity.getZclb())) {
|
|
|
- ysysm++;
|
|
|
- }
|
|
|
- updateEntity.setYsysm((int) ysysm);
|
|
|
+ if (Func.equals(entity.getStatus(), AssetStatusEnum.正常.getCode()) || Func.equals(entity.getStatus(), AssetStatusEnum.停用.getCode())) {
|
|
|
+ long ysysm = cn.hutool.core.date.DateUtil.betweenMonth(DateUtil.parse(entity.getYearAndMonth(), DateUtil.PATTERN_YYYYMM), updateEntity.getKssj(), false);
|
|
|
+ if (!Func.equals("仪器设备", updateEntity.getZclb())) {
|
|
|
+ ysysm++;
|
|
|
+ }
|
|
|
+ updateEntity.setYsysm((int) ysysm);
|
|
|
|
|
|
- //使用寿命-已使用月份数=0时,即已足额折旧
|
|
|
- if (updateEntity.getSysm() - updateEntity.getYsysm() <= 0) {
|
|
|
- updateEntity.setStatus(AssetStatusEnum.已足额折旧.getCode());
|
|
|
+ //使用寿命-已使用月份数=0时,即已足额折旧
|
|
|
+ if (updateEntity.getSysm() - updateEntity.getYsysm() <= 0) {
|
|
|
+ updateEntity.setStatus(AssetStatusEnum.已足额折旧.getCode());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
LambdaUpdateWrapper<AssetEntity> updateWrapper = Wrappers.<AssetEntity>lambdaUpdate().eq(AssetEntity::getZcbm, entity.getZcbm()).eq(AssetEntity::getYearAndMonth, entity.getYearAndMonth());
|
|
|
@@ -418,7 +419,8 @@ public class AssetServiceImpl extends BaseServiceImpl<AssetMapper, AssetEntity>
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- return baseMapper.updateStatus(asset.getId(), asset.getStatus()) == 1;
|
|
|
+// return baseMapper.updateStatus(asset.getId(), asset.getStatus()) == 1;
|
|
|
+ return updateOtherMonthAsset(asset);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -432,21 +434,22 @@ public class AssetServiceImpl extends BaseServiceImpl<AssetMapper, AssetEntity>
|
|
|
// }
|
|
|
|
|
|
asset.setStatus(AssetStatusEnum.正常.getCode());
|
|
|
- if (Func.isNull(asset.getYsysm())) {
|
|
|
- //使用寿命-已使用月份数=0时,即已足额折旧
|
|
|
-// 仪器设置的算法:当前时间为2025年01月-2024年5月,差额为9个月,因为折旧从次月开始,所以已使用月数为8个月(即9-1=8),再将使用寿命-已使用月份数=0时,即已足额折旧。
|
|
|
-// 无形资产:当月即摊销,不需要-1
|
|
|
- long ysysm = cn.hutool.core.date.DateUtil.betweenMonth(cn.hutool.core.date.DateUtil.date(), asset.getKssj(), false);
|
|
|
-// 这里
|
|
|
- if (!isFixedAsset(asset.getZclb())) {
|
|
|
- ysysm++;
|
|
|
- }
|
|
|
- asset.setYsysm((int) ysysm);
|
|
|
- }
|
|
|
- if (asset.getSysm() - asset.getYsysm() <= 0) {
|
|
|
- asset.setStatus(AssetStatusEnum.已足额折旧.getCode());
|
|
|
- }
|
|
|
- return this.updateById(asset);
|
|
|
+// if (Func.isNull(asset.getYsysm())) {
|
|
|
+// //使用寿命-已使用月份数=0时,即已足额折旧
|
|
|
+//// 仪器设置的算法:当前时间为2025年01月-2024年5月,差额为9个月,因为折旧从次月开始,所以已使用月数为8个月(即9-1=8),再将使用寿命-已使用月份数=0时,即已足额折旧。
|
|
|
+//// 无形资产:当月即摊销,不需要-1
|
|
|
+// long ysysm = cn.hutool.core.date.DateUtil.betweenMonth(cn.hutool.core.date.DateUtil.date(), asset.getKssj(), false);
|
|
|
+//// 这里
|
|
|
+// if (!isFixedAsset(asset.getZclb())) {
|
|
|
+// ysysm++;
|
|
|
+// }
|
|
|
+// asset.setYsysm((int) ysysm);
|
|
|
+// }
|
|
|
+// if (asset.getSysm() - asset.getYsysm() <= 0) {
|
|
|
+// asset.setStatus(AssetStatusEnum.已足额折旧.getCode());
|
|
|
+// }
|
|
|
+// return this.updateById(asset);
|
|
|
+ return updateOtherMonthAsset(asset);
|
|
|
}
|
|
|
|
|
|
@Override
|